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 |
|---|---|---|---|---|---|---|
How many words can still be read from the current position | def words_left
@words.length - @read_index - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_count\n @@word_count\n end",
"def word_count\n return words.size\n end",
"def word_number\n text.split.size\n end",
"def word_count\n words.size\n end",
"def word_count\n words.size\n end",
"def num_words\n @words.length\n end",
"def number_of_words(input, mod... | [
"0.72739345",
"0.71005845",
"0.70814043",
"0.69544905",
"0.69544905",
"0.69201875",
"0.687737",
"0.684153",
"0.68367505",
"0.68157464",
"0.6809575",
"0.6778886",
"0.67717016",
"0.6765795",
"0.6652025",
"0.66377586",
"0.65246797",
"0.6524012",
"0.6524012",
"0.65195334",
"0.650... | 0.7086639 | 2 |
Reads the next word in this packet | def read_word
@words[@read_index += 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_word(addr)\n self[addr] | (self[addr + 1] << 8)\n end",
"def read_word(data, offset)\n out = data[offset,4].unpack('V').first rescue 0\n return out\n end",
"def read_word(f)\n w = f.read(2).bytes\n (w[1] << 8) + w[0]\n end",
"def next_word\n return if @next > @words.length... | [
"0.68924356",
"0.68834037",
"0.6723525",
"0.64114887",
"0.63003016",
"0.61261195",
"0.6091772",
"0.60574776",
"0.6034971",
"0.598978",
"0.5942649",
"0.5935863",
"0.5927272",
"0.58419555",
"0.57606757",
"0.5756521",
"0.5756069",
"0.5676992",
"0.5662599",
"0.56187564",
"0.56001... | 0.6991267 | 0 |
Reads a player info block | def read_player_info_block
keys, ret = [], []
key_count = read_word.to_i
key_count.times { keys << read_word}
value_count = read_word.to_i
value_count.times do
current_player = {}
key_count.times do |idx|
current_player[keys[idx]] = read_word
end
ret << current_player
end
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_info\n if @health <= 0\n puts \"#{@name} has 0 health remaining!\"\n puts \"\"\n else \n puts \"#{@name} has #{@health} health remaining.\"\n puts \"\"\n \n end\n\n end",
"def displayPlayer()\n puts \"*** ... | [
"0.5565406",
"0.554985",
"0.5529806",
"0.5514591",
"0.54842824",
"0.53811693",
"0.53797734",
"0.5335994",
"0.5305192",
"0.52963436",
"0.5268964",
"0.5264534",
"0.52595246",
"0.5240565",
"0.5209086",
"0.51935726",
"0.51910174",
"0.51910174",
"0.5190243",
"0.5160632",
"0.515811... | 0.76283556 | 0 |
Reads to the end of the packet | def remaining_words
words_left.times.map { read_word }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_packet; end",
"def read\n @socket.read(1)\n end",
"def read() end",
"def read()\r\n return @socket.read(1)\r\n end",
"def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end",
"def read\n @socket.gets\n e... | [
"0.7606876",
"0.71794873",
"0.7094035",
"0.69955593",
"0.69619924",
"0.6904502",
"0.6739188",
"0.6701029",
"0.66783416",
"0.66116875",
"0.6596295",
"0.6582574",
"0.65772635",
"0.6571348",
"0.656878",
"0.65584826",
"0.6554923",
"0.65476644",
"0.6528881",
"0.6522576",
"0.648182... | 0.0 | -1 |
Reads a "Team Scores" block Returns [[team scores], target] | def read_team_scores
ret = []
num_entries = read_word.to_i
num_entries.times do
ret << read_word.to_i
end
[ret, read_word.to_i]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_scores\n end",
"def scores\n response[\"scores\"]\n end",
"def parse_scores(games)\n games.each do |game|\n puts \"#{game['date']} #{game['away_team']}: #{game['away_score']} #{game['home_team']}: #{game['home_score']}\"\n end\n end",
"def scores\n @raw.map(&:score)\n ... | [
"0.660049",
"0.61070496",
"0.6038485",
"0.60302365",
"0.59482616",
"0.58154714",
"0.580923",
"0.57670254",
"0.57669044",
"0.57376856",
"0.57059574",
"0.5691879",
"0.5625301",
"0.5618736",
"0.5618145",
"0.56132036",
"0.55778813",
"0.5561006",
"0.55560935",
"0.5519333",
"0.5475... | 0.7482773 | 0 |
Reads a boolean value NOTE: this modifies the packet | def read_bool
read_word == "true"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_bool; end",
"def boolean\n Util.from_bytes :boolean, value\n end",
"def toread\n Types::Boolean.deserialize(@toread)\n end",
"def pop_bool\n cast_to_bool(pop_string.htb)\n end",
"def get_boolean_value\n\t\tend",
"def parse_bool() true end",
"def write_booleanr(bool)\n\t\twr... | [
"0.82038957",
"0.76930314",
"0.7301042",
"0.664454",
"0.6596176",
"0.6517781",
"0.63995385",
"0.6372421",
"0.6303884",
"0.6271466",
"0.6271466",
"0.61446667",
"0.611958",
"0.6105334",
"0.6087649",
"0.6071504",
"0.6060258",
"0.6050839",
"0.60393894",
"0.6006874",
"0.60057443",... | 0.7539453 | 2 |
Encodes a packet to be sent to the RCON server | def encode
encoded_sequence = encode_sequence
encoded_words = encode_words
word_count = @words.length
# 12 bytes for header
total_size = PACKET_HEADER_SIZE + encoded_words.length
# DICE's RCON docs say packets cannot be larger than 16384 bytes
raise "packet is too big!" if total_size > 16384
ret = encoded_sequence
ret += [total_size, word_count].pack('VV')
ret += encoded_words
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode\n encoded = buffer[1..-1].reduce([]) do |acc, byte|\n if byte == 0x7e or byte == 0x7d\n acc << 0x7d << (byte ^ 0x20)\n else\n acc << byte\n end\n end\n Packet.new([0x7e] + encoded + [0x7e])\n end",
"def send_packet(payload); end",
"def push pa... | [
"0.7088402",
"0.6842481",
"0.672928",
"0.6472853",
"0.63744855",
"0.62875736",
"0.6252491",
"0.6171946",
"0.61323225",
"0.60264146",
"0.60116243",
"0.5978581",
"0.5954111",
"0.59282714",
"0.5924379",
"0.59164935",
"0.59055233",
"0.5868931",
"0.5867007",
"0.5841228",
"0.582786... | 0.643077 | 4 |
super pretty print power! | def inspect
"#{@origin} #{@type.to_s.ljust(8, ' ')} ##{@sequence.to_s.rjust(10, "0")} #{words}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty \n @pretty = true \n end",
"def pretty \n @pretty = true \n end",
"def add_pretty_printing!\n normalize!\n real_add_pretty_printing!\n normalize!\n end",
"def pretty_print_me\n sio = PP.pp(self, \"\")\n\n # aber bitte ohne die ids und ohne @\... | [
"0.73581165",
"0.73581165",
"0.73310524",
"0.7292568",
"0.7102458",
"0.70745647",
"0.7069657",
"0.70556283",
"0.70452267",
"0.7019018",
"0.7007196",
"0.6960493",
"0.6883004",
"0.6883004",
"0.68700635",
"0.6867184",
"0.6867184",
"0.68426466",
"0.6839085",
"0.6839085",
"0.68384... | 0.0 | -1 |
Return a title on a perpage basis. | def title
base_title = "Reseau Social ESMT"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def page_title\n page.title\n end",
"def pagetitle(page)\n \"Page #{page}\"\nend",
"def page_title(title)\n content_for_wrapper(:page_title, title)\n end",
"def page_title\n end",
"def titl... | [
"0.7777971",
"0.77103335",
"0.75592935",
"0.75191945",
"0.7482916",
"0.73910475",
"0.7365925",
"0.72978526",
"0.72698855",
"0.72201085",
"0.71792275",
"0.7164163",
"0.7158475",
"0.71547365",
"0.7139089",
"0.7119529",
"0.7119529",
"0.7119529",
"0.7119529",
"0.7110865",
"0.7106... | 0.0 | -1 |
GET /templates GET /templates.json | def index
@templates = Template.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def list... | [
"0.81084657",
"0.8019614",
"0.7828985",
"0.7795218",
"0.7612969",
"0.7527881",
"0.73402876",
"0.7244303",
"0.71967375",
"0.71957827",
"0.71336716",
"0.7038621",
"0.6983926",
"0.696765",
"0.69365245",
"0.6888093",
"0.68522555",
"0.680208",
"0.68002677",
"0.6781032",
"0.6740893... | 0.67261654 | 24 |
GET /templates/1 GET /templates/1.json | def show
@datatemplate = Datatemplate.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def details\n response = get \"/templates/#{... | [
"0.7563506",
"0.7371146",
"0.7312534",
"0.7261189",
"0.7196296",
"0.7141619",
"0.70456123",
"0.70320326",
"0.698067",
"0.68830216",
"0.6875805",
"0.6858511",
"0.6840219",
"0.6822663",
"0.68145746",
"0.6796842",
"0.67726284",
"0.6730709",
"0.67003226",
"0.67003226",
"0.6700322... | 0.0 | -1 |
POST /templates POST /templates.json | def create
@datatemplate = @template.datatemplates.new(datatemplate_params)
respond_to do |format|
if @template.save
format.html { redirect_to :back, notice: 'Data template was successfully added.' }
else
format.html { redirect_to :back, notice: 'Data was ocurrer an error.' }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def create\n @template = Template.new(template_params)\n\n if @template.save\n ... | [
"0.69342095",
"0.6561349",
"0.6214608",
"0.6208555",
"0.6171735",
"0.61658067",
"0.61499006",
"0.61348224",
"0.6125734",
"0.6113738",
"0.61052245",
"0.60996246",
"0.60992527",
"0.6098013",
"0.609338",
"0.6093173",
"0.60780334",
"0.60727274",
"0.6067493",
"0.6066252",
"0.60609... | 0.57135206 | 65 |
PATCH/PUT /templates/1 PATCH/PUT /templates/1.json | def update
respond_to do |format|
if @datatemplate.update(datatemplate_params)
format.html { redirect_to [@company,@template], notice: 'Template was successfully updated.' }
format.json { render :show, status: :ok, location: @template }
else
format.html { render :edit }
format.json { render json: @datatemplate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render acti... | [
"0.6655932",
"0.6617721",
"0.6595157",
"0.65617347",
"0.654955",
"0.64414483",
"0.6439676",
"0.64258075",
"0.6425407",
"0.6422731",
"0.6410636",
"0.64098436",
"0.6405113",
"0.6405113",
"0.63442934",
"0.6341111",
"0.6320779",
"0.6264782",
"0.62444544",
"0.62432337",
"0.6241863... | 0.5782662 | 73 |
DELETE /templates/1 DELETE /templates/1.json | def destroy
@datatemplate.destroy
respond_to do |format|
format.html { redirect_to :back, notice: 'Data templatesemplate was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end",
"def destroy\n @template.destroy\n respo... | [
"0.83150667",
"0.80201125",
"0.7781369",
"0.76449513",
"0.761957",
"0.7488512",
"0.7467064",
"0.7453551",
"0.74531573",
"0.74191314",
"0.7390842",
"0.7390842",
"0.7390842",
"0.73892426",
"0.7352282",
"0.7342315",
"0.7332391",
"0.7322407",
"0.7311685",
"0.7296056",
"0.72637016... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_datatemplate
@datatemplate = Datatemplate.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 datatemplate_params
params.require(:datatemplate).permit( :content,:width,:height,:fontsize, :left_width, :color, :image, :bold, :text_align)
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 |
for getting the absolute store path typically it is more correct to use "namespace" or "namespace_path" | def store_path(path = '/')
File.expand_path(File.join(settings['store_path'], path))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_store_dir\n parse_dir_options(:store_dir)\n end",
"def namespace_path(path = '')\n File.expand_path(File.join(store_path, namespace, path))\n end",
"def store_path\n store_path ||= build_store_path\n end",
"def store_dir\n File.expand_path(self.relative_store_dir... | [
"0.7734165",
"0.76716185",
"0.7509682",
"0.71453947",
"0.7118423",
"0.7118423",
"0.7062362",
"0.699993",
"0.6890429",
"0.687881",
"0.6792414",
"0.67888635",
"0.6772884",
"0.6715093",
"0.6670305",
"0.6622716",
"0.6601672",
"0.6573585",
"0.653124",
"0.6494545",
"0.6486097",
"... | 0.6884887 | 9 |
ergonomically change the namespace | def set_namespace(ns = '')
settings['namespace'] = ns
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace=(ns); end",
"def namespace=(ns); end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace=(v); end",
"def namespaces; end",
"def namespac... | [
"0.8226149",
"0.8226149",
"0.7694734",
"0.7694734",
"0.7694734",
"0.7694734",
"0.7694734",
"0.7694734",
"0.7694734",
"0.7694734",
"0.75827456",
"0.75527036",
"0.75527036",
"0.75527036",
"0.75527036",
"0.75198394",
"0.75183445",
"0.7462632",
"0.74339056",
"0.7403638",
"0.73572... | 0.7385857 | 20 |
for ergonomically recalling the current fullpath of the namespace | def namespace_path(path = '')
File.expand_path(File.join(store_path, namespace, path))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespaced_path\n @namespaced_path ||= name.tr('-', '/')\n end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def namespace; end",
"def current_namespace\n @current_namespace... | [
"0.68636113",
"0.67840534",
"0.67840534",
"0.67840534",
"0.67840534",
"0.67840534",
"0.67840534",
"0.67840534",
"0.67840534",
"0.6681643",
"0.65318257",
"0.64788204",
"0.6452407",
"0.6452407",
"0.6419561",
"0.63400996",
"0.63400996",
"0.63400996",
"0.63400996",
"0.6266991",
"... | 0.59624 | 47 |
loads configuration file which should be in the local profile or etc. Examples include /etc/noterc and ~/.noterc | def load
config = File.expand_path(@path)
@settings.deep_merge!(YAML.load_file(config)) if File.exist? config
@settings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def load_config\n file = config_file\n unless file\n if chdir\n file = Dir.glob(File.join(chdir, GLOB_CONFIG)).first\n else\n file = Dir.glob(GLOB_CONFIG).first\n ... | [
"0.71357375",
"0.7072163",
"0.70676154",
"0.703059",
"0.703059",
"0.69558394",
"0.6832805",
"0.6798522",
"0.679351",
"0.67657435",
"0.67631876",
"0.67356783",
"0.673288",
"0.6726024",
"0.672595",
"0.67130136",
"0.66971874",
"0.66820747",
"0.6678482",
"0.6652642",
"0.6646662",... | 0.0 | -1 |
GET /opinions/new GET /opinions/new.json | def new
@opinion = Opinion.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @opinion }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion ... | [
"0.74035895",
"0.71790594",
"0.70647085",
"0.70057243",
"0.6884414",
"0.68114966",
"0.67946255",
"0.67627096",
"0.6759766",
"0.674137",
"0.67315453",
"0.67271334",
"0.67270035",
"0.66947204",
"0.6687937",
"0.6681163",
"0.6661464",
"0.6658956",
"0.66523516",
"0.66523516",
"0.6... | 0.7521636 | 1 |
POST /opinions POST /opinions.json | def create
@opinion = Opinion.new(params[:opinion])
unless @opinion.city.blank?
result = Geocoder.search(@opinion.city).first
@opinion.lat = result.latitude
@opinion.lng = result.longitude
end
respond_to do |format|
if @opinion.save
format.html { redirect_to opinions_url, notice: 'Thank you for your opinion!' }
format.json { render json: @opinion, status: :created, location: @opinion }
else
format.html { render action: "new" }
format.json { render json: @opinion.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @opnion = Opnion.new(opnion_params)\n\n respond_to do |format|\n if @opnion.save\n format.html { redirect_to @opnion, notice: 'Opnion was successfully created.' }\n format.json { render :show, status: :created, location: @opnion }\n else\n format.html { render :new... | [
"0.6323597",
"0.6161955",
"0.61453325",
"0.59938204",
"0.59063107",
"0.5864144",
"0.5810853",
"0.57373416",
"0.57322514",
"0.57076865",
"0.56416374",
"0.56400925",
"0.56284666",
"0.55798507",
"0.55798507",
"0.5569501",
"0.55323154",
"0.5482596",
"0.5471573",
"0.54653114",
"0.... | 0.49525243 | 71 |
DELETE /opinions/1 DELETE /opinions/1.json | def destroy
@opinion = Opinion.find(params[:id])
@opinion.destroy
respond_to do |format|
format.html { redirect_to opinions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @opinion.destroy\n respond_to do |format|\n format.html { redirect_to opinions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opnion.destroy\n respond_to do |format|\n format.html { redirect_to opnions_url, notice: 'Opnion was successfully dest... | [
"0.72457385",
"0.7140518",
"0.70579493",
"0.6873159",
"0.68007135",
"0.68007135",
"0.68007135",
"0.6749539",
"0.67456955",
"0.67406625",
"0.6739045",
"0.6727913",
"0.67232084",
"0.6720829",
"0.6720369",
"0.6720369",
"0.6719865",
"0.6712255",
"0.6692986",
"0.66838676",
"0.6679... | 0.7202539 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_member
@member = Member.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 member_params
params.require(:member).permit :email, :first_name, :last_name, :other_name, :teacher_status, :portrait, :website_url, :facebook_url, :twitter_handle, :google_plus_url, :allow_newsletter, :allow_daily_digests
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 |
GET /columnas/1 GET /columnas/1.xml | def show
@columna = Columna.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @columna }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @columns = Column.find(:all, :order => _(:title, :column))\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @columns.to_xml }\n end\n end",
"def show\n @column = Column.find(params[:id])\n\n respond_to do |format|\n format.html # sho... | [
"0.69830537",
"0.67025596",
"0.63810366",
"0.62128",
"0.59780955",
"0.5935696",
"0.58091915",
"0.5724748",
"0.5643289",
"0.56299746",
"0.55784345",
"0.55733323",
"0.5569511",
"0.5558673",
"0.5527145",
"0.54930353",
"0.5438303",
"0.54237384",
"0.53466797",
"0.53371084",
"0.532... | 0.66912603 | 2 |
GET /columnas/new GET /columnas/new.xml | def new
@columna = Columna.new(params[:columna])
@columnas = @columna.modelo.try(:db_columnas)
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @columna }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @column = Column.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @column }\n end\n end",
"def create\n @column = Column.new(params[:column])\n\n respond_to do |format|\n if @column.save\n flash[:notice] = 'Column was succe... | [
"0.73988175",
"0.6427714",
"0.60381514",
"0.5960386",
"0.5951883",
"0.59260565",
"0.5893064",
"0.58896744",
"0.5860529",
"0.5855545",
"0.5838812",
"0.5819254",
"0.57679206",
"0.57566893",
"0.5746722",
"0.5716413",
"0.5700721",
"0.56939363",
"0.56935495",
"0.568963",
"0.567633... | 0.7099258 | 1 |
POST /columnas POST /columnas.xml | def create
@columna = Columna.new(params[:columna])
respond_to do |format|
if @columna.save
flash[:notice] = 'Columna creada correctamente.'
format.html { params[:oper].nil? ? redirect_to(@columna) : render(:text => "Ok")}
else
format.html { render :action => "new" }
format.xml { render :xml => @columna.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @column = Column.new(params[:column])\n\n respond_to do |format|\n if @column.save\n flash[:notice] = 'Column was successfully created.'\n format.html { redirect_to columns_url }\n format.xml { head :created, :location => columns_url }\n else\n format.html ... | [
"0.5983467",
"0.5898826",
"0.5806032",
"0.5672499",
"0.56610316",
"0.56500906",
"0.5550807",
"0.5447325",
"0.5429971",
"0.53801036",
"0.52531457",
"0.52470845",
"0.51605403",
"0.5128992",
"0.5124391",
"0.51195157",
"0.50877887",
"0.50714386",
"0.5068134",
"0.5057828",
"0.5056... | 0.53063875 | 10 |
PUT /columnas/1 PUT /columnas/1.xml | def update
@columna = Columna.find(params[:id])
respond_to do |format|
if @columna.update_attributes(params[:columna])
flash[:notice] = 'Columna actualizado correctamente.'
format.html { redirect_to(@columna) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @columna.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @column = Column.find(params[:id])\n\n respond_to do |format|\n if @column.update_attributes(params[:column])\n flash[:notice] = 'Column was successfully updated.'\n format.html { redirect_to columns_url }\n format.xml { head :ok }\n else\n format.html { re... | [
"0.63661593",
"0.6061867",
"0.5767408",
"0.56297696",
"0.56253153",
"0.54407805",
"0.54407805",
"0.53609174",
"0.53536314",
"0.5347528",
"0.53183496",
"0.53143686",
"0.5278481",
"0.5191654",
"0.51806056",
"0.5173827",
"0.51694566",
"0.5168048",
"0.5159258",
"0.5155395",
"0.51... | 0.61632407 | 1 |
DELETE /columnas/1 DELETE /columnas/1.xml | def destroy
@columna = Columna.find(params[:id])
modelo_id=@columna.modelo_id
@columna.destroy
respond_to do |format|
format.html { redirect_to(modelo_path(modelo_id)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @column = Column.find(params[:id])\n @column.destroy\n\n respond_to do |format|\n format.html { redirect_to columns_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @column = Column.find(params[:id])\n @column.remove_from_list()\n @column.destroy\n\n ... | [
"0.6628001",
"0.6484804",
"0.62358874",
"0.62266046",
"0.6109527",
"0.6093017",
"0.606358",
"0.6046506",
"0.6021339",
"0.6013075",
"0.5996603",
"0.598488",
"0.5975003",
"0.5928321",
"0.5900733",
"0.58786196",
"0.5866562",
"0.58602285",
"0.5852655",
"0.5827142",
"0.5819843",
... | 0.61729467 | 4 |
see if status has common messages | def check_error_response(last_response)
refute_match 'Sinatra doesn’t know this ditty', last_response.body, "unmatched url"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_status_and_output(messages); end",
"def status_message\n if self.deleted_at\n return \"Cancelled\"\n else\n if self.chosen_presenter == nil\n if self.help_required\n return \"Help Required\"\n elsif self.presenters.present?\n return \"Bids Pending\"\n ... | [
"0.6223937",
"0.60989857",
"0.6066884",
"0.6055112",
"0.60491663",
"0.60386634",
"0.5976591",
"0.5929897",
"0.58268344",
"0.58195615",
"0.57994545",
"0.57940793",
"0.57775325",
"0.57736903",
"0.57679194",
"0.57551163",
"0.57505953",
"0.57221997",
"0.5707247",
"0.5703865",
"0.... | 0.0 | -1 |
short for 'eval', execute given arguments, collect results, convert to ruby | def e *args
do_conn(:eval, *args).to_ruby
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval(*args); end",
"def eval\n execute\n end",
"def eval(expr, *rest) end",
"def eval(*args) # :nodoc:\n Evaler.eval(args[0], *args)\n end",
"def _run (expr)\n _ruby_eval expr\n end",
"def exec(cmd, *rest) end",
"def exec_args\n exec(*@args.to_exec)\n end",
"def eval(str)\... | [
"0.74978375",
"0.7119732",
"0.70240587",
"0.69538826",
"0.68561286",
"0.64452004",
"0.6393946",
"0.6312289",
"0.625699",
"0.61565864",
"0.60902935",
"0.6037185",
"0.6029692",
"0.5981864",
"0.59704417",
"0.5906445",
"0.58972",
"0.58662003",
"0.5866069",
"0.58539534",
"0.585347... | 0.69073075 | 4 |
short for 'void_eval', just execute the arguments, don't return results | def ve *args
do_conn :void_eval, *args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval(*args); end",
"def eval(expr, *rest) end",
"def eval\n execute\n end",
"def _run (expr)\n _ruby_eval expr\n end",
"def eval(*args) # :nodoc:\n Evaler.eval(args[0], *args)\n end",
"def silent_eval(str, binding = T.unsafe(nil)); end",
"def run(args = T.unsafe(nil)); end",
"def ... | [
"0.7571524",
"0.7064811",
"0.6879238",
"0.6470601",
"0.64037436",
"0.63946384",
"0.6394405",
"0.6394405",
"0.6356936",
"0.6346677",
"0.6278178",
"0.6115287",
"0.60526836",
"0.60390145",
"0.60272014",
"0.6007046",
"0.59593475",
"0.59580904",
"0.5941799",
"0.59378505",
"0.59125... | 0.73433703 | 1 |
short for 'assign', send ruby objects to r, save as variable | def a *args
args[1] = args[1].to_s if args[1].is_a?(Symbol)
do_conn :assign, *args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_and_assign(obj, symbol)\n success, rexp = convert_to_r_object(obj)\n raise RriException.new(\"Failed to convert ruby object to R object for: #{obj}\") unless success\n simple_assign(symbol, rexp)\n end",
"def assignItem _obj, _args\n \"_obj assignItem _args;\" \n end",
"de... | [
"0.67094713",
"0.6414402",
"0.63064456",
"0.6142327",
"0.6142327",
"0.6142327",
"0.6142327",
"0.6052531",
"0.60327685",
"0.6007292",
"0.5882158",
"0.587954",
"0.5798596",
"0.57708293",
"0.5726605",
"0.57231325",
"0.56600904",
"0.5655905",
"0.5638033",
"0.5620996",
"0.55354583... | 0.611157 | 7 |
attempts to install given R package if necessary and require in the environment via 'library' | def library pkgname, fail_after=300
Timeout::timeout(fail_after) do
install_package pkgname
e "library(#{pkgname})"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_library_or_gem(library_name)\n begin\n require library_name\n rescue LoadError => cannot_require\n # 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try.\n begin\n require 'rubygems'\n rescue LoadError => rubygems_not_installed\n raise... | [
"0.67765",
"0.67676556",
"0.6684611",
"0.65631115",
"0.6400627",
"0.6343927",
"0.627016",
"0.62137914",
"0.6180159",
"0.6173875",
"0.61461556",
"0.61100364",
"0.61018384",
"0.60869586",
"0.60684377",
"0.604864",
"0.60429734",
"0.60429734",
"0.60429734",
"0.6023411",
"0.601907... | 0.61528146 | 10 |
remove defined variables from the R environment | def clear
ve 'rm(list=ls())'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unset_bundler_env_vars\n empty_env = with_environment { with_unbundled_env { ENV.to_h } }\n aruba_env = aruba.environment.to_h\n (aruba_env.keys - empty_env.keys).each do |key|\n delete_environment_variable key\n end\n empty_env.each do |k, v|\n set_environm... | [
"0.6772185",
"0.65659106",
"0.6526923",
"0.64709234",
"0.64353174",
"0.6399039",
"0.6377133",
"0.63661635",
"0.6365813",
"0.63094366",
"0.6306893",
"0.6249226",
"0.62272376",
"0.6218401",
"0.61977625",
"0.61788243",
"0.6133331",
"0.60843414",
"0.60278827",
"0.5989531",
"0.596... | 0.5515341 | 65 |
GET /cars or /cars.json | def index
@cars = Car.all
# if session[:admin_id]
# @admin =Admin.find_by(id: session[:admin_id])
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end",
"def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end",
"def index\n @cars = Car.all\n\n respond_to do |format|\n format.html # ind... | [
"0.7399516",
"0.7147076",
"0.71115774",
"0.7063294",
"0.7062345",
"0.6872103",
"0.6872103",
"0.6872103",
"0.68152636",
"0.6548093",
"0.6475814",
"0.64259285",
"0.6268922",
"0.6266605",
"0.62573594",
"0.62299937",
"0.62065417",
"0.61919576",
"0.6188451",
"0.6176212",
"0.616813... | 0.0 | -1 |
GET /cars/1 or /cars/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end",
"def show\n @car = Car.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @car }\n end\n end",
"def show\n @car ... | [
"0.72511435",
"0.6980907",
"0.6980907",
"0.6980907",
"0.67776424",
"0.67715406",
"0.67000604",
"0.6699544",
"0.661067",
"0.6483125",
"0.63646543",
"0.6329132",
"0.6274753",
"0.62551606",
"0.6227201",
"0.6227201",
"0.61725324",
"0.6170383",
"0.61574715",
"0.6109707",
"0.610257... | 0.0 | -1 |
POST /cars or /cars.json | def create
@car = current_user.cars.build(car_params)
respond_to do |format|
if @car.save
format.html { redirect_to @car, notice: "Car was successfully created." }
format.json { render :show, status: :created, location: @car }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @car.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @car = Car.new(car_params)\n\n if @car.save\n render json: @car, status: :created, location: @car\n else\n render json: @car.errors, status: :bad_request\n end\n end",
"def create\n @car = Car.new(params[:car])\n\n respond_to do |format|\n if @car.save\n form... | [
"0.7150277",
"0.68458676",
"0.6828804",
"0.6772981",
"0.67468077",
"0.6737544",
"0.6737544",
"0.6737544",
"0.6737544",
"0.6737544",
"0.6737544",
"0.6737544",
"0.671949",
"0.671949",
"0.66700286",
"0.6585567",
"0.632786",
"0.6222491",
"0.61278236",
"0.6123075",
"0.6111715",
... | 0.60406977 | 26 |
PATCH/PUT /cars/1 or /cars/1.json | def update
respond_to do |format|
if @car.update(car_params)
format.html { redirect_to @car, notice: "Car was successfully updated." }
format.json { render :show, status: :ok, location: @car }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @car.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authenticate_request!\n\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end",
"def update\n @car = Car.find(params[:id])\n\n if @car.update(car_pa... | [
"0.7173147",
"0.7166568",
"0.68817484",
"0.68817484",
"0.68151075",
"0.68151075",
"0.67315507",
"0.67279273",
"0.67011905",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
"0.66613555",
... | 0.66339856 | 20 |
DELETE /cars/1 or /cars/1.json | def destroy
@car.destroy
respond_to do |format|
format.html { redirect_to cars_url, notice: "Car was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @car = Car.find(params[:id])\n @car.destroy\n\n respond_to do |format|\n format.html { redirect_to cars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @car = Car.find(params[:id])\n @car.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.72747296",
"0.72747296",
"0.7255571",
"0.7255571",
"0.7197985",
"0.712825",
"0.71196246",
"0.70051724",
"0.6983564",
"0.6971715",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
"0.6968863",
... | 0.6971166 | 10 |
Use callbacks to share common setup or constraints between actions. | def set_car
puts "#{params[:id]}yeeeeeeee"
@car = Car.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 car_params
params.require(:car).permit(:brand, :model, :description, :condition, :finish, :title, :price,:image)
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 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
lowest_key = nil
lowest_value = Float::INFINITY
name_hash.each do |x,y|
if y < lowest_value
lowest_value = y
lowest_key = x
end
end
lowest_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
def reverse_each_word(string) collect returns new arr string_array = string.split(' ') string_array.collect do |i| i.reverse! bang secures the reverse end.join(' ') end | def reverse_each_word(string) #collect returns new arr
string.split(' ').collect {|i| i.reverse!}.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_each_word(string)\n array = []\n array = string.split(\" \")\n array.collect do |word| \n word.reverse!\n end\n final_array = array.join(\" \")\n final_array\nend",
"def reverse_each_word(string)\n new_arr = string.split\n new_arr.collect do |word|\n word.reverse\n end.join(' ')\n \ne... | [
"0.9345076",
"0.9342768",
"0.931599",
"0.93141735",
"0.92930853",
"0.9284246",
"0.9275603",
"0.92731047",
"0.92704135",
"0.9261891",
"0.9246376",
"0.9246167",
"0.92429507",
"0.92428595",
"0.9239952",
"0.9233457",
"0.9233407",
"0.92294306",
"0.92253864",
"0.9221786",
"0.922028... | 0.9491139 | 0 |
Renders this statistics hash table to a textual string suitable for display on a terminal. | def to_text
result = ''
# Render the player with the most improved batting average.
player = self[:most_improved_batting_avg_2010]
result << "Most Improved Batting Avg from 2009 to 2010: #{player_label(player)}\n"
result << " 2009 average: #{'%.3f' % player[:prev_batting_avg].to_f}\n"
result << " 2010 average: #{'%.3f' % player[:batting_avg].to_f}\n"
# Render the slugging percentages.
result << "\nOakland Athletic's 2007 Slugging Percentages:\n"
players = self[:slugging_percentages_Oakland_As_2007]
sorted_players = players.sort_by { |p| [1000.0 - p[:slugging_perc], p[:last_name].to_s, p[:first_name].to_s, p[:player_id].to_s] }
sorted_players.each do |plyr|
formatted_perc = '%5.1f%%' % plyr[:slugging_perc]
result << " #{formatted_perc} #{player_label(plyr)}\n"
end
# Render the triple crown winners.
result << "\nTriple Crown Winners:\n"
winners = self[:triple_crown_winners]
sorted_winners = winners.sort_by { |p| [p[:year].to_s, p[:league].to_s] }
sorted_winners.each do |winner|
player = winner[:player]
player_lbl = player ? player_label(player) : '(No winner)'
result << " #{winner[:year]} -- #{winner[:league]}: #{player_lbl}\n"
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_hash(hsh)\n str = \"\"\n indiff_hsh = hsh.with_indifferent_access\n indiff_hsh.keys.sort.each do |key|\n str << \"#{key}: \"\n value = indiff_hsh[key]\n PP::pp(value, str)\n end\n str\n end",
"def inspect\n to_table.render :ascii\n end",
"def ... | [
"0.6450297",
"0.642465",
"0.6391721",
"0.6380282",
"0.63318515",
"0.632808",
"0.6320741",
"0.6165925",
"0.6148295",
"0.6095938",
"0.6030023",
"0.60047877",
"0.59984076",
"0.5997497",
"0.5996444",
"0.59948367",
"0.59364223",
"0.59065753",
"0.5900488",
"0.58669215",
"0.5851416"... | 0.0 | -1 |
Renders a unique label for the player described by the given data hash table. For example: Hank Aaron (aaronha01) | def player_label(player_hash)
return "N/A" unless player_hash.has_key?(:player_id)
"#{player_hash[:first_name]} #{player_hash[:last_name]} (#{player_hash[:player_id]})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label\n \tif !player.nil? && !opponent.nil?\n \t\t\"#{player_name}\\n#{opponent_name}\"\n \telsif !player.nil? && opponent.nil?\n \t\t\"#{player_name}\\n-----\"\n \telse\n \t\t\"----\\n----\"\n \tend\n end",
"def player_name(hash)\n return hash[:name]\nend",
"def title\n \"Game #{self.id}: \" +... | [
"0.64263386",
"0.61699796",
"0.6096534",
"0.6022994",
"0.5946534",
"0.586324",
"0.581778",
"0.5750777",
"0.5740393",
"0.5721323",
"0.5718659",
"0.5710497",
"0.5665154",
"0.5659331",
"0.5646402",
"0.56414205",
"0.563456",
"0.5626155",
"0.5621831",
"0.5561688",
"0.55529153",
... | 0.7647331 | 0 |
Call this method to set your configuration. SmartyStreets.configure do |config| config.auth_id = 'AUTHID' config.auth_token = 'AUTHTOKEN' config.candidates = 1 end | def configure
self.configuration = Configuration.new
yield(configuration)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure\n end",
"def configure\n Twitter.configure do |configuration|\n configuration.consumer_key = @consumer_key\n configuration.consumer_secret = @consumer_secret\n configuration.oauth_token = @oauth_token\n configuration.oauth_token_secret = @oauth_token_secret\n end\n ... | [
"0.6665718",
"0.6659978",
"0.66123873",
"0.6612209",
"0.6582256",
"0.6576537",
"0.6552118",
"0.65292865",
"0.6516262",
"0.6516262",
"0.6497489",
"0.6497489",
"0.648739",
"0.647617",
"0.6467259",
"0.646706",
"0.64499587",
"0.6446634",
"0.64241993",
"0.64241713",
"0.64164233",
... | 0.0 | -1 |
Request standardization for an address | def standardize
location = Location.new
yield(location)
Request.new(location).standardize!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_address(address)\n normalize(address).split(' ').map { |word| StreetAbbrevs[word] || word }.join(' ')\n end",
"def normalize_address(address)\n wallet.blockchain_api&.supports_cash_addr_format? ? CashAddr::Converter.to_legacy_address(super) : super\n end",
"def normalized\n @... | [
"0.76198083",
"0.7162573",
"0.6529558",
"0.648175",
"0.64649314",
"0.643721",
"0.6433053",
"0.6386413",
"0.6341347",
"0.63268363",
"0.6315183",
"0.63091004",
"0.6304331",
"0.6276354",
"0.6276354",
"0.62618005",
"0.624458",
"0.62293357",
"0.6220492",
"0.6216359",
"0.62111855",... | 0.64802885 | 4 |
check command line arguments accepts only a single argument: either "jarow" or "reg" this tells the program which string matching technique to use when selecting the show to chart | def asciiGraph(graphY, episodesPerSeason)
tickMarks = Array.new # stores the sum of the previous seasons (used to drop tick marks at season divisions)
# for example, breaking bad has 5 seasons, each containing: 7, 13, 13, 13, and 16 episdoes, respectively.
# In this case, tickMarks would store numbers: 7, 20, 33, 46, 62 in indexes 0, 1, 2, 3, 4.
for i in 0..episodesPerSeason.length-1
for j in 0..i
#
tickMarks[i] = tickMarks[i].to_i + episodesPerSeason[j].to_i
end
end
for i in 0..12
for j in 0..(graphY.length-1 + 2)
if i == 12 && j > 1
print "--"
else
if j == 0
# fill the left edge of the graph with grades corresponding to each row.
case i
when 0
print "A "
when 1
print "A-"
when 2
print "B+"
when 3
print "B "
when 4
print "B-"
when 5
print "C+"
when 6
print "C "
when 7
print "C-"
when 8
print "D+"
when 9
print "D "
when 10
print "D-"
when 11
print "F "
else
print " "
end
else
if j == 1
print "|" # drop a vertical line down to separate the grades from the start of the graph proper.
else
_yFlip = 11 - i; # flips the value, since the graph counts upside down
if graphY[graphY.length-1 - j + 2] == _yFlip then
print "O" # the episode's grade is right here
else
print "-" # blank space
end
# put down the vertical bars to separate seasons
if tickMarks.include? j-1
print "|"
else
print " " # no need to drop a bar here
end
# end vertical bar loop
end
end
end
STDOUT.flush
end
puts "" # I forget why, but taking this line out makes the graph look horrible.
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_inputs_g(args)\n raise TypeError, Ajaila::Messager.warning(\"Nothing to generate...\") if args == []\n raise TypeError, Ajaila::Messager.warning(\"Only miners, selectors, presenters supported\\n(ex. miner SomeMiner, selector SomeSelector,\\n presenter SomePresenter, table SomeTable)\") if KNOWN_INS... | [
"0.7043912",
"0.6684698",
"0.66496813",
"0.6584096",
"0.658176",
"0.6415675",
"0.6399248",
"0.63984036",
"0.63334286",
"0.63306254",
"0.6328948",
"0.6294602",
"0.6257762",
"0.6208201",
"0.6183223",
"0.6173542",
"0.6173542",
"0.61647564",
"0.61566824",
"0.6130935",
"0.6125651"... | 0.0 | -1 |
this function takes a given TV season and pushes it onto the Grades array | def pushSeason (index, reviews, grades, validSeasons, episodesPerSeason)
puts "season " + validSeasons[index].inner_html
if index != 0 then
season = reviews.link_with(class: "badge season-" + validSeasons[index].inner_html).click.search('.grade.letter.tv').reverse
else
season = reviews.search('.grade.letter.tv').reverse
end
topJunk = season[season.size - 1] # grabs top element from array
while season[season.size - 1] == topJunk
season.pop
end
#season.pop
#season.delete(topJunk)
#season.pop # the latest episode is at the top of every page, remove it from the list
# for some reason, every couple of days I will test this program and this section messes me up.
# Some days it needs 3 pops to get the right number of episodes, other days it needs 1 pop.
# There's probably a better way of removing duplicates, but I have yet to implement that. Definitely on the to-do list.
#season.pop # maybe implement something where you fetch the top episode's ID and make sure the last one isn't that,
#season.pop # except in the caes of the final season/latest season of the show where it is.
season = season.reverse
puts season.length.to_s + " episodes"
episodesPerSeason.push(season.length.to_i)
while season.length > 0 do
grades.push(season.pop.inner_text())
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_season(season)\r\n seasons << season\r\n end",
"def new_episodes( season )\n return @seasons[season][1].flatten\n end",
"def acommodate_seasons\n new_year_season = @seasons.select{|season| season.end < season.start}.first\n\n first_seasion = Season.new(new_year_season)\n new_... | [
"0.70537406",
"0.6697628",
"0.6514545",
"0.63752764",
"0.61089665",
"0.5944753",
"0.5885638",
"0.5753774",
"0.5692375",
"0.56781703",
"0.5657011",
"0.56565475",
"0.5653818",
"0.562447",
"0.5620666",
"0.5585698",
"0.5584604",
"0.5566957",
"0.5518184",
"0.55075777",
"0.5504194"... | 0.6831387 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_productquote
@productquote = Productquote.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 productquote_params
params.require(:productquote).permit(:quantity, :param1, :param2, :param3, :param4, :param5, :quote_id, :product_id)
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 |
Set class in page | def active_in_page(path)
"active" if current_page?(path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_page_class_name\n if page.present?\n self.page.class_name = page.class_name || 'ShopProductPage'\n end\n end",
"def assign_page_class_name\n if page.present?\n self.page.class_name = page.class_name || 'ShopCategoryPage'\n end\n end",
"def set_class_page\n @class_page = ... | [
"0.73582536",
"0.7342664",
"0.71903175",
"0.7038631",
"0.69890004",
"0.6927469",
"0.6717605",
"0.66459763",
"0.66459763",
"0.6643791",
"0.6628135",
"0.6536092",
"0.64411616",
"0.63731635",
"0.6361132",
"0.6310203",
"0.6296197",
"0.62857133",
"0.62467515",
"0.62375504",
"0.622... | 0.0 | -1 |
End of setup method | def test_get_name
assert_equal("Bob Dylan", @musician1.name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end"... | [
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.8531251",
"0.83570427",
"0.83570427",
... | 0.0 | -1 |
End of test_get_name method | def test_play_song()
result = @musician1.play_song("All Along the Watchtower")
assert_equal("Twing Twang... I'm playing All Along the Watchtower", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_name\n test.name\n end",
"def random_test_name\n @fake_name.name\n end",
"def test_getting_name\n result = get_name(@person5)\n assert_equal(\"Daphne\", result)\n end",
"def name\n name = self.TestResult\n end",
"def test_return_name\n t = Town::new 'Dynamic Palisades',... | [
"0.8082142",
"0.74290526",
"0.7400219",
"0.7345314",
"0.7268914",
"0.7110415",
"0.70904833",
"0.70654875",
"0.70508754",
"0.7049786",
"0.697008",
"0.6917945",
"0.69084275",
"0.68985575",
"0.6871997",
"0.6867205",
"0.6763757",
"0.673711",
"0.6732117",
"0.6732117",
"0.6726878",... | 0.0 | -1 |
End of test_play_song method | def test_play_song__on_piano
result = @musician2.play_song("Rocket Man")
assert_equal("Plink Plonk... I'm playing Rocket Man", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_play_song()\n result = @musician1.play_song(\"All Along the Watchtower\")\n assert_equal(\"Twing Twang... I'm playing All Along the Watchtower\", result)\n end",
"def test_play_random_song\n result = @room1.play_random_song\n assert_equal(true, @song_library.include?(result))\n end",
"... | [
"0.8007401",
"0.75286037",
"0.74119264",
"0.73903525",
"0.73018306",
"0.7281039",
"0.72596925",
"0.70502216",
"0.7045161",
"0.7045161",
"0.7045161",
"0.7045161",
"0.7045161",
"0.7045161",
"0.7045161",
"0.7045161",
"0.7022702",
"0.7006858",
"0.69807553",
"0.69608915",
"0.69494... | 0.7187675 | 7 |
GET /smurves/1 GET /smurves/1.json | def show
@smurf = Smurf.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @smurf }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }... | [
"0.63855404",
"0.6275176",
"0.62693167",
"0.62597644",
"0.62511855",
"0.6250993",
"0.61759907",
"0.61620575",
"0.6153522",
"0.6141912",
"0.61395603",
"0.61395603",
"0.61395603",
"0.612314",
"0.6087082",
"0.60848933",
"0.6078713",
"0.6070555",
"0.60667366",
"0.6062942",
"0.605... | 0.6499962 | 0 |
GET /smurves/new GET /smurves/new.json | def new
@smurf = Smurf.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @smurf }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n... | [
"0.73754936",
"0.7305613",
"0.7176192",
"0.715098",
"0.70933956",
"0.70841676",
"0.70841676",
"0.70841676",
"0.70148146",
"0.7000369",
"0.69950426",
"0.69940686",
"0.69802165",
"0.69802165",
"0.69802165",
"0.69802165",
"0.6974135",
"0.6971662",
"0.6949394",
"0.69412297",
"0.6... | 0.69451886 | 19 |
POST /smurves POST /smurves.json | def create
@smurf = Smurf.new(params[:smurf])
respond_to do |format|
if @smurf.save
format.html { redirect_to @smurf, notice: 'Smurf was successfully created.' }
format.json { render json: @smurf, status: :created, location: @smurf }
else
format.html { render action: "new" }
format.json { render json: @smurf.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @serf = Serve.new(serf_params)\n\n respond_to do |format|\n if @serf.save\n format.html { redirect_to @serf, notice: 'Serve was successfully created.' }\n format.json { render :show, status: :created, location: @serf }\n else\n format.html { render :new }\n ... | [
"0.5901265",
"0.5721192",
"0.5708725",
"0.5706963",
"0.56548256",
"0.55082643",
"0.54553825",
"0.5454779",
"0.5431501",
"0.5421251",
"0.54196185",
"0.53761417",
"0.5349913",
"0.5336384",
"0.53135115",
"0.53117347",
"0.5310623",
"0.5310575",
"0.52862006",
"0.5282198",
"0.52805... | 0.5562635 | 5 |
PUT /smurves/1 PUT /smurves/1.json | def update
@smurf = Smurf.find(params[:id])
respond_to do |format|
if @smurf.update_attributes(params[:smurf])
format.html { redirect_to @smurf, notice: 'Smurf was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @smurf.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def put!\n request! :put\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update... | [
"0.6073809",
"0.59960943",
"0.5939352",
"0.5846144",
"0.583905",
"0.5828634",
"0.5814998",
"0.5795041",
"0.57899046",
"0.5784447",
"0.57715017",
"0.5768905",
"0.5765787",
"0.5762351",
"0.57463884",
"0.5736198",
"0.570214",
"0.56772685",
"0.5677032",
"0.5660396",
"0.56496865",... | 0.5697031 | 17 |
DELETE /smurves/1 DELETE /smurves/1.json | def destroy
@smurf = Smurf.find(params[:id])
@smurf.destroy
respond_to do |format|
format.html { redirect_to smurves_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redire... | [
"0.6996358",
"0.6916152",
"0.68962145",
"0.6844551",
"0.6790253",
"0.6788198",
"0.67870665",
"0.6729078",
"0.6726584",
"0.6725904",
"0.6714303",
"0.66711885",
"0.66557974",
"0.66499555",
"0.664574",
"0.6643474",
"0.6610171",
"0.6602871",
"0.65991664",
"0.65934026",
"0.6590277... | 0.7117388 | 0 |
Use callbacks to share common setup or constraints between actions | def set_hold
@hold = Hold.find_by(id: 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 run_actions; end",
"def action_hook; end",
"def callbacks; end",
"def callbacks; end",
"def actions; end",
"def add_actions; end",
"def define_action_hook; end",
"def define_action_helpers\n ... | [
"0.6286812",
"0.6187808",
"0.6184776",
"0.6063208",
"0.6063208",
"0.6049123",
"0.590157",
"0.58827597",
"0.57930803",
"0.57467157",
"0.56255555",
"0.56055284",
"0.55783254",
"0.5557657",
"0.5515892",
"0.5487875",
"0.54620403",
"0.5441225",
"0.54343027",
"0.54343027",
"0.54343... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through | def hold_params
params.require(:hold).permit(:available, :borrowed, :cancelled, :student_id, :book_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_params_authentication!; end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def param_whitelist\n [:role, :title]\n end",
"de... | [
"0.7281678",
"0.69499284",
"0.6943358",
"0.68099016",
"0.6788929",
"0.67056924",
"0.6663432",
"0.65962857",
"0.6592343",
"0.6493675",
"0.6493492",
"0.649151",
"0.6466607",
"0.6459217",
"0.64093643",
"0.640502",
"0.64032215",
"0.6400939",
"0.63996387",
"0.6388152",
"0.6366433"... | 0.0 | -1 |
Fetches all available Accounts. | def all(client, opts = {})
request = Request.new(client, :get, RESOURCE_COLLECTION, params: opts)
Cursor.new(self, request, init_with: [client])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def get_accounts\n @accounts = Account.all\n end",
"def all\n result = @dealing_platform.session.get('accounts').fetch :accounts\n\n @dealing_platform.instantiate_models Account, result\n end",
"def ... | [
"0.80261576",
"0.77760065",
"0.77754533",
"0.7660104",
"0.74954516",
"0.74242496",
"0.73938143",
"0.73721933",
"0.7285005",
"0.7231965",
"0.72149473",
"0.71942526",
"0.7191922",
"0.7152123",
"0.7131927",
"0.7111829",
"0.71046203",
"0.70297486",
"0.7025086",
"0.69370556",
"0.6... | 0.0 | -1 |
Returns an inspection string for the current object instance. | def inspect
str = +"#<#{self.class.name}:0x#{object_id}"
str << " id=\"#{@id}\"" if @id
str << '>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n inspection = self.info.keys.map { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.compact.join(\", \")\n \"#<#{self.class}:0x#{self.object_id.to_s(16)} #{inspection}>\"\n end",
"def inspect\n \"(#{self})\"\n end",
"def inspect\n self.to_s\n end",
"d... | [
"0.76737326",
"0.7307379",
"0.7173789",
"0.7173789",
"0.71722484",
"0.7119555",
"0.7106687",
"0.7106687",
"0.7099927",
"0.7097702",
"0.70830613",
"0.7067245",
"0.7067245",
"0.70635533",
"0.70471007",
"0.70200425",
"0.7008564",
"0.70005727",
"0.6988642",
"0.6980305",
"0.694838... | 0.0 | -1 |
Returns a collection of features available to the current account. | def features
validate_loaded
resource = FEATURES % { id: @id }
response = Request.new(client, :get, resource).perform
response.body[:data]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features\n @client.smembers(FeaturesKey.to_s).to_set\n end",
"def features\n @features ||= Features.from_grpc @grpc\n end",
"def features\n return @discovery_document['features'] || []\n end",
"def features\n @features ||= {}\n @features.keys\n end",
"... | [
"0.7621331",
"0.722861",
"0.72246397",
"0.7224367",
"0.7080637",
"0.7049067",
"0.6957727",
"0.691753",
"0.68934476",
"0.68718046",
"0.6807074",
"0.67977524",
"0.6752334",
"0.66385114",
"0.6603914",
"0.65683436",
"0.6558759",
"0.65510184",
"0.6524793",
"0.64842623",
"0.6444794... | 0.7426405 | 1 |
Returns a collection of media creatives available to the current account. | def media_creatives(id = nil, opts = {})
load_resource(Creative::MediaCreative, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case_media_list\n\t\t@case_media_attachments = @surgery_case.case_media.case_media_attachments\n\tend",
"def get_media\n raise Errors::BadRequestError, \"Bad course site ID #{canvas_course_id}\" if canvas_course_id.blank?\n authorize Canvas::Course.new(canvas_course_id: canvas_course_id), :can_view_cou... | [
"0.62533456",
"0.60480416",
"0.596976",
"0.59451115",
"0.59098566",
"0.587478",
"0.57645965",
"0.5762714",
"0.57524914",
"0.5734547",
"0.57002115",
"0.5691022",
"0.5660827",
"0.56455326",
"0.56440204",
"0.5618907",
"0.56186515",
"0.5582878",
"0.55106074",
"0.55076337",
"0.550... | 0.6913358 | 0 |
Returns a collection of account media available to the current account. | def account_media(id = nil, opts = {})
load_resource(Creative::AccountMedia, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_list\n @redis.hkeys(\"contact_media:#{self.id}\") - ['pagerduty']\n end",
"def case_media_list\n\t\t@case_media_attachments = @surgery_case.case_media.case_media_attachments\n\tend",
"def list_media(account_id, opts = {})\n data, _status_code, _headers = list_media_with_http_info(acc... | [
"0.676765",
"0.6761676",
"0.65807205",
"0.6468452",
"0.63839895",
"0.6294728",
"0.629163",
"0.62836283",
"0.6276517",
"0.62486154",
"0.6239582",
"0.6236424",
"0.61923516",
"0.6174501",
"0.6141058",
"0.61221844",
"0.6111506",
"0.6062096",
"0.605884",
"0.6055033",
"0.603073",
... | 0.6712677 | 2 |
Returns a collection of media library available to the current account. | def media_library(id = nil, opts = {})
load_resource(Creative::MediaLibrary, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_mediasets\n []\n end",
"def fetch_libraries\n Library.limit(10)\n end",
"def libraries\n @libs ||= Collection.new(klass: Library, client: @client,\n belongs_to: self)\n end",
"def media_types\n return @media_types\n en... | [
"0.664617",
"0.62688994",
"0.6226367",
"0.6220299",
"0.6127802",
"0.60755557",
"0.6046568",
"0.60314494",
"0.60158277",
"0.59966886",
"0.5868709",
"0.57574034",
"0.57530946",
"0.5736519",
"0.5732664",
"0.5723549",
"0.57065964",
"0.5694174",
"0.5639348",
"0.56390435",
"0.56133... | 0.6336239 | 1 |
Returns a collection of promotable users available to the current account. | def promotable_users(id = nil, opts = {})
load_resource(PromotableUser, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users\n User.in(id: user_promotions.pluck(:user_id))\n end",
"def available_users\n\t\tfree_users = []\n\t\tfor user in User.all\n\t\t\tunless user.assignments.nil? || user.assignments.empty?\n\t\t\t\tfor assignment in user.assignments\n\t\t\t\t\tif assignment.active\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t... | [
"0.6947069",
"0.6832694",
"0.6698163",
"0.6584318",
"0.65361404",
"0.64484054",
"0.64337164",
"0.6423436",
"0.63936424",
"0.63697374",
"0.63697374",
"0.63697374",
"0.6357077",
"0.6336897",
"0.6319983",
"0.6288658",
"0.626963",
"0.62488395",
"0.6243069",
"0.6198256",
"0.619628... | 0.6959412 | 0 |
Returns a collection of promoted tweets available to the current account. | def promotable_tweets(id = nil, opts = {})
load_resource(Creative::PromotedTweet, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_tweets\n tweets\n end",
"def tweets\n @_tweets ||= client.filter_tweets(screen_names)\n end",
"def all_tweets\n Tweet.all\n end",
"def index\n\t\t@tweets = current_user.tweets\n\tend",
"def show\n @all_tweets = set_tweet_collection.tweets\n end",
"def sorted_tweets\n tweet... | [
"0.6715754",
"0.6518369",
"0.65176886",
"0.621802",
"0.6131905",
"0.6086351",
"0.60122764",
"0.599027",
"0.59183866",
"0.588927",
"0.5861264",
"0.58257174",
"0.58246803",
"0.58145905",
"0.58142686",
"0.5809646",
"0.5805242",
"0.5800106",
"0.5793381",
"0.5756202",
"0.5737589",... | 0.65593827 | 1 |
Returns a collection of promoted accounts available to the current account. | def promotable_accounts(id = nil, opts = {})
load_resource(Creative::PromotedAccount, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promoted\n @users = User.valid_users.promoted.page(params[:page])\n end",
"def accounts_from_current_user\n\t\taccounts = []\n\t\tcurrent_user.RelatedAccounts.each do |relatedaccount|\n\t\t\tAccount.find_all_by_Canal__c(relatedaccount.canal_id).each do |account|\n\t\t\t\taccounts << account\n\t\t\ten... | [
"0.646123",
"0.6404987",
"0.6177192",
"0.61391354",
"0.6042398",
"0.5896171",
"0.5786753",
"0.565071",
"0.5650171",
"0.5639607",
"0.5610776",
"0.55882746",
"0.55212665",
"0.5504914",
"0.54202574",
"0.541338",
"0.53962773",
"0.5364397",
"0.53255486",
"0.5304316",
"0.5290702",
... | 0.6362761 | 2 |
Returns a collection of funding instruments available to the current account. | def funding_instruments(id = nil, opts = {})
load_resource(FundingInstrument, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def funding_instruments(account_id, options = {})\n get(\"/accounts/#{account_id}/funding_instruments\", options)\n end",
"def investors\n funds = []\n num_funding_rounds.each do |round| \n funds << round.venture_capitalist\n end\n funds.uniq\n end",
"def instr... | [
"0.7331896",
"0.5937225",
"0.5805652",
"0.5790269",
"0.5622397",
"0.5592295",
"0.5540579",
"0.54610956",
"0.5458508",
"0.54407567",
"0.5384358",
"0.53625125",
"0.53479815",
"0.52955663",
"0.5280103",
"0.52766544",
"0.5260787",
"0.5227497",
"0.5219405",
"0.51910573",
"0.517315... | 0.62482667 | 1 |
Returns a collection of campaigns available to the current account. | def campaigns(id = nil, opts = {})
load_resource(Campaign, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def campaigns(params, additional_headers = {})\n perform_request(self, @token, 'campaigns', 'get', params, additional_headers)\n end",
"def campaigns(options={})\n Resources::Campaign... | [
"0.82403934",
"0.8043049",
"0.7703456",
"0.7643759",
"0.75581336",
"0.75464195",
"0.74871796",
"0.7409638",
"0.72600615",
"0.7129342",
"0.68103063",
"0.67226624",
"0.67226624",
"0.67226624",
"0.67138344",
"0.6692746",
"0.668409",
"0.66757673",
"0.6603907",
"0.65917885",
"0.65... | 0.7055873 | 10 |
Returns a collection of line items available to the current account. | def line_items(id = nil, opts = {})
load_resource(LineItem, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_items(account_id, options = {})\n get(\"/accounts/#{account_id}/line_items\", options)\n end",
"def line_items\n if line_items_downloaded?\n @line_items\n\n # There is an credit_note_is so we can assume this record was loaded from Xero.\n # attempt to download the line_item... | [
"0.7842778",
"0.7466906",
"0.71823955",
"0.7182267",
"0.7125584",
"0.7125584",
"0.71182996",
"0.7019124",
"0.6964077",
"0.6964077",
"0.6775031",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66738456",
"0.66... | 0.6502832 | 28 |
Returns a collection of tracking tags available to the current account. | def tracking_tags(id = nil, opts = {})
load_resource(TrackingTag, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get.tagGuids\n end",
"def local_tags\n @local.tags\n end",
"def tags\n return @tags ||= begin\n @site.tags.keys.map do |tag|\n TagDrop.new({\n :site => @site, :tag => tag\n })\n end\n end\n end",
"def available_tags\n available_tags = ... | [
"0.71516377",
"0.6972651",
"0.6892095",
"0.6847338",
"0.68159676",
"0.6793933",
"0.67642885",
"0.67609733",
"0.67347175",
"0.6732472",
"0.6724401",
"0.6705774",
"0.66738313",
"0.66486317",
"0.66475374",
"0.6647482",
"0.6635401",
"0.6634736",
"0.6634736",
"0.6634736",
"0.66334... | 0.62446475 | 66 |
Returns a collection of app lists available to the current account. | def app_lists(id = nil, opts = {})
load_resource(AppList, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def applications_list\n get \"applications\"\n end",
"def apps\n collect\n end",
"def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.whe... | [
"0.77140033",
"0.7486083",
"0.7393647",
"0.7339324",
"0.72975487",
"0.7283283",
"0.72634315",
"0.7230738",
"0.7160644",
"0.7160644",
"0.7158827",
"0.7139402",
"0.7132145",
"0.70733",
"0.7072276",
"0.7054705",
"0.7052108",
"0.7046461",
"0.7044437",
"0.70369285",
"0.70369285",
... | 0.70877343 | 13 |
Returns a collection of custom audiences available to the current account. | def custom_audiences(id = nil, opts = {})
load_resource(CustomAudience, id, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audiences\n respond_to?(:audience) ? audience : []\n end",
"def audiences\n return @audiences\n end",
"def audiences\n return [] if @audience_ids.nil?\n @audience_ids.map { |id| Audience.find(id) }\n end",
"def audiences=(value)\n @audiences... | [
"0.77283984",
"0.7514401",
"0.6909982",
"0.6766872",
"0.6333968",
"0.62319475",
"0.6142489",
"0.6066549",
"0.6062224",
"0.591759",
"0.57363296",
"0.5724022",
"0.5724022",
"0.57236475",
"0.57034373",
"0.55666596",
"0.55527234",
"0.5481181",
"0.5422533",
"0.5381856",
"0.5380670... | 0.73857266 | 2 |
GET /file_infos GET /file_infos.json | def index
@file_infos = FileInfo.includes(:component).all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end",
"def files_info(params = {})\n fail ArgumentError, \"Required arguments 'file' missing\" if params['file'].nil?\n r... | [
"0.7747109",
"0.74375856",
"0.6933024",
"0.67832184",
"0.6747815",
"0.66296005",
"0.6605833",
"0.65992457",
"0.6590381",
"0.65668494",
"0.65648437",
"0.6562342",
"0.6557879",
"0.65485936",
"0.65393454",
"0.6530839",
"0.6524806",
"0.65196174",
"0.6509311",
"0.6508268",
"0.6501... | 0.6422512 | 24 |
GET /file_infos/1 GET /file_infos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end",
"def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rend... | [
"0.77651364",
"0.6983009",
"0.69003063",
"0.6866669",
"0.6849671",
"0.68473196",
"0.6834536",
"0.68014026",
"0.6758681",
"0.6753426",
"0.67332083",
"0.6704869",
"0.6700151",
"0.66760004",
"0.66719335",
"0.6664686",
"0.6641569",
"0.660114",
"0.65941477",
"0.65893126",
"0.65544... | 0.0 | -1 |
POST /file_infos/multi_update POST /file_infos/multi_update.json | def multi_update
errors = false
return_value = []
file_infos_params = params.permit(file_infos: [:id, :review_done, :component_id]).require(:file_infos)
file_infos_params.each do |key, file_info_entry|
(return_value << nil) and (errors = true) and next unless file_info_entry[:id]
file_info = FileInfo.find(file_info_entry[:id])
(return_value << nil) and (errors = true) and next unless file_info
if file_info.update(file_info_entry)
return_value << file_info_entry
else
return_value << file_info.errors
errors = true
end
end
respond_to do |format|
format.json { render json: return_value }
if errors
format.html { redirect_to :back, notice: 'Some entries have errors'}
else
format.html { redirect_to :back }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userfiles_sync_multiple_post_with_http_info(multi_userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_sync_multiple_post ...'\n end\n # verify the required parameter 'multi_userfile_mod_req' is set\n if... | [
"0.6676585",
"0.6575798",
"0.6294205",
"0.6267254",
"0.6264113",
"0.6249746",
"0.6083589",
"0.6071055",
"0.60473055",
"0.59641767",
"0.59502923",
"0.59180737",
"0.5885334",
"0.5881911",
"0.58710796",
"0.58671397",
"0.5865916",
"0.5822468",
"0.5811115",
"0.58021134",
"0.579661... | 0.817044 | 0 |
POST /file_infos POST /file_infos.json | def create
@file_info = FileInfo.new(file_info_params)
respond_to do |format|
if @file_info.save
format.html { redirect_to @file_info, notice: 'File info was successfully created.' }
format.json { render :show, status: :created, location: @file_info }
else
format.html { render :new }
format.json { render json: @file_info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @file_info = FileInfo.new(params[:file_info])\n\n respond_to do |format|\n if @file_info.save\n format.html { redirect_to @file_info, notice: 'File info was successfully created.' }\n format.json { render json: @file_info, status: :created, location: @file_info }\n else\n... | [
"0.7184683",
"0.6746465",
"0.6713858",
"0.64153254",
"0.63582677",
"0.6322233",
"0.6215035",
"0.61296403",
"0.6118219",
"0.6089784",
"0.607016",
"0.5990849",
"0.5985978",
"0.59753793",
"0.5924891",
"0.58780515",
"0.5868363",
"0.5850267",
"0.5838883",
"0.5832459",
"0.5825131",... | 0.71721107 | 1 |
PATCH/PUT /file_infos/1 PATCH/PUT /file_infos/1.json | def update
respond_to do |format|
if @file_info.update(file_info_params)
format.html { redirect_to @file_info, notice: 'File info was successfully updated.' }
format.json { render :show, status: :ok, location: @file_info }
else
format.html { render :edit }
format.json { render json: @file_info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n if @file_info.update_attributes(params[:file_info])\n format.html { redirect_to @file_info, notice: 'File info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html ... | [
"0.71018904",
"0.68088216",
"0.66352844",
"0.6555451",
"0.6511351",
"0.6390588",
"0.62911636",
"0.62682223",
"0.626227",
"0.6211104",
"0.6204878",
"0.61957586",
"0.61833954",
"0.617638",
"0.61687446",
"0.6151599",
"0.6146424",
"0.61436623",
"0.6139235",
"0.6132907",
"0.611545... | 0.70129156 | 1 |
DELETE /file_infos/1 DELETE /file_infos/1.json | def destroy
@file_info.destroy
respond_to do |format|
format.html { redirect_to file_infos_url, notice: 'File info was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @file_info = FileInfo.find(params[:id])\n @file_info.destroy\n\n respond_to do |format|\n format.html { redirect_to file_infos_url }\n format.json { head :no_content }\n end\n end",
"def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_uploa... | [
"0.75509286",
"0.721264",
"0.7150537",
"0.70795196",
"0.6995506",
"0.6972538",
"0.6961943",
"0.69592553",
"0.69120973",
"0.69034076",
"0.6890075",
"0.68900293",
"0.6889352",
"0.6884351",
"0.6876602",
"0.68604535",
"0.6849929",
"0.6838628",
"0.6834432",
"0.67989504",
"0.677828... | 0.72692996 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_file_info
@file_info = FileInfo.includes(:component).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 file_info_params
params.require(:file_info).permit(:folder, :loc, :name, :type, :review_done, :component_id)
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 |
An array of names for the resources this class is equivalent to for the purposes of provider resolution. | def subclass_resource_equivalents
@subclass_resource_names ||= [resource_name.to_sym]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def resources_name\n self.class.resources_name\n end",
"def resources\n Loader.resources.keys\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def resources... | [
"0.736264",
"0.7191305",
"0.7120278",
"0.7002569",
"0.69655",
"0.68680525",
"0.6855831",
"0.68342686",
"0.67469245",
"0.6651592",
"0.6567359",
"0.65578204",
"0.6525606",
"0.6513715",
"0.64875287",
"0.6463152",
"0.639904",
"0.63418144",
"0.633887",
"0.633887",
"0.633887",
"0... | 0.70532155 | 3 |
POST /v1/users POST /v1/users.json | def create
@user = User.external(user_params, request.headers["HTTP_APP_VERSION"].to_i)
if @user.errors.blank?
render json: @user.user_show, status: :created
if params[:device].present? and params[:device][:device_id].present?
@device_data=Device.where("device_id": params[:device][:device_id]).first
@device_data.update("user_id": @user.id) if @device_data.present?
end
else
render_api_error(11, 401, "error", @user.try(:errors))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.7815911",
"0.7657968",
"0.75378156",
"0.7488481",
"0.73097456",
"0.72195035",
"0.7209448",
"0.72083896",
"0.7176814",
"0.71758825",
"0.7168937",
"0.7166019",
"0.7142043",
"0.70903206",
"0.7059153",
"0.7027522",
"0.7019905",
"0.70191944",
"0.70161146",
"0.70144063",
"0.7014... | 0.0 | -1 |
PATCH/PUT /v1/users/1 PATCH/PUT /v1/users/1.json | def update
@user.token = @token
@user.no_validate = true
if @user.update(user_params)
render json: @user, status: :ok
else
@user.errors.messages[:message]= {}
return render json: {error: @user.errors}, status: :unprocessable_entity
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.7295816",
"0.71818405",
"0.71748185",
"0.69833684",
"0.6908599",
"0.68696266",
"0.68664145",
"0.6839887",
"0.6822515",
"0.68096834",
"0.6804047",
"0.6770206",
"0.674421",
"0.6742964",
"0.67142",
"0.6713643",
"0.6699924",
"0.6683246",
"0.66831976",
"0.66801393",
"0.66572064... | 0.0 | -1 |
rake android['single_text_name'] rake android | def run_android test_file=nil
wait_for_valid_device
cmd = 'bundle exec ruby ./appium/run.rb android'
cmd += %Q( "#{ test_file }") if test_file
bash cmd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typekit_model_text_from_name(name)\n if text = available_typekits[name]\n return *text\n else \n raise OroGen::TypekitNotFound, \"#{client} has no typekit called #{name}\"\n end\n end",
"def tvText _args\n \"tv... | [
"0.57292897",
"0.5691632",
"0.561701",
"0.55859196",
"0.55355895",
"0.550346",
"0.550346",
"0.54210514",
"0.54047245",
"0.5403915",
"0.5402485",
"0.5326425",
"0.5248955",
"0.5225808",
"0.5219552",
"0.51429516",
"0.5116898",
"0.50812316",
"0.5067164",
"0.5064783",
"0.5036526",... | 0.46704313 | 83 |
Mapea los atributos del monetarios nodo 'Nomina' a su correspondienteKey en ingles ademas de ser convertidos a centavos. | def attr_money
{
perceptions_total_cents: 'TotalPercepciones',
deductions_total_cents: 'TotalDeducciones',
other_payments_total_cents: 'TotalOtrosPagos'
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kml_naturalista\n return [] unless naturalista_obs.present?\n obs = eval(naturalista_obs.decodifica64)\n return [] unless obs.count > 0\n cadenas = []\n h = HTMLEntities.new # Para codificar el html y no marque error en el KML\n\n obs.each do |ob|\n # Para evitar las captivas\n #ne... | [
"0.5138998",
"0.4904283",
"0.48788944",
"0.48673624",
"0.48432875",
"0.48291445",
"0.48161843",
"0.47962648",
"0.4790477",
"0.47727314",
"0.47062105",
"0.4699217",
"0.4676586",
"0.46619308",
"0.4655285",
"0.46538448",
"0.46530545",
"0.46399602",
"0.46102145",
"0.4607488",
"0.... | 0.0 | -1 |
Returns all sprint market positions. | def all
result = @dealing_platform.session.get('positions/sprintmarkets', API_V2).fetch :sprint_market_positions
@dealing_platform.instantiate_models SprintMarketPosition, result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_positions\n all_players = consume_player_data\n keep_position_info(all_players)\n end",
"def index\n @positions = current_user.positions.all\n end",
"def index\n @committee_positions = CommitteePosition.all\n end",
"def index\n @positions = Position.all\n end",
"def index\n @p... | [
"0.63722104",
"0.6139102",
"0.6136164",
"0.608525",
"0.60810876",
"0.59524363",
"0.5945375",
"0.5908401",
"0.5881976",
"0.58522403",
"0.58312035",
"0.5812529",
"0.5721311",
"0.57085174",
"0.5662057",
"0.5655291",
"0.56229234",
"0.5577363",
"0.5510041",
"0.5505311",
"0.5497758... | 0.8381261 | 0 |
Returns the sprint market position with the specified deal ID, or `nil` if there is no sprint market position with that ID. | def [](deal_id)
all.detect do |sprint_market_position|
sprint_market_position.deal_id == deal_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](deal_id)\n all.detect do |position|\n position.deal_id == deal_id\n end\n end",
"def get_pos_by_id(id)\n id = id.to_i\n p id\n @@pos_table.each do |k, v|\n\tp v\n return v if v.pos_id == id\n end\n nil\n end",
"def market\n Market.find(@m... | [
"0.5932084",
"0.5289196",
"0.5222829",
"0.5142622",
"0.5142622",
"0.51137316",
"0.5112394",
"0.5020907",
"0.50002027",
"0.4929236",
"0.48973534",
"0.48853442",
"0.47432047",
"0.47374982",
"0.4726791",
"0.47071695",
"0.46989948",
"0.46768805",
"0.46768805",
"0.46768805",
"0.46... | 0.77109426 | 0 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.invitations.invite_user.subject | def invite_user invitation, link
@invitation = invitation
@link = link
mail :to => invitation.email, :subject => t('invitation_mailer.invite_user.subject')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def translate(mapping, key)\n I... | [
"0.73509854",
"0.69907725",
"0.6732002",
"0.66921484",
"0.6604944",
"0.65942645",
"0.65587944",
"0.6547426",
"0.64862704",
"0.6484616",
"0.64350826",
"0.642178",
"0.64168936",
"0.64096886",
"0.6404088",
"0.6404088",
"0.6404088",
"0.6404088",
"0.6404088",
"0.6404088",
"0.63955... | 0.0 | -1 |
=== Synopsys Colorize string (for terminals) Does not work with sprintf yet === Usage "ln s".colorize(:red) === Args +color+ symbol, one of the following (black, white, red, green, yellow, blue, magenta, cyan) +bold_or_options+ True/False or Hash | def colorize(color, bold_or_options = nil)
is_bold = bold_or_options.is_a?(TrueClass)
is_underline = false
if bold_or_options.is_a?(Hash)
is_bold ||= bold_or_options[:bold]
is_underline = bold_or_options[:underline]
end
raise ArgumentError('Color must be a symbol') unless color.is_a?(Symbol)
color_const = color.to_s.upcase.to_sym
raise ArgumentError('Unknown color') unless self.class.const_defined?(color_const)
ascii_color = self.class.const_get(color_const)
s = surround_with_ansi(ascii_color)
s = s.bold if is_bold
s = s.underline if is_underline
s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strcolor(string, color=nil)\n return string if !@@options[:colors] || color.nil?\n\n case color\n when \"green\"\n \"\\033[22;32m#{string}\\x1b[0m\"\n when \"red\"\n \"\\033[22;31m#{string}\\x1b[0m\"\n when \"yellow\"\n \"\\033[01;33m#{string}\\x1b[... | [
"0.7601311",
"0.7519027",
"0.73669726",
"0.732314",
"0.7266806",
"0.72519124",
"0.72188413",
"0.71786976",
"0.71720445",
"0.7159489",
"0.7138305",
"0.7128649",
"0.7115354",
"0.7106879",
"0.7076476",
"0.7031781",
"0.69989586",
"0.69989586",
"0.6990196",
"0.69695157",
"0.696097... | 0.767132 | 0 |
=== Synopsys Make text bolder (for ASCII terminals) | def bold
surround_with_ansi(ANSI_BOLD)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scr_bold\n print \"\\33[1m\"\nend",
"def compromised_text\n clear\n tab; \"The alarm has been triggered.\\n\".typing\n tab; \"The mission has been compromised\\n\".typing\n sleep 1\n tab; \"They're closing in, Agent!\\n\".typing\n ... | [
"0.5920899",
"0.5794868",
"0.5752409",
"0.5649489",
"0.562089",
"0.56078386",
"0.5568929",
"0.555409",
"0.55521154",
"0.55458385",
"0.55333036",
"0.55236226",
"0.55061984",
"0.54967844",
"0.54967844",
"0.5453137",
"0.54408693",
"0.54408693",
"0.54389817",
"0.5422164",
"0.5417... | 0.5105682 | 76 |
=== Synopsys Make text underlined (for ASCII terminals) | def underline
surround_with_ansi(ANSI_UNDERLINE)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scr_bold\n print \"\\33[1m\"\nend",
"def underline; end",
"def underline; end",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(strin... | [
"0.7141815",
"0.7056679",
"0.7056679",
"0.6974041",
"0.6918679",
"0.6918679",
"0.6918679",
"0.6890544",
"0.6847274",
"0.6729774",
"0.66177917",
"0.64840543",
"0.64742786",
"0.6465575",
"0.64550126",
"0.64115155",
"0.63656527",
"0.63522446",
"0.62726873",
"0.6267293",
"0.62640... | 0.71809137 | 0 |
=== Synopsys remove colors from colorized string | def remove_colors
gsub(/\e\[\d+m/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_color_codes(text); end",
"def strip_color\n gsub(COLOR_REGEXP, '')\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/, '')\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/ , '')\n end",
"def uncolorize(string)\n... | [
"0.83183074",
"0.826363",
"0.81153893",
"0.8087007",
"0.80825967",
"0.8005711",
"0.7948494",
"0.7946675",
"0.77459824",
"0.7694357",
"0.7694357",
"0.75433403",
"0.75425637",
"0.7540804",
"0.75344676",
"0.75166833",
"0.74365103",
"0.739446",
"0.73661536",
"0.7256948",
"0.72524... | 0.8323858 | 0 |
Public: returns copy of string with all nonprintable characters removed Examples "q\uFFFEw\uFFFFe\uFFF0r\uFDD0t\uFDEFy".remove_nonprintable => "qwerty" Returns String | def remove_nonprintable
gsub(/[^[:print:]\n\t]/i, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_unprintable_characters(s)\n s.tr(8204.chr, \"\")\nend",
"def remove_nonprintable!\n replace(remove_nonprintable)\n end",
"def strip_non_ascii_chars(s)\n # truncate the string at the first null character\n s = s[0, s.index(\"\\x00\")] if s.index(\"\\x00\")\n \n s.gsub(/[^\\x20... | [
"0.84281784",
"0.78361064",
"0.7323828",
"0.7111021",
"0.70598125",
"0.7049634",
"0.6781265",
"0.6347388",
"0.62633306",
"0.6257677",
"0.62092805",
"0.6189821",
"0.61353105",
"0.61323464",
"0.6034439",
"0.60297114",
"0.6018472",
"0.6007184",
"0.59854007",
"0.59781754",
"0.595... | 0.830668 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.