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 |
|---|---|---|---|---|---|---|
Test 4: Cancel Delete Media Inline Comment | def test04_post_closed_news_CancelDeleteMediaOneComment
login $user_1_email, $master_password
$browser.goto($patch_news_post_closed_article)
sleep 2
commentPopSubmit "Test Comment #{random}"
sleep 2
commentCancelDelete
assert $comment_delete_link.exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test04_post_closed_board_CancelDeleteMediaOneComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_note)\n\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentCancelDelete\n\t\t\n\t\tassert $comment_delete_link.exists?\n\tend",
"def test04_pos... | [
"0.7669983",
"0.7620377",
"0.75955313",
"0.7094897",
"0.6968685",
"0.69457847",
"0.6940329",
"0.6884849",
"0.6854352",
"0.68494004",
"0.68075156",
"0.6762384",
"0.67279536",
"0.67084086",
"0.66646934",
"0.66360396",
"0.66225445",
"0.64835477",
"0.64769596",
"0.6419787",
"0.63... | 0.76182294 | 2 |
Test 5: Flag Note Inline Comment | def test05_post_closed_news_FlagNoteComment
login $user_1_email, $master_password
$browser.goto($patch_news_post_closed_note)
sleep 2
commentPopSubmit "Test Comment #{random}"
sleep 2
commentFlag
sleep 1
assert $comment_flag_success.exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_comment(line) \n end",
"def comment?; end",
"def comment?; end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def test04_FlagNoteComment\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFl... | [
"0.7198939",
"0.7009388",
"0.7009388",
"0.6941635",
"0.6941635",
"0.6941635",
"0.6941635",
"0.6928142",
"0.68475497",
"0.66972786",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
"0.6676598",
... | 0.68194926 | 9 |
Sums disk size of all disks within the virtual machine | def sum_disk_size(disks, vm_id)
return nil unless disks
disk_size = 0
disks.each do |disk|
size = default(disk['size'], :number, nil)
unless size
log.warn("Disk size invalid for vm with id #{vm_id}")
return nil
end
disk_size += size.to_i
end
disk_size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_disk_size\n if @partition_layout.find { |p| !p.size_mb.is_a?(Integer) }\n raise RuntimeError, \"Some partition sizes unspecified, cannot infer \"\\\n \"total size of all partitions\"\n end\n\n @partition_layout.inject(0) { |memo, elem| memo + elem.size_mb } \\\n + FIRST_PART... | [
"0.7563887",
"0.7440332",
"0.72365975",
"0.67536557",
"0.6727703",
"0.6648499",
"0.6643116",
"0.64139825",
"0.62922883",
"0.6252702",
"0.6186295",
"0.6160119",
"0.61461896",
"0.61187255",
"0.6117025",
"0.60948765",
"0.6026546",
"0.6003784",
"0.594552",
"0.5926578",
"0.5922849... | 0.7668819 | 0 |
The match groups for the current scan. | def matches
m = (1..9).map { |i| ss[i] }
m.pop until m[-1] or m.empty?
m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups\n match(/Groups\\s+:\\s+(.+)$/).split rescue []\n end",
"def groups\n @@groups = Group.groups if @@groups.nil? or @@groups.empty?\n @@groups\n end",
"def groups\n find(:group).map { |g| g.content }\n end",
"def matches\n @matches ||= []\n end",
"def... | [
"0.72194785",
"0.6638707",
"0.648577",
"0.6427658",
"0.6396176",
"0.63116765",
"0.6241718",
"0.6224375",
"0.6223409",
"0.6087609",
"0.60640097",
"0.6061764",
"0.60381603",
"0.6026888",
"0.60189897",
"0.60189897",
"0.6000992",
"0.5979173",
"0.5979173",
"0.5979173",
"0.58929485... | 0.0 | -1 |
Yields on the current action. | def action
yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yield\n @eff.yield.perform\n end",
"def yield!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 85 )\n\n type = YIELD\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 206:9: 'yield'\n ... | [
"0.6837829",
"0.66021365",
"0.6566684",
"0.6561242",
"0.65566164",
"0.6536764",
"0.6514061",
"0.6509614",
"0.6381067",
"0.63654613",
"0.63527995",
"0.6236162",
"0.62058985",
"0.6197538",
"0.6179291",
"0.6160574",
"0.61413884",
"0.61255014",
"0.6083853",
"0.6058326",
"0.605670... | 0.80907184 | 3 |
The current column, starting at 0. Only available if the :column option is on. | def column
old_pos - start_of_current_line_pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_column\n @col_offset\n end",
"def column\n @__col\n end",
"def getCol\n return @col\n end",
"def column\n $curwin.cursor.last\n end",
"def column_number\n env(:column_number).to_i - 1\n end",
"def column\n location&.column\n end",
"def column\... | [
"0.86379266",
"0.8303044",
"0.79437315",
"0.7679114",
"0.7671831",
"0.75441444",
"0.74412584",
"0.7432655",
"0.7432655",
"0.7432655",
"0.7432655",
"0.7432655",
"0.7432655",
"0.7432655",
"0.7421354",
"0.7337315",
"0.73184335",
"0.72825295",
"0.7241487",
"0.7139014",
"0.7133696... | 0.7474064 | 6 |
Parse the file by getting all tokens and calling lex_+type+ on them. | def do_parse
while token = next_token do
type, *vals = token
send "lex_#{type}", *vals
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 59)\n\n type = TOKENS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 596:4: 'tokens' WS_LOOP '{'\n match(\"tokens\")\n ws_loop!\... | [
"0.61286277",
"0.6077936",
"0.58176905",
"0.5771792",
"0.5752984",
"0.57261753",
"0.5696792",
"0.55376655",
"0.55376655",
"0.55376655",
"0.55376655",
"0.5529604",
"0.5522176",
"0.55052465",
"0.5472602",
"0.5453005",
"0.54524404",
"0.5438209",
"0.5420852",
"0.54180914",
"0.539... | 0.74611926 | 0 |
Parse the given string. | def parse str
self.ss = scanner_class.new str
self.lineno = 1
self.start_of_current_line_pos = 0
self.state ||= nil
do_parse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(str); end",
"def parse(str)\n RubyParser.new.parse(str.deep_clone)\n end",
"def parse(str)\n parse!(str.dup)\n end",
"def parse(str)\n read_items(tokenize(str))\n end",
"def parse(string)\n @string = string\n ast = parse_string string\n show_syntax_error unless ... | [
"0.839498",
"0.77229536",
"0.76782113",
"0.7631793",
"0.7594726",
"0.7497838",
"0.74929595",
"0.72698754",
"0.72423077",
"0.72423077",
"0.72423077",
"0.72423077",
"0.7232628",
"0.7227154",
"0.72257185",
"0.7125306",
"0.70074135",
"0.69919276",
"0.69395965",
"0.6892062",
"0.68... | 0.72171754 | 15 |
Read in and parse the file at +path+. | def parse_file path
self.filename = path
open path do |f|
parse f.read
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(path)\n if (!File.exists?(path))\n LOGGER.e {\"Unable to open specified file to parse: '#{path}'\"}\n return nil\n end\n \n File.open(path, 'r') do |f|\n parse_stream(f)\n end\n end",
"def read(path); end",
"def parse_file(path, options={})\n File.open(path)... | [
"0.7991975",
"0.7509768",
"0.7480806",
"0.74571276",
"0.7437396",
"0.7406922",
"0.71964014",
"0.71344703",
"0.7089082",
"0.70380133",
"0.70324296",
"0.6877825",
"0.68056524",
"0.6725237",
"0.6715227",
"0.6703198",
"0.66993946",
"0.66308206",
"0.6607159",
"0.65668046",
"0.6564... | 0.7846087 | 4 |
The current location in the parse. | def location
[
(filename || "<input>"),
lineno,
column,
].compact.join(":")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_loc\r\n\t\treturn driver.location\r\n\tend",
"def current_location\n object.location\n end",
"def location\n return @location\n end",
"def getLocation\r\n\t\t\t\t\treturn @location\r\n\t\t\t\tend",
"def get_current_location\n\t \tif Rails.env.test? || Rails.env... | [
"0.7871264",
"0.76558113",
"0.75980514",
"0.7489309",
"0.73702884",
"0.7361555",
"0.7361555",
"0.7320195",
"0.72030425",
"0.7089098",
"0.7075314",
"0.70482206",
"0.70379466",
"0.7033453",
"0.7021382",
"0.6991106",
"0.6967649",
"0.6949056",
"0.69464207",
"0.6940347",
"0.691292... | 0.0 | -1 |
Lex the next token. | def next_token
token = nil
until ss.eos? or token do
if ss.check(/\n/) then
self.lineno += 1
# line starts 1 position after the newline
self.start_of_current_line_pos = ss.pos + 1
end
self.old_pos = ss.pos
token =
case state
when nil, :option, :inner, :start, :macro, :rule, :group then
case
when ss.skip(/options?.*/) then
[:state, :option]
when ss.skip(/inner.*/) then
[:state, :inner]
when ss.skip(/macros?.*/) then
[:state, :macro]
when ss.skip(/rules?.*/) then
[:state, :rule]
when ss.skip(/start.*/) then
[:state, :start]
when ss.skip(/end/) then
[:state, :END]
when ss.skip(/\A((?:.|\n)*)class ([\w:]+.*)/) then
action { [:class, *matches] }
when ss.skip(/\n+/) then
# do nothing
when text = ss.scan(/\s*(\#.*)/) then
action { [:comment, text] }
when (state == :option) && (ss.skip(/\s+/)) then
# do nothing
when (state == :option) && (text = ss.scan(/stub/i)) then
action { [:option, text] }
when (state == :option) && (text = ss.scan(/debug/i)) then
action { [:option, text] }
when (state == :option) && (text = ss.scan(/do_parse/i)) then
action { [:option, text] }
when (state == :option) && (text = ss.scan(/lineno/i)) then
action { [:option, text] }
when (state == :option) && (text = ss.scan(/column/i)) then
action { [:option, text] }
when (state == :inner) && (text = ss.scan(/.*/)) then
action { [:inner, text] }
when (state == :start) && (text = ss.scan(/.*/)) then
action { [:start, text] }
when (state == :macro) && (ss.skip(/\s+(\w+)\s+#{RE}/o)) then
action { [:macro, *matches] }
when (state == :rule) && (ss.skip(/\s*#{ST}?[\ \t]*#{RE}[\ \t]*#{ACT}?/o)) then
action { [:rule, *matches] }
when (state == :rule) && (ss.skip(/\s*:[\ \t]*#{RE}/o)) then
action { [:grouphead, *matches] }
when (state == :group) && (ss.skip(/\s*:[\ \t]*#{RE}/o)) then
action { [:grouphead, *matches] }
when (state == :group) && (ss.skip(/\s*\|\s*#{ST}?[\ \t]*#{RE}[\ \t]*#{ACT}?/o)) then
action { [:group, *matches] }
when (state == :group) && (ss.skip(/\s*#{ST}?[\ \t]*#{RE}[\ \t]*#{ACT}?/o)) then
action { [:groupend, *matches] }
else
text = ss.string[ss.pos .. -1]
raise ScanError, "can not match (#{state.inspect}) at #{location}: '#{text}'"
end
when :END then
case
when ss.skip(/\n+/) then
# do nothing
when text = ss.scan(/.*/) then
action { [:end, text] }
else
text = ss.string[ss.pos .. -1]
raise ScanError, "can not match (#{state.inspect}) at #{location}: '#{text}'"
end
else
raise ScanError, "undefined state at #{location}: '#{state}'"
end # token = case state
next unless token # allow functions to trigger redo w/ nil
end # while
raise LexerError, "bad lexical result at #{location}: #{token.inspect}" unless
token.nil? || (Array === token && token.size >= 2)
# auto-switch state
self.state = token.last if token && token.first == :state
token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_token\n @current_token = @lexer.next_token\n end",
"def lex(&block)\n loop do\n token = self.next\n yield token\n break if token.eof?\n end\n end",
"def next_token\n tokens.shift\n end",
"def next_token\n\t\t@tokens.next_token\n\tend",
"def n... | [
"0.7772654",
"0.7506009",
"0.7184743",
"0.71066713",
"0.70542276",
"0.7037711",
"0.6981141",
"0.69334114",
"0.68808484",
"0.68808484",
"0.68537647",
"0.67833954",
"0.6782427",
"0.6780215",
"0.67347527",
"0.6701526",
"0.6688408",
"0.6678834",
"0.66731066",
"0.658205",
"0.65680... | 0.59639674 | 64 |
=> "Bienvenido a nuestro sitio, Oscar Vasquez!" | def nuevo_usuario saludo="Wenas", nombre: "Giovanni", apellido: "Franco"
puts "#{saludo}, #{nombre} #{apellido}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affichage_bienvenue\nputs\"------------------------------------------------\n|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |\n|Le but du jeu est d'être le dernier survivant !|\n-------------------------------------------------\"\nend",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n... | [
"0.6679216",
"0.6622785",
"0.6613474",
"0.6540045",
"0.6490878",
"0.6467363",
"0.638165",
"0.638035",
"0.63612133",
"0.6346276",
"0.63360864",
"0.6314281",
"0.6300036",
"0.6285831",
"0.62811387",
"0.62594426",
"0.625538",
"0.6251041",
"0.6218661",
"0.6204945",
"0.61899203",
... | 0.0 | -1 |
Initialize the inner_hits definition. | def initialize(name=nil, &block)
@value = name ? { name: name } : {}
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_hits(name, &block)\n @inner_hits = Queries::InnerHits.new(name, &block)\n self\n end",
"def initialize (search_hits, keywords=Array.new)\n @hits = search_hits.compact\n @used_keywords = keywords\n end",
"def initialize(hits,miss,entries,size)\n @cache_hits=hits\n ... | [
"0.7312223",
"0.62248445",
"0.6112423",
"0.6078146",
"0.58497757",
"0.5713743",
"0.57039297",
"0.5584902",
"0.55086005",
"0.5502053",
"0.54987544",
"0.54987544",
"0.54987544",
"0.54932195",
"0.54813576",
"0.5451611",
"0.5431068",
"0.5429391",
"0.5381686",
"0.53424054",
"0.532... | 0.0 | -1 |
Specify the size setting on the inner_hits definition, the maximum number of hits to return per inner_hits. By default the top three matching hits are returned. | def size(size)
@value[:size] = size
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_hits_agg(size: 100, &block)\r\n agg = { agg: { top_hits: { size: size } } }\r\n base_agg(agg, block)\r\n end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def size\n @size ||= search.size\n end"... | [
"0.5910879",
"0.5695278",
"0.5695278",
"0.5695278",
"0.56728876",
"0.5607413",
"0.55971926",
"0.5595755",
"0.5584956",
"0.5479023",
"0.54138833",
"0.5375011",
"0.537202",
"0.53141385",
"0.5268083",
"0.52396697",
"0.51625884",
"0.51605433",
"0.5126971",
"0.51029176",
"0.509711... | 0.0 | -1 |
Specify the from setting on the inner_hits definition, the offset from where the first hit to fetch for each inner_hits in the returned regular search hits. | def from(from)
@value[:from] = from
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_query_offset\n (hits_requested - 1) / 2\n end",
"def offset(from = 0)\n clone.tap { |query| query.from = from }\n end",
"def offset\n if page <= 1\n # We want first page of results\n 0\n else\n # Max offset for search API is 999\n # If there ar... | [
"0.61535347",
"0.59118974",
"0.5675037",
"0.54538816",
"0.53090334",
"0.5197817",
"0.51748174",
"0.514483",
"0.5126061",
"0.51150393",
"0.5080042",
"0.5070196",
"0.49521276",
"0.4950549",
"0.4871911",
"0.48718858",
"0.48701736",
"0.48494264",
"0.48494264",
"0.48451683",
"0.48... | 0.0 | -1 |
Specify the sorting on the inner_hits definition. By default the hits are sorted by the score. | def sort(*args, &block)
if !args.empty? || block
@sort = Sort.new(*args, &block)
self
else
@sort
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def sort_hits!\n @array.sort! do |a, b|\n code = a.hit[:code] <=> b.hit[:code]\n next code unless code.zero?\n\n b.hit[:release_date] <=> a.hit[:release_date]\n end\n self\n end",
"def rank(hits)\n\t\th... | [
"0.7079263",
"0.6229402",
"0.6110913",
"0.60737246",
"0.6050088",
"0.57671934",
"0.5668329",
"0.5656075",
"0.5590872",
"0.55580145",
"0.55340785",
"0.5487412",
"0.5483096",
"0.5482553",
"0.54735297",
"0.544484",
"0.54216963",
"0.5420557",
"0.53676146",
"0.5367204",
"0.5358428... | 0.0 | -1 |
Convert the definition to a hash, to be used in a search request. | def to_hash
call
@hash = @value
@hash[:sort] = @sort.to_hash if @sort
@hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash() end",
"def hash\n to_s.hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_hash # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/M... | [
"0.6859415",
"0.67813313",
"0.6766653",
"0.67011464",
"0.66629",
"0.664822",
"0.6480873",
"0.64639324",
"0.64639324",
"0.64538985",
"0.6428136",
"0.6428136",
"0.6428136",
"0.6428136",
"0.6428136",
"0.6428136",
"0.64093244",
"0.6400828",
"0.63811624",
"0.6369216",
"0.63399416"... | 0.0 | -1 |
GET /recipes GET /recipes.json | def index
@recipes = Recipe.all
@recipe = current_user.recipes.new if can? :new, Recipe
respond_to do |format|
format.html # index.html.erb
format.json { render json: @recipes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def index\n info = Aws.get_recipes_from_db\n render... | [
"0.8315941",
"0.76739687",
"0.76456314",
"0.75547504",
"0.7492078",
"0.7476003",
"0.74459517",
"0.7393438",
"0.7300475",
"0.7273354",
"0.72657275",
"0.7214473",
"0.7162102",
"0.71540695",
"0.7122386",
"0.71124816",
"0.7101849",
"0.7057095",
"0.7057095",
"0.7057095",
"0.705709... | 0.6394012 | 81 |
GET /recipes/1 GET /recipes/1.json | def show
# @recipe.ingredients.build
@new_ingredient = Ingredient.new
@new_ingredient.recipe = @recipe
# @flag = @recipe.flags.create
respond_to do |format|
format.html # show.html.erb
format.json { render json: @recipe }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end",
"def show\n resp... | [
"0.79409945",
"0.7901794",
"0.758486",
"0.7567964",
"0.7435599",
"0.7431769",
"0.7403111",
"0.73563355",
"0.73249334",
"0.73046607",
"0.7285358",
"0.7261962",
"0.7237502",
"0.7110716",
"0.708998",
"0.7004769",
"0.7004181",
"0.69778025",
"0.6964269",
"0.6949338",
"0.6949338",
... | 0.0 | -1 |
GET /recipes/new GET /recipes/new.json | def new
@recipe = Recipe.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @recipe }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # @recipe = Recipe.new\n #\n new! do |format|\n # format.html # new.html.erb\n # format.json { render json: @recipe }\n end\n end",
"def new\n @food_recipe = FoodRecipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_rec... | [
"0.7583094",
"0.7525324",
"0.75002795",
"0.7445067",
"0.7445067",
"0.7428469",
"0.741774",
"0.73819894",
"0.735984",
"0.7297518",
"0.72824967",
"0.72231114",
"0.72115254",
"0.7210955",
"0.72013307",
"0.71909845",
"0.7190321",
"0.7186308",
"0.71835005",
"0.71835005",
"0.714600... | 0.8032762 | 3 |
GET /recipes/1/edit def edit | def create
if params["donor"]
@recipe = Recipe.find(params["donor"]).clone_with_ingredients(params["recipe"])
@recipe.user = current_user
else
@recipe = Recipe.new(params["recipe"])
end
@recipe.user = current_user
respond_to do |format|
if @recipe.save
format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }
format.json { render json: @recipe, status: :created, location: @recipe }
else
format.html { render action: "new" }
format.json { render json: @recipe.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@recipe = Recipe.find(params[:id])\n\tend",
"def edit\n @recipe = Recipe.find(params[:id])\n end",
"def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end",
"def edit\n @recipe = Recipe.find(params[:id])\nend",
"def edit\n @page_title = \"Edit Recipe\"\n @recipe = cur... | [
"0.8768569",
"0.8739414",
"0.8611329",
"0.85578775",
"0.8213509",
"0.8213509",
"0.8104684",
"0.8015638",
"0.7453703",
"0.7416306",
"0.73971605",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
"0.7384978",
... | 0.0 | -1 |
PUT /recipes/1 PUT /recipes/1.json | def update
@recipe = Recipe.find(params[:id])
respond_to do |format|
if @recipe.update_attributes(params[:recipe])
format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @recipe.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n r... | [
"0.74094033",
"0.7145533",
"0.71189857",
"0.7044346",
"0.6945909",
"0.68607664",
"0.6834851",
"0.68348265",
"0.6766721",
"0.6739318",
"0.6734383",
"0.6681905",
"0.6641105",
"0.66234",
"0.66195375",
"0.66093194",
"0.6589371",
"0.6474113",
"0.6441488",
"0.6432353",
"0.6423691",... | 0.66983527 | 14 |
DELETE /recipes/1 DELETE /recipes/1.json | def destroy
@recipe = Recipe.find(params[:id])
@recipe.destroy
respond_to do |format|
format.html { redirect_to recipes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredient... | [
"0.8262355",
"0.82037795",
"0.7745781",
"0.7639039",
"0.76315737",
"0.76171106",
"0.7603177",
"0.7567672",
"0.74741817",
"0.7472334",
"0.74475104",
"0.7441589",
"0.7441589",
"0.7441589",
"0.7441589",
"0.7441589",
"0.7422039",
"0.74145687",
"0.7334797",
"0.7334797",
"0.7317784... | 0.7551312 | 12 |
GET /bug_tickets or /bug_tickets.json | def index
if current_user.role == "lead" || current_user.admin
@q = BugTicket.ransack(params[:q])
@bug_tickets = BugTicket.all
@bug_tickets_search = @q.result(distinct: true)
elsif current_user.role == "support"
@support_bug_tickets = BugTicket.filter_by_support_user(current_user.id)
@q = @support_bug_tickets.ransack(params[:q])
@bug_tickets_search = @q.result(distinct: true)
else
@user_bug_tickets = BugTicket.where(owner: current_user.email)
@q = @user_bug_tickets.ransack(params[:q])
@bug_tickets_search = @q.result(distinct: true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@curre... | [
"0.6926849",
"0.68266475",
"0.67867565",
"0.6766333",
"0.6571228",
"0.65564907",
"0.6535323",
"0.653433",
"0.6515011",
"0.6467531",
"0.6460319",
"0.64153284",
"0.6395943",
"0.6395943",
"0.6395943",
"0.6395943",
"0.6395943",
"0.6395943",
"0.6393753",
"0.63886166",
"0.63859934"... | 0.0 | -1 |
GET /bug_tickets/1 or /bug_tickets/1.json | def show
@bug_tickets = @bug_ticket.versions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
... | [
"0.7123173",
"0.6935194",
"0.68030137",
"0.6725955",
"0.66340584",
"0.65673095",
"0.65517896",
"0.6549004",
"0.654875",
"0.654875",
"0.6488648",
"0.64790225",
"0.6401019",
"0.6391549",
"0.6391549",
"0.6391549",
"0.6391549",
"0.6391549",
"0.6391549",
"0.6377128",
"0.63184756",... | 0.6659727 | 4 |
POST /bug_tickets or /bug_tickets.json | def create
@bug_ticket = BugTicket.new(bug_ticket_params)
@bug_ticket.owner = current_user.email
@users_support = User.all.select { |u| u.role != 'user' }
if current_user.role != 'user'
params[:users][:id].each do |user|
@bug_ticket.bug_ticket_users.build(user_id: user) unless user.empty?
end
end
respond_to do |format|
if @bug_ticket.save
format.html { redirect_to bug_tickets_path, notice: 'Bug ticket was successfully created.' }
format.json { render :show, status: :created, location: @bug_ticket }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @bug_ticket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end",
"def create_ticket\n jiraPair = @defect.getJiraList\n mapping = jiraAPIMapping\n payload = {\n :fields =>\n {:project =>\n {:key... | [
"0.7012541",
"0.6735746",
"0.6575644",
"0.6575644",
"0.6492541",
"0.6477169",
"0.64134014",
"0.64132214",
"0.6384318",
"0.63371694",
"0.63287896",
"0.6326433",
"0.63086486",
"0.6264844",
"0.62454176",
"0.62316",
"0.62178457",
"0.61994404",
"0.6197994",
"0.61852574",
"0.618033... | 0.6262091 | 14 |
PATCH/PUT /bug_tickets/1 or /bug_tickets/1.json | def update
@users_support = User.all.select { |u| u.role != 'user' }
if current_user.role != 'user'
@bug_ticket.bug_ticket_users.clear
params[:users][:id].each do |user|
@bug_ticket.bug_ticket_users.build(user_id: user) unless user.empty?
end
end
respond_to do |format|
if @bug_ticket.update(bug_ticket_params)
format.html { redirect_to @bug_ticket, notice: 'Bug ticket was successfully updated.' }
format.json { render :show, status: :ok, location: @bug_ticket }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @bug_ticket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n if @bug.update_attributes(params[:bug])\n format.html { redirect_to @bug, notice: 'B... | [
"0.7097368",
"0.68695295",
"0.68695295",
"0.6838627",
"0.6834542",
"0.6831439",
"0.6711812",
"0.67107004",
"0.67107004",
"0.67107004",
"0.6705828",
"0.66698825",
"0.66678274",
"0.6660299",
"0.6660299",
"0.6660299",
"0.6660299",
"0.6660299",
"0.66582817",
"0.6632974",
"0.65955... | 0.0 | -1 |
DELETE /bug_tickets/1 or /bug_tickets/1.json | def destroy
@bug_ticket.destroy
respond_to do |format|
format.html { redirect_to bug_tickets_url, notice: 'Bug ticket was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @client_bug.destroy\n respond_to do |format|\n format.html { redirect_to client_bugs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @... | [
"0.7514069",
"0.7189794",
"0.7187583",
"0.7187583",
"0.70620364",
"0.7061343",
"0.7061343",
"0.7061343",
"0.7061343",
"0.7061343",
"0.7048934",
"0.70236605",
"0.70105666",
"0.69615626",
"0.69615626",
"0.69615626",
"0.69615626",
"0.69615626",
"0.69615626",
"0.69436955",
"0.692... | 0.7298479 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_bug_ticket
@bug_ticket = BugTicket.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 bug_ticket_params
params.require(:bug_ticket).permit(:bug_behavior, :environment, :status, :priority, :owner, :comment, :category, :main_image, :project_id)
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 |
check if the airport is within the radius of the | def withinRadius(latitude,longitiude,radius)
rad = 3963.1676
lat1 = to_rad(latitude.to_f)
lat2 = to_rad(self.latitude.to_f)
lon1 = to_rad(longitiude.to_f)
lon2 = to_rad(self.longitude.to_f)
dLat = lat2-lat1
dLon = lon2-lon1
a = Math::sin(dLat/2) * Math::sin(dLat/2) +
Math::cos(lat1) * Math::cos(lat2) *
Math::sin(dLon/2) * Math::sin(dLon/2);
c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a));
distance = rad * c
#logger.debug "distance IS"
#logger.debug distance
#logger.debug "radius IS"
#logger.debug radius
return distance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_range?(radius:, location:)\n (((location.latitude - @latitude) ** 2) + ((location.longitude - @longitude) ** 2)) < (radius ** 2)\n end",
"def in_radius?(lat, lng, distance = nil)\n return false unless ([lat,lng].all? && (radius.present? || distance.present?))\n distance_from([lat,lng], :km) <= (... | [
"0.74392635",
"0.69674015",
"0.6553763",
"0.6546672",
"0.64894265",
"0.64626604",
"0.64519775",
"0.6441727",
"0.64345384",
"0.6421882",
"0.6378081",
"0.6247989",
"0.6245603",
"0.624226",
"0.6241998",
"0.61935323",
"0.61850804",
"0.61656815",
"0.6136147",
"0.61318964",
"0.6128... | 0.65377045 | 4 |
implement this function in your pricing verification steps | def validates_pricing?(item)
raise "Pricing verification #{self.name} has not implemented delegate validation function"
# in your implementation, you're gonna wanna return true or false to indicate
# whether the given item validates or not
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_price\n end",
"def price_is_right(bids, actual_retail_price)\n \nend",
"def price\n \n end",
"def price_is_right(bids, actual_retail_price)\n #\n # your code goes here\n #\nend",
"def validate_pricing(promocode, submitted_promocode = nil, cart = nil)\n nil\n end",
"def pric... | [
"0.75974035",
"0.6747341",
"0.6745338",
"0.67100626",
"0.6612536",
"0.65509087",
"0.6514105",
"0.6514105",
"0.645946",
"0.6400884",
"0.6378269",
"0.6351729",
"0.6339265",
"0.6326931",
"0.6309485",
"0.63009846",
"0.6293536",
"0.6280889",
"0.6272719",
"0.6271684",
"0.6254994",
... | 0.61444247 | 29 |
if Emox::BaseChannel.once_run("shared key", expires_in: 1.minute) ... end | def once_run(key, options = {})
raise ArgumentError unless key
if key.kind_of? Array
raise ArgumentError unless key.flatten.all?
key = key.join("/")
end
options = {
expires_in: 1.hours,
}.merge(options)
# https://qiita.com/shiozaki/items/b746dc4bb5e1e87c0528
values = redis.multi do
redis.incr(key)
redis.expire(key, options[:expires_in])
end
counter = values.first
Rails.logger.debug([__method__, {key: key, counter: counter, expires_in: redis.ttl(key)}])
counter == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def once_per_run(key, &block)\n Pedant::OncePerRun.once_per_run(key, &block)\n end",
"def once\n end",
"def simulate_expire; end",
"def once\n @once\n end",
"def run(current_expire = @expire)\n if 0 == current_expire\n run_once while not empty?\n else\n @end_t... | [
"0.63826525",
"0.58879524",
"0.5850821",
"0.58265233",
"0.5678668",
"0.56053406",
"0.5599045",
"0.5586025",
"0.5570672",
"0.5570672",
"0.555633",
"0.5532463",
"0.5531064",
"0.55037344",
"0.54795855",
"0.54795855",
"0.53998184",
"0.5364356",
"0.5346112",
"0.5346112",
"0.533652... | 0.62767184 | 1 |
GET /purchase_orders GET /purchase_orders.xml | def index
@search = PurchaseOrder.search(params[:search])
@purchase_orders = @search.order('purchase_order_date DESC, created_at DESC').all.uniq.paginate(:page => params[:page], :per_page => 20)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @purchase_orders }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_order(purchase_order, options={})\n params = { :klass => Invoicexpress::Models::PurchaseOrder }\n\n get(\"purchase_orders/#{id_from_purchase_order(purchase_order)}.xml\", params.merge(options))\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get... | [
"0.711933",
"0.7022439",
"0.6938693",
"0.6889104",
"0.68635595",
"0.68635595",
"0.6811278",
"0.6790314",
"0.6737723",
"0.67364055",
"0.67179865",
"0.67179865",
"0.67179865",
"0.67179865",
"0.67179865",
"0.67112046",
"0.6706442",
"0.66866785",
"0.6629791",
"0.66297334",
"0.661... | 0.6303662 | 42 |
GET /purchase_orders/1 GET /purchase_orders/1.xml | def show
@purchase_order = PurchaseOrder.find(params[:id])
@current_items = @purchase_order.purchase_order_items
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @purchase_order }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_order(purchase_order, options={})\n params = { :klass => Invoicexpress::Models::PurchaseOrder }\n\n get(\"purchase_orders/#{id_from_purchase_order(purchase_order)}.xml\", params.merge(options))\n end",
"def index\n\n @soaps = Soap.find(:all)\n @user = User.find(:first)\n\n ... | [
"0.7091775",
"0.6913499",
"0.67326635",
"0.6700522",
"0.6700522",
"0.6638576",
"0.66066706",
"0.6592316",
"0.658999",
"0.65214074",
"0.65214074",
"0.65093434",
"0.65083987",
"0.6498576",
"0.6494688",
"0.64819616",
"0.64709175",
"0.6464438",
"0.6462831",
"0.6455419",
"0.645541... | 0.6660265 | 5 |
GET /purchase_orders/new GET /purchase_orders/new.xml | def new
@purchase_order = PurchaseOrder.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @purchase_order }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @order = Order.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def new\n @order = Order.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n fo... | [
"0.7582638",
"0.756695",
"0.7524168",
"0.7524168",
"0.7524168",
"0.7524168",
"0.7524168",
"0.7524168",
"0.7402734",
"0.73174125",
"0.72601545",
"0.721259",
"0.7201101",
"0.71719986",
"0.7171375",
"0.71248925",
"0.7081051",
"0.7047204",
"0.6989614",
"0.6966249",
"0.696622",
... | 0.77110976 | 0 |
POST /purchase_orders POST /purchase_orders.xml | def create
@purchase_order = PurchaseOrder.new(params[:purchase_order])
respond_to do |format|
if @purchase_order.save
format.html { redirect_to(@purchase_order, :notice => 'Purchase Order was successfully created.') }
format.xml { render :xml => @purchase_order, :status => :created, :location => @purchase_order }
else
format.html { render :action => "new" }
format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def create_order(order_params)\n res = request('post', \"https://#{orders_path}\", order_params)\n parse_response res\n end",
"def validate_order(... | [
"0.694238",
"0.68121755",
"0.65419525",
"0.64511853",
"0.6314265",
"0.62802523",
"0.6260682",
"0.62389755",
"0.62027913",
"0.62021786",
"0.6189975",
"0.61832875",
"0.61832875",
"0.61832875",
"0.61832875",
"0.6182132",
"0.61809856",
"0.61685395",
"0.61607224",
"0.6149426",
"0.... | 0.6609905 | 2 |
PUT /purchase_orders/1 PUT /purchase_orders/1.xml | def update
@purchase_order = PurchaseOrder.find(params[:id])
respond_to do |format|
if @purchase_order.update_attributes(params[:purchase_order])
format.html { redirect_to(@purchase_order, :notice => 'Purchase Order was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\n end",
"def update_purchase_order(purchase_order, options={})\n raise(ArgumentError, \"purchase order has the wrong type\") unless purchase_or... | [
"0.66767716",
"0.6604947",
"0.63604563",
"0.6167936",
"0.6148687",
"0.61384755",
"0.6127973",
"0.612295",
"0.60602045",
"0.60454255",
"0.60454255",
"0.60454255",
"0.60454255",
"0.60218775",
"0.6015421",
"0.60105354",
"0.5997341",
"0.59793913",
"0.59606713",
"0.59606713",
"0.5... | 0.65153694 | 2 |
DELETE /purchase_orders/1 DELETE /purchase_orders/1.xml | def destroy
@purchase_order = PurchaseOrder.find(params[:id])
@purchase_order.verify_for_destroy
flash[:notice] = "Purchase Order was successfully voided"
respond_to do |format|
format.html { redirect_to(purchase_orders_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |for... | [
"0.6822707",
"0.6793863",
"0.67114717",
"0.66966397",
"0.66016227",
"0.6585553",
"0.6557384",
"0.653265",
"0.653265",
"0.65212387",
"0.6508923",
"0.6507856",
"0.6497001",
"0.6497001",
"0.6497001",
"0.6497001",
"0.6497001",
"0.6497001",
"0.6497001",
"0.6497001",
"0.6497001",
... | 0.63733 | 35 |
Calculates the total columns each Arm Detail would take up | def getTotalNumArmDetailCols(arm_id)
totalcols = 0;
@armdetailsids.each do |armd_id|
totalcols = totalcols + getNumArmDetailCols(arm_id,armd_id)
end
return totalcols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTotalNumDesignDetailCols()\n @designdetailsids.each do |dd_id|\n totalcols = totalcols + getNumDesignDetailCols(dd_id)\n end\n return totalcols\n end",
"def getTotalNumOutcomeDetailCols()\n totalcols = 0;\n @outcomedetailsids.each do |outd_id|\n ... | [
"0.7156312",
"0.67219573",
"0.65604204",
"0.5845761",
"0.58099914",
"0.56882346",
"0.56170547",
"0.5612284",
"0.55358845",
"0.55356187",
"0.54961175",
"0.5493315",
"0.5465277",
"0.54497516",
"0.54286194",
"0.5424719",
"0.54212135",
"0.53954685",
"0.5391883",
"0.5356882",
"0.5... | 0.774206 | 0 |
Calculates the total columns each Design Detail would take up | def getTotalNumDesignDetailCols()
@designdetailsids.each do |dd_id|
totalcols = totalcols + getNumDesignDetailCols(dd_id)
end
return totalcols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTotalNumOutcomeDetailCols()\n totalcols = 0;\n @outcomedetailsids.each do |outd_id|\n totalcols = totalcols + getNumOutcomeDetailCols(outd_id)\n end\n return totalcols\n end",
"def getTotalNumArmDetailCols(arm_id)\n totalcols = 0;\n @armdetailsids.ea... | [
"0.6598371",
"0.65222317",
"0.64289075",
"0.6247586",
"0.6228428",
"0.6009616",
"0.589877",
"0.58883697",
"0.5881595",
"0.5864546",
"0.58634377",
"0.58595896",
"0.5855084",
"0.5744407",
"0.5681104",
"0.5675685",
"0.56709695",
"0.56652874",
"0.56455976",
"0.5641046",
"0.563540... | 0.8257413 | 0 |
Design Details EXCEL Export Methods Calculates the total span of columns for a design detail | def getDesignDetailColSpan(dd_name)
return getDesignDetailsEXCELLabels(dd_name).size()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTotalNumDesignDetailCols()\n @designdetailsids.each do |dd_id|\n totalcols = totalcols + getNumDesignDetailCols(dd_id)\n end\n return totalcols\n end",
"def columns_incdec howmany\n @gviscols += howmany.to_i\n @gviscols = 1 if @gviscols < 1\n @gviscols = 6 if @gviscol... | [
"0.71694845",
"0.61906457",
"0.6190134",
"0.60457253",
"0.58336985",
"0.5818065",
"0.55223966",
"0.5508399",
"0.54290354",
"0.54098237",
"0.5386596",
"0.5372861",
"0.5345448",
"0.530801",
"0.529611",
"0.528089",
"0.5260863",
"0.5233473",
"0.5231387",
"0.5207396",
"0.52038914"... | 0.6856889 | 1 |
Calculates the total columns each Baseline would take up | def getTotalNumBaselineCols(arm_id)
totalcols = 0;
@baselineids.each do |bl_id|
totalcols = totalcols + getNumBaselineCols(arm_id,bl_id)
end
return totalcols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_columns!\n\n\n\n span_count = columns_span_count\n\n\n\n columns_count = children.size\n\n\n\n\n\n\n\n all_margins_width = margin_size * (span_count - 1)\n\n\n\n ... | [
"0.65711373",
"0.59179294",
"0.58279216",
"0.5756773",
"0.5717094",
"0.567975",
"0.5640121",
"0.56146014",
"0.56108147",
"0.5593488",
"0.55819404",
"0.557201",
"0.555842",
"0.555333",
"0.55502135",
"0.5545796",
"0.55415195",
"0.55386525",
"0.55346584",
"0.551362",
"0.5498705"... | 0.67058444 | 0 |
Calculates the total columns each Outcome Detail would take up | def getTotalNumOutcomeDetailCols()
totalcols = 0;
@outcomedetailsids.each do |outd_id|
totalcols = totalcols + getNumOutcomeDetailCols(outd_id)
end
return totalcols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTotalNumDesignDetailCols()\n @designdetailsids.each do |dd_id|\n totalcols = totalcols + getNumDesignDetailCols(dd_id)\n end\n return totalcols\n end",
"def getTotalNumArmDetailCols(arm_id)\n totalcols = 0;\n @armdetailsids.each do |armd_id|\n to... | [
"0.67093074",
"0.6128453",
"0.5807907",
"0.5648569",
"0.56355804",
"0.56349945",
"0.5620514",
"0.5618505",
"0.559151",
"0.55792123",
"0.54990244",
"0.54882944",
"0.5463773",
"0.54543746",
"0.54445505",
"0.54113996",
"0.5408916",
"0.5399703",
"0.53793293",
"0.53771275",
"0.537... | 0.7888984 | 0 |
=begin =end =begin Ruby Foundations: Blocks =end | def increment(number)
if block_given?
yield(number + 1)
else
number + 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"... | [
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206",
"0.73699206"... | 0.0 | -1 |
array3 = [] loop do array3 << array1.shift array3 << array2.shift break if array2.empty? end array3 end | def interleave(array1, array2)
array1.zip(array2).flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_concat(array_1, array_2)\n # Your code here\n \n new_array = Array.new\n array_1.each do |entry|\n if array_1.empty? == false\n new_array.push(entry)\n end\n end\n \n array_2.each do |entry|\n if array_2.empty? == false\n new_array.push(entry)\n end\n end\n ... | [
"0.7700531",
"0.7612516",
"0.75539976",
"0.75395834",
"0.75277203",
"0.7511273",
"0.74614704",
"0.7386016",
"0.73852295",
"0.7384887",
"0.73762",
"0.7317178",
"0.7267158",
"0.7242217",
"0.7239676",
"0.7233521",
"0.72309834",
"0.7208195",
"0.72049236",
"0.7195294",
"0.71760094... | 0.0 | -1 |
Public Interface This method calculates the eurToRon rate on a certain `date`. `:data`: is the date on the rate will be calculated. | def eurToRON(date, app_id = ENV['APP_ID'])
result = {}
rates_url = "https://openexchangerates.org/api/historical/#{date}.json?app_id=#{app_id}&symbols=EUR,RON"
response = RestClient.get rates_url
parsed_response = JSON.parse(response)
rates = parsed_response["rates"]
usdeur = rates["EUR"] # USD/EUR 1 USD in EUR
usdron = rates["RON"] # USD/RON means 1 USD in RON
# Conversion conventions
# ----
#
# Generally: <original currency>/<target currency>
# means for 1 <original currency> in <target currency>
#
# EUR/RON means: 1 EUR in RON
#
# NOT like in physics, where:
# <target currency>/<original currency> * <original currency value> = <targetcurrency value>
#
# The formula for converting from `EUR to RON` based on `usd/eur` and `usd/ron` rates.
# ---
#
# Input: `usd/eur`, `usd/ron`
# Output: `eur/ron`
#
# eurron =
# = eur/ron
# = eur/ron * usd/usd
# = usd/ron * eur/usd
# = usd/ron / usd/eur
# = usdron/usdeur
#
eurron = usdron/usdeur
result[:date] = date
result[:usdron] = usdron
result[:usdeur] = usdeur
result[:eurron] = eurron
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revenue(date)\n end",
"def get_date_rate(date, currency)\n api_data = get_api_data(date)\n api_data[\"rates\"][currency]\n end",
"def load_data(date)\n doc = Yajl::Parser.parse(open(rates_source(date)).read)\n\n base_currency = doc['base'] || 'USD'\n\n doc['rates'].each... | [
"0.6577043",
"0.58343554",
"0.58114547",
"0.5723392",
"0.5621875",
"0.56155026",
"0.55567086",
"0.55351555",
"0.5534326",
"0.5520394",
"0.550791",
"0.54840744",
"0.54219174",
"0.5415155",
"0.53820336",
"0.5379775",
"0.5369536",
"0.5341891",
"0.5272014",
"0.5272014",
"0.527028... | 0.6733097 | 0 |
Export the word frequency data. This saves its data out as a CSV file to be downloaded by the user later. As of yet, we don't offer display in the browser; I think this data is so complex that you'll want to pull it up on a spreadsheet. | def perform(task, options = {})
standard_options(task, options)
# Patch up the two strange arguments that don't come in the right format
# from the web form
options[:all] = true if options[:word_method] == 'all'
options.delete(:stemming) if options[:stemming] == 'no'
# Do the analysis
analyzer = RLetters::Analysis::Frequency.call(
options.merge(
dataset: dataset,
progress: ->(p) { task.at(p, 100, t('.progress_calculating')) }
)
)
corpus_size = RLetters::Solr::CorpusStats.new.size
dataset_size = dataset.document_count
# Create some CSV
csv_string = csv_with_header(header: t('.csv_header',
name: dataset.name)) do |csv|
# Output the block data
if analyzer.blocks.size > 1
csv << [t('.each_block')]
name_row = ['']
header_row = ['']
word_rows = []
analyzer.word_list.each do |w|
word_rows << [w]
end
types_row = [t('.types_header')]
tokens_row = [t('.tokens_header')]
ttr_row = [t('.ttr_header')]
analyzer.blocks.each_with_index do |b, i|
s = analyzer.block_stats[i]
name_row << s[:name] << '' << '' << ''
header_row << t('.freq_header') << t('.prop_header')
header_row << t('.tfidf_dataset_header')
header_row << t('.tfidf_corpus_header')
word_rows.each do |r|
word = r[0]
r << (b[word] || 0).to_s
r << ((b[word] || 0).to_f / s[:tokens].to_f).to_s
r << Math.tfidf((b[word] || 0).to_f / s[:tokens].to_f,
analyzer.df_in_dataset[word],
dataset_size)
r << if analyzer.df_in_corpus.present?
Math.tfidf((b[word] || 0).to_f / s[:tokens].to_f,
analyzer.df_in_corpus[word],
corpus_size)
else
''
end
end
# Output the block stats at the end
types_row << s[:types].to_s << '' << '' << ''
tokens_row << s[:tokens].to_s << '' << '' << ''
ttr_row << (s[:types].to_f / s[:tokens].to_f).to_s << '' << '' << ''
end
csv << name_row
csv << header_row
word_rows.each do |r|
csv << r
end
csv << types_row
csv << tokens_row
csv << ttr_row
end
# Output the dataset data
csv << ['']
csv << [t('.whole_dataset')]
csv << ['', t('.freq_header'), t('.prop_header'),
t('.df_header'), t('.tfidf_corpus_header')]
analyzer.word_list.each do |w|
tf_in_dataset = analyzer.tf_in_dataset[w]
r = [w,
tf_in_dataset.to_s,
(tf_in_dataset.to_f / analyzer.num_dataset_tokens).to_s]
if analyzer.df_in_corpus.present?
r << analyzer.df_in_corpus[w].to_s
r << Math.tfidf(tf_in_dataset, analyzer.df_in_corpus[w],
corpus_size)
else
r << ''
r << ''
end
csv << r
end
csv << [t('.types_header'), analyzer.num_dataset_types.to_s]
csv << [t('.tokens_header'), analyzer.num_dataset_tokens.to_s]
csv << [t('.ttr_header'), (analyzer.num_dataset_types.to_f /
analyzer.num_dataset_tokens).to_s]
end
# Write out the CSV to a file
task.files.create(description: 'Spreadsheet',
short_description: 'CSV', downloadable: true) do |f|
f.from_string(csv_string, filename: 'results.csv',
content_type: 'text/csv')
end
# Save out JSON to make an interactive word cloud
word_cloud_data = {
word_cloud_words: analyzer.word_list.each_with_object({}) do |w, ret|
ret[w] = analyzer.tf_in_dataset[w]
end
}
task.files.create(description: 'JSON Data for Word Cloud',
short_description: 'JSON') do |f|
f.from_string(word_cloud_data.to_json, filename: 'word_cloud.json',
content_type: 'application/json')
end
task.mark_completed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_csv\n CSV.generate do |csv|\n csv << %w[word count]\n sort_words.each do |word_count|\n csv << word_count\n end\n end\n end",
"def freqs_to_csv(frequencies, path)\n CSV.open(path, \"wb\") do |csv|\n frequencies.map { |k, v| csv << [k, v] }\n end\nend",
"def outputFreqTa... | [
"0.73714685",
"0.6749898",
"0.62109023",
"0.603986",
"0.58612096",
"0.5838182",
"0.5813978",
"0.5806528",
"0.57581705",
"0.57221615",
"0.5650897",
"0.56488425",
"0.5611036",
"0.54919356",
"0.54736966",
"0.5447206",
"0.5433188",
"0.54114014",
"0.53788596",
"0.5308221",
"0.5284... | 0.0 | -1 |
Returns all sinatra helpers | def sinatra_helpers
@sinatra_helpers ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_application_helpers\n all_helpers_from_path(helpers_path)\n end",
"def all_application_helpers; end",
"def get_helpers\n @helpers\n end",
"def helpers\n Blush.helpers\n end",
"def helpers\n ActionController::Base.helpers\n end",
"def helpers_paths; end",
... | [
"0.7399825",
"0.73736113",
"0.7317161",
"0.72457266",
"0.7239529",
"0.7099844",
"0.7099844",
"0.7099844",
"0.7099844",
"0.70835793",
"0.7013236",
"0.7013236",
"0.7004001",
"0.7004001",
"0.7004001",
"0.6931524",
"0.6931524",
"0.6855131",
"0.6849203",
"0.6811858",
"0.6737754",
... | 0.83913314 | 0 |
Return all sinatra extensions | def sinatra_extensions
@sinatra_extensions ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end",
"def extensions\n []\n end",
"def extensions\n []\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n @extension... | [
"0.72396106",
"0.72255605",
"0.72255605",
"0.7034675",
"0.70216185",
"0.70125985",
"0.70125985",
"0.6963687",
"0.6963687",
"0.6963687",
"0.6914189",
"0.6914189",
"0.6912775",
"0.6901285",
"0.6874874",
"0.68325347",
"0.68325347",
"0.67954016",
"0.67954016",
"0.67954016",
"0.67... | 0.8385138 | 0 |
Greets person by name | def greet(who)
"Hello, #{who}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_na... | [
"0.77691305",
"0.774263",
"0.7680728",
"0.7144816",
"0.7083714",
"0.7017474",
"0.697527",
"0.69349223",
"0.69336474",
"0.69315314",
"0.6923245",
"0.6912978",
"0.69043094",
"0.6900562",
"0.68843323",
"0.6865858",
"0.6860581",
"0.6818351",
"0.6809368",
"0.68073845",
"0.68071693... | 0.679792 | 24 |
Create a hash of home players, away players, and both combined | def players_hash(team_name)
players1 = game_hash[:home][:players]
players2 = game_hash[:away][:players]
arr_players = players1 + players2
all_players = arr_players[0].merge(arr_players[1])
result = {
"Brooklyn Nets" => players1[0],
"Charlotte Hornets" => players2[0],
"All" => all_players
}
# Lookup team_name passed in in above hash
result[team_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_hash\n\t#game_hash = \n\t{\n\t\thome: {\n\t\t\tteam_name: \"Brooklyn Nets\",\n\t\t\tcolors: [\"Black\", \"White\"],\n\t\t\tplayers: {\n\t\t\t\t\"Alan Anderson\" => {\n\t\t\t\t\tnumber: 0,\n\t\t\t\t\tshoe: 16,\n\t\t\t\t\tpoints: 22,\n\t\t\t\t\trebounds: 12,\n\t\t\t\t\tassists: 12,\n\t\t\t\t\tsteals: 3,\n\t... | [
"0.7099548",
"0.7004504",
"0.69644856",
"0.69571984",
"0.6952454",
"0.6952454",
"0.6916057",
"0.6888376",
"0.6888118",
"0.68707526",
"0.68624896",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",
"0.6851916",... | 0.68201333 | 26 |
/ line_inter_pfas Code pour les horloges des parties | def horloges_parties
cmd = []
cmd << %Q{-stroke gray50 -fill -pointsize 6.5 -strokewidth 2}
# Pour le paradigme absolu
decs = [0,30,60,90,120] # on en aura besoin ci-dessous
decs.each do |dec|
h = Horloge.new(horloge:realtime(dec).to_horloge, top:self.class.top_horloge_part_absolue, left:realpos(dec), bgcolor:'gray50', color:'gray90')
cmd << h.magick_code
end
# Pour le paradigme propre au film
[ne(:dv), ne(:d2)||ne(:cv), ne(:dn)].each_with_index do |neu, idx|
next if neu.nil?
dec = decs[idx+1]
leftpos = realpos(dec)
top = self.class.top_horloge_part_relative
h = Horloge.new(horloge:neu.time.to_i.to_horloge, top:top, left:leftpos, bgcolor:'gray20', color:'white')
cmd << h.magick_code
# Pour le décalage
leftdec = realpos(dec + 2.5)
diff = neu.time.to_i - realtime(dec)
pref = diff > 0 ? '+' : '−'
cmd << %Q{-stroke black -fill black -draw "text #{leftdec},#{top+LINE_HEIGHT/5} '#{pref}#{diff.abs.to_horloge}'"}
end
return cmd.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_image\n \"%s%s%s %s%s%s %s%s%s\" % POT.collect{ |i| own(i) }\n end",
"def line(party, votes, pct, seats)\n\tparty = Repls[party] if Repls[party]\n\tpct = pct ? ('%.1f' % pct) : '' \n\tFormat % [party, thousands(votes), pct, seats]\nend",
"def interior_steel(entities)\n#draw_rectangle(\"EW1\",70*1... | [
"0.5633293",
"0.5572928",
"0.5370749",
"0.53067595",
"0.52587837",
"0.5225",
"0.52230096",
"0.5215552",
"0.5198749",
"0.5160088",
"0.5131497",
"0.51073086",
"0.51073086",
"0.51056963",
"0.5101794",
"0.510113",
"0.5096122",
"0.50731564",
"0.50691515",
"0.5069094",
"0.5069094",... | 0.6887804 | 0 |
GET /goals GET /goals.json | def index
@goals = current_user.goals.where(archived: false)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @goals }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def goals(*args)\n @client.get \"#{@path}/goa... | [
"0.826191",
"0.8260275",
"0.8180174",
"0.80670863",
"0.7758634",
"0.7750546",
"0.77415055",
"0.7585685",
"0.7510723",
"0.7510723",
"0.7510723",
"0.7510723",
"0.7423019",
"0.73233336",
"0.72730386",
"0.72055686",
"0.7153684",
"0.71175015",
"0.71036863",
"0.70495373",
"0.702417... | 0.7302528 | 14 |
GET /goals/1 GET /goals/1.json | def show
@goal = Goal.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @goal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n @goals = Goal.all\n\n respond_to d... | [
"0.784109",
"0.7738737",
"0.7736624",
"0.76390994",
"0.7635657",
"0.7631211",
"0.7567874",
"0.7562388",
"0.7537905",
"0.74951446",
"0.7376878",
"0.7376878",
"0.7376878",
"0.7376878",
"0.73729753",
"0.7357465",
"0.72015375",
"0.71718776",
"0.71540856",
"0.71246475",
"0.7071349... | 0.73902845 | 12 |
GET /goals/new GET /goals/new.json | def new
@goal = Goal.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @goal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @goal = @user.goals.new\n\n if params[:project_id]\n @goal.project_id = params[:project_id]\n @goal.goal_type = \"project-based\"\n end\n \n @goal.started_on = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n ... | [
"0.81155914",
"0.79099786",
"0.7895249",
"0.78287673",
"0.78104573",
"0.77127975",
"0.76466817",
"0.76465636",
"0.75925833",
"0.7574942",
"0.7545405",
"0.7543523",
"0.7543523",
"0.7514804",
"0.7382149",
"0.7365325",
"0.73299634",
"0.7324689",
"0.730605",
"0.7292521",
"0.72766... | 0.8324818 | 2 |
POST /goals POST /goals.json | def create
@goal = Goal.new :name => params[:name], :user => current_user, :position => params[:position], :archived => params[:archived]
respond_to do |format|
if @goal.save
format.html { redirect_to @goal, notice: 'Goal was successfully created.' }
format.json { render json: @goal, status: :created, location: @goal }
else
format.html { render action: "new" }
format.json { render json: @goal.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end",
"def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'i... | [
"0.7675624",
"0.74291724",
"0.72749054",
"0.72453797",
"0.71667904",
"0.71145284",
"0.71145284",
"0.70561117",
"0.6993439",
"0.69871545",
"0.6968615",
"0.69321275",
"0.68897337",
"0.68752927",
"0.6872396",
"0.68634003",
"0.68587345",
"0.68497473",
"0.67752355",
"0.67364514",
... | 0.6454942 | 39 |
PUT /goals/1 PUT /goals/1.json | def update
@goal = Goal.find(params[:id])
to_update = { :name => params[:name], :position => params[:position], :archived => params[:archived] }
respond_to do |format|
if @goal.update_attributes(to_update)
format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @goal.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attribute... | [
"0.7622851",
"0.72812176",
"0.7161341",
"0.7087199",
"0.7074676",
"0.7027918",
"0.6993307",
"0.6960847",
"0.69586647",
"0.69293064",
"0.69255567",
"0.6918485",
"0.69119203",
"0.6882555",
"0.6882555",
"0.6882555",
"0.6882555",
"0.6882555",
"0.6879645",
"0.6870632",
"0.6860628"... | 0.66398585 | 28 |
DELETE /goals/1 DELETE /goals/1.json | def destroy
@goal = Goal.find(params[:id])
@goal.destroy
respond_to do |format|
format.html { redirect_to goals_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @goal = @user.goals.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to user_goals_url(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |form... | [
"0.78341436",
"0.78339034",
"0.77804095",
"0.7715518",
"0.7665273",
"0.763701",
"0.75495553",
"0.7520316",
"0.7480151",
"0.7480151",
"0.7480151",
"0.7480151",
"0.7480151",
"0.7480151",
"0.7480151",
"0.7478468",
"0.7462783",
"0.74464816",
"0.7390982",
"0.73118263",
"0.72868234... | 0.78066945 | 3 |
Expires the cache when the authentication is deleted | def delete_cache
Rails.cache.delete("user_#{self.user_id.to_s}_provider_#{self.provider}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire\n Rails.cache.delete(CACHE_KEY)\n end",
"def clear_cache; end",
"def expire_cache!\n @snapshot = nil\n end",
"def clear_cache(auth_token)\n Authentication::RedisStore.instance.delete(auth_token)\n end",
"def expire_cache_control\n @response[PRAGMA] = 'no-cache'\n ... | [
"0.7401218",
"0.7064361",
"0.7051076",
"0.7047834",
"0.70443845",
"0.7019036",
"0.7007823",
"0.698256",
"0.69659406",
"0.68231356",
"0.6804741",
"0.67989296",
"0.67774767",
"0.67774767",
"0.67392004",
"0.673349",
"0.6725013",
"0.6697521",
"0.6676111",
"0.66680026",
"0.6655733... | 0.7229005 | 1 |
Lists all children of a parent business | def get_businesses_parenttoken_children(parent_token, opts = {})
data, _status_code, _headers = get_businesses_parenttoken_children_with_http_info(parent_token, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end",
"def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.... | [
"0.7642372",
"0.72581947",
"0.7227889",
"0.69969285",
"0.69559145",
"0.69310373",
"0.68953025",
"0.6880114",
"0.68602186",
"0.68552375",
"0.6839402",
"0.6836797",
"0.68346053",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.68341... | 0.0 | -1 |
Lists all children of a parent business | def get_businesses_parenttoken_children_with_http_info(parent_token, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.get_businesses_parenttoken_children ...'
end
# verify the required parameter 'parent_token' is set
if @api_client.config.client_side_validation && parent_token.nil?
fail ArgumentError, "Missing the required parameter 'parent_token' when calling BusinessesApi.get_businesses_parenttoken_children"
end
# resource path
local_var_path = '/businesses/{parent_token}/children'.sub('{' + 'parent_token' + '}', CGI.escape(parent_token.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
query_params[:'start_index'] = opts[:'start_index'] if !opts[:'start_index'].nil?
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'UserCardHolderListResponse'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.get_businesses_parenttoken_children",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#get_businesses_parenttoken_children\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end",
"def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.... | [
"0.7642372",
"0.72581947",
"0.7227889",
"0.69969285",
"0.69559145",
"0.69310373",
"0.68953025",
"0.6880114",
"0.68602186",
"0.68552375",
"0.6839402",
"0.6836797",
"0.68346053",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.6834165",
"0.68341... | 0.0 | -1 |
Returns a specific business | def get_businesses_token(token, opts = {})
data, _status_code, _headers = get_businesses_token_with_http_info(token, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business\n self.select(&:business?)\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def show\n\t\t@business = business.find(params[:id, as: :business_line])\n\t... | [
"0.7658305",
"0.76370037",
"0.7377012",
"0.73505217",
"0.72497505",
"0.7171874",
"0.7137327",
"0.6982709",
"0.6982709",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6884551",
"0.688317",
"0.6817059",
... | 0.0 | -1 |
Returns a specific business | def get_businesses_token_with_http_info(token, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.get_businesses_token ...'
end
# verify the required parameter 'token' is set
if @api_client.config.client_side_validation && token.nil?
fail ArgumentError, "Missing the required parameter 'token' when calling BusinessesApi.get_businesses_token"
end
# resource path
local_var_path = '/businesses/{token}'.sub('{' + 'token' + '}', CGI.escape(token.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'BusinessCardHolderResponse'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.get_businesses_token",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#get_businesses_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business\n self.select(&:business?)\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def show\n\t\t@business = business.find(params[:id, as: :business_line])\n\t... | [
"0.7658305",
"0.76370037",
"0.7377012",
"0.73505217",
"0.72497505",
"0.7171874",
"0.7137327",
"0.6982709",
"0.6982709",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6884551",
"0.688317",
"0.6817059",
... | 0.0 | -1 |
Returns a specific business proprietor's SSN | def get_businesses_token_ssn(token, opts = {})
data, _status_code, _headers = get_businesses_token_ssn_with_http_info(token, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_sn(socialnumber)\n Apis.client.get(\"/company?socialnumber=#{socialnumber}\")\n end",
"def ssn\n legacy_ssn\n end",
"def sns\n return '' unless @parts\n return '' unless @parts[:street_number] && @parts[:street_name] && @parts[:state]\n\n \"#{@parts[:street_number]}#{@parts[:street_... | [
"0.69556934",
"0.6614583",
"0.6332323",
"0.6242999",
"0.5973923",
"0.59651834",
"0.5963354",
"0.5726864",
"0.5714184",
"0.56935585",
"0.56862676",
"0.56616986",
"0.5646111",
"0.5635679",
"0.5606705",
"0.5606483",
"0.55944073",
"0.55637145",
"0.5535317",
"0.5516372",
"0.549018... | 0.0 | -1 |
Returns a specific business proprietor&39;s SSN | def get_businesses_token_ssn_with_http_info(token, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.get_businesses_token_ssn ...'
end
# verify the required parameter 'token' is set
if @api_client.config.client_side_validation && token.nil?
fail ArgumentError, "Missing the required parameter 'token' when calling BusinessesApi.get_businesses_token_ssn"
end
# resource path
local_var_path = '/businesses/{token}/ssn'.sub('{' + 'token' + '}', CGI.escape(token.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'full_ssn'] = opts[:'full_ssn'] if !opts[:'full_ssn'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'SsnResponseModel'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.get_businesses_token_ssn",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#get_businesses_token_ssn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_sn(socialnumber)\n Apis.client.get(\"/company?socialnumber=#{socialnumber}\")\n end",
"def ssn\n legacy_ssn\n end",
"def sns\n return '' unless @parts\n return '' unless @parts[:street_number] && @parts[:street_name] && @parts[:state]\n\n \"#{@parts[:street_number]}#{@parts[:street_... | [
"0.68710625",
"0.6566035",
"0.64450765",
"0.60356605",
"0.5939801",
"0.59184206",
"0.58141583",
"0.57870036",
"0.57240146",
"0.570942",
"0.5633085",
"0.5618865",
"0.56029254",
"0.5565779",
"0.55607617",
"0.5542979",
"0.55008656",
"0.5499892",
"0.54984033",
"0.5482033",
"0.542... | 0.0 | -1 |
Returns a specific business | def post_businesses_lookup(opts = {})
data, _status_code, _headers = post_businesses_lookup_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business\n self.select(&:business?)\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def show\n\t\t@business = business.find(params[:id, as: :business_line])\n\t... | [
"0.7658305",
"0.76370037",
"0.7377012",
"0.73505217",
"0.72497505",
"0.7171874",
"0.7137327",
"0.6982709",
"0.6982709",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6884551",
"0.688317",
"0.6817059",
... | 0.0 | -1 |
Returns a specific business | def post_businesses_lookup_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.post_businesses_lookup ...'
end
# resource path
local_var_path = '/businesses/lookup'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
# return_type
return_type = opts[:debug_return_type] || 'BusinessCardholder'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.post_businesses_lookup",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#post_businesses_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business\n self.select(&:business?)\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def show\n\t\t@business = business.find(params[:id, as: :business_line])\n\t... | [
"0.7658305",
"0.76370037",
"0.7377012",
"0.73505217",
"0.72497505",
"0.7171874",
"0.7137327",
"0.6982709",
"0.6982709",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6961089",
"0.6884551",
"0.688317",
"0.6817059",
... | 0.0 | -1 |
Creates a note for a business | def post_businesses_token_notes(token, opts = {})
data, _status_code, _headers = post_businesses_token_notes_with_http_info(token, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_note(content)\n note = Note.new({:type_id => self.id,\n :owner => 'bill',\n :content => content})\n note.save\n end",
"def create_deal_note(deal_id, note)\n post(\"deals/#{deal_id}/notes\", note: { note: note })\n end",
"def create_notes\n end... | [
"0.70525974",
"0.70029694",
"0.698142",
"0.6913433",
"0.6889003",
"0.6853754",
"0.6697056",
"0.66949487",
"0.66323763",
"0.66316503",
"0.6606369",
"0.65524846",
"0.64785665",
"0.6456634",
"0.6452458",
"0.6411934",
"0.64012694",
"0.6356798",
"0.6352378",
"0.634197",
"0.6323851... | 0.0 | -1 |
Creates a note for a business | def post_businesses_token_notes_with_http_info(token, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.post_businesses_token_notes ...'
end
# verify the required parameter 'token' is set
if @api_client.config.client_side_validation && token.nil?
fail ArgumentError, "Missing the required parameter 'token' when calling BusinessesApi.post_businesses_token_notes"
end
# resource path
local_var_path = '/businesses/{token}/notes'.sub('{' + 'token' + '}', CGI.escape(token.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
# return_type
return_type = opts[:debug_return_type] || 'CardholderNoteResponseModel'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.post_businesses_token_notes",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#post_businesses_token_notes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_note(content)\n note = Note.new({:type_id => self.id,\n :owner => 'bill',\n :content => content})\n note.save\n end",
"def create_deal_note(deal_id, note)\n post(\"deals/#{deal_id}/notes\", note: { note: note })\n end",
"def create_notes\n end... | [
"0.70525974",
"0.70029694",
"0.698142",
"0.6913433",
"0.6889003",
"0.6853754",
"0.6697056",
"0.66949487",
"0.66323763",
"0.66316503",
"0.6606369",
"0.65524846",
"0.64785665",
"0.6456634",
"0.6452458",
"0.6411934",
"0.64012694",
"0.6356798",
"0.6352378",
"0.634197",
"0.6323851... | 0.0 | -1 |
Updates a specific business | def put_businesses_token(token, body, opts = {})
data, _status_code, _headers = put_businesses_token_with_http_info(token, body, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @business = @user.businesses.find(params[:id])\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to edit_user_business_path(@user, @business), notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, locat... | [
"0.78292865",
"0.76953244",
"0.76044536",
"0.7580088",
"0.75658745",
"0.749781",
"0.7442871",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7381009",
"0.7381009",
"0.7381009",
"0.7381009",
"0.7380285",
... | 0.0 | -1 |
Updates a specific business | def put_businesses_token_with_http_info(token, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.put_businesses_token ...'
end
# verify the required parameter 'token' is set
if @api_client.config.client_side_validation && token.nil?
fail ArgumentError, "Missing the required parameter 'token' when calling BusinessesApi.put_businesses_token"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling BusinessesApi.put_businesses_token"
end
# resource path
local_var_path = '/businesses/{token}'.sub('{' + 'token' + '}', CGI.escape(token.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'BusinessCardholder'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.put_businesses_token",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#put_businesses_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @business = @user.businesses.find(params[:id])\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to edit_user_business_path(@user, @business), notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, locat... | [
"0.78292865",
"0.76953244",
"0.76044536",
"0.7580088",
"0.75658745",
"0.749781",
"0.7442871",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7417775",
"0.7381009",
"0.7381009",
"0.7381009",
"0.7381009",
"0.7380285",
... | 0.0 | -1 |
Updates a specific note for a business | def put_businesses_token_notes_notestoken(token, notes_token, opts = {})
data, _status_code, _headers = put_businesses_token_notes_notestoken_with_http_info(token, notes_token, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_deal_note(deal_id, note_id, note)\n post(\"deals/#{deal_id}/notes/#{note_id}\", note: { note: note })\n end",
"def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to ad... | [
"0.69158924",
"0.6687861",
"0.6646455",
"0.6610085",
"0.65993184",
"0.65181744",
"0.65047455",
"0.6501007",
"0.6445948",
"0.64355016",
"0.64129865",
"0.63965684",
"0.6396287",
"0.63907135",
"0.6373567",
"0.6364125",
"0.6341956",
"0.63259137",
"0.63078433",
"0.63053775",
"0.62... | 0.0 | -1 |
Updates a specific note for a business | def put_businesses_token_notes_notestoken_with_http_info(token, notes_token, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BusinessesApi.put_businesses_token_notes_notestoken ...'
end
# verify the required parameter 'token' is set
if @api_client.config.client_side_validation && token.nil?
fail ArgumentError, "Missing the required parameter 'token' when calling BusinessesApi.put_businesses_token_notes_notestoken"
end
# verify the required parameter 'notes_token' is set
if @api_client.config.client_side_validation && notes_token.nil?
fail ArgumentError, "Missing the required parameter 'notes_token' when calling BusinessesApi.put_businesses_token_notes_notestoken"
end
# resource path
local_var_path = '/businesses/{token}/notes/{notes_token}'.sub('{' + 'token' + '}', CGI.escape(token.to_s)).sub('{' + 'notes_token' + '}', CGI.escape(notes_token.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
# return_type
return_type = opts[:debug_return_type] || 'CardholderNoteResponseModel'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BusinessesApi.put_businesses_token_notes_notestoken",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BusinessesApi#put_businesses_token_notes_notestoken\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_deal_note(deal_id, note_id, note)\n post(\"deals/#{deal_id}/notes/#{note_id}\", note: { note: note })\n end",
"def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to ad... | [
"0.69158924",
"0.6687861",
"0.6646455",
"0.6610085",
"0.65993184",
"0.65181744",
"0.65047455",
"0.6501007",
"0.6445948",
"0.64355016",
"0.64129865",
"0.63965684",
"0.6396287",
"0.63907135",
"0.6373567",
"0.6364125",
"0.6341956",
"0.63259137",
"0.63078433",
"0.63053775",
"0.62... | 0.0 | -1 |
TODO: Consider reimplementation of this functions | def fill_with(test_response)
if (test_response.nil?)
return
end
self.status = test_response.status unless test_response.status.nil?
self.message = test_response.message unless test_response.message.nil?
self.user_time = test_response.user_time unless test_response.user_time.nil?
self.system_time = test_response.system_time unless test_response.system_time.nil?
self.memory_usage = test_response.memory_usage unless test_response.memory_usage.nil?
self.exit_status = test_response.exit_status unless test_response.exit_status.nil?
self.term_sig = test_response.term_sig unless test_response.term_sig.nil?
puts "TEST ID IS", test_response.test_id
self.test = PCS::Model::Test.find(test_response.test_id) unless test_response.test_id.nil?
self.checker_response = PCS::Model::CheckerResponse.new
self.checker_response.fill_with(test_response.checker_response) unless test_response.checker_response.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def formation; end",
"def anchored; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def offences_by; end",
"def identify; end",
"def terpene; end",
"def berlioz; end",
"def stderrs; end",
"de... | [
"0.66185206",
"0.6036891",
"0.5849312",
"0.58049244",
"0.5803746",
"0.57889485",
"0.57889485",
"0.57889485",
"0.57889485",
"0.5730797",
"0.55796814",
"0.553609",
"0.55195016",
"0.55105156",
"0.54612005",
"0.54612005",
"0.54612005",
"0.54612005",
"0.54529345",
"0.54517305",
"0... | 0.0 | -1 |
Input: Array of names Output: array of names in 3s, 4s or 5s Steps: Divide the group by 5 and if it is divisible, group by 5 people, if the remainder is 1, group by 4 calculate all the nondivisible numbers and group them into either 3s or 4s | def assign(group)
if group.length % 5 == 0
return group.shuffle.each_slice(5).to_a
elsif group.length % 5 == 1
return group.shuffle.each_slice(4).to_a
elsif group.length % 5 == 2
return group.shuffle.each_slice(4).to_a
elsif group.length % 5 == 3
return group.shuffle.each_slice(5).to_a
elsif group.length % 5 == 4
return group.shuffle.each_slice(5).to_a
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n... | [
"0.7389019",
"0.72403204",
"0.7079357",
"0.70584637",
"0.6911252",
"0.6852386",
"0.6845513",
"0.6833714",
"0.68026775",
"0.67539793",
"0.67516077",
"0.6659828",
"0.6623151",
"0.6610161",
"0.66091454",
"0.6605451",
"0.65991753",
"0.65931517",
"0.6592943",
"0.6590389",
"0.65436... | 0.0 | -1 |
Many kinds of image files contain prerendered thumbnail images that can be quickly loaded without having to decode the entire contents of the image file and reconstruct the fullsize image. The ImageIO framework's CGImageSource API provides a means to do this, using the CGImageSourceCreateThumbnailAtIndex() function. For more information on CGImageSource objects and their capabilities, see the CGImageSource reference on the Apple Developer Connection website, at | def createImageSource
if !self.imageSource
# Compose absolute URL to file.
sourceURL = self.url.absoluteURL
if sourceURL == nil
return false
end
# Create a CGImageSource from the URL.
imageSource = CGImageSourceCreateWithURL(sourceURL, nil)
if imageSource == nil
return false
end
imageSourceType = CGImageSourceGetType(imageSourceType)
if imageSourceType == nil
return false
end
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def via_files(filename, thumbnail_width)\n thumb = Vips::Image.thumbnail filename, thumbnail_width, crop: \"centre\"\n\n thumb.write_to_buffer \".jpg\"\nend",
"def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::Application.config.thumbnail_geometry\n image = Magick::Image.read(\n ... | [
"0.6782672",
"0.67808783",
"0.6661726",
"0.66513854",
"0.65950364",
"0.6527004",
"0.65160733",
"0.6371853",
"0.63292915",
"0.6294586",
"0.62412095",
"0.6210229",
"0.61829346",
"0.61716884",
"0.6161719",
"0.6125932",
"0.6099309",
"0.6076479",
"0.60716623",
"0.60587347",
"0.603... | 0.0 | -1 |
results should be a Browseable::Search instance that exposes the attributes delegated to it below | def initialize(results, params)
@results, @params = results, params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results\n populate\n @results\n end",
"def results\n @results\n end",
"def search_results\n builder = search_builder.with(search_state)\n builder.page = search_state.page\n builder.rows = search_state.per_page\n\n builder = yield(builder) if block_given?\n resp... | [
"0.7074576",
"0.67719966",
"0.6754554",
"0.6751245",
"0.673338",
"0.6730103",
"0.6710264",
"0.6708941",
"0.6708941",
"0.6708941",
"0.6642521",
"0.6634811",
"0.66293615",
"0.65955234",
"0.6583457",
"0.6581491",
"0.65464157",
"0.6520678",
"0.6512731",
"0.65064543",
"0.6459854",... | 0.0 | -1 |
Sense check that the current page cannot be greater than the total number of pages | def current_page
[results.current_page, results.total_pages].min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_of_bounds?\n current_page > total_pages\n end",
"def out_of_range?\n current_page > total_pages\n end",
"def out_of_bounds?\n current_page > total_pages\n end",
"def page_num_checker \n\t\t@page_num < @total_page || @total_page == 0\n\tend",
"def out_of_bounds?\n ... | [
"0.8158684",
"0.8132915",
"0.8068304",
"0.79109985",
"0.77741146",
"0.7273143",
"0.7218764",
"0.71324223",
"0.713043",
"0.6831567",
"0.6788576",
"0.67090416",
"0.6685562",
"0.66647506",
"0.66118276",
"0.6584686",
"0.6573794",
"0.6504076",
"0.6502295",
"0.6498997",
"0.64638513... | 0.0 | -1 |
Creates a new instance of the SQLite adapter object | def initialize(model, database_id = nil, &block)
super
instance_eval(&block) if block_given?
@sqlitedump_utility ||= utility(:sqlitedump)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(adapter); end",
"def initialize(opts = {})\n if opts[:path]\n @path = opts[:path]\n else\n @path = DEFAULT_DB_PATH\n end\n\n @db = SQLite3::Database.new(@path)\n\n create()\n end",
"def default_adapter; :sqlite3 end",
"def initialized_... | [
"0.6352168",
"0.6295366",
"0.6275203",
"0.61830306",
"0.61414385",
"0.61235833",
"0.6059588",
"0.5981082",
"0.59522706",
"0.5946701",
"0.59395176",
"0.5914396",
"0.584874",
"0.5827446",
"0.5822664",
"0.57982755",
"0.57619417",
"0.5718529",
"0.5711524",
"0.571043",
"0.5676737"... | 0.0 | -1 |
Performs the sqlitedump command and outputs the data to the specified path based on the 'trigger' | def perform!
super
dump = "echo '.dump' | #{sqlitedump_utility} #{path}"
pipeline = Pipeline.new
dump_ext = "sql".dup
pipeline << dump
if model.compressor
model.compressor.compress_with do |command, ext|
pipeline << command
dump_ext << ext
end
end
pipeline << "cat > '#{File.join(dump_path, dump_filename)}.#{dump_ext}'"
pipeline.run
if pipeline.success?
log!(:finished)
else
raise Error,
"#{database_name} Dump Failed!\n" + pipeline.error_messages
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_cmd!\n \"pg_dump #{pg_dump_args} | psql #{new_db_name}\"\n end",
"def jump_sql\n \n FileUtils.cd(@app_path+\"/lib/tasks\",:verbose => true)\n if File.directory? @d\n puts \"Directory #{@d} exists\"\n else\n FileUtils.mkdir @d, :mode => 0700, :verbose => true\n end\n ... | [
"0.6333992",
"0.61740005",
"0.6135332",
"0.6090008",
"0.59961396",
"0.57564926",
"0.57380736",
"0.5704385",
"0.56534404",
"0.55996126",
"0.5573658",
"0.55507",
"0.5519168",
"0.55170834",
"0.54677784",
"0.54585975",
"0.5429266",
"0.5405841",
"0.5395195",
"0.53851396",
"0.53610... | 0.57651085 | 5 |
Get Activation State of Main Commands | def main_commands_enabled
$game_party.exists
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_state\n puts \"Entering #{self.class}\"\n execution_state = EXECUTION_STATE[:active]\n end",
"def pro_activate\n set_activate\n end",
"def activate()\n end",
"def activate; end",
"def main_commands_enabled\n TactBattleManager.tact_battle?\n end",
"def activate\n @status = t... | [
"0.64964753",
"0.6145384",
"0.60388285",
"0.6026532",
"0.5991227",
"0.59475595",
"0.59248847",
"0.58299166",
"0.5824358",
"0.5802027",
"0.5737022",
"0.5653557",
"0.56489336",
"0.5614368",
"0.5604132",
"0.5599249",
"0.55877775",
"0.55806124",
"0.5577102",
"0.5529075",
"0.55258... | 0.0 | -1 |
Indicate whether user should be able to perform action on subject. | def can?(user, action, subject, *extra_args)
ability = find_user(user)&.ability || Ability.new
ability.can?(action, subject, *extra_args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized?(action, subject)\n ability.can? action, subject\n end",
"def authorized?(action, subject = nil)\n false\n end",
"def authorized?(action, subject = nil)\n true\n end",
"def can?(subject, action, object)\n abilities.allowed?(subject, action, object)\n # abiliti... | [
"0.7736919",
"0.77167815",
"0.7632834",
"0.74461174",
"0.7410521",
"0.71880525",
"0.7135189",
"0.703474",
"0.7030571",
"0.7030571",
"0.7023352",
"0.6954076",
"0.69482183",
"0.6928183",
"0.69213176",
"0.687875",
"0.6878633",
"0.68746114",
"0.6830711",
"0.68180686",
"0.6755335"... | 0.68510425 | 18 |
Returns a 2element array: [successful?, transaction ID (string) or error message if payment unsuccessful] | def process_payment
raise 'invalid credit card' unless @credit_card && @credit_card.valid?
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(
:login => LOGIN_ID,
:password => TRANSACTION_KEY
)
description = "Concerts in the Clearing"
if reservation
description += "/Tickets, #{reservation.concert.name}"
end
response = gateway.purchase((amount * 100).to_i, @credit_card, name_and_address.merge({:description => description}))
return [true, response.authorization] if response.success?
return [false, response.message]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_response(hash)\n @direct_pay = @response.body\n @transaction = CGI::parse(@direct_pay)\n if @transaction['ACK'].to_sentence == \"Failure\" and @transaction['L_LONGMESSAGE0'].to_sentence.present? and @transaction['L_ERRORCODE0'].present?\n message = @transaction['L_LONGMESSAGE... | [
"0.6055146",
"0.5995641",
"0.5911756",
"0.5876868",
"0.5849357",
"0.58337885",
"0.580085",
"0.57896227",
"0.57635486",
"0.5758745",
"0.57537746",
"0.57524496",
"0.5752287",
"0.5750072",
"0.5749379",
"0.57311887",
"0.5695093",
"0.5670692",
"0.5668682",
"0.5652686",
"0.5635497"... | 0.0 | -1 |
Fair market value of the tickets received for a donation is the product of the number of tickets reserved and the suggested donation per ticket. Returns BigDecimal. | def fair_market_value_of_tickets
return BigDecimal.new('0.0') unless reservation && reservation.number_of_tickets
return BigDecimal.new(reservation.number_of_tickets.to_s) * concert.suggested_ticket_donation
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profit\n return 0.0 unless self.deliverables.size > 0\n \n # Covers fixed and percentage profit though the +profit+ method being overloaded on the Deliverable types\n return self.deliverables.collect(&:profit).delete_if { |d| d.blank?}.inject { |sum, n| sum + n } || 0.0\n end",
"def estimate_cry... | [
"0.67098993",
"0.66637766",
"0.6626616",
"0.6579953",
"0.6564602",
"0.6554305",
"0.6536307",
"0.65205896",
"0.6491187",
"0.64690745",
"0.63918215",
"0.6333603",
"0.6326828",
"0.63132703",
"0.6308428",
"0.62544465",
"0.62318367",
"0.62187386",
"0.6204551",
"0.62035716",
"0.620... | 0.86179996 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_flight
@flight = Flight.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 flight_params
params.require(:flight).permit(:flight_name, :flight_route_id, :departure, :arrival, :number_of_passengers, :aircraft_type, :arrived, :stocked, :cleaned)
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.7122858",
"0.70540553",
"0.69476545",
"0.6902004",
"0.6735809",
"0.671776",
"0.668886",
"0.66776645",
"0.66611695",
"0.6555913",
"0.6527077",
"0.64584446",
"0.64516115",
"0.64500964",
"0.64474493",
"0.6435065",
"0.6413185",
"0.6413185",
"0.6391701",
"0.6380101",
"0.6380101... | 0.0 | -1 |
UTILITY METHODS gets the appointment | def get_apt
apt = Appointment.find_by(pet_id: self.id)
if apt
apt
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appointment(params = {})\n @appointment_id = params.delete :appointment_id\n scope 'user_schedule'\n\n get_one('schedule/appointmenttypes/', @appointment_id, params)\n end",
"def appointments\n @appointments\n end",
"def appointments\n @appointments\n end",
"def appointment\n ... | [
"0.75792485",
"0.73035896",
"0.73035896",
"0.7200514",
"0.71619725",
"0.70602685",
"0.70024145",
"0.69952506",
"0.6988289",
"0.6949746",
"0.69429874",
"0.6888478",
"0.6869464",
"0.68626195",
"0.6794518",
"0.6778451",
"0.67243433",
"0.6717482",
"0.67144334",
"0.6708502",
"0.67... | 0.7431194 | 1 |
user_string = gets.chomp puts "Please input a factor to shift The string by. (Only works with positive numbers.)" user_shift = gets.chomp.to_i while user_shift <= 0 puts "Please input a valid number." user_shift = gets.chomp.to_i end | def caesar_cypher (text, shift)
upper = ("A".."Z").to_a
lower = ("a".."z").to_a
text_a = text.chars
finished = ""
text_a.each do |char|
# Check if the character is uppercase
if upper.include?(char)
index = upper.index(char)
index += shift
while index >= upper.length
index -= upper.length
end
finished << upper[index]
# Check if it's lowercase
elsif lower.include?(char)
index = lower.index(char)
index += shift
while index >= lower.length
index -= lower.length
end
finished << lower[index]
# Append all miscellaneous characters that don't match
else
finished << char
end
end
finished
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_input(user_input)\n while (user_input.to_i == 0 && user_input.to_s != \"0\")\n puts \"Invalid input. Please re-enter a non-negative integer. Enter a negative integer to exit. \"\n user_input = gets.chomp\n end\n if user_input.to_i < 0\n puts \"Goodbye.\"\n exit\n end\n return user_input.... | [
"0.6870906",
"0.66562676",
"0.6585946",
"0.633935",
"0.63153845",
"0.62783605",
"0.6250007",
"0.6195514",
"0.6189993",
"0.61712325",
"0.61634105",
"0.6153617",
"0.6134423",
"0.60906214",
"0.6076552",
"0.60624737",
"0.60461766",
"0.6042694",
"0.5997423",
"0.59873116",
"0.59776... | 0.0 | -1 |
before_action :current_user_only, :only => %w(edit update) | def index
@users = User.page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n require_user\n end",
"def edit\n authorize! :update, @user\n end",
"def user_permitted_to_edit(item)\n item.user == current_user \n end",
"def edit_current_user\n end",
"def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit... | [
"0.7676778",
"0.7653307",
"0.7643958",
"0.7605308",
"0.7467822",
"0.7455803",
"0.73937756",
"0.736493",
"0.73313254",
"0.73313254",
"0.73304766",
"0.72297674",
"0.7184436",
"0.71564865",
"0.7152865",
"0.7145936",
"0.71417725",
"0.7141193",
"0.709706",
"0.70906484",
"0.7062776... | 0.0 | -1 |
Include the user's personal account by default, but allow overriding with params Useful if you want to enable acts_as_tenant on the notification model | def to_database
{
account: params.delete(:account) || recipient.personal_account,
type: self.class.name,
params: params
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_settings\r\n @person = current_person\r\n end",
"def set_default_params(params)\n\t\t\tparams[:authorization_token] = @token\n\t\t\tparams[:account] = params[:account] || @account\n\t\t\t\n\t\t\tif params[:site] == \"ignore\"\n\t\t\t\tparams.delete(:site)\n\t\t\telse\n\t\t\t\tparams[:site] = para... | [
"0.6380397",
"0.6131106",
"0.6125282",
"0.6076859",
"0.60246",
"0.59889114",
"0.597387",
"0.597387",
"0.597387",
"0.597387",
"0.597387",
"0.597387",
"0.597387",
"0.597387",
"0.5973416",
"0.5966858",
"0.59591246",
"0.5955891",
"0.5908885",
"0.59021866",
"0.5896303",
"0.58899... | 0.0 | -1 |
given [2,3,4], and num = 7, sub array [3,4] will satisfy that condition, and the answer is 2, if none is found, return 0 | def subarray(arr,num)
#sort the array, use pointers
j = 0
i = 0
sum = 0
while j < arr.length
if sum < num
#moving up the array if sum is less than number
sum += arr[j]
j += 1
else
minLen = [9000, j-i].min
if i == (j-1)
return 1
end
sum -= arr[i]
i += 1
end
puts sum, "first"
puts minLen, "minfirst"
puts i,"i", j, "j"
end
while sum >= num
minLen = [9000, j-i].min
i += 1
sum -= arr[i]
puts sum, "second"
puts minLen, "minsecond"
puts i,"i", j, "j"
end
if minLen == 9000
puts 0
else
puts minLen
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_array(array, num)\n answer = nil\n (array.length+1).times do | index |\n if array[index] == num\n answer = index\n end\n end\n answer\nend",
"def search_array(arr, num)\n\tindex = 0\n\tarr.each do |value|\n\t\tif value == num\n\t\t\treturn index\n\t\tend\n\tindex +... | [
"0.64027697",
"0.6356266",
"0.61588424",
"0.61105347",
"0.6096768",
"0.6054576",
"0.60498273",
"0.5989455",
"0.59728354",
"0.5962153",
"0.59607214",
"0.5940591",
"0.5940152",
"0.5919077",
"0.5915703",
"0.58977383",
"0.5863744",
"0.585695",
"0.5836207",
"0.5816212",
"0.5799226... | 0.617715 | 2 |
When to generate slug | def should_generate_new_friendly_id?
new_record? || self[:slug].blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_slug\n self.slug = self.title[0..47].parameterize\n end",
"def generate_slug\n self.slug = self.title[0..47].parameterize\n end",
"def generate_slug\n self.slug = title.parameterize if title\n end",
"def generate_slug\n self.slug = self.name.parameterize\n end",
"def genera... | [
"0.84773606",
"0.84773606",
"0.84123176",
"0.8389778",
"0.83229667",
"0.8282342",
"0.81981635",
"0.81981635",
"0.80609685",
"0.7958557",
"0.7902023",
"0.78699803",
"0.7803096",
"0.78017354",
"0.77984864",
"0.77562433",
"0.7755325",
"0.7749865",
"0.77209365",
"0.77142334",
"0.... | 0.0 | -1 |
Simple put string using a variable using a method print "Hello world\n" puts "Hello World" p "Hello World" greeting = "printing greeting" puts greeting | def say_hello(thing_to_say)
puts thing_to_say
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greet(name)\n print \"Hello, #{name} how are you doing today?\"\nend",
"def greeter(name)\n puts \"Hello #{name}! How are you today?\"\nend",
"def greeting\nputs \"HELLO, BONJOUR, HOLA, GUTENTAG, HALLO, HOWDY, NAMASKAR, MERHABA\"\nend",
"def sayHello(str)\n puts 'Hey, good to see you ' + str\nend",
... | [
"0.7564093",
"0.7273662",
"0.7261233",
"0.7215179",
"0.7213817",
"0.7205488",
"0.7188771",
"0.7188771",
"0.7186403",
"0.7181362",
"0.7163328",
"0.7153069",
"0.7127139",
"0.71258265",
"0.71240467",
"0.7109389",
"0.7106015",
"0.71015817",
"0.71012884",
"0.7084759",
"0.7072734",... | 0.0 | -1 |
=> 1 That's because the .new class method, if it were implemented in Ruby, works like this: def self.new(args, &block) obj = allocate obj.initialize(args, &block) end initialize is an instance method called on the instance. | def constructor_arity(klass)
klass.allocate.method(:initialize).arity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(*args)\n o = self.allocate # Create a new object of this class\n o.initialize(*args) # Call the object's initialize method with our args\n o # Return new object; ignore return value of initialize\nend",
"def new(*args, &block)\n obj = allocate()\n obj.initialize(*args, &block... | [
"0.7843383",
"0.7355232",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7255009",
"0.7233414",
"0.6930407",
"0.6814302",
"0.6747488",
"0.6730213",
"0.6681664",
"0.66197205",
"0.66026556",
"0.66026556",
"0.66026556",... | 0.7232826 | 12 |
I worked on this challenge [by myself, with: Darius]. Your Solution Below | def leap_year? (x)
if x % 4 == 0
if x % 100 == 0 && x % 400 != 0
return false
end
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n ... | [
"0.6590719",
"0.6300852",
"0.62474555",
"0.6180034",
"0.61705273",
"0.61479133",
"0.6118381",
"0.6115137",
"0.61025983",
"0.6075181",
"0.6067654",
"0.60650444",
"0.6054077",
"0.6041747",
"0.6037317",
"0.60254323",
"0.6014936",
"0.60102797",
"0.59971714",
"0.59938246",
"0.5992... | 0.0 | -1 |
GET /recall_events GET /recall_events.json | def index
@total_count = RecallEvent.count
@class_one_count = RecallEvent.class_one.count
@class_two_count = RecallEvent.class_two.count
@class_three_count = RecallEvent.class_three.count
@completed_count = RecallEvent.completed.count
@ongoing_count = RecallEvent.ongoing.count
@terminated_count = RecallEvent.terminated.count
@recall_events = RecallEvent.all.order(report_date: :desc, recall_number: :desc).page(params[:page])
if params[:classification].present?
@recall_events = case params[:classification].to_sym
when :class_one
@recall_events.class_one
when :class_two
@recall_events.class_two
when :class_three
@recall_events.class_three
end
end
@recall_events = @recall_events.where('locations.short_name': params[:location]) if params[:location].present?
if params[:year].present? && params[:month].present? && params[:day].present?
@report_date = Date.parse "#{params[:year]}-#{params[:month]}-#{params[:day]}"
@recall_events = @recall_events.where report_date: @report_date
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_recall_event\n @recall_event = RecallEvent.find(params[:id])\n end",
"def recall_event_params\n params[:recall_event]\n end",
"def show\n @related_recall_events = RecallEvent.where(:id.ne => @recall_event.id, recalling_firm: @recall_event.recalling_firm).order(report_date: :desc, recall_numb... | [
"0.70096964",
"0.68969685",
"0.6521292",
"0.62053066",
"0.61614007",
"0.6154899",
"0.6151275",
"0.60766095",
"0.6016523",
"0.6014423",
"0.5971709",
"0.59508723",
"0.5928448",
"0.59004545",
"0.58704805",
"0.57720745",
"0.56967837",
"0.5669059",
"0.5667683",
"0.56663704",
"0.56... | 0.5954489 | 11 |
GET /recall_events/1 GET /recall_events/1.json | def show
@related_recall_events = RecallEvent.where(:id.ne => @recall_event.id, recalling_firm: @recall_event.recalling_firm).order(report_date: :desc, recall_number: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_recall_event\n @recall_event = RecallEvent.find(params[:id])\n end",
"def recall_event_params\n params[:recall_event]\n end",
"def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end",
"def state_events(state)\n api_return = RestClient.get('https://... | [
"0.73438036",
"0.6941012",
"0.59343165",
"0.5888656",
"0.58333355",
"0.5796445",
"0.57812893",
"0.57766205",
"0.57571346",
"0.5749303",
"0.5736863",
"0.57068735",
"0.5660683",
"0.5631506",
"0.5613912",
"0.56026036",
"0.5478464",
"0.5473085",
"0.5466687",
"0.5455687",
"0.54426... | 0.66005427 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_recall_event
@recall_event = RecallEvent.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def recall_event_params
params[:recall_event]
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.