query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Tests if the transactions are being added if the users do have balances Returns the current balances for the users whose balances were just changed | def test_add_transaction_existing_balances
@bv.balances["FROM_ADDR"] = 90
@bv.balances["TO_ADDR"] = 25
assert_equal([44, 71], @bv.add_trasaction(["FROM_ADDR", "TO_ADDR", "46"]))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balances\n # Very inefficient at this point for a large network...\n self.network_as_users.map { |user|\n {:balance => self.balance_with(user), :user => user}\n }.select {|balance| balance[:balance].to_f != 0.0}\n end",
"def balances\n accounts.with_balance\n end",
"def balance\n... | [
"0.74575853",
"0.7167512",
"0.70419085",
"0.7016464",
"0.6959257",
"0.6918059",
"0.6880202",
"0.68378603",
"0.6799305",
"0.67822766",
"0.67782426",
"0.6770425",
"0.6758881",
"0.67206943",
"0.66988075",
"0.66631025",
"0.66627455",
"0.6613032",
"0.6584272",
"0.6571524",
"0.6570... | 0.0 | -1 |
UNIT TESTs FOR METHOD check_balances Equivalence classes: | def test_check_balances_true
@bv.balances["Joe"] = 90
@bv.balances["John"] = 25
assert @bv.check_balances? 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_balances_empty\n assert_equal(false, @bv.check_balances?(1))\n end",
"def test_check_balances_false\n @bv.balances[\"Joe\"] = 90\n @bv.balances[\"John\"] = -25\n assert_equal(false, @bv.check_balances?(1))\n end",
"def test_get_holder_balance\n bank_account = BankAccount.new(\"Zso... | [
"0.7698799",
"0.75033224",
"0.6966035",
"0.68347317",
"0.67134786",
"0.66480035",
"0.66061723",
"0.6483336",
"0.6381506",
"0.63618916",
"0.63463044",
"0.63444597",
"0.6328175",
"0.6318974",
"0.63187814",
"0.6297266",
"0.6283055",
"0.62642473",
"0.6202636",
"0.6188326",
"0.615... | 0.7679664 | 1 |
Returns false if any are < 0 | def test_check_balances_false
@bv.balances["Joe"] = 90
@bv.balances["John"] = -25
assert_equal(false, @bv.check_balances?(1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_negatives?(nums)\n nums.each { |element| return false if element >= 0 }\n true\nend",
"def values_positive?\n is_ok = self.start_value > 0.0\n \n if is_ok\n self.value_changes.each do |offset, setting|\n setting.value > 0.0\n end\n end\n return is_ok\n end",
"def vali... | [
"0.7828851",
"0.73416007",
"0.7285464",
"0.72191006",
"0.7214318",
"0.7211145",
"0.6901265",
"0.6873245",
"0.67161375",
"0.67037565",
"0.6690217",
"0.66679186",
"0.662047",
"0.6599158",
"0.656177",
"0.65605456",
"0.65490663",
"0.65318984",
"0.65274286",
"0.652321",
"0.6515286... | 0.0 | -1 |
Returns false if there are no balances | def test_check_balances_empty
assert_equal(false, @bv.check_balances?(1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_balances(num)\n @balance.each do |key, value|\n if value.negative?\n puts \"Line #{@blocks[num].block_number}: Invalid block, address #{key} has #{value} billcoins!\"\n return false\n end\n end\n true\n end",
"def had_funds?\n balance_at = self.get_address.balance(s... | [
"0.75350034",
"0.7453981",
"0.74383307",
"0.73680574",
"0.7301043",
"0.72199714",
"0.7195072",
"0.71925575",
"0.7160139",
"0.7039787",
"0.6968024",
"0.6959195",
"0.6942367",
"0.6929739",
"0.69063514",
"0.6904805",
"0.68338495",
"0.6801799",
"0.6720461",
"0.66996497",
"0.66381... | 0.7334761 | 4 |
UNIT TESTs FOR METHOD check_balances Equivalence classes: | def test_print_balances
@bv.balances["Joe"] = 90
assert_equal({"Joe"=>90}, @bv.print_balances)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_balances_empty\n assert_equal(false, @bv.check_balances?(1))\n end",
"def test_check_balances_true\n @bv.balances[\"Joe\"] = 90\n @bv.balances[\"John\"] = 25\n assert @bv.check_balances? 1\n end",
"def test_check_balances_false\n @bv.balances[\"Joe\"] = 90\n @bv.balances[\"Jo... | [
"0.7698799",
"0.7679664",
"0.75033224",
"0.6966035",
"0.68347317",
"0.67134786",
"0.66480035",
"0.66061723",
"0.6483336",
"0.6381506",
"0.63618916",
"0.63463044",
"0.63444597",
"0.6328175",
"0.6318974",
"0.63187814",
"0.6297266",
"0.6283055",
"0.62642473",
"0.6188326",
"0.615... | 0.6202636 | 19 |
UNIT TESTs FOR METHOD timestap_correct Equivalence classes: cur_ts(sec) > prev_time(sec) > return true cur_ts(sec) == prev_time(sec) && cur_ts(nano) > prev_time(nano) > return true cur_ts(sec) == prev_time(sec) && cur_ts(nano) return false cur_ts(sec) return false | def test_cur_sec_greater
assert(@bv.timestap_correct(1, "123456.1111", "123457.1111"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_timestamps(info)\r\n\t\tprev_ts = @current_timestamp\r\n\t\tcur_ts = info['ts']\r\n\r\n\t\tif cur_ts[:sec] > prev_ts[:sec]\r\n\t\t\tsuccess = true\r\n\t\telsif cur_ts[:sec] == prev_ts[:sec]\r\n\t\t\t(cur_ts[:nsec] > prev_ts[:nsec]) ? success = true : success = false\r\n\t\telse\r\n\t\t\tsuccess = fals... | [
"0.6770778",
"0.6423801",
"0.6247706",
"0.61394906",
"0.60789466",
"0.60789466",
"0.5991424",
"0.5991131",
"0.5906956",
"0.5881061",
"0.5868687",
"0.58053577",
"0.57888556",
"0.57769",
"0.5739282",
"0.5726565",
"0.5713198",
"0.5698705",
"0.56904066",
"0.56673694",
"0.5607048"... | 0.74898046 | 0 |
UNIT TESTs FOR METHOD block_hash_correct Equivalence classes: block hashes to it's designated value > return true block does not hash to it's designated value > return false | def test_block_hash_match
block = "1|1c12|SYSTEM>George(100)|1518892051.740967000|abb2".split("|")
assert(@bv.block_hash_correct(block))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend",
"def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.... | [
"0.7791571",
"0.774712",
"0.76096284",
"0.74865127",
"0.7471536",
"0.73596907",
"0.73526806",
"0.73179466",
"0.72697735",
"0.722627",
"0.71481854",
"0.6983133",
"0.6844728",
"0.68166196",
"0.68144375",
"0.6711806",
"0.6709819",
"0.6709665",
"0.6682381",
"0.666755",
"0.6617819... | 0.7024899 | 11 |
Send Loan Request notification to SOUNZ administrator | def reserve_product
method = params[:method]
type = params[:type]
#send out our reserve product notice.
#find our object description
if type == 'resource'
object = Resource.find(params[:id])
elsif type =='manifestation'
object = Manifestation.find(params[:id])
else
logger.debug("DEBU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loan_request_notification(owner, requester, user_lacquer)\n @owner = owner\n @requester = requester\n @user_lacquer = user_lacquer\n @user_url = \"http://www.lacquerloveandlend.com/users/#{@owner.id}\"\n\n mail(to: @owner.email, subject: \"#{@requester.name} wants to borrow #{@user_lacquer.lacqu... | [
"0.6972806",
"0.68753254",
"0.62525284",
"0.60538715",
"0.60293454",
"0.5925193",
"0.59100205",
"0.5890195",
"0.5839237",
"0.58164954",
"0.5753193",
"0.57231987",
"0.57213575",
"0.57131565",
"0.56889826",
"0.5659572",
"0.5629314",
"0.5613704",
"0.5611938",
"0.560911",
"0.5603... | 0.0 | -1 |
Returns the header as an Array of Strings | def header
@header ||= csv_rows.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_array\n hash = get_headers \n arr = []\n hash.each do |k, v|\n\tv.each do |i|\n\tarr << k + \"=\" + i\n\tend\nend\n arr\nend",
"def headers\r\n # NB: return value is supposed to be an array of strings\r\n @headers || []\r\n end",
"def header_array\n @columns.collect {|c|\n ... | [
"0.7747496",
"0.7712913",
"0.7710009",
"0.75460875",
"0.75460875",
"0.74373853",
"0.7306578",
"0.7292573",
"0.7080915",
"0.69741154",
"0.69498193",
"0.6855952",
"0.68306535",
"0.67860144",
"0.6770542",
"0.6744262",
"0.67315036",
"0.67160535",
"0.6629969",
"0.6628852",
"0.6608... | 0.0 | -1 |
Returns the rows as an Array of Arrays of Strings | def rows
@rows ||= csv_rows[1..-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_array\n row_names = []\n rows = [] \n if @db == @@sdb\n @@sdb.select('select * from `' + @table_name + '`')[:items].each do |row| \n row.each do |row_name, row_data| \n row_names << row_name\n rows << reassemble_sdb_items(row_data)\n end\n end\n elsif @d... | [
"0.7255771",
"0.7202204",
"0.71563977",
"0.7079499",
"0.7009184",
"0.6989121",
"0.69629776",
"0.69235784",
"0.68642193",
"0.68429774",
"0.6830531",
"0.678052",
"0.6726782",
"0.6707392",
"0.66858405",
"0.662201",
"0.65883344",
"0.6541216",
"0.6492307",
"0.6470291",
"0.64270633... | 0.0 | -1 |
Remove trailing white spaces and ensure we always return a string | def sanitize_cells(rows)
rows.map do |cells|
cells.map do |cell|
if cell.is_a? Float
cell = cell ? cell.to_i.to_s : ""
else
cell = cell ? cell.to_s : ""
end
cell ? cell.strip : ""
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lstrip\n `return self.replace(/^\\s*/, '');`\n end",
"def lstrip\n `return self.replace(/^\\s*/, '');`\n end",
"def strip!\n \"\"\n end",
"def rstrip\r\n match = rewrite(/\\s+\\z/)\r\n match ? match[0] : ''\r\n end",
"def rstrip() end",
"def rstrip!() end",
"def rstrip!\n ... | [
"0.72432256",
"0.72432256",
"0.72327036",
"0.7091219",
"0.7044358",
"0.7025721",
"0.7022299",
"0.6904989",
"0.68071115",
"0.6769343",
"0.6763078",
"0.67538524",
"0.67496264",
"0.671676",
"0.6707767",
"0.6695731",
"0.667739",
"0.6662084",
"0.66530895",
"0.664142",
"0.66353166"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_designated_hitter_stat
@designated_hitter_stat = DesignatedHitterStat.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def designated_hitter_stat_params
params.require(:designated_hitter_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :games_started, :games_played, :win, :loss, :wins, :losses, :plate_appearances, :at_bats, :hits, :runs_scored, :runs_batted_in, :walks, :strike_outs, :stolen_b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
GET /brokers GET /brokers.json | def index
@brokers = Broker.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_brokers(zk)\n brokers = []\n zk.children(BROKERS_PATH).each do |id|\n node = fetch_znode(zk, id)\n next if node.nil? # whatever error could happen from ZK#get\n brokers << format_broker_from_znode(node)\n end\n brokers.compact\n ... | [
"0.7051236",
"0.68707937",
"0.6769851",
"0.6659675",
"0.66335565",
"0.6169546",
"0.5948697",
"0.5938416",
"0.5853714",
"0.5587312",
"0.5544535",
"0.5449617",
"0.54455584",
"0.5420963",
"0.54051834",
"0.5394053",
"0.53822464",
"0.5374119",
"0.53701985",
"0.5365667",
"0.5359402... | 0.72443676 | 1 |
GET /brokers/1 GET /brokers/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brokers = Broker.all\n end",
"def index\n @brokers = Broker.all\n end",
"def brokers\n {\n zerodha: 'Zerodha'\n }\n end",
"def fetch_brokers(zk)\n brokers = []\n zk.children(BROKERS_PATH).each do |id|\n node = fetch_znode(zk, id)\n ... | [
"0.6934983",
"0.6934983",
"0.6670304",
"0.65115017",
"0.6458271",
"0.6456723",
"0.61464584",
"0.5907727",
"0.5791836",
"0.56359464",
"0.55435723",
"0.551697",
"0.54263645",
"0.54256326",
"0.5403944",
"0.53931546",
"0.5392842",
"0.53426063",
"0.5333677",
"0.5302617",
"0.530236... | 0.0 | -1 |
POST /brokers POST /brokers.json | def create
# Net::SSH doesn't like \r\n, turn it into \n
broker_params[:ssh_key].gsub! /\r/, ''
@broker = Broker.new(broker_params)
respond_to do |format|
if @broker.save
format.html { redirect_to @broker, notice: 'Broker was successfully created.' }
format.json { render :show, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @broker = Broker.new(broker_params)\n\n respond_to do |format|\n if @broker.save\n format.html { redirect_to @broker, notice: 'Broker was successfully created.' }\n format.json { render :show, status: :created, location: @broker }\n else\n format.html { render :new... | [
"0.6365527",
"0.626024",
"0.6027397",
"0.5956891",
"0.57395416",
"0.5725861",
"0.5510428",
"0.55091923",
"0.5483251",
"0.54683936",
"0.5455697",
"0.53731143",
"0.53731143",
"0.5326313",
"0.53161407",
"0.528063",
"0.5220122",
"0.5164155",
"0.5091011",
"0.5090669",
"0.5087528",... | 0.6190117 | 2 |
PATCH/PUT /brokers/1 PATCH/PUT /brokers/1.json | def update
respond_to do |format|
if @broker.update(broker_params)
format.html { redirect_to @broker, notice: 'Broker was successfully updated.' }
format.json { render :show, status: :ok, location: @broker }
else
format.html { render :edit }
format.json { render json: @br... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @broker.update(broker_params)\n format.html { redirect_to admin_broker_path(@broker), notice: 'Broker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { rend... | [
"0.6430197",
"0.5873663",
"0.58352643",
"0.5804712",
"0.579548",
"0.57660854",
"0.57577115",
"0.57195246",
"0.5612699",
"0.5596571",
"0.55918723",
"0.557679",
"0.5555344",
"0.553395",
"0.55223775",
"0.5520542",
"0.5506617",
"0.5488713",
"0.5488067",
"0.5468515",
"0.54634094",... | 0.64801073 | 1 |
DELETE /brokers/1 DELETE /brokers/1.json | def destroy
@broker.destroy
respond_to do |format|
format.html { redirect_to brokers_url, notice: 'Broker was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @broker.destroy\n respond_to do |format|\n format.html { redirect_to admin_brokers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def delete *args, &block\n res = @conn.delete *args, &block\... | [
"0.72603434",
"0.6518133",
"0.63496816",
"0.626372",
"0.6231754",
"0.6219475",
"0.6182017",
"0.6176153",
"0.6171414",
"0.61301535",
"0.6122671",
"0.6121881",
"0.6108328",
"0.6105318",
"0.6097706",
"0.6080372",
"0.60788345",
"0.6058661",
"0.60557616",
"0.6051015",
"0.6042314",... | 0.7074709 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_broker
@broker = Broker.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def broker_params
params.require(:broker).permit(:name, :secure_port, :insecure_port, :ssh_hostname, :ssh_username, :ssh_key, :postgresql_database, :postgresql_username, :postgresql_password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Show detail for a person with ID = params[:id] (in HTML) | def show
@person = Person.find_by(id: params[:id])
# render json: @person #skips the view, and just renders out the json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @person = Person.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n end",
"def show\n @person = Person.find(params[:id])\n end",
"def show\n\t\t\"I'd love to show you object with id: #{params[:id]}\"\n... | [
"0.78439254",
"0.78439254",
"0.78439254",
"0.78439254",
"0.74003106",
"0.737659",
"0.737659",
"0.73615515",
"0.7342409",
"0.7327003",
"0.72591347",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7254157",
"0.7237062"... | 0.74049747 | 4 |
Form for adding a new person (in HTML) | def new
@person = Person.new
# render json: @person #skips the view, and just renders out the json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @person = Person.new #will create a blank person in memory but it will not have an id nor will it save it in memory\n @term = 'Add Person'\n render partial: 'form' #this will send it to the form page\n end",
"def new\n if params[:user_id]\n @person = Person.new(:user_id => params[:use... | [
"0.73493713",
"0.7081533",
"0.7019391",
"0.67846614",
"0.6749706",
"0.67137605",
"0.67014635",
"0.66614395",
"0.6571615",
"0.6546107",
"0.65235984",
"0.65147805",
"0.65141886",
"0.6495651",
"0.6477576",
"0.645529",
"0.64358675",
"0.6430418",
"0.6423581",
"0.6413789",
"0.63660... | 0.5999712 | 90 |
POST to this to crea a new person, then redirect to show | def create
@person = Person.create(person_params)
redirect_to person_url(@person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @person = Person.new(params[:person])\n \n respond_to do |format|\n if @person.save\n format.html { redirect_to \"people/#{@person.id}\" }\n format.json { render :nothing }\n format.xml { render :nothing }\n else \n format.html { render :action =... | [
"0.76947653",
"0.7588184",
"0.7574242",
"0.7558878",
"0.7544491",
"0.7371358",
"0.73573285",
"0.7238314",
"0.7235427",
"0.72345966",
"0.7226837",
"0.71969783",
"0.71967286",
"0.71811986",
"0.7169143",
"0.7166791",
"0.7159473",
"0.7153321",
"0.7153321",
"0.7153321",
"0.7153321... | 0.7904684 | 0 |
Form for updating a person with ID = params[:id] (in HTML) | def edit
@person = Person.find_by(id: params[:id])
# @person.save
# render json: @person #skips the view, and just renders out the json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @person = Person.find(params[:id])\n \n if @person.update(person_param)\n redirect_to action: 'show', id: @person\n else\n render action: 'edit'\n end\n end",
"def update\n @person = Person.find(params[:id])\n flash[:notice] = @person.Name + \" updated.\" if @person.u... | [
"0.7455652",
"0.7249185",
"0.7226626",
"0.72021395",
"0.71891093",
"0.71840113",
"0.71840113",
"0.71840113",
"0.71229106",
"0.7104267",
"0.7099262",
"0.70973676",
"0.7094156",
"0.7089855",
"0.7089855",
"0.7089611",
"0.7089611",
"0.7089611",
"0.7089611",
"0.7089611",
"0.705700... | 0.6837059 | 32 |
PUT or PATCH to this to update person with ID = params[:id] , then redirect to show | def update
@person = Person.find_by(id: params[:id])
@person.update_attributes(person_params)
# Same as below!
# @person.name = params[:person][:name]
# @person.age = params[:person][:age]
# @person.is_a_clown = params[:person][:is_a_clown]
# @person.save
# redirect_to 'index'
redirect_to person_url... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @person = Person.find(params[:id])\n \n if @person.update(person_param)\n redirect_to action: 'show', id: @person\n else\n render action: 'edit'\n end\n end",
"def update\n @person = Person.find(params[:id])\n\t\n respond_to do |format|\n if @person.update_attrib... | [
"0.8401223",
"0.7975485",
"0.78246343",
"0.7745351",
"0.7727075",
"0.7727075",
"0.7727075",
"0.7727075",
"0.7727075",
"0.7725909",
"0.7680989",
"0.7680989",
"0.76730907",
"0.76730907",
"0.76360327",
"0.76088136",
"0.7607535",
"0.75903964",
"0.7577583",
"0.7568009",
"0.755288"... | 0.79922146 | 1 |
Destroy the person with ID = params[:id] then redirect to index to list remaining persons | def destroy
@person = Person.find_by(id: params[:id])
@person.destroy
redirect_to persons_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n Person.find(params[:id]).destroy\n redirect_to action: 'list'\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n redirect_to people_url\n end",
"def destroy\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\tperson.destroy\... | [
"0.8222524",
"0.7985597",
"0.78747016",
"0.78474975",
"0.7819563",
"0.76894635",
"0.76742464",
"0.76742464",
"0.76742464",
"0.7672275",
"0.7672275",
"0.7672275",
"0.7672275",
"0.76407313",
"0.76407313",
"0.76407313",
"0.76407313",
"0.76407313",
"0.76407313",
"0.76407313",
"0.... | 0.81456625 | 1 |
Can minimize queries further? | def friends
@user = User.includes(:owned_friendships => :friend, :sent_requests => :requestee,
:received_requests => :requestor).find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_plus_one_query_enable=(_arg0); end",
"def query; end",
"def all(query); end",
"def query_full\n query = @initial_query.dup\n\n # restrict to select columns\n query = query_projection(query)\n\n #filter\n query = query_filter(query)\n\n # sorting\n query = query_sort(q... | [
"0.62424976",
"0.6154537",
"0.6087545",
"0.5991856",
"0.5943457",
"0.59045774",
"0.5849899",
"0.57261455",
"0.57086575",
"0.56875557",
"0.5618286",
"0.5541254",
"0.55016744",
"0.5480363",
"0.54759485",
"0.54673344",
"0.5449103",
"0.5446138",
"0.5439659",
"0.543566",
"0.543493... | 0.0 | -1 |
has_many :movies, through: :reviews | def most_active_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review.movie\n # end\n # end\n # output\n reviews.map { |review| review.movie }\n end",
"def index\n\t\t@reviews = @movie.reviews\n\tend",
"def my_reviews\n self.reviews.s... | [
"0.6800279",
"0.6710098",
"0.6224078",
"0.6177935",
"0.6074521",
"0.6066943",
"0.6061157",
"0.6060866",
"0.6042389",
"0.60041595",
"0.5941225",
"0.59136283",
"0.5904447",
"0.5878563",
"0.58746123",
"0.5871023",
"0.58257854",
"0.58241546",
"0.5818715",
"0.5816904",
"0.5815789"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_activity
if params[:id].nil?
@activity = Activity.where("id = ? AND status != ?",params[:activity_id], "archived").first
else
@activity = Activity.where("id = ? AND status != ?", @comment.commentable_id, "archived").first
end
if @activity.nil?
head(:not_found)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def comment_params
params.permit(:id, :activity_id, :body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Add word to the trie | def add(word, w)
if word != ""
cur = self
word.downcase.each_char do |character|
modified_char = @@vowels.include?(character) ? '*' : character
cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char
cur = cur.kids[modified_char]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_word(word)\n node = @root\n word.each_char do |c|\n node.children[c] ||= TrieNode.new\n node = node.children[c]\n end\n node.is_end = true\n end",
"def add_word(word)\n node = root\n word.chars.each do |c|\n node.children[c] = TrieNode.new unless node.child... | [
"0.8928484",
"0.8890534",
"0.87248605",
"0.8193801",
"0.8164656",
"0.81642723",
"0.8090314",
"0.8070715",
"0.7946194",
"0.792776",
"0.78631514",
"0.769386",
"0.7667705",
"0.7656466",
"0.76255304",
"0.75310016",
"0.7470982",
"0.7381077",
"0.7339154",
"0.7328768",
"0.71847665",... | 0.84995633 | 3 |
Get all possible matches for this word | def get_matches(word)
cur = self
word.each_char do |character|
modified_char = @@vowels.include?(character) ? '*' : character
return Set.new if not cur.kids.has_key? modified_char
cur = cur.kids[modified_char]
end
cur.words_here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_matched_words(combination, dictionary)\n all_matched_words = []\n combination.map { |pattern| all_matched_words.push(find_matches(pattern, dictionary)) unless pattern.empty? }\n all_matched_words\n end",
"def find_potential_matches\n comp_words.each_with_object([]) do |comp_word, collect... | [
"0.7529127",
"0.6988116",
"0.69878054",
"0.68993735",
"0.6804667",
"0.6803045",
"0.6622627",
"0.65796477",
"0.6525263",
"0.6517714",
"0.6516067",
"0.6482335",
"0.6423594",
"0.6407582",
"0.6402379",
"0.63669336",
"0.63657856",
"0.6311127",
"0.6299503",
"0.6295652",
"0.6221051"... | 0.73896664 | 1 |
1.+2.2+3.325 0.0+.2 DOESN'T PARSE: .+1 ~~~~~~~~~~~~~~ | def test_decimals
assert_equal( "+(+(1., 2.2), 3.325)" , @p.prefix_form("1.+2.2+3.325") )
assert_equal( "+(0.0, .2)" , @p.prefix_form("0.0+.2") )
assert_raise(ArgumentError) { @p.prefix_form(".+1") }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17', value)\n assert_equal(' boondocks', rest)\n end",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17L boondocks\")\n assert_equal(:floa... | [
"0.6327271",
"0.6266714",
"0.6244752",
"0.62047374",
"0.5891791",
"0.5861372",
"0.58174413",
"0.5769725",
"0.57191044",
"0.5641495",
"0.5605381",
"0.5597739",
"0.5584901",
"0.5584796",
"0.55824196",
"0.5572681",
"0.5557243",
"0.5543382",
"0.5514017",
"0.5496371",
"0.54896444"... | 0.70562214 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_unit
@unit = Unit.find params[:id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def unit_params
params.require(:unit).permit(:short_label, :long_label, :universe)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
This action find attributes for a like object crud functionality | def find_likable
params.each do |name, value|
if name =~ /(.+)_id$/
return $1.classify.constantize.find(value)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes\n end",
"def attributes\n query[ model_name ]\n end",
"def attributes\n end",
"def attributes\n @attributes\n end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def... | [
"0.69078743",
"0.69022477",
"0.6874818",
"0.67302054",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66597956",
"0.66105086",
"0.6597939",
"0.6499589",
"0.64465606",
"0.6332203",
... | 0.0 | -1 |
This action permit accessible attributes | def likes_params
params.require(:like).permit(:value, :likable_id, :likable_type, :user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_permitted?(_attribute)\n true\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def attributes\n @allowed_attributes\n end",
"def showable_attributes\n return attributes if permitted_to?(WriteAllPrivilege)\n att... | [
"0.7123395",
"0.71127534",
"0.71127534",
"0.7017276",
"0.695442",
"0.68544084",
"0.6797037",
"0.6786133",
"0.67733675",
"0.6760781",
"0.666957",
"0.6593361",
"0.65300167",
"0.6521256",
"0.65087867",
"0.64782894",
"0.6474634",
"0.64651334",
"0.64651334",
"0.6461606",
"0.645946... | 0.0 | -1 |
This action find path for redirect after like crud functionality | def path(commentable)
if Athlete === commentable
return athletes_url
else
return games_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_path\n if @bank_dup.present?\n latest_ofxes_path\n elsif session[:current_acct].present?\n account_path(session[:current_acct])\n else\n account_path(@entry.splits.order(:id).first.account)\n end\n end",
"def redirect_path\r\n if !(@target =~ /invoice/i... | [
"0.7109695",
"0.70993054",
"0.7054458",
"0.7054458",
"0.6886143",
"0.68488044",
"0.6694127",
"0.6678261",
"0.66705686",
"0.6612455",
"0.6601483",
"0.6601483",
"0.6575973",
"0.6560777",
"0.65546954",
"0.6535104",
"0.6469684",
"0.64657927",
"0.64580023",
"0.64529663",
"0.637481... | 0.0 | -1 |
From here below is for debugging purposes! | def to_s
@final_name ||= (Functional.lookup(self) || @name).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def stderrs; end",
"def terpene; end",
"def berlioz; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def verdi; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect;... | [
"0.74972904",
"0.6889632",
"0.6476685",
"0.6307317",
"0.62392807",
"0.62373227",
"0.6230778",
"0.6230778",
"0.6230778",
"0.6230778",
"0.6228744",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
"0.6228431",
... | 0.0 | -1 |
Renders the post belonging to the board `GET /api/boards/:board_id/posts` | def index
paginate json: @board.posts.page(params[:page]), per_page: 20
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.new\n @board = Board.friendly.find(params[:board_id])\n @posts = @discussion.posts.order(\"created_at\")\n end",
"def show\r\n #取得したデータと関連データを取得する。\r\n @related_posts = Board.tagged_with(@board.tag_list, any: true).where.not(id:@board.id).limit(2) \r\n #照会数がnilの場合\r\n ... | [
"0.70260465",
"0.691777",
"0.68746316",
"0.6686401",
"0.6568524",
"0.65337074",
"0.6478847",
"0.6439058",
"0.6414157",
"0.6414017",
"0.6413667",
"0.64123106",
"0.638343",
"0.6380103",
"0.6379",
"0.63663864",
"0.63642156",
"0.6354975",
"0.63493115",
"0.6343367",
"0.6336854",
... | 0.6404108 | 12 |
Renders a single post belonging to the board `GET /api/boards/:board_id/posts/:id` | def show
render json: @post
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = PostsService.getPostById(params[:id])\n end",
"def show\n @post = Post.find params[:id]\n end",
"def show\n @post = Post.new\n @board = Board.friendly.find(params[:board_id])\n @posts = @discussion.posts.order(\"created_at\")\n end",
"def show_post\n @post = Post... | [
"0.7047936",
"0.7020695",
"0.7012874",
"0.69978493",
"0.6992401",
"0.6991395",
"0.6960202",
"0.6960202",
"0.6960202",
"0.6959597",
"0.6949172",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
"0.6932132",
... | 0.6532229 | 68 |
Creates a single post belonging to the board `POST /api/boards/:board_id/posts/` | def create
@post = Post.new(params.permit(:title, :content, :board_id))
@post.user = @user
if (@post.save)
render json: @post, status: :created
else
render json: @post.errors, status: 422
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @post = @board.posts.new(post_params)\n @post.user = current_user\n if @post.save\n redirect_to [@post.board, @post]\n else\n render :new\n end\n end",
"def create\n @post = Post.create!(post_params)\n end",
"def create\n @room = Room.find(params[:target_ro... | [
"0.7507344",
"0.717528",
"0.70928776",
"0.70735633",
"0.6998513",
"0.6901336",
"0.68980116",
"0.6870815",
"0.68384343",
"0.68115216",
"0.68018353",
"0.6788599",
"0.6788516",
"0.6786119",
"0.6785575",
"0.6775223",
"0.676622",
"0.67612785",
"0.67606324",
"0.6757347",
"0.6755959... | 0.7809621 | 0 |
Updates a single post belonging to the board `PUT /api/boards/:board_id/posts/:id` | def update
if (@post.update(params.permit(:title, :content)))
render json: @post, status: :ok
else
render json: @post.errors, status: 422
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_post(post_id, post_data)\n uri = \"#{@api_url}/#{@project_id}/posts/#{post_id}?access_token=#{@access_token}\"\n put uri, post_data\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n\t\t@post = Post.find(params[:id])\n\t\t@post.update... | [
"0.766763",
"0.72856414",
"0.7283943",
"0.7193082",
"0.7175347",
"0.7107009",
"0.7085065",
"0.7045289",
"0.6949492",
"0.6935929",
"0.6934233",
"0.69159096",
"0.687185",
"0.6864513",
"0.6861796",
"0.6831526",
"0.68277967",
"0.67854613",
"0.6776311",
"0.6740591",
"0.6738098",
... | 0.0 | -1 |
Deletes a single post belonging to the board `DELETE /api/boards/:board_id/posts/:id` | def destroy
@post.destroy
render json: {}, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @post.destroy\n redirect_to board_posts_path(@post.board)\n end",
"def delete_post\n post = Post.find_by_id(params[:id])\n if !post.nil?\n post.destroy\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n redirect_to posts_url, :message => '... | [
"0.8202752",
"0.76487154",
"0.7637361",
"0.7611909",
"0.75947064",
"0.75572",
"0.7554881",
"0.75540286",
"0.7541162",
"0.7533716",
"0.7533716",
"0.7533716",
"0.75264835",
"0.75220126",
"0.75153226",
"0.74529696",
"0.74489665",
"0.7443189",
"0.74085045",
"0.7404781",
"0.740080... | 0.0 | -1 |
Cancels the currently running task. | def cancel
@coordinator.cancel
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n @__status = TaskStatus::CANCELED\n TaskScheduler.remove_task(self)\n Process.kill('QUIT', @__pid) if @__pid&.positive?\n end",
"def cancel\n to_run.clear\n reset\n current_self\n end",
"def cancel\n return unless @running\n @running = false\n ... | [
"0.80033064",
"0.7176392",
"0.68291205",
"0.67970556",
"0.6630788",
"0.6626562",
"0.6521523",
"0.64944863",
"0.6490713",
"0.6420403",
"0.63767684",
"0.6364318",
"0.636416",
"0.636075",
"0.6351108",
"0.633388",
"0.6332596",
"0.6331544",
"0.63039786",
"0.6293447",
"0.6290104",
... | 0.5999259 | 68 |
Releases resources used by this instance. | def finalize
if @finish_callback
@finish_callback.call(@result, @exception) unless isCancelled
end
@context = nil
if @timer
@timer.invalidate
@timer = nil
end
@timeout_callback = nil
@update_callback = nil
@finish_callback = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release\n end",
"def release\n\n a = self.to_a\n self.close\n a\n end",
"def release(resource); end",
"def release\n end",
"def release\n end",
"def dispose\n call Memory.deAlloc(self)\n end",
"def dispose\n call Memory.deAlloc(self)\n end",
"def release!\n ... | [
"0.74515873",
"0.7349599",
"0.71226543",
"0.7099577",
"0.7099577",
"0.7097877",
"0.7097877",
"0.6978719",
"0.6940871",
"0.6939554",
"0.68659306",
"0.6834341",
"0.68288726",
"0.67964196",
"0.6760575",
"0.6760253",
"0.67564744",
"0.67301464",
"0.67301464",
"0.66867256",
"0.6671... | 0.0 | -1 |
Returns information about this task. | def inspect
details = []
details << "<canceled>" if @coordinator.cancelled?
"#<#{self.class.name}: #{details.join(" ")}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end",
"def task\n return @task\n end",
"def task\n @keys[:task]\n end",
"def getTaskName\r\n\t\t\t\t\treturn @taskName\r\n\t\t\t\tend",... | [
"0.75002944",
"0.71599823",
"0.7153722",
"0.69352055",
"0.69291276",
"0.6866722",
"0.685847",
"0.6824618",
"0.67383647",
"0.67048657",
"0.66620994",
"0.6626473",
"0.66205156",
"0.65905035",
"0.6586509",
"0.6585146",
"0.6537738",
"0.6527271",
"0.6480947",
"0.64676315",
"0.6442... | 0.0 | -1 |
Logs debugging information in certain configurations. | def log(line)
puts line unless RUBYMOTION_ENV == "test"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug\n Puppet::Util::Log.level = :debug\n end",
"def log_debug(*debug_infos)\r\n options = debug_infos.extract_options!\r\n options[:development_only] ||= true\r\n\r\n if options[:development_only]\r\n if Rails.env != 'production'\r\n infos = create_info_log_string debug_infos\r\n end\r\n ... | [
"0.7300473",
"0.72281426",
"0.709023",
"0.7016581",
"0.69447035",
"0.6893172",
"0.6843393",
"0.68428445",
"0.6835123",
"0.682858",
"0.67713594",
"0.67713594",
"0.67713594",
"0.67713594",
"0.6757518",
"0.6757409",
"0.6752175",
"0.67407006",
"0.67407006",
"0.67407006",
"0.67407... | 0.0 | -1 |
Runs the specified task. | def main
log " START: #{inspect}"
@coordinator.install
begin
unless @coordinator.cancelled?
@result = @context.execute do |*args|
@update_callback.call(*args) if @update_callback
end
end
rescue Exception => e
@exception = e
if e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(task)\n debug \"Run task: #{task}\"\n raise Deployment::NotImplemented, 'This method is abstract and should be implemented in a subclass'\n end",
"def run_task(task_class, params = nil)\n check_run_once_and_build_and_run_task(task_class, params)\n end",
"def run_task(task_name)\n ... | [
"0.7856401",
"0.7820794",
"0.7680609",
"0.76239777",
"0.7622293",
"0.7592743",
"0.75520873",
"0.75520873",
"0.75520873",
"0.75520873",
"0.74616367",
"0.73620474",
"0.72784185",
"0.7242865",
"0.71813875",
"0.71529925",
"0.7127952",
"0.7017618",
"0.7015484",
"0.6903866",
"0.689... | 0.0 | -1 |
Sets the callback to be run upon completion of this task. Do not call this method after the task has started. | def on_finish=(callback)
@finish_callback = callback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCB(callback)\n @callbackfn = callback\n end",
"def register_completion_callback(callback)\n @duty_completion_callback = callback\n end",
"def on_end(&callback)\n @end_callback = callback\n end",
"def on_finish &b\n @on_finish_cb = b\n end",
"def callback\n se... | [
"0.7689121",
"0.71183443",
"0.6980981",
"0.6980865",
"0.68416524",
"0.68416524",
"0.6607878",
"0.65284956",
"0.6463157",
"0.64463776",
"0.6418159",
"0.6400489",
"0.63950074",
"0.63853514",
"0.63853514",
"0.63853514",
"0.6384273",
"0.63601536",
"0.63149846",
"0.6299545",
"0.62... | 0.7872246 | 0 |
Sets the callback to be run when this task is queued. Do not call this method after the task has started. | def on_start=(callback)
weak = WeakRef.new(self)
Dispatch::Queue.main.async do
if weak
callback.call unless weak.isCancelled
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCB(callback)\n @callbackfn = callback\n end",
"def callback\n headers.clear\n if callbacks and not callbacks.empty?\n queue_name = callbacks.shift\n Minion.enqueue(queue_name, as_json)\n end\n end",
"def callback=(proc)\n # Save proc to instance variable so t... | [
"0.7260464",
"0.6600915",
"0.6274302",
"0.620766",
"0.620766",
"0.6166546",
"0.6125203",
"0.6099105",
"0.6095063",
"0.6037872",
"0.5981868",
"0.5944778",
"0.59440017",
"0.59440017",
"0.59440017",
"0.59440017",
"0.59434325",
"0.5890416",
"0.58610034",
"0.5843237",
"0.5841655",... | 0.59269834 | 17 |
Sets the timeout callback. | def on_timeout=(callback)
@timeout_callback = callback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout=(timeout)\n @timeout = timeout\n end",
"def timeout=(value)\n @timeout = value\n end",
"def timeout=(timeout)\n @timeout = timeout.to_f/1000 * 60\n end",
"def timeout=(timeout=:default)\n @timeout = TIMEOUTS.member?(timeout) ? TIMEOUTS[timeout] : timeout... | [
"0.8006837",
"0.79251444",
"0.7594308",
"0.7546353",
"0.7505642",
"0.75049967",
"0.75049967",
"0.75049967",
"0.75049967",
"0.75049967",
"0.74784315",
"0.74784315",
"0.72534895",
"0.7235006",
"0.71027553",
"0.7010802",
"0.69891006",
"0.697952",
"0.69780755",
"0.6963867",
"0.69... | 0.8856442 | 0 |
Sets the update callback, which is invoked for any yield statements in the task. | def on_update=(callback)
@update_callback = callback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update &block\n receive_update_callbacks << block\n end",
"def update(&block)\n @update_block = block\n end",
"def on_update(&block)\n @on_update = block\n end",
"def update(&block)\n instance_eval(&block)\n end",
"def update\n run_callbacks :update do\n ... | [
"0.7023923",
"0.6957127",
"0.6758909",
"0.6474079",
"0.64377373",
"0.62310773",
"0.6179972",
"0.6114582",
"0.6104724",
"0.6076622",
"0.59133756",
"0.5886631",
"0.58081937",
"0.57866657",
"0.57500595",
"0.57500595",
"0.5749189",
"0.57273954",
"0.572261",
"0.57084644",
"0.56452... | 0.67188644 | 3 |
Sets the timeout interval for this task. The timeout starts when the task is queued, not when it is started. | def timeout=(interval)
@timer = NSTimer.scheduledTimerWithTimeInterval(interval,
target: self,
selector: :"on_timeout_elapsed:",
userInfo: nil,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout=(timeout)\n @timeout = timeout.to_f/1000 * 60\n end",
"def timeout=(value)\n @timeout = value\n end",
"def timeout=(timeout)\n @stop_time = timeout.nil? ? nil : current_time + timeout\n end",
"def timeout=(timeout)\n @timeout = timeout\n end",
"def init... | [
"0.64712644",
"0.6374823",
"0.63068753",
"0.6200231",
"0.6200122",
"0.61918443",
"0.6023284",
"0.598804",
"0.5974049",
"0.5936065",
"0.59017986",
"0.59003377",
"0.59003377",
"0.59003377",
"0.59003377",
"0.59003377",
"0.5899333",
"0.587631",
"0.5850922",
"0.58413583",
"0.58366... | 0.6776041 | 0 |
Returns whether this task timed out. | def timed_out?
@exception.class == TimeoutError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timed_out?\n @timed_out\n end",
"def timed_out?\n key = fei['wfid'] + '__' + fei['expid']\n\n if self.fields[\"__timeouts__\"] && timeout = self.fields[\"__timeouts__\"][ key ]\n return Time.at( timeout.last ) < Time.now\n end\n\n return false\n end",
"def timed_out?\n ... | [
"0.82628447",
"0.8005512",
"0.7949051",
"0.7949051",
"0.776866",
"0.77381974",
"0.7605984",
"0.7467769",
"0.73997706",
"0.72970545",
"0.72560734",
"0.72403",
"0.7188992",
"0.707767",
"0.7070802",
"0.6930644",
"0.6883082",
"0.68577635",
"0.68098855",
"0.6689378",
"0.6686861",
... | 0.7552387 | 7 |
Manual option post processing | def postprocess_user_choices
if @user_choices[:files][0] and @user_choices[:files][0] != Pathname('-')
@user_choices[:input] = @user_choices[:files][0].open('r')
else
@user_choices[:input] = STDIN
end
if @user_choices[:files][1] and @user_choices[:f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n @options.each do |option, value|\n if value == true && VALID_OPTIONS.include?(option)\n self.send(\"option_#{optio... | [
"0.7294307",
"0.7294307",
"0.7294307",
"0.72005993",
"0.67977357",
"0.6699792",
"0.6632949",
"0.6440824",
"0.61900157",
"0.6163724",
"0.61547893",
"0.6138772",
"0.6138772",
"0.6122621",
"0.60632604",
"0.601661",
"0.5999434",
"0.5998526",
"0.5989271",
"0.59409744",
"0.58801556... | 0.5418758 | 71 |
GET /purchase_bills GET /purchase_bills.xml | def index
@search = PurchaseBill.search(params[:search])
@purchase_bills = @search.paginate(:page => params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @purchase_bills }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bills(options = {})\n get('/bills', options)\n end",
"def index\n @bills = Bills.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bills }\n end\n end",
"def show\n @bills = Bill.find(params[:id])\n end",
"def index\n @bills =... | [
"0.7505682",
"0.6876165",
"0.67958534",
"0.6691268",
"0.6648815",
"0.6609882",
"0.6563545",
"0.6563545",
"0.6563545",
"0.6563545",
"0.6563545",
"0.6563545",
"0.6563545",
"0.6558738",
"0.64534354",
"0.64473516",
"0.63594264",
"0.6351284",
"0.6350014",
"0.6342575",
"0.6341317",... | 0.6513031 | 14 |
GET /purchase_bills/1 GET /purchase_bills/1.xml | def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @purchase_bill }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bills(options = {})\n get('/bills', options)\n end",
"def index\n @bills = Bills.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bills }\n end\n end",
"def show\n @bills = Bill.find(params[:id])\n end",
"def index\n @user_bi... | [
"0.69741476",
"0.68557817",
"0.6644232",
"0.6618171",
"0.6498496",
"0.6482986",
"0.64742076",
"0.6425278",
"0.6414153",
"0.64035714",
"0.6387382",
"0.6381908",
"0.6296569",
"0.6296569",
"0.6296569",
"0.6296569",
"0.6296569",
"0.6296569",
"0.6296569",
"0.62874115",
"0.62874115... | 0.6608088 | 4 |
GET /purchase_bills/new GET /purchase_bills/new.xml | def new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @purchase_bill }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @billitem = Billitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billitem }\n end\n end",
"def new\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.new\n\n respond_to do |format|\n format.html # n... | [
"0.73977935",
"0.7347366",
"0.7323552",
"0.7223968",
"0.7012963",
"0.6999312",
"0.69747585",
"0.6957625",
"0.6902143",
"0.6899609",
"0.6888181",
"0.6886502",
"0.68813336",
"0.6878464",
"0.68001854",
"0.67901814",
"0.67844296",
"0.67608905",
"0.67595965",
"0.67386967",
"0.6738... | 0.76499414 | 0 |
POST /purchase_bills POST /purchase_bills.xml | def create
respond_to do |format|
if @purchase_bill.save
flash[:notice] = 'PurchaseBill was successfully created.'
format.html { redirect_to(@purchase_bill) }
format.xml { render :xml => @purchase_bill, :status => :created, :location => @purchase_bill }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bill(params)\n build_header_auth('/bills', API_VERSION_1, 'POST')\n build_request()\n p_hash = {}\n p_hash[\"bill\"] = {\"identifier\" => params['id'],\n \"amount_cents\" => params['amount_cents'],\n \"bill_template_id\" => params['bill_template_id'],\n \"memo\" ... | [
"0.64897627",
"0.6389377",
"0.6367057",
"0.6260991",
"0.61473686",
"0.6095703",
"0.6084638",
"0.59209114",
"0.57883453",
"0.57837945",
"0.5775508",
"0.5755814",
"0.5716498",
"0.5707134",
"0.5701826",
"0.57010937",
"0.5666968",
"0.56646323",
"0.56617695",
"0.56428283",
"0.5635... | 0.60984474 | 5 |
PUT /purchase_bills/1 PUT /purchase_bills/1.xml | def update
respond_to do |format|
if @purchase_bill.update_attributes(params[:purchase_bill])
flash[:notice] = 'PurchaseBill was successfully updated.'
format.html { redirect_to(@purchase_bill) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bills\n @bills = Bill.find(params[:id])\n end",
"def update\n @bill = Bill.find(params[:id])\n \n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n\tif @bill.cancel == true\n\t @items=Item.find(:all, :conditions => { :bill_id => @bill.id })\n\t\t\t@items.each do ... | [
"0.6381649",
"0.6242302",
"0.61223644",
"0.61216897",
"0.6099318",
"0.6098144",
"0.6060764",
"0.60293335",
"0.59802777",
"0.59733695",
"0.5917917",
"0.5883975",
"0.5875893",
"0.58695036",
"0.58530486",
"0.5844409",
"0.5838775",
"0.5827904",
"0.5827904",
"0.5781468",
"0.577806... | 0.6548754 | 0 |
DELETE /purchase_bills/1 DELETE /purchase_bills/1.xml | def destroy
@purchase_bill.destroy
respond_to do |format|
format.html { redirect_to(purchase_bills_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bill = Bill.find(params[:id])\n \n @bill.destroy\n\n respond_to do |format|\n format.htm... | [
"0.69073313",
"0.69045633",
"0.6767482",
"0.67393124",
"0.659065",
"0.652486",
"0.6494563",
"0.6452803",
"0.6413942",
"0.6392631",
"0.6387735",
"0.63801557",
"0.6378728",
"0.63716996",
"0.6325296",
"0.6306549",
"0.6282353",
"0.62719524",
"0.62719524",
"0.62719524",
"0.6270774... | 0.7259874 | 0 |
=begin Write a method that takes a String of digits, and returns the appropriate number as an integer. You may not use any of the methods mentioned above. The String may have a leading + or sign; if the first character is a +, your method should return a positive number; if it is a , your method should return a negativ... | def string_to_integer(string)
char_to_int = {
'1'=> 1,
'2'=> 2,
'3'=> 3,
'4'=> 4,
'5'=> 5,
'6'=> 6,
'7'=> 7,
'8'=> 8,
'9'=> 9,
'0'=> 0,
}
if string[0] == '-' then
string[1..string.length].chars.reduce(0) { |int, char| int * 10 + char_to_int[char]} * -1
elsif string... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_to_integer(string)\n digits = string.chars.map(&:to_i)\n value = 0\n digits.each do |digit|\n value = 10 * value + digit\n end\n value\nend",
"def my_atoi(s)\n # Alternatively, return Float::NAN instead of 0 when string is invalid\n return 0 if !s || s.length == 0\n\n i, result, sign = 0, 0... | [
"0.7989032",
"0.7853851",
"0.78022414",
"0.7775034",
"0.7775034",
"0.77494603",
"0.77494603",
"0.7747008",
"0.77435416",
"0.7718353",
"0.7717375",
"0.7707537",
"0.7697112",
"0.767421",
"0.766992",
"0.7668405",
"0.76245433",
"0.7589005",
"0.7586831",
"0.75766706",
"0.75408554"... | 0.83969057 | 0 |
As it is, it's too easy to forget to add help line when adding a new command | def help
puts "job 'name' - create job named 'name'"
puts "background 'name' - make 'name' a background job"
puts "forget_background - make there be no background job"
puts "jobs - a list of jobs"
puts "forget_job 'name' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_help\n display_possible_actions\n end",
"def help\n send_command \"--help\"\n end",
"def create_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [create | c] <name=> <type=> creates a a... | [
"0.8300882",
"0.8121515",
"0.8016202",
"0.7984647",
"0.7898424",
"0.7898424",
"0.7897591",
"0.78804713",
"0.78596014",
"0.7816986",
"0.7816986",
"0.78099394",
"0.78099394",
"0.78099394",
"0.78099394",
"0.78099394",
"0.78099394",
"0.78099394",
"0.778164",
"0.778164",
"0.778164... | 0.0 | -1 |
Return the lower boundary. (inside) | def search_lower_boundary(array, range=nil, &block)
range = 0 ... array.length if range == nil
lower = range.first() -1
upper = if range.exclude_end? then range.last else range.last + 1 end
while lower + 1 != upper
mid = ((lower + upper) / 2).to_i # for working with m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bsearch_lower_boundary(range = 0...length, &block)\n bsearch_boundary(true, range, &block)\n end",
"def boundary \n \"An43094fu\"\n end",
"def lower_left\n @lower_left ||= world.point(x_min, y_min)\n end",
"def lower_bound_inclusive\n lower_bound\n end",
"def lower_r... | [
"0.67887455",
"0.67638355",
"0.672935",
"0.6608207",
"0.65204424",
"0.6485839",
"0.6410217",
"0.6278635",
"0.6270882",
"0.6232875",
"0.62015975",
"0.6192386",
"0.6178948",
"0.613504",
"0.6101162",
"0.6100208",
"0.60570985",
"0.59560215",
"0.59289557",
"0.5893165",
"0.586623",... | 0.67022943 | 3 |
This method searches the FIRST occurrence which satisfies a condition given by a block in binary fashion and return the index of the first occurrence. Return nil if not found. | def search_first(array, range=nil, &block)
boundary = search_lower_boundary(array, range, &block)
if boundary >= array.length || yield(array[boundary]) != 0
return nil
else
return boundary
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_index(value = nil, &block)\n\t\tusing_block = block_given?\n\t\teach_with_index do |element,index|\n\t\t\treturn index if (using_block && yield(element)) || (value == element)\n\t\tend\n\t\treturn nil\n\tend",
"def first_index(arr, &blck)\n #arr.find_index { |el| blck.call(el) }\n arr.each_with_i... | [
"0.75818205",
"0.71781105",
"0.69856346",
"0.6966587",
"0.69466877",
"0.6888693",
"0.68764716",
"0.68764716",
"0.67838234",
"0.6783131",
"0.6717584",
"0.66223234",
"0.65435696",
"0.6484598",
"0.6472098",
"0.64700866",
"0.64310557",
"0.64215714",
"0.63797617",
"0.6327892",
"0.... | 0.67575824 | 10 |
Return the upper boundary. (outside) | def search_upper_boundary(array, range=nil, &block)
range = 0 ... array.length if range == nil
lower = range.first() -1
upper = if range.exclude_end? then range.last else range.last + 1 end
while lower + 1 != upper
mid = ((lower + upper) / 2).to_i # for workin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bsearch_upper_boundary (range = 0 ... self.length, &block)\r\n lower = range.first() -1\r\n upper = if range.exclude_end? then range.last else range.last + 1 end\r\n while lower + 1 != upper\r\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\r\n if yield(self[mid]) ... | [
"0.7144699",
"0.70840055",
"0.70781666",
"0.68269825",
"0.6781487",
"0.67805713",
"0.67593443",
"0.6694636",
"0.66764",
"0.65029466",
"0.645912",
"0.64023507",
"0.63714796",
"0.6322714",
"0.63165784",
"0.62936145",
"0.6277267",
"0.62603027",
"0.62522477",
"0.62395126",
"0.621... | 0.70793647 | 2 |
This method searches the LAST occurrence which satisfies a condition given by a block in binary fashion and return the index of the last occurrence. Return nil if not found. | def search_last(array, range=nil, &block)
# `- 1' for canceling `lower + 1' in bsearch_upper_boundary.
boundary = search_upper_boundary(array, range, &block) - 1
if (boundary <= -1 || yield(array[boundary]) != 0)
return nil
else
return boundary
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bsearch_last (range = 0 ... self.length, &block)\r\n # `- 1' for canceling `lower + 1' in bsearch_upper_boundary.\r\n boundary = bsearch_upper_boundary(range, &block) - 1\r\n\r\n if (boundary <= -1 || yield(self[boundary]) != 0)\r\n return nil\r\n else\r\n return boundary\r\n end\r\n ... | [
"0.7378256",
"0.7320525",
"0.7289556",
"0.67986006",
"0.6703967",
"0.65401196",
"0.65181756",
"0.6166911",
"0.5953939",
"0.58840674",
"0.5852745",
"0.5777674",
"0.57669425",
"0.5756242",
"0.57287514",
"0.57222855",
"0.5718391",
"0.5708264",
"0.56901443",
"0.5686891",
"0.56689... | 0.7313856 | 2 |
Return the search result as a Range object. | def search_range(array, range=nil, &block)
lower = search_lower_boundary(array, range, &block)
upper = search_upper_boundary(array, range, &block)
return lower ... upper
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_range\n Range.new(self.start, self.end)\n end",
"def parse_range\n val = super || return\n val.begin == val.end ? val.begin : val\n end",
"def to_r\n array = self.gsub('..',',').gsub(/[\\. ]/,'').split(',').sort\n Range.new(array.first, array.last) if array\n end",
"def t... | [
"0.68659705",
"0.6026809",
"0.5944496",
"0.5926931",
"0.59176946",
"0.5846727",
"0.5817175",
"0.5644059",
"0.5644059",
"0.56400543",
"0.5633314",
"0.56298167",
"0.5601049",
"0.55527073",
"0.554004",
"0.5532447",
"0.548552",
"0.5483828",
"0.54735917",
"0.54299945",
"0.54264903... | 0.5257526 | 31 |
GET /interested/1 GET /interested/1 | def show
@interested = Interested.find(params[:id])
respond_to do |format|
format.html #show.html.erb
format.json { render json: @interested }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json... | [
"0.7566279",
"0.64945936",
"0.64105994",
"0.632893",
"0.62898767",
"0.6232081",
"0.61090374",
"0.5988122",
"0.5981005",
"0.59546214",
"0.59535587",
"0.5926884",
"0.59255075",
"0.59059256",
"0.5890596",
"0.58715117",
"0.58129203",
"0.5812558",
"0.5783864",
"0.5774819",
"0.5760... | 0.75078005 | 1 |
GET /interested/new GET /interested/new.json | def new
@interested = Interested.new
respond_to do |format|
format.html #new.html.erb
format.json { render json: @interested }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json... | [
"0.8284121",
"0.7406988",
"0.7306092",
"0.71771854",
"0.7152724",
"0.7074022",
"0.7041739",
"0.7013142",
"0.68761283",
"0.68370694",
"0.68325716",
"0.68173355",
"0.67524505",
"0.6717636",
"0.6714867",
"0.6701645",
"0.66986185",
"0.6696264",
"0.667595",
"0.6649351",
"0.6638842... | 0.7851865 | 1 |
POST /interested POST /interested/json | def create
@interested = Interested.new(params[:interested])
respond_to do |format|
if @interested.save
format.html{ redirect_to @interested, notice: 'Interested was successfully created.'}
format.json{ render json: @interested, status: :create, location: @interested }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n \t\t@interested = Interested.new\n\n \t\trespond_to do |format|\n \t\t\tformat.html #new.html.erb\n \t\t\tformat.json { rende... | [
"0.65840924",
"0.6559458",
"0.62354505",
"0.61917657",
"0.5962289",
"0.56296325",
"0.5603882",
"0.55902255",
"0.5575795",
"0.55663764",
"0.5428858",
"0.5409256",
"0.5382118",
"0.53693223",
"0.5350429",
"0.5342798",
"0.52038246",
"0.5200577",
"0.517381",
"0.5163211",
"0.515710... | 0.7141424 | 0 |
PUT /interested/1 PUT /interested/1.json | def update
@interested = Interested.find(params[:id])
respond_to do |format|
if @interested.update_attributes(params[:interested])
format.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }
format.json {head :no_content }
else
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n forma... | [
"0.7221055",
"0.6328312",
"0.6268491",
"0.61731136",
"0.61406994",
"0.6086587",
"0.6011314",
"0.5944492",
"0.59325844",
"0.5917796",
"0.59158456",
"0.5849277",
"0.58319813",
"0.5793166",
"0.57871336",
"0.5785742",
"0.57855123",
"0.577788",
"0.577512",
"0.57667637",
"0.5756799... | 0.7127515 | 1 |
DELETE /Interested/1 DELETE /Interested/1.json | def destroy
@interested = Interested.find(params[:id])
@interested.destroy
respond_to do |format|
format.html { redirect_to interested_url }
format.json {head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @interested = Interested.find(params[:id])\n @interested.destroy\n\n respond_to do |format|\n format.html { redirect_to interesteds_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @interesting ... | [
"0.7386796",
"0.7132523",
"0.7000895",
"0.69395566",
"0.691684",
"0.68572444",
"0.6766489",
"0.67611974",
"0.67611974",
"0.67611974",
"0.67611974",
"0.670205",
"0.6695413",
"0.6681933",
"0.6582275",
"0.6576164",
"0.65745795",
"0.65619725",
"0.6559779",
"0.655709",
"0.65551704... | 0.7232903 | 1 |
helper methods xxx import from combination index | def get_image_name_list(filename)
text = File.read filename
image_name_list = text.split COMBINATION_SEPARATOR
image_name_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_index(name); end",
"def require_index(name); end",
"def construct_index\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def legacy_indexes()\n arr = []\n\n # REFACTOR: make to_llo call this one\n hr_op = analysis(A... | [
"0.58232933",
"0.58232933",
"0.5819918",
"0.56498814",
"0.56498814",
"0.56498814",
"0.56498814",
"0.5590367",
"0.5497561",
"0.5359837",
"0.5333603",
"0.5296735",
"0.5296735",
"0.5275391",
"0.52480227",
"0.5226045",
"0.5184552",
"0.5161283",
"0.5136517",
"0.51123905",
"0.51044... | 0.0 | -1 |
export image about the line | def make_image_for_line(index, image_name_list)
image_name_list_for_line = get_list_for_line(index, image_name_list)
line_image = Magick::ImageList.new
image_name_list_for_line.each do |image_name|
pixel_image = Magick::ImageList.new(ELEMENTS_PATH + image_name)
line_image << pixel_image.append(f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_image\n \"%s%s%s %s%s%s %s%s%s\" % POT.collect{ |i| own(i) }\n end",
"def output_image\r\n @icon.each do |data|\r\n puts data.join\r\n end\r\n end",
"def draw_icon(line, graphic_name)\n return if line <= 0\n y = 32 * line - 32\n bitmap = RPG::Cache.picture(graphic_name)\n r... | [
"0.7349891",
"0.6481626",
"0.646876",
"0.6383798",
"0.63392013",
"0.6328948",
"0.62556326",
"0.6223717",
"0.6141318",
"0.6097345",
"0.60736114",
"0.60671115",
"0.606267",
"0.6038938",
"0.6015371",
"0.5982587",
"0.59490603",
"0.59362197",
"0.5919553",
"0.59145993",
"0.58790827... | 0.6894556 | 1 |
choose image only about the line | def get_list_for_line(index, image_name_list)
first_image_index = index * SIDE_PICTURES_COUNT
last_image_index = first_image_index + SIDE_PICTURES_COUNT - 1
list_for_line = image_name_list[first_image_index..last_image_index]
list_for_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_image\n \"%s%s%s %s%s%s %s%s%s\" % POT.collect{ |i| own(i) }\n end",
"def draw_icon(line, graphic_name)\n return if line <= 0\n y = 32 * line - 32\n bitmap = RPG::Cache.picture(graphic_name)\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\n self.contents.blt(0, y, bitmap, rect)\n e... | [
"0.6928735",
"0.6455689",
"0.63305837",
"0.6143375",
"0.5925871",
"0.58981055",
"0.58095974",
"0.5779842",
"0.5615091",
"0.56091076",
"0.5575049",
"0.55569947",
"0.5543254",
"0.5539181",
"0.55032146",
"0.5492514",
"0.54896677",
"0.54877806",
"0.54816335",
"0.54620117",
"0.540... | 0.5378916 | 21 |
get image name about the line | def get_image_name(index)
index_string = format('%03d', index)
image_name = DRAW_LINE_FILE_NAME_PREFIX + index_string + JPG_FILE_SUFFIX
image_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_image\n \"%s%s%s %s%s%s %s%s%s\" % POT.collect{ |i| own(i) }\n end",
"def img_name\n \"#{@function}_#{@side.to_s[0,1]}\"\n end",
"def draw_icon(line, graphic_name)\n return if line <= 0\n y = 32 * line - 32\n bitmap = RPG::Cache.picture(graphic_name)\n rect = Rect.new(0,0,bitmap.wi... | [
"0.77331674",
"0.6548924",
"0.65150356",
"0.64218074",
"0.6399532",
"0.62547606",
"0.62376654",
"0.614639",
"0.6125745",
"0.60995823",
"0.6096742",
"0.6096668",
"0.60406375",
"0.5996999",
"0.59910667",
"0.59773844",
"0.5939996",
"0.5926809",
"0.5906517",
"0.58850217",
"0.5852... | 0.69740075 | 1 |
export mosaic image based on each line images | def make_mosaic_image(name, size)
mosaic_image = Magick::ImageList.new
(0..SIDE_PICTURES_COUNT - 1).each do |index|
line_image_name = get_image_name(index)
line_image = Magick::ImageList.new(line_image_name)
line_image.first.resize!(size)
mosaic_image << line_image.append(true)
lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main()\n img = ImageList.new($input)\n convert = ImageList.new\n page = Magick::Rectangle.new(0,0,0,0)\n $total_ops = (img.rows * img.columns).to_f\n\n for i in 0..img.rows\n for j in 0..img.columns\n pixel = generate_hex_pixel(rgb_to_hex(img.pixel_color(j,i)))\n convert << pi... | [
"0.69662267",
"0.66095763",
"0.65717804",
"0.6433266",
"0.62219846",
"0.61048955",
"0.6085255",
"0.60767984",
"0.60607773",
"0.6053802",
"0.60535914",
"0.6024615",
"0.5996447",
"0.59628564",
"0.5958728",
"0.5958728",
"0.5955863",
"0.58754545",
"0.58386546",
"0.5828182",
"0.57... | 0.7353917 | 0 |
Creating the main menu | def main_menu
# Step 1, create the entries with (display text, method(:to_be_called), optional_args)
hello = GemMenu::Entry.new('hello', method(:hello_world))
world = GemMenu::Entry.new('world', method(:counting_world))
second_menu = GemMenu::Entry.new('2nd level', method(:menu_2))
food_menu = GemMenu::Entry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main()\n main_menu(SHOW_HEADER);\n end",
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :... | [
"0.80439067",
"0.792527",
"0.76986384",
"0.7597517",
"0.75538075",
"0.7553098",
"0.7540343",
"0.7498294",
"0.74825674",
"0.7479814",
"0.7476318",
"0.7359683",
"0.73471135",
"0.7250467",
"0.7234959",
"0.72228986",
"0.72167933",
"0.7198957",
"0.7186514",
"0.7185247",
"0.7174473... | 0.66436094 | 93 |
def require_login redirect_to '/' unless logged_in? end | def note_params
params.require(:note).permit(:content, :visible_to)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_login\n redirect_to root_path unless logged_in?\n end",
"def require_login\n redirect_to root_path unless logged_in?\n end",
"def require_login\n redirect_to login_path unless logged_in?\n end",
"def require_login\n redirect R(:login) unless logged_in?\n end",
"def require_... | [
"0.94502455",
"0.94502455",
"0.9316637",
"0.92552495",
"0.91952664",
"0.90982586",
"0.9074368",
"0.9061058",
"0.90458214",
"0.9015767",
"0.9015513",
"0.90034735",
"0.89842546",
"0.89606786",
"0.8919213",
"0.88777333",
"0.88667154",
"0.8782386",
"0.8698103",
"0.8661159",
"0.86... | 0.0 | -1 |
Run a query againt a Loki database | def query(query)
case query
when RangeQuery
get("query_range", query.to_h)
when SnapshotQuery
get("query", query.to_h)
else
raise RuntimeError, "Unknown query type" # The type system should catch this when we use it.
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(sql)\n database.execute2(sql)\n end",
"def query(*args, &bl)\n alf_connection.query(*args, &bl)\n end",
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def que... | [
"0.7089389",
"0.6859536",
"0.6852236",
"0.68454283",
"0.6819395",
"0.6742704",
"0.6620503",
"0.66148835",
"0.6564121",
"0.6563403",
"0.65587705",
"0.6471232",
"0.6459623",
"0.6459623",
"0.6454228",
"0.6442993",
"0.6404734",
"0.6394041",
"0.6329392",
"0.63222486",
"0.63190603"... | 0.0 | -1 |
PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
respond_to do |format|
if current_user.update(user_params)
format.html { redirect_to me_profile_path, notice: 'User was successfully updated.' }
else
format.html { render :edit }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.7225568",
"0.7129473",
"0.70036036",
"0.6903525",
"0.6821961",
"0.68157715",
"0.6708618",
"0.66936064",
"0.66810983",
"0.6673763",
"0.6672601",
"0.6664346",
"0.6664346",
"0.6659468",
"0.6659468",
"0.6654875",
"0.66486204",
"0.66436917",
"0.6641295",
"0.6635214",
"0.6618464... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.permit(:name, :avatar)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement. CREATE Table projects ( id INTEGER PRIMARY KEY, title TEXT, category TEXT, funding_goal NUMERIC, start_date TEXT, end_date TEXT ) ; CREATE TABLE users ( id INTEGER PRIMARY... | def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title
"SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title;"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'musi... | [
"0.8511767",
"0.72729754",
"0.6844709",
"0.68258965",
"0.6589721",
"0.6497847",
"0.64187443",
"0.63813114",
"0.6361029",
"0.63150173",
"0.62545604",
"0.62367946",
"0.62351096",
"0.62234205",
"0.62169015",
"0.61765385",
"0.614842",
"0.613242",
"0.60815966",
"0.60610795",
"0.60... | 0.0 | -1 |
POST /tutors POST /tutors.xml | def create
@tutor = Tutor.new(params[:tutor])
respond_to do |format|
if @tutor.save
flash[:notice] = 'Tutor was successfully created.'
format.html { redirect_to(@tutor) }
format.xml { render :xml => @tutor, :status => :created, :location => @tutor }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r... | [
"0.60879534",
"0.573952",
"0.57282126",
"0.5585275",
"0.55170107",
"0.544391",
"0.5399828",
"0.5391241",
"0.5371524",
"0.53707093",
"0.5363835",
"0.53634125",
"0.5362265",
"0.5316295",
"0.5308254",
"0.5298813",
"0.5291201",
"0.52625585",
"0.5256272",
"0.5254673",
"0.5254163",... | 0.52527475 | 21 |
DELETE /tutors/1 DELETE /tutors/1.xml | def destroy
@tutor = Tutor.find(params[:id])
@tutor.destroy
respond_to do |format|
format.html { redirect_to(tutors_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tutorials = Tutorials.find(params[:id])\n @tutorials.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutorials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testament = Testament.find(params[:id])\n @testament.destroy\n\n respond_to ... | [
"0.6827508",
"0.6620382",
"0.65588003",
"0.65367115",
"0.65294313",
"0.6523628",
"0.65149015",
"0.64782095",
"0.64555186",
"0.64362955",
"0.64362955",
"0.6431264",
"0.64204496",
"0.6420317",
"0.6419907",
"0.64083564",
"0.64004976",
"0.6395208",
"0.63870955",
"0.6369697",
"0.6... | 0.66337585 | 1 |
Generate a naive score for any wrapped text. This is currently just the sum of the differences between the length of each line and the longest line in the text. Since we want to penalize large spaces at the end of a line more, we use the cube of the difference between the longest line in the text, and each line. | def score(text)
text_array = text.split("\n")
max_line_length = 0
text_array.each { |l| max_line_length = l.length if l.length > max_line_length}
score = 0
text_array.each { |l|
score += (max_line_length - l.length)**3
}
score
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score_text(txt)\n txt_length = txt.length.to_f\n total_score = 0\n\n e_ratio = txt.count('e') / txt_length\n t_ratio = txt.count('t') / txt_length\n a_ratio = txt.count('a') / txt_length\n o_ratio = txt.count('o') / txt_length\n i_ratio = txt.count('i') / txt_length\n\n space_ratio = txt.count(' ') / t... | [
"0.6467365",
"0.6050257",
"0.5915031",
"0.5868216",
"0.5849919",
"0.5834971",
"0.56851476",
"0.568011",
"0.56560314",
"0.5631012",
"0.5548188",
"0.5532544",
"0.55221134",
"0.55207413",
"0.5495143",
"0.5471692",
"0.5449309",
"0.5433821",
"0.5428001",
"0.5426561",
"0.5409389",
... | 0.7701516 | 0 |
Given some text, and a size, wrap the text to that size. This doesn't do any clever justification, just skip to the next line. FIXME: greedy = stupid. dynamic programming goes here. | def wrap_text(text, size)
text = text.split(" ")
wrapped_text = ""
current_line_size = 0
text.each { |word|
if (word.length + 1 + current_line_size > size)
wrapped_text += "\n"
wrapped_text += word
current_line_size = word.length
else
wrapped_text += " " unless current_line_size ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_text_wrap(x, y, width, text, size = nil, justification = :left, angle = 0, test = false)\n if text.kind_of?(Numeric) and size.kind_of?(String)\n text, size = size, text\n warn PDF::Writer::Lang[:add_textw_parameters_reversed] % caller[0]\n end\n\n if size.nil? or size <= 0\n size = ... | [
"0.70982915",
"0.7060776",
"0.68981194",
"0.67892784",
"0.67883503",
"0.6763344",
"0.6736948",
"0.6728279",
"0.6608429",
"0.6550147",
"0.6544458",
"0.65435934",
"0.649667",
"0.64911246",
"0.6488622",
"0.6478751",
"0.64765316",
"0.6360844",
"0.63475025",
"0.6346627",
"0.633090... | 0.81479454 | 0 |
GET /tipo_vendas GET /tipo_vendas.json | def index
@tipo_vendas = TipoVenda.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def show\n @tipo_atendimento ... | [
"0.68715674",
"0.6806421",
"0.6788124",
"0.6679188",
"0.6660401",
"0.6638057",
"0.660623",
"0.65980786",
"0.65810084",
"0.65721303",
"0.65721303",
"0.656927",
"0.6562119",
"0.6551008",
"0.65366507",
"0.64573723",
"0.6447615",
"0.6425993",
"0.6385598",
"0.6364801",
"0.6352948"... | 0.7173421 | 0 |
GET /tipo_vendas/1 GET /tipo_vendas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tipo_vendas = TipoVenda.all\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(param... | [
"0.71262246",
"0.7103409",
"0.70208514",
"0.6876293",
"0.68322426",
"0.6768924",
"0.67621636",
"0.6757796",
"0.6745319",
"0.67159",
"0.6695787",
"0.66454816",
"0.664176",
"0.6602082",
"0.65907687",
"0.6586585",
"0.656023",
"0.65454924",
"0.6540971",
"0.6513127",
"0.6493849",
... | 0.0 | -1 |
POST /tipo_vendas POST /tipo_vendas.json | def create
@tipo_venda = TipoVenda.new(tipo_venda_params)
respond_to do |format|
if @tipo_venda.save
format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully created.' }
format.json { render :show, status: :created, location: @tipo_venda }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tipo_venda_params\n params.require(:tipo_venda).permit(:tipo)\n end",
"def create\n # Crear nuevo voto\n @voto = Voto.new(params[:voto])\n\n # Asociarlo con el usuario\n @voto.usuario_id = current_usuario.id\n\n # Asociarlo con la Pregunta o Respuesta\n votable_type = params[:voto][... | [
"0.6748738",
"0.6657727",
"0.6485694",
"0.6463089",
"0.6435352",
"0.64341295",
"0.641049",
"0.6390463",
"0.63853955",
"0.63680315",
"0.6366826",
"0.632976",
"0.63272655",
"0.63155377",
"0.63139194",
"0.62754816",
"0.6258191",
"0.62567276",
"0.6235566",
"0.62309283",
"0.622494... | 0.6826731 | 0 |
PATCH/PUT /tipo_vendas/1 PATCH/PUT /tipo_vendas/1.json | def update
respond_to do |format|
if @tipo_venda.update(tipo_venda_params)
format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully updated.' }
format.json { render :show, status: :ok, location: @tipo_venda }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.js... | [
"0.6857759",
"0.6773808",
"0.6744527",
"0.67239875",
"0.6664866",
"0.6603299",
"0.6595096",
"0.657895",
"0.6573522",
"0.6567753",
"0.65588343",
"0.65456104",
"0.65264344",
"0.65154165",
"0.64695466",
"0.64632803",
"0.6447152",
"0.6435841",
"0.6434038",
"0.6430224",
"0.6422124... | 0.70341283 | 0 |
DELETE /tipo_vendas/1 DELETE /tipo_vendas/1.json | def destroy
if @tipo_venda.destroy
respond_to do |format|
format.html { redirect_to tipo_vendas_url, notice: 'Tipo venda excluído.' }
format.json { head :no_content }
end
else
respond_to do |format|
format.html { redirect_to tipo_vendas_url, notice: 'Erro ao... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tipoenvolvido.destroy\n respond_to do |format|\n format.html { redirect_to tipoenvolvidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n fo... | [
"0.7460151",
"0.74549747",
"0.7396868",
"0.7358272",
"0.7356871",
"0.7329078",
"0.7328409",
"0.7328011",
"0.73206276",
"0.7314219",
"0.730406",
"0.7303064",
"0.7300335",
"0.72983277",
"0.728426",
"0.72833335",
"0.72765577",
"0.7270191",
"0.72628397",
"0.7258514",
"0.7256494",... | 0.71890783 | 33 |
Use callbacks to share common setup or constraints between actions. | def set_tipo_venda
@tipo_venda = TipoVenda.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def tipo_venda_params
params.require(:tipo_venda).permit(:tipo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Builds resources with the given data with this Relation's Schema. data Either a Hash of properties, or an Array of Hashes Returns either a single Sawyer::Resource or an Array of Sawyer::Resources | def build(data)
raise Sawyer::Error, "No schema for this relation: #{inspect}" unless @schema
@schema.build data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_data(hash)\n Array(hash).map do |hash|\n Resource.new(client, hash, resource_relations, resources_key)\n end\n end",
"def process_data(data)\n case data\n when Hash then Resource.new(agent, data)\n when Array then data.map { |hash| process_data(hash) }\n when ... | [
"0.5913571",
"0.5860949",
"0.58408237",
"0.5645685",
"0.5585343",
"0.5549103",
"0.54231155",
"0.53730166",
"0.5250041",
"0.52428937",
"0.52396435",
"0.523483",
"0.5209615",
"0.51773137",
"0.51664066",
"0.5146622",
"0.5134894",
"0.5094856",
"0.5086919",
"0.5082016",
"0.5058846... | 0.679384 | 0 |
very basic sanity check...no whitespace in username, very lax host name | def email_is_valid?(email)
email =~ /[^@ \t\n\r]+@[a-zA-Z0-9\.-]{3,}$/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_username username\n\t\t\traise 'Username must be a String' unless username.is_a?(String)\n\t\t\traise 'Username must be >= 10 characters.' unless username.to_s.length >= 10\n\t\t\traise 'Spaces are not permitted in usernames.' if username =~ /[[:space:]]/\n\t\tend",
"def validate_hostname(userdata)\n ... | [
"0.7513926",
"0.7406178",
"0.7059857",
"0.70108145",
"0.6895181",
"0.67209804",
"0.6720572",
"0.66349655",
"0.6595273",
"0.65769845",
"0.6543794",
"0.6539283",
"0.6539142",
"0.6514716",
"0.65135574",
"0.64802784",
"0.6472943",
"0.644164",
"0.63752776",
"0.6372203",
"0.6366117... | 0.0 | -1 |
POST /payment_notifications POST /payment_notifications.json | def create
PaymentNotification.create!(params: params, status: params[:payment_status], transaction_id: params[:txn_id])
render :nothing => true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n PaymentNotification.create!(:params => params, :organization_id => params[:invoice], \n :status => params[:payment_status], :transaction_id => params[:txn_id], :amount => params[:auth_amount])\n render :nothing => true\n end",
"def create\n PaymentNotification.create(payment_notificat... | [
"0.72523344",
"0.7158064",
"0.7153944",
"0.70695704",
"0.69803303",
"0.6938628",
"0.6881103",
"0.6726519",
"0.6697491",
"0.6662659",
"0.66308725",
"0.6550315",
"0.6532152",
"0.6529717",
"0.6524505",
"0.6519265",
"0.64404035",
"0.6436471",
"0.6436471",
"0.6428387",
"0.6410616"... | 0.7096191 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_payment_notification
@payment_notification = PaymentNotification.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.