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 |
|---|---|---|---|---|---|---|
Used to perform a single click on this view in the remote application | def click()
mouse_down
mouse_up
stall :click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def click\n `#@native.click()`\n self\n end",
"def click\n `#@native.click()`\n end",
"def click\n @mech.click self\n end",
"def action\n trigger :click\n end",
"def click; end",
"def click; end",
"def click; e... | [
"0.7851789",
"0.7331209",
"0.7267243",
"0.70068026",
"0.69055134",
"0.6712826",
"0.6712826",
"0.6712826",
"0.66349316",
"0.6542265",
"0.6498272",
"0.64977866",
"0.64418554",
"0.64115185",
"0.6405271",
"0.6405271",
"0.6403231",
"0.63779926",
"0.6377938",
"0.63176066",
"0.62931... | 0.6213732 | 25 |
Used to perform a single right click on this view in the remote application | def right_click()
right_mouse_down
right_mouse_up
stall :right_click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Sui... | [
"0.69611996",
"0.6806256",
"0.66562665",
"0.64541644",
"0.63785434",
"0.6358608",
"0.630985",
"0.63055325",
"0.6230192",
"0.6185122",
"0.616992",
"0.6126149",
"0.5999554",
"0.59909505",
"0.5973776",
"0.59367365",
"0.5917623",
"0.5895321",
"0.5859786",
"0.5852538",
"0.5851412"... | 0.6970275 | 0 |
Used to perform a single basic click on this view in the remote application | def basic_click()
scroll_to_visible
@driver.sc_basic_click action_target, *action_locator_args
stall :click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def click\n `#@native.click()`\n self\n end",
"def click\n `#@native.click()`\n end",
"def action\n trigger :click\n end",
"def click\n @mech.click self\n end",
"def click; end",
"def click; end",
"def click; e... | [
"0.79658914",
"0.7399428",
"0.73979634",
"0.7080815",
"0.69916844",
"0.69690925",
"0.69690925",
"0.69690925",
"0.66622967",
"0.6624738",
"0.66089916",
"0.6590496",
"0.651034",
"0.6488527",
"0.6451603",
"0.64472383",
"0.64472383",
"0.6390206",
"0.6388577",
"0.63356143",
"0.632... | 0.70629334 | 4 |
Used to perform a mouse wheel action on the xaxis | def mouse_wheel_delta_x(delta)
@driver.sc_mouse_wheel_delta_x action_target, delta, *action_locator_args
stall :mouse_wheel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scroll_mouse(x_amount, y_amount)\n send_request RequestMessage.new(mouse_wheel_message: MouseWheel.new(x_scroll: x_amount, y_scroll: y_amount))\n end",
"def mouse_x\n end",
"def mouse_x_update(val)\n $mouse_x += val\n sc_osc \"/n_set\", $synth_g, \"x\", $mouse_x\nend",
"def mouseX; end",
"de... | [
"0.6770733",
"0.6498436",
"0.63490856",
"0.6292921",
"0.6154801",
"0.60555744",
"0.60477966",
"0.6037942",
"0.6001609",
"0.59388274",
"0.591052",
"0.591052",
"0.5729326",
"0.5668674",
"0.5656004",
"0.5642068",
"0.5602431",
"0.55874383",
"0.55874383",
"0.5560465",
"0.55550665"... | 0.7761264 | 0 |
Used to perform a mouse wheel action on the yaxis | def mouse_wheel_delta_y(delta)
@driver.sc_mouse_wheel_delta_y action_target, delta, *action_locator_args
stall :mouse_wheel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_y\n end",
"def move_home_y\n @axis_y.move_home()\n @axis_y.disable_motor()\n end",
"def mouseY; end",
"def yaxis\n end",
"def mouse_moved\n modulate_amount = map1d(mouse_y, (0..height), (220..1))\n modulate_frequency = map1d(mouse_x, (0..width), (0.1..100)) \n fm.frequency.set_last_v... | [
"0.6374681",
"0.61653805",
"0.61569786",
"0.61246145",
"0.6017624",
"0.59153116",
"0.58866054",
"0.5867629",
"0.5809054",
"0.5772996",
"0.57716495",
"0.5763039",
"0.5592902",
"0.5578934",
"0.5560531",
"0.55119735",
"0.55083764",
"0.54832613",
"0.54794395",
"0.5450281",
"0.544... | 0.7782795 | 0 |
Used to perform a key down on this view in the remote application You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corresponding symbol. Example: view.key_down 'a' key down for printable character 'a' view.key_down :delete key down for function key delete view.key_down :meta_key key down for the meta key | def key_down(key)
focus
@driver.sc_key_down action_target, key, *action_locator_args
stall :key_down
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def down(key)\n key = normalize_keys(Array(key)).first\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: type, **key)\n self\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"... | [
"0.81894314",
"0.77000344",
"0.77000344",
"0.71842504",
"0.6992742",
"0.69250065",
"0.6849509",
"0.6667458",
"0.6621216",
"0.6574964",
"0.65252584",
"0.65185386",
"0.64259654",
"0.6388991",
"0.63725513",
"0.63124335",
"0.63088435",
"0.62571913",
"0.6159989",
"0.61031437",
"0.... | 0.77849996 | 1 |
Used to perform a key up on this view in the remote application You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corresponding symbol. Example: view.key_up 'a' key up for printable character 'a' view.key_up :delete key up for function key delete view.key_up :meta_key key up for the meta key | def key_up(key)
focus
@driver.sc_key_up action_target, key, *action_locator_args
stall :key_up
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up(key)\n key = normalize_keys(Array(key)).first\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n self\n end",
"def up(key)\n description = key_description_for_string key\n\n @modifiers &= ~(modifier_bit description[:key])\n @_pressed_ke... | [
"0.80277866",
"0.7596856",
"0.7575435",
"0.7575435",
"0.7025894",
"0.6904381",
"0.6534596",
"0.6478036",
"0.6455483",
"0.6391917",
"0.63572425",
"0.6198706",
"0.6142492",
"0.613259",
"0.61030865",
"0.60262626",
"0.6021781",
"0.6021781",
"0.60146433",
"0.60125947",
"0.59947884... | 0.75465304 | 4 |
Used to type a key on this view in the remote application. This will cause a key down followed by a key up You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corresponding symbol. Example: view.type_key 'a' type printable character 'a' view.type_key :delete type function key delete | def type_key(key)
focus
@driver.sc_type_key action_target, key, *action_locator_args
stall :type_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(key)\n send_command([:type, key])\n end",
"def type(key)\n call_command(['type', key])\n end",
"def type(key)\n call_command(['type', key])\n end",
"def type(*keys)\n keys = normalize_keys(Array(keys))\n\n keys.each do |key|\n type = key[:text] ? \"keyDown\" ... | [
"0.7480066",
"0.73115885",
"0.72530967",
"0.71177316",
"0.6900506",
"0.6753131",
"0.661871",
"0.64906937",
"0.6437501",
"0.6437501",
"0.63951325",
"0.62520427",
"0.62520427",
"0.61219114",
"0.6108311",
"0.6108311",
"0.61071455",
"0.60195",
"0.5999828",
"0.5995542",
"0.5982869... | 0.7402131 | 1 |
Override this to supply the target, which can either be one of the following: :view :core_query_element | def action_target()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targetElement=(value)\n\t\t\t@targetElement = value\n\t\tend",
"def targetElement=(value)\n\t\t\t@targetElement = value\n\t\tend",
"def method_missing(method, *args, &block)\n @view.send(method, @selector, *args, &block)\n self\n end",
"def select_target\n @target or raise Vanagon::Er... | [
"0.5994996",
"0.5994996",
"0.5757981",
"0.5746993",
"0.57150686",
"0.5632601",
"0.5632601",
"0.5615904",
"0.5615043",
"0.5550563",
"0.5539968",
"0.552279",
"0.552279",
"0.5507207",
"0.55031276",
"0.54934937",
"0.54718274",
"0.54684377",
"0.5446981",
"0.54395056",
"0.53883445"... | 0.5408089 | 20 |
Override this to supply the arguments to generate the locator | def action_locator_args()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_args__\n self\n end",
"def locator(options={})\n options.inject([]) do |locators, locator|\n key, value = locator\n locators << \"#{key}:#{value}\"\n end.join(',')\n end",
"def args()\n #This is a stub, used for indexing\n end",
"def regio... | [
"0.6004458",
"0.59963995",
"0.59331214",
"0.5824153",
"0.5785663",
"0.57632834",
"0.5745456",
"0.5745456",
"0.573316",
"0.5699353",
"0.5698791",
"0.5696598",
"0.5635229",
"0.5607605",
"0.5593467",
"0.5593467",
"0.5554346",
"0.55269915",
"0.54894",
"0.5470132",
"0.5441323",
... | 0.6621261 | 0 |
Used as a Dashboard | def index
@items = Item.select { |item| item.user == current_user}
@bookings = Booking.select { |booking| booking.user == current_user }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard\r\n end",
"def dashboard; end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n\n end",
"def dashboard\n\n end",
"def dashboard\n\tend",
"def set_dashboard\n end",
"def dashboard\n ... | [
"0.81040573",
"0.80815953",
"0.78646934",
"0.78646934",
"0.78646934",
"0.78646934",
"0.78646934",
"0.7845085",
"0.7845085",
"0.7632984",
"0.7386546",
"0.73487204",
"0.7086469",
"0.7004972",
"0.68298876",
"0.6699293",
"0.66983193",
"0.66835874",
"0.6682708",
"0.66500187",
"0.6... | 0.0 | -1 |
Do we need? def show | def new
@item = Item.find(params[:item_id])
@booking = Booking.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show() end",
"def show() end",
"def show() end",
"def show ; end",
"def show\n\t\t end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n... | [
"0.835698",
"0.835698",
"0.835698",
"0.83345175",
"0.824427",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.8125699",
"0.81254435",
"0.805334",
"0.79969937",
"0.78854215",
"0.78854215",
"0.7885... | 0.0 | -1 |
Merges accepted corrections for specially formatted files into content AT. This is done in two steps: 1. Apply all corrections that can be done automatically (based on exact text matches) 2. Apply manual corrections where no or multiple extact matches are found. We have to do it in two steps so that when we open the file in the editor for manual changes, all auto corrections are already applied to the file and they don't overwrite any manual corrections prior to when the script stores auto corrections to disk. | def merge_accepted_corrections_into_content_at(options)
# First validate the spot sheets and cancel process if errors are found.
validate_spot_sheet(options.merge('validate_or_merge' => 'merge'))
accepted_corrections_base_dir = config.compute_base_dir(
options['base-dir'] ||
options['base-dir-1'] ||
:accepted_corrections_dir
)
accepted_corrections_glob_pattern = config.compute_glob_pattern(
accepted_corrections_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging accepted corrections into content_at'
start_time = Time.now
total_count = 0
auto_success_count = 0
manual_success_count = 0
errors_count = 0
Dir.glob(accepted_corrections_glob_pattern).each do |accepted_corrections_file_name|
if accepted_corrections_file_name !~ /\.accepted_corrections\.txt\z/
$stderr.puts " - skipping #{ accepted_corrections_file_name }"
next
end
total_count += 1
# prepare paths
content_at_file_name = accepted_corrections_file_name.gsub(
accepted_corrections_base_dir,
content_base_dir
).gsub(
/\.accepted_corrections\.txt\z/, '.at'
)
output_file_name = content_at_file_name
begin
# First apply all corrections that can be done automatically
outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_auto(
File.read(accepted_corrections_file_name),
File.read(content_at_file_name),
content_at_file_name,
)
if outcome.success
# write to file
at_with_accepted_corrections = outcome.result
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_accepted_corrections)
auto_success_count += 1
$stderr.puts " + Auto-merged accepted corrections from #{ accepted_corrections_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }"
end
# Second apply manual corrections.
outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_manually(
File.read(accepted_corrections_file_name),
File.read(content_at_file_name),
content_at_file_name,
)
if outcome.success
# Nothing needs to be written to file. This has already been done
# manually in the editor.
manual_success_count += 1
$stderr.puts " + Manually merged accepted corrections from #{ accepted_corrections_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }"
end
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ accepted_corrections_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
end
$stderr.puts "Finished merging #{ total_count } files in #{ Time.now - start_time } seconds:"
$stderr.puts " - Auto-merges: #{ auto_success_count } files."
$stderr.puts " - Manual merges: #{ manual_success_count } files."
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\... | [
"0.54476726",
"0.5409826",
"0.5293991",
"0.52066636",
"0.5095803",
"0.5063352",
"0.50611675",
"0.49807286",
"0.4966632",
"0.4940869",
"0.4900983",
"0.48987687",
"0.48934543",
"0.4866788",
"0.48495376",
"0.4838936",
"0.48299643",
"0.48292568",
"0.48143947",
"0.4813448",
"0.480... | 0.7996232 | 0 |
Merges gap_mark_tagging_import into content AT. Uses content AT as authority for text. | def merge_gap_mark_tagging_import_into_content_at(options)
gap_mark_tagging_import_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir
)
gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(
gap_mark_tagging_import_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(
options['base-dir-2'] || :content_dir
)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'
start_time = Time.now
total_count = 0
success_count = 0
errors_count = 0
Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|
if gap_mark_tagging_import_file_name !~ /\.gap_mark_tagging\.txt\z/
next
end
total_count += 1
# prepare paths
content_at_file_name = gap_mark_tagging_import_file_name.gsub(
gap_mark_tagging_import_base_dir, content_base_dir
).gsub(
/\.gap_mark_tagging\.txt\z/, '.at'
)
output_file_name = content_at_file_name
begin
outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(
File.read(gap_mark_tagging_import_file_name),
File.read(content_at_file_name),
)
if outcome.success
# write to file
at_with_merged_tokens = outcome.result
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
$stderr.puts " + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }"
end
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_gap_mark_tagging(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('gap_m... | [
"0.6669897",
"0.6423653",
"0.5679911",
"0.5664879",
"0.5527974",
"0.5379095",
"0.5342197",
"0.52206373",
"0.5152867",
"0.5109662",
"0.50669765",
"0.50081336",
"0.49331763",
"0.478046",
"0.47328126",
"0.47231713",
"0.47207317",
"0.4708869",
"0.4655644",
"0.46509063",
"0.462561... | 0.7781892 | 0 |
Merges record_marks from FOLIO XML import into IDML import Uses IDML as authority for text and all tokens except record_marks. If no IDML file is present, uses FOLIO XML as authority for everything. | def merge_record_marks_from_folio_xml_at_into_idml_at(options)
input_folio_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :folio_import_dir
)
input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)
input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)
input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)
output_base_dir = config.base_dir(:staging_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'
start_time = Time.now
total_count = 0
success_count = 0
errors_count = 0
idml_not_present_count = 0
folio_not_present_count = 0
# First get union of all Folio and Idml files
folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)
idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)
all_output_files = (folio_files + idml_files).map { |e|
# process folio files
e = e.gsub(input_folio_base_dir, output_base_dir)
.gsub(/\.folio\.at\z/, '.at')
# process idml files
e = e.gsub(input_idml_base_dir, output_base_dir)
.gsub(/\.idml\.at\z/, '.at')
}.uniq.sort
all_output_files.each do |output_file_name|
if output_file_name !~ /\.at\z/
$stderr.puts " - Skip #{ output_file_name }"
next
end
total_count += 1
# prepare paths
at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\.at\z/, '.folio.at')
at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\.at\z/, '.idml.at')
if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)
# Both files are present, merge tokens
begin
at_folio = File.read(at_folio_file_name)
at_idml = File.read(at_idml_file_name)
at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(
at_folio, at_idml
)
# write to file
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
$stderr.puts " + Merge rids from #{ at_folio_file_name }"
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
elsif File.exist?(at_folio_file_name)
# IDML file is not present, use Folio import as authority
FileUtils.mkdir_p(File.dirname(output_file_name))
at_with_merged_tokens = File.read(at_folio_file_name)
# write to file
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
idml_not_present_count += 1
$stderr.puts " Use #{ at_folio_file_name }"
elsif File.exist?(at_idml_file_name)
# Folio file is not present, use Idml import as authority
FileUtils.mkdir_p(File.dirname(output_file_name))
at_with_merged_tokens = File.read(at_idml_file_name)
# write to file
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
folio_not_present_count += 1
$stderr.puts " Use #{ at_idml_file_name }"
else
raise "Could find neither Folio nor IDML file! (#{ output_file_name })"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts " - Folio files not present: #{ folio_not_present_count }"
$stderr.puts " - IDML files not present: #{ idml_not_present_count }"
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_author_identities_set(import_settings)\n import_settings.map do |import_setting|\n # ensure that we have a *new* identity worth saving\n next unless author_identity_different?(import_setting_to_attribs(import_setting))\n\n normalize_author_identity(import_setting['firstName'], import_s... | [
"0.51859033",
"0.51580006",
"0.47088492",
"0.46572605",
"0.45058817",
"0.44985515",
"0.44369283",
"0.44071212",
"0.44071007",
"0.43925086",
"0.43878338",
"0.43812704",
"0.4317431",
"0.42685977",
"0.42623025",
"0.42609125",
"0.42325857",
"0.4231966",
"0.41948512",
"0.4176468",
... | 0.63851887 | 0 |
Merges subtitle_marks from subtitle_import into content AT. Uses content AT as authority for text and all tokens except subtitle_marks. | def merge_subtitle_marks_from_subtitle_import_into_content_at(options)
subtitle_import_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir
)
subtitle_import_glob_pattern = config.compute_glob_pattern(
subtitle_import_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'
merge_subtitle_marks_from_subtitle_shared_into_content_at(
subtitle_import_glob_pattern,
subtitle_import_base_dir,
content_base_dir,
options
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_... | [
"0.80893487",
"0.60355467",
"0.56063306",
"0.5563302",
"0.55631053",
"0.5482907",
"0.54163516",
"0.5389429",
"0.53316957",
"0.5297075",
"0.52208096",
"0.5157434",
"0.5102568",
"0.5079679",
"0.50069255",
"0.4964183",
"0.4943861",
"0.4942114",
"0.48841727",
"0.48463398",
"0.476... | 0.8202545 | 0 |
Merges subtitle_marks from subtitle_tagging_import into content AT. Uses content AT as authority for text and all tokens except subtitle_marks. | def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)
subtitle_tagging_import_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir
)
subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(
subtitle_tagging_import_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'
merge_subtitle_marks_from_subtitle_shared_into_content_at(
subtitle_tagging_import_glob_pattern,
subtitle_tagging_import_base_dir,
content_base_dir,
options
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_imp... | [
"0.8073107",
"0.6250079",
"0.60288954",
"0.5826444",
"0.5427378",
"0.5423028",
"0.53833884",
"0.5312697",
"0.5263177",
"0.52549976",
"0.5229811",
"0.51592773",
"0.51465636",
"0.5127518",
"0.5099899",
"0.4941452",
"0.48906457",
"0.47415972",
"0.47116363",
"0.46969014",
"0.4677... | 0.83738387 | 0 |
Merges titles from folio roundtrip compare txt files into content AT to get correct spelling. | def merge_titles_from_folio_roundtrip_compare_into_folio_import(options)
folio_roundtrip_compare_base_dir = File.join(
config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :compare_dir
),
'folio_source/with_folio_import'
)
folio_import_base_dir = config.compute_base_dir(options['base-dir-2'] || :folio_import_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging titles from folio roundtrip compare into content_at'
start_time = Time.now
total_count = 0
success_count = 0
errors_count = 0
Dir.glob(
[
folio_roundtrip_compare_base_dir,
config.compute_file_selector(options['file-selector'] || :all_files),
config.compute_file_extension(options['file-extension'] || :txt_extension)
].join
).each do |folio_roundtrip_compare_file_name|
total_count += 1
# prepare paths
content_at_file_name = folio_roundtrip_compare_file_name.gsub(
folio_roundtrip_compare_base_dir, # update path
folio_import_base_dir
).gsub(
/\/+/, '/' # normalize runs of slashes resulting from different directory depths
).gsub(
/\.txt\z/, '.folio.at' # replace file extension
)
output_file_name = content_at_file_name
begin
outcome = Repositext::Process::Merge::TitlesFromFolioRoundtripCompareIntoContentAt.merge(
File.read(folio_roundtrip_compare_file_name),
File.read(content_at_file_name),
)
if outcome.success
# write to file
at_with_merged_title = outcome.result
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_merged_title)
success_count += 1
$stderr.puts " + Merge title from #{ folio_roundtrip_compare_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ folio_roundtrip_compare_file_name }: #{ outcome.messages.join }"
end
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ folio_roundtrip_compare_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_compare_titles_with_those_of_erp(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n titles_from_erp = load_titles_from_erp\n file_count = 0\n titles_with_differences = []\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern... | [
"0.68886334",
"0.5963178",
"0.58270115",
"0.57796055",
"0.56616473",
"0.5658089",
"0.5650263",
"0.56049395",
"0.55702674",
"0.5556202",
"0.5552666",
"0.55489075",
"0.55408376",
"0.5492955",
"0.54602766",
"0.54545224",
"0.5394314",
"0.5377122",
"0.5366659",
"0.53440577",
"0.53... | 0.74505836 | 0 |
Uses either idml_imported (preference) or folio_imported (fallback) at for content. NOTE: this duplicates a lot of code from merge_record_marks_from_folio_xml_at_into_idml_at | def merge_use_idml_or_folio(options)
input_folio_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :folio_import_dir
)
input_idml_base_dir = config.compute_base_dir(
options['base-dir-2'] || :idml_import_dir
)
input_file_selector = config.compute_file_selector(
options['file-selector'] || :all_files
)
input_file_extension = config.compute_file_extension(
options['file-extension'] || :at_extension
)
output_base_dir = config.base_dir(:staging_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Using either idml_at or folio_at for content_at'
start_time = Time.now
total_count = 0
success_count = 0
idml_used_count = 0
folio_used_count = 0
# TODO: refactor this method to use Cli::Utils so that the changed-only flag works
# First get union of all Folio and Idml files
folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)
idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)
all_output_files = (folio_files + idml_files).map { |e|
# process folio files
e = e.gsub(input_folio_base_dir, output_base_dir)
.gsub(/\.folio\.at\z/, '.at')
# process idml files
e = e.gsub(input_idml_base_dir, output_base_dir)
.gsub(/\.idml\.at\z/, '.at')
}.uniq.sort
all_output_files.each do |output_file_name|
if output_file_name !~ /\.at\z/
$stderr.puts " - Skip #{ output_file_name }"
next
end
total_count += 1
# prepare paths
at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\.at\z/, '.folio.at')
at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\.at\z/, '.idml.at')
if File.exist?(at_idml_file_name)
# Idml is present, use it
FileUtils.mkdir_p(File.dirname(output_file_name))
idml_at = File.read(at_idml_file_name)
# write to file
File.write(output_file_name, idml_at)
success_count += 1
idml_used_count += 1
$stderr.puts " Use #{ at_idml_file_name }"
elsif File.exist?(at_folio_file_name)
# IDML file is not present, bt folio is, use it
FileUtils.mkdir_p(File.dirname(output_file_name))
folio_at = File.read(at_folio_file_name)
# write to file
File.write(output_file_name, folio_at)
success_count += 1
folio_used_count += 1
$stderr.puts " Use #{ at_folio_file_name }"
else
raise "Could find neither Folio nor IDML file! (#{ output_file_name })"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts " - IDML files used: #{ idml_used_count }"
$stderr.puts " - Folio files used: #{ folio_used_count }"
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)\n ... | [
"0.61001337",
"0.59466064",
"0.5316787",
"0.5243763",
"0.5201312",
"0.51964575",
"0.50662744",
"0.49114943",
"0.4884987",
"0.48686188",
"0.4845496",
"0.48205814",
"0.4813428",
"0.47976515",
"0.47955358",
"0.47776836",
"0.47776836",
"0.4754573",
"0.47400784",
"0.47339615",
"0.... | 0.57625264 | 2 |
NOTE: This is very much tailored to handling Stellar requests. | def post_response(url, opts = {})
options = {
parse_json: true,
data: {}
}.merge(opts)
uri = URI.parse(url)
http = HTTPClient.new
begin
response = http.post(uri, options[:data].to_json)
rescue EOFError => e
end
if response
if options[:parse_json]
JSON(response.body).with_indifferent_access
else
response.body
end
else
{
result: {
status: 'error'
}
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onRequest(req)\n\t\tif req.request == 'WHEREAMI?'\n\t\t\tloc = location.space\n\t\t\tresp = {:x => loc.x, :y => loc.y, :sectorx => loc.sector.offsetX, :sectory => loc.sector.offsetY}.to_json\n\t\t\treq.reply('YOURPOS', resp)\n\t\telsif req.request == 'NEARBY?'\n\t\t\tdistOfSight = req.message.to_i\n\t\t\tdistO... | [
"0.62451726",
"0.588067",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.5700883",
"0.56267005",
"0.56157666",
"0.55748546",
"0.55524296",
"0.5511729",
"0.54547125",
... | 0.0 | -1 |
Conversions Currencies need to implement conversion methods for currencies that are not themselves. | def to_btc(value)
value.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallow_currency_conversion!; end",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def currencies\n raise NotImplementedError\n end",
"def convert_to(new_currency)\n\n # if the instance is already in the requested cur... | [
"0.750382",
"0.7207858",
"0.6895679",
"0.68831897",
"0.67953604",
"0.6747275",
"0.66808015",
"0.6665789",
"0.6650125",
"0.6630351",
"0.661515",
"0.6573833",
"0.6539112",
"0.65294176",
"0.6407027",
"0.63641405",
"0.63641405",
"0.63641405",
"0.63625187",
"0.6344454",
"0.6308042... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_pet
@pet = Pet.find_by!(id: params[:pet_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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_bid
@bid = @pet.bids.find_by!(number: 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 bid_params
params.require(:bid).permit(:bid_price, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
def make_path(input) case input.to_i when (1..50) creates the specific city's link for Scraper.get_activities | def list_activities(name)
puts ""
puts "--------------------------------------------------"
puts "Here is a list of activities popular in #{name}:".colorize(:green)
puts "--------------------------------------------------"
puts ""
# prints activities available in city chosen by user
Twyd::Activity.all.each.with_index(1) do |a, i|
puts "#{i}. #{a.name}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_visit\n par = case $url.upcase\n when \"LMX\" then \"https://www.linio.com.mx\"\n when \"LCO\" then \"https://www.linio.com.co\"\n when \"LCL\" then \"https://www.linio.cl\"\n when \"LVE\" then \"https://www.linio.com.ve\"\n when \"LAR\" then \"https://www.linio.com.ar\"\n when \"LEC\" then \"https:... | [
"0.6597116",
"0.64332086",
"0.6273109",
"0.59461427",
"0.59392375",
"0.5852955",
"0.58299935",
"0.5791049",
"0.57619834",
"0.56556153",
"0.56498593",
"0.56402016",
"0.5618965",
"0.5555122",
"0.55499893",
"0.55436796",
"0.5530475",
"0.5527893",
"0.55217767",
"0.55056745",
"0.5... | 0.0 | -1 |
GET /exam_managements GET /exam_managements.json | def index
@exam_managements = ExamManagement.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @managements = Management.all\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def exam_management_params\n params[:exam_management]\n end",
"def index\n @product_managements = ProductManagement.all\n\n render json: @product... | [
"0.6691709",
"0.6376951",
"0.615914",
"0.61048347",
"0.6024783",
"0.59841484",
"0.5923909",
"0.5871902",
"0.5850734",
"0.5838046",
"0.58378536",
"0.5837433",
"0.5683783",
"0.5663371",
"0.5661857",
"0.56558764",
"0.5653756",
"0.564942",
"0.5639136",
"0.56313556",
"0.5618737",
... | 0.75781417 | 0 |
GET /exam_managements/1 GET /exam_managements/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exam_managements = ExamManagement.all\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\... | [
"0.7520445",
"0.68434495",
"0.64389783",
"0.64270663",
"0.6416772",
"0.6402397",
"0.6362644",
"0.6251403",
"0.62056255",
"0.61888474",
"0.6154322",
"0.6121455",
"0.6120247",
"0.61154735",
"0.6103058",
"0.6096471",
"0.6079488",
"0.60758805",
"0.60682464",
"0.60455257",
"0.6044... | 0.0 | -1 |
POST /exam_managements POST /exam_managements.json | def create
@exam_management = ExamManagement.new(exam_management_params)
respond_to do |format|
if @exam_management.save
format.html { redirect_to @exam_management, notice: 'Exam management was successfully created.' }
format.json { render :show, status: :created, location: @exam_management }
else
format.html { render :new }
format.json { render json: @exam_management.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exam_managements = ExamManagement.all\n end",
"def create\n @exam_set = ExamSet.new(exam_set_params)\n\n respond_to do |format|\n if @exam_set.save\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully created.' }\n format.json { render :show, status:... | [
"0.6509114",
"0.6235746",
"0.60923886",
"0.60821307",
"0.6022878",
"0.6022878",
"0.5989685",
"0.5982695",
"0.5969359",
"0.59178036",
"0.59096515",
"0.5891241",
"0.5866648",
"0.5845734",
"0.5825597",
"0.5807066",
"0.57910025",
"0.5787659",
"0.5783099",
"0.5780498",
"0.57164174... | 0.6725472 | 0 |
PATCH/PUT /exam_managements/1 PATCH/PUT /exam_managements/1.json | def update
respond_to do |format|
if @exam_management.update(exam_management_params)
format.html { redirect_to @exam_management, notice: 'Exam management was successfully updated.' }
format.json { render :show, status: :ok, location: @exam_management }
else
format.html { render :edit }
format.json { render json: @exam_management.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\... | [
"0.6895557",
"0.68855846",
"0.6880162",
"0.6808966",
"0.6785631",
"0.6678732",
"0.6678732",
"0.6678732",
"0.6678732",
"0.6628142",
"0.65718216",
"0.6540536",
"0.6492062",
"0.64654267",
"0.6451805",
"0.6390057",
"0.6369078",
"0.63637996",
"0.634729",
"0.63406545",
"0.6309019",... | 0.6901353 | 0 |
DELETE /exam_managements/1 DELETE /exam_managements/1.json | def destroy
@exam_management.destroy
respond_to do |format|
format.html { redirect_to exam_managements_url, notice: 'Exam management was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n f... | [
"0.7551792",
"0.7548073",
"0.7528161",
"0.7385695",
"0.7367076",
"0.73138744",
"0.73138744",
"0.73138744",
"0.72853357",
"0.7240872",
"0.7238346",
"0.7214121",
"0.7206823",
"0.7203359",
"0.7180046",
"0.71610653",
"0.7146668",
"0.71156037",
"0.71142673",
"0.7108968",
"0.710119... | 0.753681 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_exam_management
@exam_management = ExamManagement.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def exam_management_params
params[:exam_management]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Replace this with your real tests. | def test_truth
assert true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end"... | [
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188"... | 0.0 | -1 |
for a URL like the fixture is expected to be spec/fixures/CertiPathBridgeCAG3.p7c | def stub_p7c(url)
fixture = File.basename(url)
stub_request(:get, url)
.to_return(body: File.read(File.join('spec/fixtures/', fixture)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ca_path_name\n uri = URI.parse('https://www.amazon.com')\n http = Net::HTTP.new(uri.host, uri.port)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_path = path(\"fixture/ca_path/\")\n http.use_ssl = true\n response = http.start do |s|\n assert s.get(uri.request_uri).length ... | [
"0.62057793",
"0.61017436",
"0.6044438",
"0.5995589",
"0.5995589",
"0.5980684",
"0.5884771",
"0.5880114",
"0.5871856",
"0.5869041",
"0.5832278",
"0.58309627",
"0.5753628",
"0.57271135",
"0.56682533",
"0.56628823",
"0.56373787",
"0.557301",
"0.55467206",
"0.5543499",
"0.550795... | 0.58757395 | 8 |
TODO: Review code below this line, it was pretty much a copy and paste from VirtualBox base driver and has no tests | def execute(*command, &block)
# Get the options hash if it exists
opts = {}
opts = command.pop if command.last.is_a?(Hash)
tries = 0
tries = 3 if opts[:retryable]
sleep = opts.fetch(:sleep, 1)
# Variable to store our execution result
r = nil
retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do
# Execute the command
r = raw(*command, &block)
# If the command was a failure, then raise an exception that is
# nicely handled by Vagrant.
if r.exit_code != 0
if @interrupted
@logger.info("Exit code != 0, but interrupted. Ignoring.")
else
raise LXC::Errors::ExecuteError, :command => command.inspect
end
end
end
# Return the output, making sure to replace any Windows-style
# newlines with Unix-style.
r.stdout.gsub("\r\n", "\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_vmware_vbox_vm(client_name)\n modify_vbox_vm(client_name,\"rtcuseutc\",\"on\")\n modify_vbox_vm(client_name,\"vtxvpid\",\"on\")\n modify_vbox_vm(client_name,\"vtxux\",\"on\")\n modify_vbox_vm(client_name,\"hwvirtex\",\"on\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Conf... | [
"0.64217657",
"0.64150083",
"0.6336082",
"0.6271",
"0.6229963",
"0.6147014",
"0.6101017",
"0.60893047",
"0.60614574",
"0.60469615",
"0.5993159",
"0.59561354",
"0.5870823",
"0.58669585",
"0.5860617",
"0.58535385",
"0.58292145",
"0.58032453",
"0.57781637",
"0.57720804",
"0.5750... | 0.0 | -1 |
Remembers a user in the database for use in presistent sessions | def remember
self.remember_token = User.new_token
# 'update_attribute' relieves me of the requirement to provide password when updating
update_attribute(:remember_digest, User.digest(remember_token))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end",
"def set_session_current_user(user)\n self.current_user = user\n # Try to reuse existing sessions.\n if session[:authpwn_suid]\n ... | [
"0.702948",
"0.6555715",
"0.6535143",
"0.6432948",
"0.6322701",
"0.6273564",
"0.6240582",
"0.62013775",
"0.6187015",
"0.6182969",
"0.61562073",
"0.6121879",
"0.6093624",
"0.60839635",
"0.6082462",
"0.60799545",
"0.6067676",
"0.6059618",
"0.604971",
"0.604039",
"0.6016863",
... | 0.0 | -1 |
Returns true if the given token matches the digest | def authenticated?(attribute, token)
# 'send' (in fact its 'self.send' but 'self can be omitted in this context')
# is a method that receives a method name, either in symbol or string format,
# and applies it to the base argument (in this case, 'self').
# String interpolation is used because we only know whether it's
# the user's remember token or activation token at run time. Symbols are interpolated as strings.
digest = send("#{attribute}_digest")
return false if digest.nil?
BCrypt::Password.new(digest).is_password?(token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest does not exist in the database.\n BCrypt::Password.new(digest).is_password?(token)\n ... | [
"0.7857136",
"0.75394505",
"0.743387",
"0.7321885",
"0.714117",
"0.714117",
"0.71279824",
"0.7091808",
"0.705077",
"0.6928193",
"0.6892255",
"0.6887895",
"0.6860336",
"0.6815546",
"0.6793302",
"0.678842",
"0.67861015",
"0.678452",
"0.67813665",
"0.67691225",
"0.6757527",
"0... | 0.0 | -1 |
Sends password reset email. | def send_password_reset_email
UserMailer.password_reset(self).deliver_now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"de... | [
"0.87891245",
"0.86781377",
"0.86781377",
"0.8662409",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.8657558",
"0.86509216",
"0.86493695",
"0.864714",
"0.8631843",
"0.8631843",
"0.8631843",
"0.... | 0.85449773 | 26 |
Sets the password reset attributes | def create_reset_digest
self.reset_token = User.new_token
update_columns(reset_digest: User.digest(reset_token), reset_sent_at: Time.zone.now)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend",
"def send_reset_password_instructions(attributes={})\n send_instructions_for(:reset_password, attributes)\n end",
"def set_password_reset\n self.make_password_... | [
"0.7346467",
"0.72117406",
"0.71095175",
"0.6930916",
"0.68712664",
"0.68263495",
"0.6816177",
"0.6814454",
"0.6810618",
"0.6797832",
"0.6779232",
"0.6750862",
"0.675002",
"0.6744577",
"0.6740439",
"0.67244756",
"0.67201275",
"0.6704257",
"0.66986483",
"0.66656804",
"0.666568... | 0.0 | -1 |
Returns true if a password reset has expired. | def password_reset_expired?
reset_sent_at < 2.hours.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset_expired?\n reset_sent_at < Settings.timeout_reset_password.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # password reset sent earlier than two hours ago.\n end",
"def password... | [
"0.8866848",
"0.8742425",
"0.87405956",
"0.869067",
"0.86877984",
"0.86600757",
"0.86578995",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.8651915",
"0.8649047",
"0.86207587",
"0.8620148",
"0.86081725",
"0.... | 0.86076194 | 26 |
Returns a user's status feed. | def feed
# Using a sub-select is more efficient. The entire query is performed in the database.
following_ids = "SELECT followed_id FROM relationships
WHERE follower_id = :user_id"
Micropost.where("user_id IN (#{following_ids})
OR user_id = :user_id", user_id: id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed\n get '/users/self/feed', auth_params\n end",
"def user_live_feed(user_id, params = {})\n get(\"/v1/users/#{user_id}/live\", params)\n end",
"def username_feed(username)\n\t\t\tid = search_user(username)['data'][0]['id']\n\t\t\tfeed = user_feed(id)\t\t\t\n\t\t\treturn feed\n\t\tend... | [
"0.6737085",
"0.66459346",
"0.6458702",
"0.63994145",
"0.6398368",
"0.6332916",
"0.6291411",
"0.62239045",
"0.6168492",
"0.6140585",
"0.61130196",
"0.6111324",
"0.60560274",
"0.6045318",
"0.60336715",
"0.6002429",
"0.5992754",
"0.59684235",
"0.5960727",
"0.59190536",
"0.59177... | 0.0 | -1 |
Returns true if the current user is following the other user. | def following?(other_user)
following.include?(other_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n ... | [
"0.85312015",
"0.85117656",
"0.85117656",
"0.85117656",
"0.84812355",
"0.84812355",
"0.84812355",
"0.84812355",
"0.84238315",
"0.8413351",
"0.8333338",
"0.83173794",
"0.83137536",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
... | 0.8340864 | 21 |
Converts email to all lowercase. | def downcase_email
self.email.downcase!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downcase_email\n\t email.downcase!\n\t end",
"def downcase_email\n email.downcase!\n end",
"def lowercase_email\n email.downcase! if email.present?\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def do... | [
"0.8380517",
"0.8339932",
"0.8242504",
"0.82153374",
"0.82153374",
"0.82153374",
"0.82153374",
"0.8192566",
"0.8161937",
"0.8131639",
"0.8121609",
"0.80987734",
"0.80987734",
"0.80987734",
"0.80724174",
"0.80567265",
"0.80567265",
"0.80567265",
"0.80567265",
"0.7995695",
"0.7... | 0.8112856 | 11 |
Creates and assigns the activation token and digest | def create_activation_digest
self.activation_token = User.new_token
# Since the user model has an 'activation_digest' attribute,
# the following will be automatically saved to the database upon user creation
self.activation_digest = User.digest(activation_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_token_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activation_token)\n end",
"def create_acti... | [
"0.8696872",
"0.8685808",
"0.8668821",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.8641853",
"0.86381954",
... | 0.83503246 | 91 |
Options: "null_value" => "_null_" | def initialize field, options = {}
@field = field
@options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_null\n allow = opts[ :null ]\n allow.nil? || allow\n end",
"def set_null(params)\n params == \"NA\" ? \"null\" : params\n end",
"def format_value_to_null(_value)\n 'null'\n end",
"def optionalize\n without_values(nil)\n end",
"def replace_null(value)\n retu... | [
"0.70210624",
"0.7016927",
"0.69164056",
"0.688695",
"0.6710271",
"0.6666045",
"0.6512412",
"0.6500791",
"0.6331238",
"0.6331238",
"0.6280449",
"0.6262283",
"0.6252102",
"0.62466925",
"0.6231183",
"0.6209968",
"0.62059504",
"0.6170421",
"0.61517316",
"0.60883665",
"0.6084081"... | 0.0 | -1 |
FIXME this straightsum approach is incomplete also, PostgreSQL should be doing this | def estimate
e = 0
@@mappings.each do |k,v|
counts = eval v.pluralize
counts.each do |obj|
if obj.respond_to? 'population_estimate'
e = e + obj.population_estimate
elsif obj.respond_to? 'population_estimate_min'
# handles the Other case which just has a range
e = e + obj.population_estimate_min
else
strata = eval "obj.#{v}_strata"
strata.each do |stratum|
e = e + stratum.population_estimate
end
end
end
end
e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum; end",
"def sum(column)\n result = all\n\n if result.any?\n result.inject(0.0) do |acc, record|\n if value = record.public_send(column)\n acc += value\n end\n\n acc\n end\n end\n ... | [
"0.6658209",
"0.6530124",
"0.6527941",
"0.6433709",
"0.6385949",
"0.63739604",
"0.6357413",
"0.6303917",
"0.6272823",
"0.6270746",
"0.62623036",
"0.6221295",
"0.6210003",
"0.62016964",
"0.61695623",
"0.61660933",
"0.6165906",
"0.6152174",
"0.6061705",
"0.6043078",
"0.5978181"... | 0.0 | -1 |
Create a new Chef::Catalog object. | def initialize
@name = ''
@public = ''
@description = ''
@nspath = ''
@cis = Mash.new
@relations = Mash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @chef = Chef.new\n end",
"def initialize(catalog, conf = nil)\n @catalog = catalog\n super conf\n end",
"def initialize(catalog, conf = nil)\n @catalog = catalog\n super conf\n end",
"def build_catalog(logger)\n if @facts_terminus != 'facter'\n facts_ob... | [
"0.65114766",
"0.6408157",
"0.6408157",
"0.6232818",
"0.6134841",
"0.61303484",
"0.60200423",
"0.59663665",
"0.5885244",
"0.58741844",
"0.58663607",
"0.5852079",
"0.5837976",
"0.58337486",
"0.57464826",
"0.5735152",
"0.5674026",
"0.5668682",
"0.5656703",
"0.56287915",
"0.5628... | 0.0 | -1 |
Serialize this object as a hash | def to_json(*a)
to_hash.to_json(*a)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n JSON.dump(@hash)\n end",
"def to_hash\n @_hash_\n end",
"def to_hash\n @hash\n end",
"def serialize\n self.to_hash.to_json\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def hash\n to_s.hash\n end",
... | [
"0.81273913",
"0.77855784",
"0.77548593",
"0.77375627",
"0.7666434",
"0.7666434",
"0.75483555",
"0.7526138",
"0.75173",
"0.7508914",
"0.750206",
"0.7472599",
"0.7439899",
"0.7439899",
"0.7439899",
"0.7428211",
"0.74079853",
"0.7393187",
"0.7383238",
"0.7358389",
"0.73462814",... | 0.0 | -1 |
GET /legalstatuses GET /legalstatuses.json | def index
@legalstatuses = Legalstatus.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def index\n @statuses = Status.all\n end",
"def index\n @statuses = Status.all\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def index\n @statuses... | [
"0.6845886",
"0.6465115",
"0.6465115",
"0.6464044",
"0.636774",
"0.62718093",
"0.6264999",
"0.6180492",
"0.6174048",
"0.61573136",
"0.61374754",
"0.61334693",
"0.60591936",
"0.6051795",
"0.6031431",
"0.60227746",
"0.60095674",
"0.5990998",
"0.59709334",
"0.59526783",
"0.59458... | 0.7404985 | 0 |
GET /legalstatuses/1 GET /legalstatuses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end",
"def index\n @legalstatuses = Legalstatus.all\n end",
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def index\n @statuses = Status.all\n end",
"def index\n @stat... | [
"0.66540307",
"0.6653958",
"0.6629162",
"0.63261473",
"0.63261473",
"0.62362653",
"0.62248176",
"0.61528414",
"0.61343324",
"0.6132748",
"0.6103023",
"0.609806",
"0.609794",
"0.6073009",
"0.60718715",
"0.60591614",
"0.60081697",
"0.60052973",
"0.6004673",
"0.59771657",
"0.594... | 0.0 | -1 |
POST /legalstatuses POST /legalstatuses.json | def create
@legalstatus = Legalstatus.new(legalstatus_params)
respond_to do |format|
if @legalstatus.save
format.html { redirect_to @legalstatus, notice: 'Legalstatus was successfully created.' }
format.json { render :show, status: :created, location: @legalstatus }
else
format.html { render :new }
format.json { render json: @legalstatus.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_statuses\n end",
"def create_statuses\n end",
"def legalstatus_params\n params.require(:legalstatus).permit(:code, :text)\n end",
"def postTweet(status)\n\t\t\t@client.update(status)\n\t\tend",
"def create\n @status = current_user.statuses.new(status_params)\n\n if current_user.s... | [
"0.65436524",
"0.65436524",
"0.6144123",
"0.6125193",
"0.6115143",
"0.6028511",
"0.5986845",
"0.5928423",
"0.5866472",
"0.5856229",
"0.5829015",
"0.58262753",
"0.5793527",
"0.5783653",
"0.5739105",
"0.5720138",
"0.57171315",
"0.56681",
"0.5646018",
"0.56075555",
"0.5572053",
... | 0.6317618 | 2 |
PATCH/PUT /legalstatuses/1 PATCH/PUT /legalstatuses/1.json | def update
respond_to do |format|
if @legalstatus.update(legalstatus_params)
format.html { redirect_to @legalstatus, notice: 'Legalstatus was successfully updated.' }
format.json { render :show, status: :ok, location: @legalstatus }
else
format.html { render :edit }
format.json { render json: @legalstatus.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format... | [
"0.66764855",
"0.64086103",
"0.6344793",
"0.6315379",
"0.6261616",
"0.6235401",
"0.62259835",
"0.62110996",
"0.61854464",
"0.61854464",
"0.61702174",
"0.61626023",
"0.6150136",
"0.6131052",
"0.6131052",
"0.61271745",
"0.6063575",
"0.60505676",
"0.60452765",
"0.6038075",
"0.60... | 0.62303233 | 6 |
DELETE /legalstatuses/1 DELETE /legalstatuses/1.json | def destroy
@legalstatus.destroy
respond_to do |format|
format.html { redirect_to legalstatuses_url, notice: 'Legalstatus was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(sta... | [
"0.73920476",
"0.73458785",
"0.73326504",
"0.7237071",
"0.72144437",
"0.7211335",
"0.71939945",
"0.7157266",
"0.7122924",
"0.7085873",
"0.70427907",
"0.70313346",
"0.70313346",
"0.70294374",
"0.70289266",
"0.7002675",
"0.6991998",
"0.69873947",
"0.69333905",
"0.6917524",
"0.6... | 0.7413961 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_legalstatus
@legalstatus = Legalstatus.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def legalstatus_params
params.require(:legalstatus).permit(:code, :text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_credit
@credit = Credit.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 credit_params
params.require(:credit).permit(:amount, :content, :created_user_id, :credit, :completed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Menu Helper not included in Groups Controller... | def link_to_switch_locale( locale, trigger=false )
uparams = params.dup
uparams[:locale] = locale
options = {:title => locale}
options = options.merge({:class => "dropdown-toggle locale-switcher", :"data-toggle" => "dropdown", :"data-target" => "#" }) if trigger
link_to "#{image_tag("flags/#{locale}.png")}#{trigger ? '<b class=\'caret\'></b>' : ''}".html_safe, refinery.url_for(uparams.merge(:only_path => true )), options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_menu_items\n menu = []\n menu.push([t(\"menu.home\"), admin_home_path, Proc.new {controller_name == \"home\"}])\n if current_user\n menu.push([t(\"menu.projects\"), admin_projects_path, Proc.new {controller_name == \"projects\" || controller_name == \"project_to_users\"}])... | [
"0.6744772",
"0.6721269",
"0.66564834",
"0.6611857",
"0.64854634",
"0.6471733",
"0.6461823",
"0.64451444",
"0.64383954",
"0.6432569",
"0.6418043",
"0.6368616",
"0.6331997",
"0.6271178",
"0.62687194",
"0.62326694",
"0.6224355",
"0.61916786",
"0.6189219",
"0.6177069",
"0.615525... | 0.0 | -1 |
Punctuation is not part of the word unless it is a contraction. In order to not have to write an actual language parser, there won't be any punctuation too complex. There will be no "'" that is not part of a contraction. | def alternate_words(string)
unwanted = ["!","@","$","#","%","^","&","*","(",")","-","=","_","+","[","]",":",";",",",".","/","<",">","?","|"]
counter = 0
new_str_arr = Array.new
unwanted.each do |symbol|
string = string.gsub(symbol," ")
end
array_str = string.split(" ");
while counter < array_str.length do
if counter.even?
new_str_arr.push(array_str[counter])
end
counter += 1
end
return new_str_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_word?\n not is_punctuation?\n end",
"def is_punctuation?(str)\n %w(. , ? ! ; :).include?(str)\n end",
"def is_punctuation?\n %w(. ,).include?(wordform)\n end",
"def strip_punctuation(word)\n punctuation_stripping_regexp = /(.+)([^.,?!-_+=@#$%^&*()])/\n word.match(punctuation_stripping_re... | [
"0.7231849",
"0.6943074",
"0.68991745",
"0.66488045",
"0.65997034",
"0.65801895",
"0.65178627",
"0.64397717",
"0.6418457",
"0.6399256",
"0.6366257",
"0.6229297",
"0.6225596",
"0.61731094",
"0.611905",
"0.610501",
"0.6044963",
"0.60444134",
"0.60388345",
"0.6016317",
"0.600554... | 0.0 | -1 |
Return Time Range Array | def time_range
range_time = []
(1..12).each do |n|
time = n == 1 ? 12 : n - 1
range_time << "#{time}:00 am"
range_time << "#{time}:30 am"
end
(1..12).each do |n|
time = n == 1 ? 12 : n - 1
range_time << "#{time}:00 pm"
range_time << "#{time}:30 pm"
end
range_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt... | [
"0.7549909",
"0.7376667",
"0.7167006",
"0.67499447",
"0.67321837",
"0.67124",
"0.66843575",
"0.6673482",
"0.6661179",
"0.66502464",
"0.6642185",
"0.6627762",
"0.65787345",
"0.64759034",
"0.6464391",
"0.64186114",
"0.6390875",
"0.6346739",
"0.63105834",
"0.62871027",
"0.627784... | 0.7213178 | 2 |
GET /buddyfights GET /buddyfights.json | def index
@buddyfights = Buddyfight.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end",
"def breakdown\n @points = current_user.points.limit(5)\n render json: @points, ... | [
"0.60715854",
"0.5926916",
"0.5924033",
"0.59208554",
"0.5827693",
"0.5801998",
"0.58001655",
"0.5779875",
"0.57729566",
"0.57603973",
"0.5757087",
"0.573221",
"0.57222956",
"0.57210886",
"0.5703818",
"0.5697461",
"0.5694296",
"0.56819487",
"0.5681444",
"0.56712115",
"0.56640... | 0.73732185 | 0 |
GET /buddyfights/1 GET /buddyfights/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @buddyfights = Buddyfight.all\n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def show\n @buddy = Buddy.... | [
"0.72476643",
"0.63128006",
"0.62903166",
"0.60897577",
"0.60348153",
"0.60020787",
"0.597076",
"0.5914595",
"0.5908769",
"0.58838147",
"0.5833816",
"0.58067745",
"0.5801884",
"0.5792441",
"0.5785414",
"0.57534134",
"0.57490456",
"0.572998",
"0.5719566",
"0.5714669",
"0.57131... | 0.0 | -1 |
POST /buddyfights POST /buddyfights.json | def create
@buddyfight = Buddyfight.new(buddyfight_params)
respond_to do |format|
if @buddyfight.save
format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully created.' }
format.json { render :show, status: :created, location: @buddyfight }
else
format.html { render :new }
format.json { render json: @buddyfight.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @buddyfights = Buddyfight.all\n end",
"def create\n #@buddy = Buddy.new(buddy_params)\n @buddy = current_user.buddies.build(buddy_params)\n\n respond_to do |format|\n if @buddy.save\n format.html { redirect_to @buddy, notice: \"Buddy was successfully created.\" }\n fo... | [
"0.6472698",
"0.59794897",
"0.5909013",
"0.5754998",
"0.56470066",
"0.5450042",
"0.54413",
"0.539094",
"0.5339248",
"0.5324998",
"0.5297267",
"0.52962697",
"0.5288078",
"0.5266932",
"0.524439",
"0.522984",
"0.5226278",
"0.5203779",
"0.5200533",
"0.5156734",
"0.51198804",
"0... | 0.6356847 | 1 |
PATCH/PUT /buddyfights/1 PATCH/PUT /buddyfights/1.json | def update
respond_to do |format|
if @buddyfight.update(buddyfight_params)
format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully updated.' }
format.json { render :show, status: :ok, location: @buddyfight }
else
format.html { render :edit }
format.json { render json: @buddyfight.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @buddy.update(buddy_params)\n format.html { redirect_to @buddy, notice: \"Buddy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @buddy }\n else\n format.html { render :edit, status: :unprocessable_entity }... | [
"0.68470675",
"0.6527308",
"0.6415726",
"0.6158539",
"0.60426503",
"0.5983439",
"0.5982167",
"0.59356016",
"0.5917969",
"0.59163165",
"0.59081644",
"0.59080803",
"0.58849",
"0.5881259",
"0.5870572",
"0.5870572",
"0.5870572",
"0.5869069",
"0.5864077",
"0.5863633",
"0.5853311",... | 0.6139885 | 4 |
DELETE /buddyfights/1 DELETE /buddyfights/1.json | def destroy
@buddyfight.destroy
respond_to do |format|
format.html { redirect_to buddyfights_url, notice: 'Buddyfight was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @buddy.destroy\n respond_to do |format|\n format.html { redirect_to buddies_url, notice: \"Buddy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @buddy = Buddy.find(param... | [
"0.70315355",
"0.6775857",
"0.67417806",
"0.67115635",
"0.6507376",
"0.64911884",
"0.64599603",
"0.64336133",
"0.6394245",
"0.63872856",
"0.63478756",
"0.63468444",
"0.6346075",
"0.6331447",
"0.63210344",
"0.63184744",
"0.6318289",
"0.6315614",
"0.62983215",
"0.628507",
"0.62... | 0.7034131 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_buddyfight
@buddyfight = Buddyfight.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def buddyfight_params
params.fetch(:buddyfight, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Get a specific selected actor or current actor i : index of the selected actor GET | def selected_actor(i=nil)
actor = nil
if i == nil
actor = @data[self.index]
else
actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)])
end
return actor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_actor\n return nil unless actor_selected?\n get_actor @active_index\n end",
"def get_actor(index)\n @data[index]\n end",
"def selected_reserve_actor(i=nil)\n actor = nil\n if i == nil\n actor = @data[self.index]\n else\n actor = (index < 0 || self.index(i) < 0 ? nil :... | [
"0.81715715",
"0.76902163",
"0.71803135",
"0.66437393",
"0.66295344",
"0.66295344",
"0.66063595",
"0.6575213",
"0.6575213",
"0.6575213",
"0.655686",
"0.647524",
"0.6469444",
"0.64618087",
"0.64066714",
"0.635936",
"0.634233",
"0.6334411",
"0.6279572",
"0.6268531",
"0.61687344... | 0.8488137 | 1 |
////////////////////////////////////////////////////////////////////////// Constructors ////////////////////////////////////////////////////////////////////////// Object Initialization x : window xcoordinate y : window ycoordinate width : window width height : window height members : party members | def initialize(x, y, width, height, members)
super(x, y, width, height, 10, 156 - 32)
@column_max = 4
@ucCharFacesList = []
window_update(members)
self.index = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(window)\n super(window)\n @width = 1\n @height = 1\n rebuild_vertices\n end",
"def initialize(x, y, width, height, party_id, actors=nil)\n super(x, y, width, height, 28, 48)\n @column_max = 2\n @ucPartyActorsList = []\n @party_id = party_id\n window_update(act... | [
"0.7197765",
"0.7058596",
"0.7026573",
"0.7022096",
"0.6948037",
"0.6931735",
"0.6910408",
"0.6810857",
"0.6753257",
"0.6732402",
"0.6682165",
"0.66670364",
"0.6510932",
"0.6477286",
"0.6465317",
"0.6453747",
"0.64535826",
"0.64493585",
"0.6413301",
"0.6392259",
"0.63895935",... | 0.65772164 | 12 |
////////////////////////////////////////////////////////////////////////// Public Methods ////////////////////////////////////////////////////////////////////////// Update members : party members | def window_update(members)
@data = []
for i in @data.size .. 4-1
@data.push(nil)
end
if members != nil
index = 0
for member in members
@data[$game_party.actor_positions[index]] = member
index += 1
end
end
@item_max = @data.size
create_contents()
@ucCharFacesList.clear()
for i in 0..@item_max-1
@ucCharFacesList.push(create_item(i))
end
refresh()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n \tsuper\r\n \tcheck_visible\r\n \tif @party_size != $game_party.all_members.size\r\n \t refresh\r\n \tend\r\n i = 0\r\n while i < @party_size\r\n if $game_party.members[i].hp != @actor_hp[i] or $game_party.members[i].mp != @actor_mp[i]\r\n\t refresh\r\n\t end\r\n i += 1... | [
"0.68839043",
"0.6731065",
"0.66302663",
"0.66302663",
"0.6463374",
"0.6463374",
"0.64317214",
"0.63836825",
"0.633099",
"0.6313046",
"0.6313046",
"0.63062865",
"0.63037014",
"0.6283841",
"0.6249791",
"0.6230665",
"0.6230665",
"0.6133379",
"0.61207014",
"0.611562",
"0.611562"... | 0.0 | -1 |
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Create an item for CharFacesList index : item index | def create_item(index)
actor = @data[index]
rect = item_rect(index, true)
ucChar = UCFormationCharFace.new(self, actor, rect)
return ucChar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_item(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucItem = UCCharacterGraphic.new(self, Rect.new(rect.x+9,rect.y+9,30,30), actor,\n 0, 255, 0, PARTY_CONFIG::CHARS_FACING_DIRECTION)\n \n if actor != nil && actor.reserve_locked\n ucIt... | [
"0.7662621",
"0.7636722",
"0.7592121",
"0.72477305",
"0.7087319",
"0.70122004",
"0.6987993",
"0.6957028",
"0.6855867",
"0.6855867",
"0.66067153",
"0.66067153",
"0.6596195",
"0.6519527",
"0.630674",
"0.58808196",
"0.58012563",
"0.5765026",
"0.569752",
"0.5696452",
"0.5666526",... | 0.8059416 | 0 |
puts "nyan" break end counter + 1 while counter < 11 puts counter counter = counter + 1 end def hungry_sb kitkat = 0 while < 30 puts "Give me another kitkat!" kitkat += | def hungry_person
mango= 0
until mango == 10
puts "Give me my mango! i only want #{mango}"
mango += 1
end
puts "thank you"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monkey(n)\n i = n\n loop do\n if i > 1\n p \"#{i} little monkeys jumping on the bed,\"\n p \"One fell off and bumped his head,\"\n p \"Mama called the doctor and the doctor said,\"\n p \"No more monkeys jumping on the bed\"\n else\n p \"#{i} little monkey jumping on the bed,\"\... | [
"0.70303243",
"0.6988207",
"0.6977826",
"0.6949915",
"0.6896138",
"0.68927455",
"0.68828565",
"0.68824446",
"0.6852196",
"0.68253917",
"0.6818178",
"0.6788263",
"0.6782082",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941"... | 0.7084161 | 0 |
this method removes some digits from the solution to create a puzzle | def puzzle(sudoku)
sudoku.map {|x| rand < 0.75 ? 0 : x }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puzzle(sudoku)\n#this method is yours to implement\n#need to remove 2 numbers from grid\nsudoku =sudoku.dup\n# [10,20,30,40,23,45,56,76,34,56,77,21].each do |index| \n(1.upto(81).to_a.shuffle.slice(0,25)).each do |index|\n sudoku[index]=''\nend\n # random_values =Array.new(10.upto(37).to_a).shuffle\n\t# random... | [
"0.6630241",
"0.6603103",
"0.6479867",
"0.645885",
"0.643311",
"0.6350987",
"0.63352233",
"0.6247261",
"0.6136404",
"0.6121963",
"0.611602",
"0.61033034",
"0.60841864",
"0.6058191",
"0.6054813",
"0.5986607",
"0.5978528",
"0.5911764",
"0.5894846",
"0.5894596",
"0.5866746",
"... | 0.0 | -1 |
return the move a piece in danger can use | def escaping_moves(board)
# all_possible_moves(board).map{}
# p pieces_in_danger(board)
pieces_in_danger = pieces_in_danger(board)
positions_of_pieces_in_danger = pieces_in_danger.map(&:pos)
# p "Printing pieces in danger..."
# p positions_of_pieces_in_danger
safe_moves(board).select { |move| positions_of_pieces_in_danger.include?(move.first) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPiece move\n case move[0]\n when /^[Pa-h]/\n return Pawn.new(@colour)\n when \"R\" \n return Rook.new(@colour)\n when \"N\" \n return Knight.new(@colour)\n when \"B\"\n return Bishop.new(@colour)\n when \"Q\"\n return Queen.new(@colour)\n when \"K\" \n retu... | [
"0.729062",
"0.72682714",
"0.7221892",
"0.70854187",
"0.69375086",
"0.6926393",
"0.6908807",
"0.69065803",
"0.6900929",
"0.6885741",
"0.6883427",
"0.68811166",
"0.6870572",
"0.6827892",
"0.68186325",
"0.68059045",
"0.67936265",
"0.67819095",
"0.6760928",
"0.67469805",
"0.6746... | 0.0 | -1 |
GET /charges GET /charges.json | def index
@charges = Charge.all
@cart = current_cart
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_charges(opts = {})\n data, _status_code, _headers = get_charges_with_http_info(opts)\n data\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def retrieve(params = ... | [
"0.7544956",
"0.74264014",
"0.7300223",
"0.71588546",
"0.7057038",
"0.70192325",
"0.6964819",
"0.6954642",
"0.69070524",
"0.67966926",
"0.67279094",
"0.65885085",
"0.65502703",
"0.6523561",
"0.6451186",
"0.64396286",
"0.63823134",
"0.63137037",
"0.63024515",
"0.62901855",
"0.... | 0.6035707 | 30 |
GET /charges/1 GET /charges/1.json | def show
@cart = current_cart
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb... | [
"0.74812806",
"0.7350248",
"0.72522545",
"0.7103907",
"0.69858915",
"0.6856662",
"0.67906594",
"0.67368233",
"0.6654566",
"0.6603766",
"0.65610653",
"0.65597296",
"0.6554744",
"0.64294314",
"0.6333491",
"0.6329944",
"0.63016343",
"0.62653667",
"0.62309116",
"0.62274677",
"0.6... | 0.0 | -1 |
POST /charges POST /charges.json | def create
@user = current_user
@charge = current_user.charges.build(charge_params)
@cart = current_cart
@charge.add_line_items_from_cart(current_cart)
@order = current_user.orders.last
@pages = Page.where(id: [$pageIds])
secondary_amount = @cart.total_price * 100
overall_amount = secondary_amount.floor
@charge.status = "complete"
@amount = overall_amount
@description = "#{current_user.name} Order ID: "
if session[:last_created_at].to_i > params[:timestamp].to_i
redirect_to @order, notice: 'Order has already been confirmed. You were not charged again.'
else
respond_to do |format|
@time_stamp = Time.now.to_i
session[:last_created_at] = @time_stamp
if @charge.save
Cart.destroy(session[:cart_id])
session[:cart_id] = nil
OrderNotifierMailer.confirmed(@order, @user).deliver
@pages.each do |page|
OrderNotifierMailer.producerConfirmed(@order, page, @user).deliver
end
if @order.pay_type == "Card"
begin
customer = Stripe::Customer.create(
email: params[:stripeEmail],
source: params[:stripeToken]
)
charge = Stripe::Charge.create(
customer: customer.id,
amount: @amount,
description: @description + @order.id.to_s,
currency: 'cad'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
format.html { redirect_to @order, notice: 'Thank you for buying from Markset, here is your purchased list.' }
format.json { render :show, status: :created, location: @order }
elsif @order.pay_type == "Cash"
format.html { redirect_to @order, notice: 'Thank you for buying from Markset, here is your purchased list.' }
format.json { render :show, status: :created, location: @order }
end
else
format.html { render :new }
format.json { render json: @charge.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n respons... | [
"0.7672574",
"0.7215251",
"0.68520707",
"0.6689371",
"0.66431886",
"0.66290617",
"0.65909123",
"0.6544708",
"0.6541061",
"0.65237236",
"0.65159947",
"0.65101594",
"0.64668536",
"0.6451828",
"0.64515865",
"0.6396128",
"0.63951296",
"0.63783294",
"0.6332698",
"0.6322661",
"0.62... | 0.0 | -1 |
PATCH/PUT /charges/1 PATCH/PUT /charges/1.json | def update
respond_to do |format|
if @charge.update(charge_params)
format.html { redirect_to @charge, notice: 'Charge was successfully updated.' }
format.json { render :show, status: :ok, location: @charge }
else
format.html { render :edit }
format.json { render json: @charge.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n if @charge.update_attributes(params[:charge])\n format.html { redirect_to @charge, notice: 'Charge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.6709213",
"0.63224685",
"0.6219971",
"0.62160665",
"0.6205336",
"0.61869967",
"0.6182331",
"0.61630267",
"0.61559904",
"0.61324704",
"0.61324704",
"0.61280996",
"0.60937095",
"0.6074652",
"0.606247",
"0.6043708",
"0.59999967",
"0.5996834",
"0.5993192",
"0.59772927",
"0.593... | 0.6472606 | 2 |
DELETE /charges/1 DELETE /charges/1.json | def destroy
@charge.destroy
respond_to do |format|
format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharge... | [
"0.76896924",
"0.7397849",
"0.7170086",
"0.7155251",
"0.70793885",
"0.7073027",
"0.7067324",
"0.7063051",
"0.70048577",
"0.70018744",
"0.6968353",
"0.6931584",
"0.69189745",
"0.6872579",
"0.6861695",
"0.6851218",
"0.6824666",
"0.68158454",
"0.6783234",
"0.67831796",
"0.677275... | 0.74057406 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_charge
@charge = Charge.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def charge_params
params.require(:charge).permit(:order_id, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
args are [length, [arrays...]] all args get gobbled into arrays to get our array of arrays, need to index into arrays | def zip_to_length(length, *arrays)
(0...length).map do |i|
arrays[-1].map { |array| array[i] }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getArray _args\n \"getArray _args;\" \n end",
"def array(arg)\n if arg\n arg = arg.chomp.rstrip.lstrip\n name = arg.scan(/\\s*(\\w*)\\[\\d*\\]?/).first.first\n \n # following 10 lines seem to be unnecessary\n # and are left over from early array work\n # but t... | [
"0.72085196",
"0.6706875",
"0.66030556",
"0.652929",
"0.62340826",
"0.62146765",
"0.61685103",
"0.61206514",
"0.6107678",
"0.6088064",
"0.6083156",
"0.6063542",
"0.6036628",
"0.60332185",
"0.6031445",
"0.60296476",
"0.60219175",
"0.60188574",
"0.59962803",
"0.59715825",
"0.59... | 0.6143612 | 7 |
GET /calllists GET /calllists.json | def index
@calllists = Calllist.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end",
"def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end",
"def get_lists(user)\n get(\"/#{user}/lists.json\")\... | [
"0.7363616",
"0.7230093",
"0.722831",
"0.70862454",
"0.68135136",
"0.6797734",
"0.6694339",
"0.6470458",
"0.6460293",
"0.6459647",
"0.64155036",
"0.63093925",
"0.62856966",
"0.628545",
"0.62800384",
"0.62745154",
"0.62738174",
"0.6267455",
"0.6256401",
"0.6215297",
"0.6207788... | 0.6958071 | 5 |
GET /calllists/1 GET /calllists/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end",
"def index\n @calllists = Calllist.all\n end",
"def index\n @calllists = Calllist.all\n end",
"def get_list(access_token, list_id)\n url ... | [
"0.74661916",
"0.7078063",
"0.6896423",
"0.6896423",
"0.65365624",
"0.6412983",
"0.63802004",
"0.63655066",
"0.6283037",
"0.62794334",
"0.62382066",
"0.6234962",
"0.62295103",
"0.6202455",
"0.6189692",
"0.61784637",
"0.6176848",
"0.6176848",
"0.6176848",
"0.61673087",
"0.6149... | 0.0 | -1 |
POST /calllists POST /calllists.json | def create
@calllist = Calllist.new(calllist_params)
respond_to do |format|
if @calllist.save
format.html { redirect_to @calllist, notice: 'Calllist was successfully created.' }
format.json { render :show, status: :created, location: @calllist }
else
format.html { render :new }
format.json { render json: @calllist.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create\n @list = List.create!(list_params)\n json_response(@list, :created)... | [
"0.7110512",
"0.6961915",
"0.6842721",
"0.67839736",
"0.66024226",
"0.65687096",
"0.6445054",
"0.6407429",
"0.6344443",
"0.63354605",
"0.6321155",
"0.63176143",
"0.62924296",
"0.6289217",
"0.6266322",
"0.62657166",
"0.62535435",
"0.6247331",
"0.62464195",
"0.6243584",
"0.6233... | 0.6974059 | 2 |
PATCH/PUT /calllists/1 PATCH/PUT /calllists/1.json | def update
respond_to do |format|
if @calllist.update(calllist_params)
format.html { redirect_to @calllist, notice: 'Calllist was successfully updated.' }
format.json { render :show, status: :ok, location: @calllist }
else
format.html { render :edit }
format.json { render json: @calllist.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @call_list_owner = CallListOwner.find(params[:id... | [
"0.6996695",
"0.6796956",
"0.6646768",
"0.65260017",
"0.64233965",
"0.64014107",
"0.636995",
"0.635389",
"0.6289805",
"0.627942",
"0.62759566",
"0.62745863",
"0.6246258",
"0.62419814",
"0.62419814",
"0.6230335",
"0.622694",
"0.62245065",
"0.6214325",
"0.6212348",
"0.61828446"... | 0.70516884 | 1 |
DELETE /calllists/1 DELETE /calllists/1.json | def destroy
@calllist.destroy
respond_to do |format|
format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def destroy\n @invite_list = InviteList.find(param... | [
"0.737909",
"0.7237097",
"0.7104932",
"0.69288784",
"0.68634534",
"0.680756",
"0.6781529",
"0.6768832",
"0.6768832",
"0.6768832",
"0.67651886",
"0.6722435",
"0.6722435",
"0.6722435",
"0.6710659",
"0.6681779",
"0.6681386",
"0.6678337",
"0.6671298",
"0.66649324",
"0.6655452",
... | 0.7562142 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_calllist
@calllist = Calllist.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def calllist_params
params.require(:calllist).permit(:from_num, :to_num)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Now add this, and see that given the proper values, the first method will come out as true | def my_array_sorting_method(source)
source.sort_by{|x| x.to_s}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trueish?\n %w(1 t).include? self\n end",
"def add(this, that)\n\tthis + that\nend",
"def enotsup?() super; end",
"def method_missing(*_args)\n true\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def add_a_b\n end",
"def and_this(&b)\n\t\t\t\tnil? ? nil... | [
"0.57765615",
"0.5665845",
"0.5657031",
"0.5611802",
"0.5557766",
"0.5557766",
"0.5557766",
"0.5537145",
"0.5510125",
"0.5504218",
"0.5497452",
"0.54910374",
"0.54880494",
"0.548695",
"0.5486572",
"0.54860955",
"0.5473144",
"0.5471921",
"0.5467681",
"0.5453532",
"0.5447502",
... | 0.0 | -1 |
Policy is based on passphrase and location data | def initialize(pass, location)
@pass = pass
@location = location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passphrase\n super\n end",
"def searchpolicy\n eval @policy_key\n end",
"def create_adr_policy(policy, password)\n adr_policy_name_select.select(policy)\n save_adr_policy_btn.click\n password_input.type_text(password)\n submit_adr_policy_btn.click\n if alert_present... | [
"0.62416947",
"0.61088634",
"0.6086485",
"0.60613376",
"0.6040584",
"0.60325545",
"0.6008921",
"0.5992994",
"0.5934717",
"0.59248143",
"0.5913577",
"0.5840207",
"0.5824734",
"0.57596356",
"0.5751527",
"0.5696536",
"0.56575817",
"0.56310415",
"0.5613634",
"0.5611024",
"0.55858... | 0.0 | -1 |
Scope is based on passphrase | def initialize(pass, scope)
@pass = pass
@scope = scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passphrase\n super\n end",
"def scope_name; end",
"def scope\n read_attr :scope, :to_sym\n end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def sco... | [
"0.64734966",
"0.6261137",
"0.6158956",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60980564",
"0.59548336",
"0.58726656",
"0.5827765",
"0.5827765",
"0.58026713",
"0.57970184",
"0.57333654",
"0.5731722",
... | 0.0 | -1 |
Resolves indexing on location data matching passphrase | def resolve
pass_id = Pass.where(phrase: pass&.phrase).pluck(:id)
scope.where(pass_id: pass_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_for_location(offense); end",
"def autoindex(loc, switch = 'on')\n oputs <<-eos\n location #{loc} {\n autoindex #{switch};\n }\n eos\nend",
"def index_location_description # :nologin: :norobots:\n query = find_or_create_query(:LocationDescription, :by => params[:by])\n show_selected_locati... | [
"0.56463295",
"0.5576413",
"0.54254687",
"0.5375601",
"0.5365921",
"0.5365921",
"0.53657",
"0.5359279",
"0.5321872",
"0.53075194",
"0.52972305",
"0.528984",
"0.5272637",
"0.5252646",
"0.5252646",
"0.5233713",
"0.5232985",
"0.5209967",
"0.5141896",
"0.5122398",
"0.51071024",
... | 0.0 | -1 |
parse String value into Date for date attribute | def date
date_parser(self[:date])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date(value)\n ::Date.parse(value)\n end",
"def parse_date(date_str)\n new_date = Date.parse(date_str)\nend",
"def string_to_date(string)\n super(handle_date_parse_input(string))\n end",
"def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end",
"def parse_date(s... | [
"0.77893156",
"0.7623741",
"0.7572967",
"0.7562203",
"0.7455002",
"0.74343103",
"0.7428058",
"0.73742354",
"0.7292935",
"0.7254805",
"0.7242775",
"0.72346556",
"0.71632606",
"0.7144458",
"0.71287286",
"0.7120739",
"0.7109873",
"0.70848984",
"0.7063075",
"0.7061004",
"0.705968... | 0.6887317 | 35 |
an alias for goal attribute | def goal_points
self[:goal]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute(name); end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def achieve(goal)\n @goal = goal\n self\n end",
"def aref_prefix\n 'attribute'\n end",... | [
"0.6258468",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6164495",
"0.59150785",
"0.5899401",
"0.5828215",
"0.5828215",
"0.5797423",
"0.5790445",
"0.5783975",
"0.5783975",
"0.5783975",
"0.57605445",
"0.5693495",
"0.56294894",
... | 0.5547266 | 24 |
TODO: Figure out how to test document= | def notest_should_remove_blank_char_from_filename
document_field = CGI.new( :multipart => true )
puts document_field.inspect
document = Document.new(document_field)
puts document.inspect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document?; end",
"def document... | [
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.7721279",
"0.7721279",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673... | 0.0 | -1 |
TODO: Figure out why the commented out line causes an error | def test_document_max_length
new_document = Document.new( #:data => 'a' * (Document::MAX_FILE_SIZE - 1),
:data => 'a' * 100,
:unpacked => 0,
:name => 'dummy.doc',
:content_type => 'text/html',
:created_by => @cathy.id)
documents = Document.find(:all)
design_review_documents = DesignReviewDocument.find(:all)
new_document.attach(@mx234a_placement,
document_types(:stackup),
@cathy)
updated_documents = Document.find(:all)
updated_design_review_documents = DesignReviewDocument.find(:all)
new_document_list = updated_documents - documents
new_design_review_document_list = updated_design_review_documents - design_review_documents
assert_equal(1, new_document_list.size)
assert_equal(1, new_design_review_document_list.size)
new_doc = new_document_list[0]
new_design_review_document = new_design_review_document_list[0]
assert_equal(new_document.id, new_doc.id)
assert_equal(new_document.id, new_design_review_document.document_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def source_line=(_); end",
"def culprit\n @culprit\n end",
"def source_line; end",
"def missed_lines; end",
"def missed_lines; end",
"def probers; end",
"def fresh_line?; end",
"def last_magic_comment(source); end",
"def original_line; end",
"def line_number; end",
... | [
"0.6695561",
"0.6261798",
"0.6253075",
"0.6199866",
"0.6187976",
"0.6187976",
"0.6119457",
"0.61019135",
"0.60794467",
"0.6020298",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990... | 0.0 | -1 |
Add a stock rating to Database. | def stocks2_category(db,company,ticker,price,exchange,recomm)
db.execute("INSERT INTO stocks2 (company_name,
stock_ticker,
stock_price,
stock_exchange,
recommendation_id) VALUES (?,?,?,?,?)",[company,ticker,price,exchange,recomm])
puts "==========================================="
puts "#{ticker} has been added to the database."
puts "==========================================="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(rating)\n @rating_list[rating.movie_id] = rating\n end",
"def add(rating)\n @rating_list[rating.movie_id] = rating\n end",
"def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end",
"def rate_recipe(rating, recipe)\n recipe.ratings << Rating.create(user: self, ... | [
"0.6476404",
"0.6476404",
"0.6428312",
"0.6321881",
"0.62484944",
"0.61580354",
"0.61575603",
"0.60726744",
"0.60298854",
"0.60198843",
"0.6010236",
"0.60034364",
"0.59853",
"0.5983888",
"0.59637064",
"0.5948381",
"0.5931595",
"0.59059",
"0.58692276",
"0.58544207",
"0.582988"... | 0.5875876 | 18 |
update a stock rating | def update_rating (db,stock_ticker,rating)
db.execute(<<-SQL
UPDATE stocks2
SET recommendation_id="#{rating}"
Where stock_ticker="#{stock_ticker}";
SQL
)
puts "#{stock_ticker} has been changed to '#{rating}'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_rating\n @packages = Packages.find(params[:pid])\n @packages.update(:rating => params[:rate])\n end",
"def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end",
"def update!(**args)\n ... | [
"0.74021316",
"0.71803564",
"0.7158744",
"0.7127627",
"0.69602317",
"0.6918255",
"0.6889902",
"0.68546915",
"0.6852867",
"0.6846486",
"0.68398315",
"0.6816089",
"0.6772984",
"0.673968",
"0.66997576",
"0.6652885",
"0.6599967",
"0.65896297",
"0.6561463",
"0.6523203",
"0.6517419... | 0.7128225 | 3 |
remove a stock from database | def remove_stock(db,stock_ticker)
db.execute(<<-SQL
DELETE FROM stocks2
Where stock_ticker="#{stock_ticker}";
SQL
)
puts "==================================================="
puts "#{stock_ticker} has been removed from the database."
puts "==================================================="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete()\n sql = \"DELETE FROM stock_items WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def deleteStock\n p params[:ticker]\n Stock.where(:ticker => params[:ticker]).destroy_all \n end",
"def rem_stock_entity(stock_id)\n redis.srem(\"#{Porp.ns}:saleentity:id... | [
"0.7314341",
"0.7244771",
"0.7157054",
"0.70789826",
"0.70109254",
"0.698456",
"0.69810426",
"0.6920175",
"0.688013",
"0.6864305",
"0.6626184",
"0.6587378",
"0.6523363",
"0.6521096",
"0.65153295",
"0.65153295",
"0.65130085",
"0.64820665",
"0.6475954",
"0.64438754",
"0.6440132... | 0.84008443 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.