query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
291f69fc7d6c76c1a61466db7c340122
if gold == 0 && silver >1, print only silver with ounces
[ { "docid": "db371524d0c0f6061d882228475fe501", "score": "0.0", "text": "def test_print_round_missing_gold_plur\n testarr = [1, 2]\n testgame = Game.new(testarr)\n\n testloc = 'Sutter Creek'\n str = testgame.print_round(0, 2, testloc)\n assert_equal \"\\tFound 2 ounces of silver in Sutter ...
[ { "docid": "b66ac3665fd096f4b5bee7a5d3d32afa", "score": "0.69663244", "text": "def print_loot(gold_found, silver_found, current_location)\n print \"\\tFound\"\n print_amount 'gold', gold_found unless gold_found.zero?\n print_amount 'silver', silver_found unless silver_found.zero?\n puts \" i...
96dbfe12b19ad2af5bb8e03c0ecf32d3
Pretend the user wrote a little script to capture recordings or perhaps they just ran their server and then indirectly invoked it a bunch. Since this is a test we're going to be intentionally contrived here instead
[ { "docid": "3f3fe805b2fbf53ae81b62138845c4b3", "score": "0.5558468", "text": "def record_calls_of_the_original_code!\n ENV[\"SUTURE_RECORD_CALLS\"] = \"true\"\n items = create_a_bunch_of_items\n 100.times do\n GildedRose.update_quality(items)\n end\n ENV.delete(\"SUTURE_RECORD_CALLS\...
[ { "docid": "36f305cc7a576552ad43e3f1fd774ecc", "score": "0.6190394", "text": "def test_recording\n assert_empty @listener.instance_variable_get('@recordings')\n @listener.send(:record, 'Hello world!')\n assert_equal ['Hello world!'], @listener.instance_variable_get('@recordings')\n end", "...
d62663983527ff399274e55d3284838b
GET /streamapi_streams/new GET /streamapi_streams/new.xml
[ { "docid": "2d203102ff01283f13fda564ff7131c0", "score": "0.6986105", "text": "def new\n @streamapi_stream = StreamapiStream.new\n\t\t@band_id = params[:band_id] || LiveStreamSeries.find(@live_stream_series_id).band.id\n\t\t@user = User.find(session[:user_id])\n\n if @band_id\n @series_list = ...
[ { "docid": "8b862941c57e6394c13e3eddec09c2f6", "score": "0.7626294", "text": "def new\n @stream = Stream.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stream }\n end\n end", "title": "" }, { "docid": "8b862941c57e6394c13e3edde...
9550427b36ee4c433adaecaeac3f7648
OPTIMIZE: run this in its own thread, so the system could continue to run while elevators are moving.
[ { "docid": "9ece6cf8e6bb9002408fabd44912bee2", "score": "0.0", "text": "def stop_at_current_floor\n @destination_queue.shift\n sleep 1\n end", "title": "" } ]
[ { "docid": "81fb3f5f93b02a36979e7610308d259a", "score": "0.6477872", "text": "def elevated; end", "title": "" }, { "docid": "405fdda03201f7ee761814a6ba573fd1", "score": "0.6361498", "text": "def elevated=(_arg0); end", "title": "" }, { "docid": "20b17f76007879997aca9dbe17...
e8630ff73f3a9cedefdcafba3c9f9526
POST /parkspacelogs POST /parkspacelogs.json
[ { "docid": "089223122e295b6e246a4b3fdfb94145", "score": "0.7505806", "text": "def create\r\n @parkspacelog = Parkspacelog.new(parkspacelog_params)\r\n\r\n respond_to do |format|\r\n if @parkspacelog.save\r\n format.html { redirect_to @parkspacelog, notice: 'Parkspacelog was successfull...
[ { "docid": "af7c171fb91206c00913d4f6f9405573", "score": "0.6679408", "text": "def parkspacelog_params\r\n params.require(:parkspacelog).permit(:parking_no, :date, :message, :park_space_id)\r\n end", "title": "" }, { "docid": "de0d6a812487e0c6d9ed65c7880b7616", "score": "0.6544106...
b42dd7aa3a49b2f4267d7738aeb76e5c
Searches the last page fetched with get and returns html in tags using Hpricot
[ { "docid": "8b4b1532e6f952943e34cf1ace3e0452", "score": "0.0", "text": "def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end", "title": "" } ]
[ { "docid": "fe8349eec97ec55395bbe19ce5e0cf3d", "score": "0.62996054", "text": "def getLastfmArtistPopularity altnet_name\n url = getLastfmArtistPopularityUrl(altnet_name)\n puts url \n begin\n html = open(url, \"User-Agent\" => getUseragent(), :proxy=>getProxy()) \n document = H...
32d0c111dff01a7d590144a48e1a058e
need to create file before running
[ { "docid": "37992eabb51078094da214a60d6781f9", "score": "0.0", "text": "def execute_task\n create_test_files\n commands = rake_result[:commands] = []\n allow(task).to receive(:sh) do |command, _|\n commands << command\n end\n Rake::Task[:default].invoke\n end", "title": "" } ]
[ { "docid": "bd33b945298d67a967ac477ce606b070", "score": "0.73333514", "text": "def create_from_file\n end", "title": "" }, { "docid": "f99eb0d156e4610a003bcb317c6446c6", "score": "0.7163003", "text": "def create(file, task, mode)\n\n file = File.open(file, mode)\n #file.write(...
0f64ea78de9c7038152a318a982efcd3
DEVUELVE EL VALOR EN LA CAJA S
[ { "docid": "9f36c9ca9ef4079afd5d43dc20deb204", "score": "0.0", "text": "def busqueda_caja_s(v1, v2, matriz)\n matriz.get_elemento(v1,v2)\n end", "title": "" } ]
[ { "docid": "a102ec0bf39065420031c2573ca91781", "score": "0.6708958", "text": "def dolni\n @y - @hrana/2\n end", "title": "" }, { "docid": "14fcb2dacb365865bf319d032003b362", "score": "0.65375566", "text": "def valor_desconto\n self.valor_normal - self.valor \n end", "...
5308c85f9eeaea96896028026cc04fe7
GET /slider_dentals GET /slider_dentals.json
[ { "docid": "7fc2c5aea78ece2fc41ac351f7aaa9b6", "score": "0.7810717", "text": "def index\n @slider_dentals = SliderDental.all\n end", "title": "" } ]
[ { "docid": "48a643ede59e14b5657ae327c1b0e155", "score": "0.70396626", "text": "def set_slider_dental\n @slider_dental = SliderDental.find(params[:id])\n end", "title": "" }, { "docid": "a886bc12e789eb78d596fc1807e3a93e", "score": "0.6564145", "text": "def create\n @slider_...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "26fc81ae9ec3bb16bb3b0ace1199e20f", "score": "0.0", "text": "def admin_service_center_params\n params.require(:service_center).permit(:name, :address, :city, :phone, :is_active)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980957", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783065", "text": "def strong_params\n params.requi...
5f875c4aa3865bc43acd7f2fb10cbe26
Retrieve a single page of AccountInstance records from the API. Request is executed immediately.
[ { "docid": "6ad5eb205b1b877d24e4d7731e58a1ba", "score": "0.0", "text": "def page(friendly_name: T.unsafe(nil), status: T.unsafe(nil), page_token: T.unsafe(nil), page_number: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "283e020fcb4e1c4a4db366fdd6bd53c1", "score": "0.6587937", "text": "def account\n get('/account') do |resp|\n return AssetZen::Resources::Account.new(JSON.parse(resp.body), dup)\n end\n end", "title": "" }, { "docid": "5916e1c5e68ab59b129e3372c9d4d15d", ...
d6bfcc7dde1bb0e4938a49d5ad51df89
GET /regdetails/1 GET /regdetails/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "12c0ee60a8263a2009573689854b4172", "score": "0.7187388", "text": "def index\n @regdetails = Regdetail.all\n end", "title": "" }, { "docid": "9f688840b9788171caf37f5a4b90cc46", "score": "0.6905259", "text": "def get_register_details(title_no)\n\n response = rest_get_c...
f96fc4fcde9ff2586a2e5137d0d51d38
Internal: Accessory method to allow the resource respond to methods that will hit method_missing.
[ { "docid": "f2d5873f8adaf92beea146a6d16024f2", "score": "0.0", "text": "def respond_to_missing?(method, include_private = false)\n @_attributes.include?(method.to_s) ||\n super\n end", "title": "" } ]
[ { "docid": "afd8a54217d1aed949b8815d686a4edf", "score": "0.72589964", "text": "def method_missing\n end", "title": "" }, { "docid": "b530a4bfca2f54b8f3fead948aa1f9af", "score": "0.719818", "text": "def method_missing\n end", "title": "" }, { "docid": "e7f973ca22dbe9fc...
f9ac07225da5794795d85a655f6da8de
PUT /macros/1 PUT /macros/1.json
[ { "docid": "86c94c4ff923c2a2e300213d5f705457", "score": "0.66266584", "text": "def update\n @macro = Macro.find(params[:id])\n\n respond_to do |format|\n if @macro.update_attributes(params[:macro])\n format.html { redirect_to @macro, notice: 'Macro was successfully updated.' }\n ...
[ { "docid": "1622751f4937cdc56103ab3cf0d45c13", "score": "0.6458708", "text": "def update_macro(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"macros/#{id}\",options)\n if response['success']\n return response['results']['macro']\n els...
a8396afdf48b5ffb51cf5c6845d42c7f
POST /practices POST /practices.json
[ { "docid": "576ec0685669eea7b43e299069d22477", "score": "0.7208919", "text": "def create\n @practice = Practice.new(params[:practice])\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to @practice, notice: 'Practice was successfully created.' }\n format.js...
[ { "docid": "61f88b59363d2317df84b49f028dde0e", "score": "0.74118704", "text": "def create\n respond_to do |format|\n if @practice.save\n format.json { render json: @practice, status: :created}\n else\n format.json { render json: @practice.errors, status: :unprocessable_entity ...
bea49040956d1d8e5c133dfdf125b955
This is to prevent the Errno::EIO error from occurring by ensuring that if we haven't been made the process group controlling the TTY that we become so. This method intentionally blocks.
[ { "docid": "cb03e447c45f732d754eb1e741eba927", "score": "0.6428313", "text": "def ensure_process_group_controls_the_tty\n while Process.pid != Termios.tcgetpgrp(STDIN)\n Termios.tcsetpgrp(STDIN, Process.pid)\n sleep 0.1\n end\n end", "title": "" } ]
[ { "docid": "f8e55387795f85a89bc8aa2a9cfc0133", "score": "0.64690983", "text": "def ensure_process_group_controls_the_tty\n return unless STDIN.isatty\n\n tty_pgrp = Termios.tcgetpgrp(STDIN)\n while ![Process.pid, Process.getpgrp].include?(tty_pgrp)\n Termios.tcsetpgrp(STDIN, Proces...
df5e4fa2f782aa49a32de01f652303ce
Uses legal moves to create new knight objects
[ { "docid": "69e8d13155a9a30806725076cf56492f", "score": "0.6778566", "text": "def make_knights(target)\n @moves.each do |move|\n break if @knight_history.include?(target) || @knight_history.include?(move)\n\n knight = Knight.new(move, self)\n @connected_knights << knight unless knight....
[ { "docid": "1ce8f2fa3526ef63a8d962d5465bdad4", "score": "0.7181147", "text": "def next_moves\n\t\tmoves = [ [ @x + 2, @y + 1 ], [ @x + 2, @y - 1 ], [ @x + 1, @y + 2 ],\n\t\t\t\t\t\t [ @x + 1, @y - 2 ], [ @x - 1, @y + 2 ], [ @x - 1, @y - 2 ],\n\t\t\t\t\t\t [ @x - 2, @y + 1 ], [ @x - 2, @y -1 ] ]\n\t\tmov...
5b79f4faefa3d7d1d3939dcb928c96b5
Just eliminating this from the Rails callstack
[ { "docid": "ddad427cb26ddc5a6d6c70a55dc7628a", "score": "0.0", "text": "def protect_against_forgery?\n \n end", "title": "" } ]
[ { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.62904936", "text": "def in_use; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.62904936", "text": "def in_use; end", "title": "" }, { "docid": "0aa0db9270c5a88c81da713a1ee0e8f8", ...
f871b93551961bc68760f19d23475664
Defines a Ruby package Example: ruby_package 'package_name' do |pkg| pkg.doc_target = 'doc' end +pkg+ is an Autobuild::Importer instance. See the Autobuild API for more information.
[ { "docid": "3c988cd2677bd3e432eb6b611f18fed6", "score": "0.7446037", "text": "def ruby_package(name, workspace: Autoproj.workspace)\n package_common(:ruby, name, workspace: workspace) do |pkg|\n pkg.prefix = pkg.srcdir\n\n # Documentation code. Ignore if the user provided its own docume...
[ { "docid": "6f09a2b5e9f846ce4f8f63392edcba58", "score": "0.6605696", "text": "def define\n lib('.', 'package.rb')\n end", "title": "" }, { "docid": "6f09a2b5e9f846ce4f8f63392edcba58", "score": "0.6605696", "text": "def define\n lib('.', 'package.rb')\n end", "titl...
a7aee9c368baa448131d876aeef0e464
Public instance methods NonSQL virtual attributes
[ { "docid": "c3b1c71f60ab7f8f49ff181437eecfe4", "score": "0.0", "text": "def virtual_account_active\n !account_deactivated\n end", "title": "" } ]
[ { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.736734", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.736734", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31",...
0a46ac65166a84a4f7c794d9b8b91a48
Figures out the most flown aircraft for a logbook for access in a view
[ { "docid": "7214eec09ed69ea023f5799b94714673", "score": "0.7087468", "text": "def most_flown_aircraft\n flights\n .group(:aircraft)\n .count\n .max_by{|k,v| v}\n end", "title": "" } ]
[ { "docid": "db156ef416acb95838417585b2693ab9", "score": "0.62227315", "text": "def most_hours_aircraft\n flights\n .group(:aircraft)\n .sum(:flight_time)\n .max_by{|k,v| v}\n end", "title": "" }, { "docid": "db156ef416acb95838417585b2693ab9", "score": "0.62227315", ...
3d7c6f0a30ec843dd124198118423dac
exists :: String > Result Checks for existence of the specified key. Example: kv.exists("foo") => kv.exists("octocat") =>
[ { "docid": "a194ede331f128c9ecbe00511db9789d", "score": "0.65268975", "text": "def exists(key)\n validate_key(key)\n\n mexists([key]).map { |values| values[0] }\n end", "title": "" } ]
[ { "docid": "551493b03694d6ef6e44265e825fd2d5", "score": "0.7836392", "text": "def exists?(key)\n !get(key).nil?\n end", "title": "" }, { "docid": "7755d29299f17ab0996b05875a9d801d", "score": "0.7778622", "text": "def key_exists?(key)\n dict.key?(key)\n end", "title": "" ...
c75d2fecfa1b45a6c5d0f5d70c10e338
Test for getting field from document
[ { "docid": "b6b08f6f50449a61cfddca6e89925b55", "score": "0.69769", "text": "def test_get_field\n filename = 'GetField.docx'\n remote_name = 'TestGetField.docx'\n index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test...
[ { "docid": "0479f6414495f95e0e964d52f141265d", "score": "0.71628755", "text": "def get(field)\n _doc[field.to_s]\n end", "title": "" }, { "docid": "0479f6414495f95e0e964d52f141265d", "score": "0.71628755", "text": "def get(field)\n _doc[field.to_s]\n end", "title"...
ab8809ca9b4c594908d3c6e3d38e9fdd
Converts an OCCI compute instance to a valid ONe virtual machine template.
[ { "docid": "aba93a382b1d2b4a6f02b245523f2354", "score": "0.77076733", "text": "def virtual_machine_from(compute)\n os_tpl = compute.os_tpl.term\n template = pool_element(:template, os_tpl, :info)\n\n modify_basic! template, compute, os_tpl\n %i[set_context! set_size! set_secu...
[ { "docid": "b45688d86902dd3124cbb07af72d2048", "score": "0.6177499", "text": "def post_compute(request)\n # Get client with user credentials\n client = get_client(request.env)\n \n if request.body\n vm_info=Crack::XML.parse(request.body.read)\n else\n ...
bcfcc043c72240df0e71758455d07b70
Perform the map reduce operation
[ { "docid": "d45833df0b9e458853e5f634be22bb40", "score": "0.8059413", "text": "def exec\n @data.each do |record|\n map(record)\n end\n \n return @mapped unless respond_to? :reduce\n \n @reduced = {} \n @mapped.keys.each do |key|\n @reduced[key]=reduce(key,@mapped[key])\n ...
[ { "docid": "e37a95f7c606424eceb27b93a627e216", "score": "0.74140626", "text": "def map_reduce!\n rule.model.map_reduce(map, reduce).out(replace: rule.collection_name).time\n end", "title": "" }, { "docid": "3bc3fb7185b40a5cfcf2c8d58024e787", "score": "0.73368037", "text": "de...
be56699cdffcf3fa9e9989ad17ef7726
DELETE /tutorials/1 DELETE /tutorials/1.json
[ { "docid": "0ff660c91d2ace4c426c7e17ccb0a447", "score": "0.7489617", "text": "def destroy\n @tutorial = Tutorial.find(params[:id])\n authorize! :manage, @tutorial, :message => 'Not authorized to do this action.'\n\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_t...
[ { "docid": "83f9b1b06d38eb7123d5a9fcacb453b7", "score": "0.7841835", "text": "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tutorials_url }\n format.json { head :no_content }\n end\n end", ...
799b95f5c6a9ad35673fa5f6c5149036
Causes chain? to return false. Returns self.
[ { "docid": "cfca9bfe1d66d6c691daa535d4d6a6d6", "score": "0.68256456", "text": "def unchain\n @chain = false\n self\n end", "title": "" } ]
[ { "docid": "578ac41cc6becc7472076f5a29a6755a", "score": "0.77604544", "text": "def chain?\n @chain\n end", "title": "" }, { "docid": "a4ffa77a1a17fda25e8183bfc0197dfc", "score": "0.74907976", "text": "def chainable?\n false\n end", "title": "" }, { "docid": "a...
727d39a264d4fc7c85a86558b2d75be7
Convert a SID string, e.g. "S1532544" to a pointer (containing the address of the binary SID structure). The returned value can be used in Win32 APIs that expect a PSID, e.g. IsValidSid. The account for this SID may or may not exist.
[ { "docid": "6211329bc6a4fb00fc963e9ae2d21589", "score": "0.7577041", "text": "def string_to_sid_ptr(string, &block)\n sid_buf = 0.chr * 80\n string_addr = [string].pack('p*').unpack('L')[0]\n\n raise Puppet::Util::Windows::Error.new(\"Failed to convert string SID: #{string}\") unless Conv...
[ { "docid": "3345ffe426190658135e7e096435d7b4", "score": "0.7845887", "text": "def string_to_sid_ptr(string_sid, &block)\n FFI::MemoryPointer.from_string_to_wide_string(string_sid) do |lpcwstr|\n FFI::MemoryPointer.new(:pointer, 1) do |sid_ptr_ptr|\n\n if ConvertStringSidToSidW(lpcws...
e57379c1df0e3ed4f6699287b94e02fb
p binary_search([1, 2, 3, 4, 5, 6, 7, 8, 9], 9)
[ { "docid": "68744888db49825dba8d1b08861223c2", "score": "0.0", "text": "def find_rotation_pt(arr)\n return 0 if arr.length == 1 || arr.empty?\n\n mid = arr.length / 2\n return mid if out_of_order?(arr[mid - 1], arr[mid]) == -1\n\n left = find_rotation_pt(arr[0...mid])\n right = find_rotat...
[ { "docid": "38ee5dfbf39586080fc24d8216213eed", "score": "0.8246655", "text": "def binary_search(ary, value); end", "title": "" }, { "docid": "9ed3fef9543392d257f6c53d299df53b", "score": "0.7958036", "text": "def binary_search(array, length, value_to_find)\n puts \"NOT IMPLEMENTED\"\...
c98d46ffe7656c2d0fd09684c12c422d
need to keep for a while for backward compatibility
[ { "docid": "ce2a7d12a9b11d37f5117941510462c7", "score": "0.0", "text": "def ses_client\n @region ||= map_region(@cronus_region)\n @endpoint ||= email_service_url\n\n unless !ec2_creds || ec2_creds.nil?\n begin\n @credentials ||=\n Aws::Credentials.new(ec2_creds....
[ { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6707422", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6707422", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",...
2309ec369a388923bad63ae201ea26fd
The singleton module will override this when included.
[ { "docid": "9b193ec1ce72da7c819d1dfd5e5c1a49", "score": "0.60227036", "text": "def singleton?\n false\n end", "title": "" } ]
[ { "docid": "a3860511f4560931f84dc7532c454e34", "score": "0.7350335", "text": "def singleton_instance; end", "title": "" }, { "docid": "408ddb1914e417247ab19dc6e5a8d236", "score": "0.6838392", "text": "def singleton_class \n class << self \n self \n end \n end", ...
1fd313a49f613d19a91a6ff2cdaadeb1
Set the value of the MaxID input for this Choreo.
[ { "docid": "2383d25f40f0930301e9533788ebb6b2", "score": "0.81253076", "text": "def set_MaxID(value)\n set_input(\"MaxID\", value)\n end", "title": "" } ]
[ { "docid": "24503b692a5075bec90f0c434622fee9", "score": "0.772003", "text": "def max_id(id)\n @query[:max_id] = id\n self\n end", "title": "" }, { "docid": "0f6d1cd21ebc1ced973f8d6bc4724ea9", "score": "0.72936887", "text": "def set_max_id(number) # :doc:\n# \t\tep 'MAXES...
b449c794de6dbd6ef51ef8e465b20ed6
Sets the run list to the specified value
[ { "docid": "c1bb5f48deb2341f641541fa5e80f54f", "score": "0.7908106", "text": "def run_list=(value)\n json[:run_list] = value\n end", "title": "" } ]
[ { "docid": "fb38f446acd591196a44cd5e5a60dc9e", "score": "0.738653", "text": "def set_run_list(node, entries)\n node.run_list.run_list_items.clear\n entries.each { |e| node.run_list << e }\n end", "title": "" }, { "docid": "0d57d731cc72ea988fb245e4256b23f8", "score": "0...
51e42f701525fb58c0f9d0ab1c7e1b5c
Subscoping Keep a list of subscopes, but only ever use the front one. The rest get pushed/popped in cases when we have many levels of subscopable layers. This lets us push/pop without otherwise keeping track very closely.
[ { "docid": "b7b23f83e645c49cc50a714fdfc2e96e", "score": "0.5382925", "text": "def register_hooks(walker)\n @subscope_layers = []\n\n walker.before do |layer|\n if layer.subscopable?\n @subscope_layers.push(layer)\n end\n end\n\n walker.after do |l...
[ { "docid": "7a5df134abe4eca2ed7e08a80bb8ce1a", "score": "0.63392496", "text": "def subscope\n self.clone\n end", "title": "" }, { "docid": "f57cf1637c3ce082671452a3571394d4", "score": "0.58259207", "text": "def leave_scope\n # puts __callee__\n current_scope = s...
1f9d104a7a6f4f9622b65111d2c9bcfb
Test to login with valid credentials
[ { "docid": "3fdc535ce393ea359b7c3d60ddd10731", "score": "0.0", "text": "def test_create_vendor\n login\n sleep 15\n @driver.find_element(:xpath, \"//i[@name ='suitcase']\").click\n @driver.find_element(:xpath, \".//*[@id='main-nav']/li[4]/ul/li[4]/a\").click\n @driver.find_element(:xpath,...
[ { "docid": "bdbd4e91f9243698c6fe8a8c40fc1110", "score": "0.7779137", "text": "def test_login\n if @auth!='' then\n result = do_request(json_obj('user.checkauth',\n {'sessionid'=>@auth}))\n if !result['result'] then\n @auth=''\n return false #auth hash bad\n end\n ...
ac6e846f56e23c60d365eda102c87ccc
creates a blob of binary from some properties in a hash, like the ones to_h gives you If you give it an IO as it's second param, it'll return an instance of this instead of the blob, and write the blob straight to your IO for you right where you left it. :)
[ { "docid": "173419b6f0180bc27d273c6d5352dc1f", "score": "0.61073625", "text": "def create properties, write_to = ''\n original_position = write_to.pos if write_to.respond_to?(:pos)\n @parts.each_with_index do |part, i|\n write_to << send(\"blob_#{@part_types[i]}\", properties[part], pro...
[ { "docid": "49e040c68ecd5faf94000e67b356ba76", "score": "0.7097813", "text": "def generate_binary_blob\n blob = BinaryBlob.new\n\n blob.store_data(\"YAML\", to_h)\n\n blob.id\n end", "title": "" }, { "docid": "9d2fbaf59b434ce9a278dceeca93a9e0", "score": "0.63396215", ...
5cc1a64353a2cb7bc0f9ab1c18415d84
Sets the page public and sweeps the page cache
[ { "docid": "8e9bbdbdd0e2fd1910ea4894456c5a5a", "score": "0.55564594", "text": "def publish\n # fetching page via before filter\n @page.publish!\n flash[:notice] = _t(:page_published, :name => @page.name)\n redirect_back_or_to_default(admin_pages_path)\n end", "title"...
[ { "docid": "bad01aa044f7af89cec259fd13d3a44a", "score": "0.6911112", "text": "def cache_rendered_page\n response.headers['Cache-Control'] = 'public, max-age=300'\n end", "title": "" }, { "docid": "eb67aa71411b4d0c452c01c5a3f286ac", "score": "0.66157454", "text": "def cache_pu...
db4d9ea6f2796a4f5c13f65c5ba6f2aa
questionnaire's answer version of adding_responder
[ { "docid": "68f4473d34affcdac5265d0c51fd7972", "score": "0.0", "text": "def render_question_entities\n article = find_entity # article with questionnaire\n @question_entities = article.questionnaires\n base_div_id = params[:base_div_id] # id of div to add \n render :update do |page| \...
[ { "docid": "fb649545b400192ec7697357672db3d9", "score": "0.6790786", "text": "def add_answer\n request('answers/add')\n end", "title": "" }, { "docid": "858d0b2b84ffb92ff3cb714bf8b86ff6", "score": "0.655378", "text": "def add_answer(name, type, klass)\n self.payload +=...
e80848cd66f1e8e98a11d02d8763a307
GET /lab_permissions_roles/new GET /lab_permissions_roles/new.json
[ { "docid": "1525b70e4f360a91066e23d36d5fba1c", "score": "0.83249116", "text": "def new\n @lab_permissions_role = LabPermissionsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end", "title": "" } ]
[ { "docid": "a7aa89c5dbb61b8975d423aaba54a5f2", "score": "0.8174005", "text": "def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end", "ti...
25b13c2fcf3242383ce08bd127844b86
GET /detalle_pedidos/1 GET /detalle_pedidos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "8083d17d825e9fa61dad2888519ddbaa", "score": "0.76561403", "text": "def index\n @pedidos = @producto.pedidos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "title": "" }, { "docid": "18da6c487111d...
55de9584166d7e256219bbf1614a73d3
We overwrite the errors object with our own error object to support dynamic attribute name in the errors.
[ { "docid": "6a3fe0de8ddd3d07f6c5ad87440e9142", "score": "0.0", "text": "def errors\n @errors ||= EntityPropertyErrors.new(self)\n end", "title": "" } ]
[ { "docid": "e26cf2b921d80b1c10125e7fdc308487", "score": "0.6974427", "text": "def errors=(new_errors)\n self['errors'] = new_errors\n end", "title": "" }, { "docid": "6d3ef2c584d6f9f5887471f85567e7b5", "score": "0.69660306", "text": "def append_errors name, model\n model.e...
75b01324e83496664cc3c47591b3098a
Stub to get Current Environment Whether
[ { "docid": "0c7d3872f26c45eb76384b846d5b0228", "score": "0.0", "text": "def show_current_environment\n\n render json: {status: status_code(:ok), message: \"\", data: {:is_staging => (ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING].present? ? 1 : 0)}}\n\n end", "title": "" } ]
[ { "docid": "f85f03ebb6b7cd8a73ae32290b5ad145", "score": "0.7322421", "text": "def mock_environment?\n # The GoGrid environments have a mockedServices: true/false value in the environment details. This is a much\n # easier way to determine if the environment uses mocked services. The RE team is u...
28227ae267a555a7f5e65bed1b329379
POST /emos POST /emos.json
[ { "docid": "33e0fd5cfd86c634ca9f32447cfe2661", "score": "0.0", "text": "def create\n @emo = Emo.new(emo_params)\n\n require \"negapoji\"\n\n @emo.emo = (Negapoji.judge(@emo.text) == 'positive' if @emo.text.is_a?(String)) ? 1 : 0\n @emo.point = Negapoji.pointing(@emo.text) if @emo.text.is_a?(...
[ { "docid": "8c7a64e0d58f2d3f4ab1ae4bf07bed1b", "score": "0.6148757", "text": "def post_node()\n @options = {:path => '/nodes/content', :body => Megam::JSONCompat.to_json(\n=begin\n{\n \"systemprovider\" => {\n \"provider\" => {\n \"prov\" => \"chef\"\n }\n },\n \"c...
e54fe220eac5b3dc4b022637f5a8b3dc
The method should return the element of the array that is equal to half of the sum of all elements of the array. If there is no such element, the method should return nil.
[ { "docid": "5925e62bd308513b04779d6515604f6a", "score": "0.6210868", "text": "def all_else_equal(arr)\n sum = 0\n arr.each do |num|\n sum += num\n end\n\n sum_div_2 = sum / 2\n\n arr.each do |x|\n if x == sum_div_2\n return x\n end\n end\n return false\n\nend", "title": "" } ]
[ { "docid": "63969655f25a617f63ba76387509b920", "score": "0.7298426", "text": "def all_else_equal(arr)\n sum = sum_array(arr)\n\n arr.each do |ele|\n if ele == sum / 2.0\n return ele\n end\n end\n\n return nil\nend", "title": "" }, { "docid": "b1e223a4777fef04...
e8afe75b4896c33ca7048278b988394f
fill object properties from a 750g url
[ { "docid": "16dc13c99b2ecbc75b06380335a5e3db", "score": "0.55330557", "text": "def fetch_from_cuisineaz url\n if cuisineaz_host? url\n page = Nokogiri::HTML(open(url).read)\n @title = page.css('h1').text\n\n # get times\n @preptime = page.css('#ctl00_ContentPlaceHolder_...
[ { "docid": "8ee2d6873b7036b9b9c9682a89e55377", "score": "0.6362543", "text": "def parse_url\n set_url_type_and_command\n generate_field\n set_domain\n end", "title": "" }, { "docid": "e1e23ec2fc06482a13b3f78d48b45d7b", "score": "0.6328165", "text": "def url_obj (url)...
223f018fd3f5afec2a4de6f7a1c875e3
GET /dogs GET /dogs.json
[ { "docid": "969afa146b0bf73e0d73d1ed224dc5e1", "score": "0.0", "text": "def index\n @dogs = Dog.where(contact_id: current_user.id)\n end", "title": "" } ]
[ { "docid": "f8c2d8284e854cc7b2f94cf62d2851f2", "score": "0.7563714", "text": "def list_dogs\n breed = Breed.find(params[:id])\n render json: breed.dogs.all\n end", "title": "" }, { "docid": "1e8ead8b86778b111bc82f5a5eb9ca5f", "score": "0.75357485", "text": "def index\n @dog...
f6b49f1f716cfa368d9560c6f00d07ee
PATCH/PUT /rental_orders/1 PATCH/PUT /rental_orders/1.json
[ { "docid": "b33c24d9313c61664dfb989c8b6005bd", "score": "0.7042494", "text": "def update\n respond_to do |format|\n if @rental_order.update(rental_order_params)\n format.html { redirect_to @rental_order, notice: 'Rental order was successfully updated.' }\n format.json { render :sho...
[ { "docid": "7a5fbe7c6e8fc1a567a4e7edbc3cf75e", "score": "0.77792984", "text": "def update\n @rental_order.update(rental_order_params)\n render json: @rental_order\n end", "title": "" }, { "docid": "5475e478e362598519f05ab929db4ab8", "score": "0.6908524", "text": "def update\n ...
620931acfd1a89a00e1482378541e55f
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
[ { "docid": "25a8636255f6e4c5e0c6eac38d3fe98c", "score": "0.0", "text": "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsi...
[ { "docid": "a34f3dad821ba9744bc8d807b65489ad", "score": "0.6719518", "text": "def hash\n [value].hash\n end", "title": "" }, { "docid": "a34f3dad821ba9744bc8d807b65489ad", "score": "0.6719518", "text": "def hash\n [value].hash\n end", "title": "" }, { "doc...
e68d0a8c929812c935e1b5dc6b41ecd1
Description Renders a standad GET response to a GET call based on the request format. Renders views/GET.xml.builder internally
[ { "docid": "63ac7c2d6c39a28ee985f68817a9a91e", "score": "0.76362", "text": "def render_get\n respond_to do |wants|\n wants.html {render :to_xml => 'GET.xml.builder', :layout => false}\n wants.xml {render :to_xml => 'GET.xml.builder', :layout => false}\n wants.json {render :t...
[ { "docid": "46a50841bfddbd9e88f71e0a6d812d3c", "score": "0.6488471", "text": "def render_get_all\n respond_to do |wants| \n wants.html {render :to_xml => 'GETALL.xml.builder', :layout => false}\n wants.json {render :to_json => 'GETALL.xml.builder'}\n wants.xml {render :to_xml ...
b1fca7be865f2275307eed8ea0d946cd
Mark a game for download (torrent if possible, otherwise direct) We check if there is a BitTorrent link _and_ if the link works properly (returns a 200 OK HTTP response _and_ produces a valid torrent)
[ { "docid": "edfe8ec3df1d522ee23355db2633f341", "score": "0.7833808", "text": "def mark_download game\n\tusebt = game.btlink ? true : false\n\tif usebt and $verify\n\t\t# check if it exists\n\t\tbegin\n\t\t\ttorrent = open(game.btlink).read\n\t\t\tbegin\n\t\t\t\tdecoded = torrent.bdecode.first\n\t\t\t\tf...
[ { "docid": "1bd90c033f7cf971c418ad838d55bed2", "score": "0.7133669", "text": "def find_download_link(game)\n page = agent.get(game.fetch('url'))\n a = page.search(GET_IT_SELECTOR).first\n\n if a\n href = a.attribute('href').value.strip\n game['download_url...
3ac2198ec3ebae89d9e28819abb2cd08
====================== = Virtual Attributes = ======================
[ { "docid": "58f276af47a9e6755bbf1d9bc96b0f2b", "score": "0.0", "text": "def pay_in_full=(pay)\n self.amount_paid = total if pay\n end", "title": "" } ]
[ { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.7300186", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.7300186", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31...
91819d8dd9ff222a37e10e223318fad1
Called when page parsing starts
[ { "docid": "1c2c0ff8149b89bbc254c5eae4cd3256", "score": "0.0", "text": "def begin_page(arg = nil)\n @content << \"\"\n end", "title": "" } ]
[ { "docid": "e43ca2c35308a3bc312d46b8aa001c0a", "score": "0.77202773", "text": "def parse(page)\r\n #In future we will add some useful logic here\r\n #so, -- please call super(page) as a first row of your parse() method\r\n end", "title": "" }, { "docid": "8396b371b931608cf5b8648312b7...
0a2e7735f481eb056d963b6a6cccf6ad
update_quantity(grocery_list, "carrots", 7) p grocery_list Method to print a list and make it look pretty input: hash steps: set grocery list as parameter iterate through the hash, print each item and quanity in a readable format output: list of the items and quantities
[ { "docid": "0b5324072e4f738d67e8a5a6a219df51", "score": "0.0", "text": "def print_list(list)\r\n list.each do |item, quantity|\r\n puts \"You need to buy #{quantity} #{item}.\"\r\n end \r\nend", "title": "" } ]
[ { "docid": "eedf47def9a46f093f8b4d5fa01f56cd", "score": "0.8045042", "text": "def print_list\n\tupdate_quantity_hash = update_item_quantity(\"pizza\", 8)\n\tfinal_list_hash = update_quantity_hash\n\tfinal_list_hash\nend", "title": "" }, { "docid": "ad71ee081e79a04d01a4ef473dc6b4e3", "sco...
7b28991b4826def7fb9d88363b0ce97b
return the dependencies of all the packages who start with the root path
[ { "docid": "e1711776ae12db416cb83fde9380515e", "score": "0.7978299", "text": "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << pa...
[ { "docid": "b33ee091fa7a5955b3844822cd93ae28", "score": "0.728381", "text": "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |p...
87d30922d7e50015bb6346356c1a6858
the desired result. To check your work, run this file by entering the following command in your terminal: `ruby section2/exercises/methods.rb` Example: Write a method that when called will print your name:
[ { "docid": "670eff5091bd56f2e14acec7b908f675", "score": "0.0", "text": "def print_name\n p \"Severus Snape\"\nend", "title": "" } ]
[ { "docid": "05094a9f717c81bae4092a29aa983995", "score": "0.7961971", "text": "def print_name\nputs \"Person called #{@name}\"\nend", "title": "" }, { "docid": "40dffe906199df9d2778dbed62c27590", "score": "0.7951763", "text": "def print_name(name)\n # YOUR CODE HERE\n p \"#{name}\"\...
d6591ca8d84016744b2da36a3e564ad0
Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.
[ { "docid": "b2f8994defdaa33dd07a4422d273acb1", "score": "0.0", "text": "def leave(id)\n post(\"/notifications/leave/#{id}.json\")\n end", "title": "" } ]
[ { "docid": "d10135bc8e313b6242e7c8e8900c7a1f", "score": "0.6934741", "text": "def disable_all_notifications\r\n @user = current_user\r\n\r\n return if show_session_user_on_get\r\n\r\n if @params['disable'] == \"on\"\r\n @user.set_att(UserAttribute::ATT_REMIND_BY_EMAIL, 0)\r\n end\r\n e...
13834c033f3e71849d936604cfe8f394
Set I/O streams as unbuffered if they support it.
[ { "docid": "f0677736345975fc040adcd7a91b87e9", "score": "0.5761822", "text": "def sync_io!\n [input, output, error_output].each do |io|\n io.sync = true if io.respond_to?(:sync=)\n end\n end", "title": "" } ]
[ { "docid": "17e536c944ce6532a5829ecde6462f50", "score": "0.6519867", "text": "def initialize_buffered_io; end", "title": "" }, { "docid": "c602f779ec22930fbef147e63083feba", "score": "0.5791827", "text": "def silence_stream(stream)\n old_stream = stream.dup\n stream.reopen(RUBY_PLA...
8fa020303186b2a7aca403219709414c
The dot product of two points (treating them as vectors) ==== Parameters +a+ point a +b+ point b
[ { "docid": "abca8e0bfcafdf1712fed52736e9c3e9", "score": "0.83792776", "text": "def dot(a, b)\n\t\treturn (a.x * b.x) + (a.y * b.y)\n\tend", "title": "" } ]
[ { "docid": "648308aacd1e8595a2858a8bb9470a8f", "score": "0.8395246", "text": "def dot(v1, v2) #the dot product of two vectors\n\t(v1.x*v2.x + v1.y*v2.y)\nend", "title": "" }, { "docid": "8fb3877af8b1c2aa1a0e173a2da9be81", "score": "0.8370008", "text": "def dot_product(vector1, vector...
276edb66120fc56c13ddc1e3fd63523c
find zone matching the host and port combination
[ { "docid": "f4793b24875706b7dd6945136feda2fb", "score": "0.8660707", "text": "def zone_for( host, port )\n config.each_pair do |zone, info|\n return zone if info['host'] == host and info['port'] == port.to_i\n end\n nil\n end", "title": "" } ]
[ { "docid": "b78063771fad6cd2d6a540b0f7ee605a", "score": "0.67302406", "text": "def get_zone(zone)\n return find_match(@dns.domains, zone)\n end", "title": "" }, { "docid": "e8c09364dee58cfabe9587dd66961739", "score": "0.6681263", "text": "def zone_by_name name\n co...
7b49b8b9343ee963036c1e7659748dae
Render a single entry for use within a list of items.
[ { "docid": "e96fe796b029cb62d43b6360b2e70dbb", "score": "0.0", "text": "def list_item(pairs: nil, **opt)\n opt[:pairs] = model_index_fields.merge(pairs || {})\n super(**opt)\n end", "title": "" } ]
[ { "docid": "d800b968ecf2856b902e6f5b0bef9d24", "score": "0.70706666", "text": "def render_entry(entry)\n %{<div class=\"hentry\" id=\"#{entry[:id]}\">\n <h2 class=\"entry-title\">#{entry[:title]}</h2>\n <span class=\"entry-content\">#{entry[:content]}</span>\n #{entry[:...
2b68fa72e60bd64adfbd297926f52ac6
Called by RSpec when an the json:api response doesn't match the object instance
[ { "docid": "c8ed4a743f7b0c6e492b0f5ac3110e7b", "score": "0.0", "text": "def failure_message\n \"#{@failure_message} - parsed response: #{pretty_response}\"\n end", "title": "" } ]
[ { "docid": "10d9ae5c4f0ab7037e99d5a95d4da747", "score": "0.68217677", "text": "def expected_json_errors(msg)\n expect(last_response.body).to eql(msg)\n expect(last_response.status).to eq 422 \n end", "title": "" }, { "docid": "45486bea1a7cb384f3cde27dc6e643dd", "sco...
38dcf435d176578ccaf5d6797004283b
return top 10 most popular cards GET /cards/popular.json
[ { "docid": "8eefed2629daa63daf78aa4367177260", "score": "0.8248473", "text": "def show_most_popular\n @cards = Card.order(\"impressions_count DESC\")[0..19]\n end", "title": "" } ]
[ { "docid": "9d28ac8814e4b01593f6a2ead0005fff", "score": "0.73919994", "text": "def popular\n request(\"fields\")[\"popular\"]\n end", "title": "" }, { "docid": "bdbacefe71b5059cedb5f5ed67d42bef", "score": "0.73864466", "text": "def most_used_card(top_how_many_cards)\n ...
6f4dce1dbe7e3c41963f0f4df9866374
POST /gentres POST /gentres.json
[ { "docid": "4f62cbc84aa70af1ed82bcbd89051b94", "score": "0.69791114", "text": "def create\n @gentre = Gentre.new(gentre_params)\n\n respond_to do |format|\n if @gentre.save\n format.json { render :show, status: :created, location: @gentre }\n else\n format.json ...
[ { "docid": "52f32e5f7995ab153232169f5b42c390", "score": "0.60144335", "text": "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unproce...
9310af11e0a10f9bca442bc51f1b9653
Add the _name_ class path which may be a file or a folder to this classpath.
[ { "docid": "9f1a99e506331bdc0b1712f64f32f21a", "score": "0.77049154", "text": "def add_file_name(name)\r\n if FolderClasspath.valid_location?(name)\r\n add_element(FolderClasspath.new(name))\r\n elsif JarClasspath.valid_location?(name)\r\n add_element(JarClasspath.new(nam...
[ { "docid": "117c67ffb830d2d412d51e6f69b008e8", "score": "0.7205038", "text": "def add_classpath(p_path)\n puts \"looking at path - #{p_path} for new jar files.\"\n Dir.new(p_path).each {|file|\n @classpaths << \"#{p_path}/#{file}\"\n }\n return self\n end", "title": "" }, { ...
5c1ff3e806efb91859c220ee743cb03e
Returns the position of the mouse relative to the game window.
[ { "docid": "05caac25b4a038d1e745af82dfc2b71e", "score": "0.7800312", "text": "def getMousePos(catch_anywhere = false)\r\n return nil unless System.mouse_in_window || catch_anywhere\r\n return Input.mouse_x, Input.mouse_y\r\n end", "title": "" } ]
[ { "docid": "2692640b577866efdd43c347eb7af1f2", "score": "0.77747035", "text": "def x\r\n return $window.mouse_x\r\n end", "title": "" }, { "docid": "0afd9697ca99aa72220eb0a9a33086be", "score": "0.7554534", "text": "def cursor_pos\n @functions[:cursor_pos_x] ||= AU3_Funct...
78d47b286c9461686234abea0481f6b2
GET /endorsements/1 GET /endorsements/1.xml
[ { "docid": "cf4bdcd58f7a6b0d24f1563b7df75173", "score": "0.71811384", "text": "def show\n @endorsement = Endorsement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @endorsement }\n end\n end", "title": "" } ]
[ { "docid": "b76782a75f9c13711c32b4bf299a47ec", "score": "0.64082503", "text": "def index\n @endorsment_proposals = EndorsmentProposal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @endorsment_proposals }\n end\n end", "title": "" }...
901259572990289e07716fdfc91e0d8f
Returns all sessions in this Group
[ { "docid": "b1eaf106bcdcdb555ab062c201db185d", "score": "0.8393141", "text": "def sessions\n s = @instance.client.listSessionsOfGroup(@id) || {}\n s.map { |id,info| Session.new(@instance, id, info) }\n end", "title": "" } ]
[ { "docid": "71f2eb843e7aefcf9a11901c5aa185c1", "score": "0.84251845", "text": "def sessions\n s = @instance.client.listSessionsOfGroup(groupID: @id) || {}\n s.map { |id,info| Session.new(@instance, id, info) }\n end", "title": "" }, { "docid": "b90761427ca3088bea449d0b818cfb9a",...
61c89fe86fa279e1cc341a74a40b358d
Deserializes the data based on type
[ { "docid": "ff72977383448db1b109727863a33544", "score": "0.0", "text": "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n ...
[ { "docid": "36a7ecd8f09e91284f3ff814815f745d", "score": "0.8233457", "text": "def deserialize(data, type = nil)\n serializer(type).deserialize(data)\n end", "title": "" }, { "docid": "36a7ecd8f09e91284f3ff814815f745d", "score": "0.8233457", "text": "def deserialize(data, type = n...
bf4c1be5918eefef470574af1f0d205a
PATCH/PUT /product_categories/1 PATCH/PUT /product_categories/1.json
[ { "docid": "b9b29eec72e80a745aa70fe3e7e5b78f", "score": "0.0", "text": "def update\n respond_to do |format|\n if @project_category.update(project_category_params)\n if @project_category.save\n if params[:images] != nil\n params[:images].each do |image|\n P...
[ { "docid": "3d55cf51582f90e3ccd7b5d53b83c5c0", "score": "0.73909044", "text": "def update\n category_ids = params[:product][:category_ids]\n params[:product].delete(:category_ids)\n @admin_product = Product.find(params[:id])\n params[:product][:categories] = Array.new\n if category_ids\n ...
7b6fca375b660f8ee3a96c096faa2959
Paths for all of this class's dependencies, for passing to +require+.
[ { "docid": "b9ea8287ff671007ea958eb91c45a071", "score": "0.646708", "text": "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "title": "" } ]
[ { "docid": "f37fee61b8be2e781c4268c6dcf495de", "score": "0.76892275", "text": "def generate_require_paths; end", "title": "" }, { "docid": "29922c62bfd407a1d9905fe72b662b79", "score": "0.7674085", "text": "def require_paths; end", "title": "" }, { "docid": "29922c62bfd407...
586ff3eb16eee1a96c96198807973b12
map_mmio is a method that can be used to register handlers for memory reads/writes at a specific address so that the programs running in the emulator can interact with the outside world. See Computerinitialize_mmio for examples
[ { "docid": "9e4c61fd6e1b784216744f92c7c43c1f", "score": "0.8700108", "text": "def map_mmio(address, &handler)\n\t\t@mmio[address] = handler\n\tend", "title": "" } ]
[ { "docid": "87649338879b96ad4d71a0690bb86ba3", "score": "0.55433977", "text": "def initialize(memory, address)\n @ir = Vic20::Memory::Mapping.new(memory, address)\n # @pa = Register.new\n # @pb = Register.new\n end", "title": "" }, { "docid": "9aae5baec709fee9851fac6d7d81d9...
5823c75f7437cf9f59a185b6d2ebf8b8
GET /posts/1 GET /posts/1.json
[ { "docid": "61c5fabd88a4b619676161026006bb99", "score": "0.0", "text": "def show\n ## 面包屑导航\n add_breadcrumb I18n.t('view.action.show'), :back_post_path\n end", "title": "" } ]
[ { "docid": "c884d3048f42b4b1b768c271940bbed7", "score": "0.7437435", "text": "def show\n post_id = params[:id]\n render json: V1::Post.get_a_post(post_id)\n end", "title": "" }, { "docid": "fb578f587fdfe1b0a8d3ac27001f9611", "score": "0.736332", "text": "def index\n ...
c70b228368b47bc8782059d06a191d7a
DELETE /promotions/1 DELETE /promotions/1.json
[ { "docid": "3e42982eb4d27c9539df845942f89052", "score": "0.6610987", "text": "def destroy\n @promotion.destroy\n respond_to do |format|\n format.html { redirect_to promotions_url, notice: 'Oferta foi excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "title...
[ { "docid": "25d48063ac5f55826be308ce28be3f74", "score": "0.71382344", "text": "def destroy\n @promoter = Promoter.find(params[:id])\n @promoter.destroy\n\n respond_to do |format|\n format.html { redirect_to promoters_url }\n format.json { head :ok }\n end\n end", "title": "" ...
ada8091ae1d13c41263524d5d2e1d863
There is no need to check for incomplete fields. If this changes, simply uncomment the all_fields_present method and the validate :all_fields_present call. def all_fields_present if has_empty_fields?(header_properties) || (form_type.has_checklist? && has_empty_fields?(checklist_properties)) || has_empty_fields?(footer_...
[ { "docid": "074fb5c96b728fb84f2189d7284823bb", "score": "0.5780557", "text": "def has_empty_fields?(fields)\n fields.values.any?{ |field| field.empty? }\n end", "title": "" } ]
[ { "docid": "16e672f1c1dcd5e1d148ca4229505886", "score": "0.7267027", "text": "def validate_fields\n self.class.required_fields.each do |field|\n value = public_send(field)\n if value.nil? || value.respond_to?(:empty?) && value.empty?\n raise Outbox::MissingRequiredFieldError,...
6f8be568367da4ebfb257d93e40ffb54
Skip password when validating.
[ { "docid": "fa031fdfdebd69216e6cc503ba2cdce3", "score": "0.75469583", "text": "def skip_password!\n # Securely remove all password fields, otherwise user cannot confirm.\n self.password = nil\n self.password_confirmation = nil\n self.encrypted_password = ''\n self.skip_password = true\n ...
[ { "docid": "37131e67087c26b5e2053b3521995df4", "score": "0.78304416", "text": "def disable_empty_password_validation()\n @password = \"non-empty\"\n end", "title": "" }, { "docid": "39ec4c62a66ef63338d018bfcc5d6f29", "score": "0.7793445", "text": "def skip_password_check(*)\n ...
3d25beceedfaad9363477b564236e1b7
Update a bank link Update the information for a bank link for an account.
[ { "docid": "5a173d923865d2222b485e0b52b39e95", "score": "0.68692404", "text": "def update_bank_link_using_put_with_http_info(bank_link, bank_link_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.update_bank_link_using_put ...'\n ...
[ { "docid": "5aefc1cc0411a7de2908587b22689390", "score": "0.70728964", "text": "def update\n @link_account = LinkAccount.find(params[:id])\n\n respond_to do |format|\n if @link_account.update_attributes(params[:link_account])\n format.html { redirect_to @link_account, notice: 'Link acco...
6b753157a81593d3dfbe67eb1157ac47
Helper method to get logged in user
[ { "docid": "a1113aadc1df1e084a29067a48e6d9a0", "score": "0.0", "text": "def current_user\n User.find_by(id: session[:user_id])\n end", "title": "" } ]
[ { "docid": "d54f7678ada4754ef0b36da35dea4740", "score": "0.87386656", "text": "def get_user\n if logged_in?\n return User.find_by_id(session[:user_id])\n # logger.debug \"get_user ran. Logged in User #{User.find_by_id(session[:user_id])}\"\n else\n \n end\n end", "title": "" ...
6b86270fdd2eb3e98df54f22268a64f7
Get the avatar of a blog
[ { "docid": "d05439245e8569e7dd123b6abbfb653b", "score": "0.87693816", "text": "def avatar(blog)\n get(\"/v2/blog/#{Blog.new blog}/avatar\", {}, false)\n end", "title": "" } ]
[ { "docid": "e0f72fd0a869b2434d93a9619f33f11e", "score": "0.85430735", "text": "def avatar(blog, size = 64)\n get(\"/v2/blog/#{blog}/avatar\", :size => size)\n end", "title": "" }, { "docid": "04c5c22049d33508b51301b2454b2a3b", "score": "0.83641183", "text": "def avatar(bl...
d1863c552f3e4c4b6f3f2cf75e911d02
FIXME: => in rails console def initialize
[ { "docid": "fc4541146d50fd9e7a307c57970a1d1e", "score": "0.0", "text": "def word_combos(word)\n\t\tword = word.chars.to_a\n\t\tall_permutations = []\n\t\ti = 1\n\t\twhile i <= word.size\n\t\t\tall_permutations << word.permutation(i).to_a\n\t\t\ti+=1\n\t\tend\n\t\treturn all_permutations\n\tend", "ti...
[ { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.8282664", "text": "def initialize() end", "title": "" }, { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.8282664", "text": "def initialize() end", "title": "" }, { "docid": "a83980d1953a1624afdb6684da64...
2853b0ec7ee6be4676bdd6b1fbb0ec71
Stops the server if running (ie a handler is set).
[ { "docid": "e17fd7155f17c20e3c80fd900f00fbcf", "score": "0.0", "text": "def stop!\n if @handler\n # Use thins' hard #stop! if available, otherwise just #stop\n @handler.respond_to?(:stop!) ? @handler.stop! : @handler.stop\n @handler = nil\n \n yield if block_given?\...
[ { "docid": "3b9b601c6abcd45e717c1d3d29a6e43b", "score": "0.8346219", "text": "def stop\n @server.stop if @server.running?\n end", "title": "" }, { "docid": "24278e04a9de27ded2f6c8e080520ec1", "score": "0.81967807", "text": "def stop\n @server.stop if @server\n end", ...
dd5d6628a9ca880f4306c36290d35f36
validates_presence_of :round, :card, :correct, :first_guess
[ { "docid": "61e373549e8ef178b04c8b4ebad19439", "score": "0.57646555", "text": "def right_first_time?\n\t\tself.correct && self.first_guess\n\tend", "title": "" } ]
[ { "docid": "d3449986d206654bef366f4b73c06ed8", "score": "0.69108564", "text": "def valid?(current_guess)\n true\n end", "title": "" }, { "docid": "a4ed63059c7858862cc3fba59e020d6d", "score": "0.6450005", "text": "def correct?\n @guess == @card.answer ? true : false\n end", ...
a81035beb8ae55f9956830a1b06ca033
Fetching the image 2 from the source
[ { "docid": "bfec2f743f92c2aecd2e8901744d3ff9", "score": "0.67339957", "text": "def download_remote_image2(remote_image_2_url)\n io = open(URI.parse(remote_image_2_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # ...
[ { "docid": "9d674d720d949095715c5ad94337bb9e", "score": "0.6636437", "text": "def get_image2(doc, image)\n x = doc.xpath(image).first.to_s\n end", "title": "" }, { "docid": "659314ac9bb694a9f6f1b10fcafac197", "score": "0.6607311", "text": "def get_image\n source_file = Item.ne...
bedf147c648a6f8d5e0b6e2567fd9e8d
returns a string of data such as "90406080406090447F"
[ { "docid": "627fc052b168afb00b696813702f387a", "score": "0.5733775", "text": "def gets_data_s(*a)\n arr = gets_bytestr\n arr.map { |msg| msg[:data] }.join\n end", "title": "" } ]
[ { "docid": "f7b2c3e1c1915f1f01e4dd115e90701f", "score": "0.6789691", "text": "def string\n binary.map { |i| i.to_i.to_s(16) }.join('')\n end", "title": "" }, { "docid": "3840eae0cca0f91a06915abdbcd36625", "score": "0.67375934", "text": "def to_s22\n \tinteger=self.to_i\n \t...
f3952a6c1015b3958ae695447a68ef9d
Transfer all symbol keys to string keys
[ { "docid": "1e00305a35336136422a4592d2891e9d", "score": "0.0", "text": "def transfer\n self.keys.each do |k|\n self[k.to_s] = self[k] if k.is_a? Symbol\n end\n return self\n end", "title": "" } ]
[ { "docid": "445628ed8fd7ace25d38b6bdbffa2c2c", "score": "0.78043514", "text": "def key_strings_to_symbols!\n result = Hash.new\n self.each_pair do |key,value|\n value.key_strings_to_symbols! if value.kind_of? Hash and value.respond_to? :key_strings_to_symbols!\n result[key.to_sym] = valu...
a4fad4cba41eae2b9eda8c49f02884b9
Returns the credits remaining (for prepaid users only).
[ { "docid": "b2116de0b04a47e51e41afcb82ca6fee", "score": "0.68549305", "text": "def get_credits_remaining\n response_message, response_code = post_data_to_server(\"MESSAGES\\r\\n.\\r\\n\")\n\n if response_message =~ /^(\\d+)\\s+OK\\s+(\\d+).+/\n if response_code != 100\n raise B...
[ { "docid": "8f8643a87e02eeb87f839c57a6febf78", "score": "0.77903336", "text": "def credit_remaining\n perform_request( 'Type' => 'credits' ) do |xml|\n xml.xpath('/api_result/data/credits/text()').to_s.to_i\n end\n end", "title": "" }, { "docid": "3abb039f2e0859627dcf6884...
5886d7051546156387f466b4c3591309
Does the item in the list correspond to the given entity?
[ { "docid": "f35647dc498c88b75fc82b83686c0661", "score": "0.0", "text": "def stores? other\n (entity(false) == other) ||\n (id==other.id && klass==other.class)\n end", "title": "" } ]
[ { "docid": "d22605c87f018d0bede7bafd2e404212", "score": "0.6747452", "text": "def has_entity? entity\n return true if (self.entities.select {|e| e.match? entity}).length > 0\n end", "title": "" }, { "docid": "4c0bf1f2a8875f21230f2e68fa07d320", "score": "0.6733453", "text"...
599e30abce427f3f053586a7303693c6
Returns a report of the current transaction set. See Mny::Reportreport
[ { "docid": "8c8c60d6afeb28513096590fef562fba", "score": "0.5803268", "text": "def report(date = nil)\n filter!\n @reporter.report date\n end", "title": "" } ]
[ { "docid": "4b63c781777e47212fb8c3ed46b682ed", "score": "0.701543", "text": "def report\n @report ||= Report.new(self)\n end", "title": "" }, { "docid": "0972e8218d4bb4bcb1d316fe7c4da53e", "score": "0.6918043", "text": "def report\n Report.new(self)\n end", "title...
dd9aea1dffbdf1220cbde39a865eab6f
Deletes row from table
[ { "docid": "6738686143565f61e654f365902701aa", "score": "0.0", "text": "def delete\n CONNECTION.execute(\"DELETE FROM assignments WHERE id = #{self.id};\")\n end", "title": "" } ]
[ { "docid": "b5a5877eebe4de0dab20081a2dbd6a59", "score": "0.78912216", "text": "def delete_row(id)\n table_name = self.to_s.pluralize.underscore\n DATABASE.execute(\"DELETE FROM #{table_name} WHERE id = #{id}\")\n end", "title": "" }, { "docid": "3702b5cd9a1e22f75a47716273188d60", ...
134ed1b404547c497437c15b96a634c2
Get this field's value, suitable for indexing.
[ { "docid": "3a99a97e005e011b845ee5f405b3ea9e", "score": "0.0", "text": "def indexvalue\n if multiple?\n @value.map {|v| single_indexvalue v }\n else\n single_indexvalue @value\n end\n end", "title": "" } ]
[ { "docid": "f71f440336bb2e3b49fa0aadf2e77a02", "score": "0.7520439", "text": "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "title": "" }, { "docid": "a31182a070ca1eb3839b6c349369234c", "score": "0.748235", "text": "def get_value(field)\n field = i...
7e5d6ee40189f56a88070a4d119e3156
Make the Dictionary an pleasant hash with Integer top keys (addresses) and symbols for other keys
[ { "docid": "661f9c3e68933bb4f3a400fc03b24545", "score": "0.0", "text": "def clean_dict(original_dict)\n original_dict.each_with_object({}) do |(k, v), memo|\n memo[k.to_i] = clean_node(v)\n end\n end", "title": "" } ]
[ { "docid": "6938cc34537e4457ae5dd123375a97d6", "score": "0.6601522", "text": "def hash\n hash = 17\n hash = 37 * hash + @prob.hash\n hash = 37 * hash + @alias.hash\n hash = 37 * hash + @values.hash\n hash\n end", "title": "" }, { "docid": "5efacc36ffcf6769eb11ea7d427e096c", ...
91f35b8a2db49addf0cfa6646485f361
limitation: this currently reads the whole file in before making a decision
[ { "docid": "82770ac22dc829cd55c8230fdd74147b", "score": "0.0", "text": "def guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \"\\r\\n\" => 0}\n quoted_char = false\n\n # count how many of the pre-defined line-endings we find\n # ignoring those contained ...
[ { "docid": "20fcb47c07932a38e4d6c18dcb12037b", "score": "0.64510834", "text": "def read_file(file)\n results = error_basic_inject(\"select CHAR_LENGTH(load_file(#{file.strip.chomp.mysqlhex}))\")\n if results.nil? or results == ''\n print_line(\"\")\n print_caution(\"Unable to determine s...
d63cef65e33f03813154236b21acdd1c
Start up the networking layer, opening up sockets and getting ready for communication.
[ { "docid": "90d79230bb0c04d29160b7b011356b50", "score": "0.5947371", "text": "def run\n @security = Communication::Security.new_client\n\n @subscribe_socket = Communication::SubscribeSocket.new_link(\n Pantry.config.server_host,\n Pantry.config.pub_sub_port,\n @s...
[ { "docid": "202859738fd4fcb98256cc49154cc941", "score": "0.70618844", "text": "def socket_setup()\n ctx = { 'Msf' => self.options['Msf'], 'MsfExploit' => self.options['MsfExploit'] }\n self.socket = case self.handle.protocol\n\n when 'ncacn_ip_tcp'\n Rex::Socket.create_tcp(\n ...
ffa8848cb0f918a471082570a1b862d8
GET /subctegories/1 GET /subctegories/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "3f54008ad1b157dbe1b3754917250700", "score": "0.72183335", "text": "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "title": "" }, { "docid": "ac84ef9fb07c49309c...
3c87bbd8687fb900d63e7810deada7e2
the value of the original string with all consecutive duplicate characters collapsed into a single char. Do not use Stringsqueeze or squeeze!
[ { "docid": "7f673612b6bc87dfb6f8a0ab8f747ee7", "score": "0.0", "text": "def crunch(string)\n array = string.split('')\n new_array = []\n prev_char = ''\n array.each do |char|\n if char != prev_char\n new_array << char\n prev_char = char\n end\n end\n new_array.join\n\nend", "ti...
[ { "docid": "e73b409a2888577e45a691fe5ea35f29", "score": "0.7701307", "text": "def same_char_collapse(str)\n \n \n str = str[0...unique_check(str)] + str[unique_check(str)+2..-1]\n return str\nend", "title": "" }, { "docid": "74022bb8c7569e68feaf7af79785667e", "score": "0.76573...
0ac1d9adfc7b1f1e6a638eae8f9a63b9
Internal: Gets the internal Array of exclusions. Initializes to an empy Array if it doesn't exist. Returns an Array.
[ { "docid": "f9c12e1c80ebf0c6ed6271518946edec", "score": "0.69144213", "text": "def exclusions\n @collection[:exclude] ||= []\n end", "title": "" } ]
[ { "docid": "946ce50568551b42c55f581622ffce87", "score": "0.7613444", "text": "def exclusions\n @exclusions ||= []\n end", "title": "" }, { "docid": "5a33b429e577d5ebef983b2061c102a2", "score": "0.7150363", "text": "def excluded\n return [] if workspace.nil?\n @e...
d520e8df62d34e2b7dea3226c92c5c78
partially update status of the specified DaemonSet
[ { "docid": "8f5dfdf4b3fbd6bb635737cedc360f42", "score": "0.59508485", "text": "def patch_namespaced_daemon_set_status(name, namespace, body, opts = {})\n data, _status_code, _headers = patch_namespaced_daemon_set_status_with_http_info(name, namespace, body, opts)\n return data\n end", "...
[ { "docid": "282eeba6c2def298bb50ec616a601288", "score": "0.6533453", "text": "def set_daemon_status(stat)\n @daemon_status = stat\n\n update_status\n end", "title": "" }, { "docid": "490ae024cd0fe29f4be44df43c1e1653", "score": "0.595404", "text": "def check_status(cli)\n...
37125c0779efc1adfbbfe5b4719d6a36
an element that can appear multiple times that contains text 'one_name' is the name of the element, 'many_name' is the name of the attribute that will be created on this Element
[ { "docid": "edb62010cc8236bb86c630aee87ccdc2", "score": "0.61634755", "text": "def strings(ns, one_name, many_name)\n attr_reader many_name\n\n self.on_init do\n instance_variable_set(\"@#{many_name}\", [])\n end\n\n self.on_parse_many [ns[1], one_name] do |e,xs|\n var ...
[ { "docid": "c207f06b4ac23fe6b4d992a0616d86d2", "score": "0.67670137", "text": "def elements(ns, one_name, many_name, klass)\n attr_reader many_name\n\n self.on_init do\n var = Atom::Multiple(klass).new\n instance_variable_set(\"@#{many_name}\", var)\n end\n\n self.on_pa...
86c58f61adfab221bba118f7b272003e
Log a debug message
[ { "docid": "ec440b7b09a87b6498a64fb3456f9c07", "score": "0.0", "text": "def add_debug(node, message = \"\", &block)\n log_debug(node_path(node), message, &block)\n end", "title": "" } ]
[ { "docid": "ea9a4185a7483f29ed4b975edad6e12a", "score": "0.8707265", "text": "def debug(msg) log(DEBUG, \"DEBUG \" << format(msg)); end", "title": "" }, { "docid": "a7a91d2d5cf0e3418176d4e0a7c5f695", "score": "0.8680048", "text": "def debug(message)\n log(message, :debug)\n e...
8cfaec321ad6eac08b50f128d41c9e18
Defines a new Schema node, if a block is provided, then the contents of the block are treated as children of the node.
[ { "docid": "a11caf3d82a640fee030323cd75db8fd", "score": "0.60487247", "text": "def node(kind, name, **options, &block)\n data = patch_options(**options).merge(\n enum: options[:enum],\n # '*' means any type\n type: options.fetch(:type, '*'),\n key: name.to_s,\n...
[ { "docid": "1210ed201162c441dd889ace51ad34d0", "score": "0.7552416", "text": "def schema(&block)\n if block\n @schema = Schema.new(&block)\n else\n @schema\n end\n end", "title": "" }, { "docid": "14c051a6280bcf099444720400038d83", "score": "0....
71ddbf62518bbc563fc7e011d590aa7a
Target Device: iOS Function Name: testSingleDownload Activity: Function for downloading single content Param: object
[ { "docid": "5952e01b5e6c1e11b98c522328d1244b", "score": "0.6642014", "text": "def ios_testSingleDownload(client)\n\t\tclient.sleep(2000)\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs \"::MSG::[iOS] STARTING TEST SINGLE DOWNLOAD@単話ダウンロード機能\"\n\n\t\t$totalTest = $totalTest + 1\n\n\t\tclient.sleep(2000)\n\t\tbeg...
[ { "docid": "4eb603707a26cb2abb2058675d7ff9d5", "score": "0.68283826", "text": "def testSingleDownload(client)\n\t\tclient.sleep(2000)\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs \"::MSG::[ANDROID] STARTING TEST SINGLE DOWNLOAD@単話ダウンロード機能\"\n\n\t\t$totalTest = $totalTest + 1\n\n\t\tclient.sleep(2000)\n\t\tbe...