query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
9b0039cbf788a8d2f8205d48a0ef5bee
this method loads all the industries which are required while creating the pitch
[ { "docid": "0d8043662a6542fed283c29af7551205", "score": "0.71392006", "text": "def load_industries\n @industries = Industry.all\n end", "title": "" } ]
[ { "docid": "e5e2791dfb28c2eb01bbeea68367d035", "score": "0.6568643", "text": "def load_available_associations\n @available_groups = @employee.get_available_groups\n @available_services = @employee.get_available_services(@year)\n @available_products = @employee.get_available_products(@year...
72973fddb0d43724093f3326f0aef51f
GET /clients/1 GET /clients/1.json
[ { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.752935", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" } ]
[ { "docid": "11367d36e4c90c8a0de89176b3b870a4", "score": "0.77151686", "text": "def index\n @clients = current_user.clients\n render json: @clients\n end", "title": "" }, { "docid": "c08f08851a4c0ff67e672bffd88bc989", "score": "0.7692742", "text": "def show\n client = Client...
fb9243276f01871d7fb52e636c5a3f64
a new Array with the elements of the original list in reverse order. Do not modify the original list. You may not use Arrayreverse or Arrayreverse!, nor may you use the method you wrote in the previous exercise.
[ { "docid": "0d067ea149f4a9a882d8d0c3eace73d3", "score": "0.0", "text": "def reverse(array)\n array.length\n reverse_index = -1\n count = 0\n new_array = []\n loop do\n break if count > array.length - 1\n new_array << array[reverse_index]\n reverse_index -= 1\n count += 1\n end\n new_a...
[ { "docid": "183577aede14e9e3ffb0fb19768ab5f1", "score": "0.8564066", "text": "def reverse_list list\n new_array = []\n x = list.length - 1\n while x >= 0\n new_array.push(list[x])\n x -= 1\n end\n new_array\nend", "title": "" }, { "docid": "21ebf18adbd4d75f0d5d3927ad00d935", "...
bf9122f3e661c6740989f5fd0ede0ef6
GET /vacancies GET /vacancies.json
[ { "docid": "999a29baf7b01944e14e40ea096c190b", "score": "0.7050913", "text": "def index\n @vacancies = Vacancy.all\n end", "title": "" } ]
[ { "docid": "5859662f0b5acc807543ecc4e856922f", "score": "0.73045945", "text": "def index\n @vacations = Vacation.all\n\n render json: @vacations\n end", "title": "" }, { "docid": "236575e20a1854178118e856d10b03af", "score": "0.7245945", "text": "def index\n # @user = curren...
1ff4f0907a3a2882a6150a34f47f3540
POST /articles POST /articles.xml
[ { "docid": "88e93020a76bb20221953c4c151158ce", "score": "0.0", "text": "def create\n authorize! :create, @post\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n \n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post wa...
[ { "docid": "d85710a2a98585aaf11d4a7bb02ec459", "score": "0.6919453", "text": "def create\n @articles = Article.root_articles\n @article = Article.new(params[:article])\n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n format....
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5df25ab361ec4854e31890e9ad3185b6", "score": "0.0", "text": "def set_api_v1_poll_response\n @api_v1_poll_response = Api::V1::PollResponse.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
ede641998686debd1825424b5f888a2a
Copy a static file from the template into the new application
[ { "docid": "8f486f12345b60d8daff786bf0a5daaf", "score": "0.72829396", "text": "def copy_static_file(path, new_path = false)\n # puts \"Installing #{path}...\".magenta\n new_path = path unless new_path\n remove_file new_path\n file new_path, File.read(File.join(@static_files, path))\n # puts \"\\n\"...
[ { "docid": "26f5a30c863ab43ef7f48a13b07bcb93", "score": "0.7711274", "text": "def copy_static\n FileUtils.cp_r 'static/.', 'output/', :preserve => true\nend", "title": "" }, { "docid": "860111c89d607d8f90f6f99d50c16c01", "score": "0.76080567", "text": "def copy_static\n FileUtils.c...
6c998376a828440bfe004e88503d6ee2
Finds and returns the smallest integer value in the array Assumes that the array is not sorted. Time complexity: O(n), as usual, the time used is dependent on the value of 'length'. Space complexity: O(1), the variable 'smallest_int' is assigned to a value that already exists in 'array', so it does not take up more mem...
[ { "docid": "87ce44bdbe2d74b90dc301c730eaaa1f", "score": "0.80226326", "text": "def find_smallest(array, length)\n smallest_int = array[0]\n length.times do |i|\n if array[i] < smallest_int\n smallest_int = array[i]\n end\n end\n return smallest_int\nend", "title": "" } ]
[ { "docid": "d2df7f4ecfe634c309a19f6187afb26a", "score": "0.75650066", "text": "def find_smallest(array, length)\n smallest_number = array[0]\n length.times do |i|\n if smallest_number > array[i]\n smallest_number = array[i]\n end\n end\n return smallest_number\nend", "title": "" }, ...
491fd25645030a1f03140fe7bbf38f17
Baseline implementation for the delete_route REST call
[ { "docid": "bef17268a8d9dba9fe5c12a3f96f9006", "score": "0.7242078", "text": "def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_re...
[ { "docid": "116da2cdae1a98a74d0f3c8d55477ad6", "score": "0.71712446", "text": "def destroy\n Rails.logger.info('👻 Disraptor: Destroying route.')\n\n if Disraptor::Route.remove(params[:route_id])\n Rails.application.reload_routes!\n\n render json: success_json\n else\n render jso...
50b3ce974bd1885ac2e7c92ee4f93229
Match using the scanQuotelike method, but only return the match or nil.
[ { "docid": "84d181c1e0f5cae572f3114147892cb3", "score": "0.7726995", "text": "def extractQuotelike( *args )\r\n rval = scanQuotelike( *args ) or return nil\r\n return rval[:match]\r\n end", "title": "" } ]
[ { "docid": "bd6c35aab77f9ec429357a9b78097f0a", "score": "0.7113318", "text": "def matching(quote); end", "title": "" }, { "docid": "79cb79b502fc17e251a66e7412b4efe4", "score": "0.6758865", "text": "def scanQuotelike( prefix='\\s*', matchRawRegex=true )\r\n\r\n self.matchError ...
f548d2f33a0d27251ad6a05451c04a59
where the group definition should be looked up when no scope given. This is expected to return a controller.
[ { "docid": "f13e136a82b06e9b56c61227a35d0fde", "score": "0.60410553", "text": "def _default_param_group_scope\n self\n end", "title": "" } ]
[ { "docid": "64f4d7a0e3e03dadcfa2383cc8524cd9", "score": "0.6227264", "text": "def _default_param_group_scope\n @scope\n end", "title": "" }, { "docid": "c7c8803a6b8afa7cc9b3e50aee7b4970", "score": "0.6203228", "text": "def default_param_group_scope\n @scope\n ...
32d7fe5fabe3ec3bba57377ebd7d3a5c
Looks like RubyMotion adds UIKit constants at compile time. If you don't use these directly in your code, they don't get added to Kernel and const_int_get crashes.
[ { "docid": "f3a1438e33d4ff41bfadd438cf18c8cf", "score": "0.0", "text": "def load_constants_hack\n [UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, \n UIImagePickerControllerSourceTypeSavedPhotosAlbum\n ]\n end", "title": "" } ]
[ { "docid": "018c5c2cd45cc6f4fe5080993d58346e", "score": "0.63997877", "text": "def included_constants; end", "title": "" }, { "docid": "965f68dfb3ee1ea98d49ced3e6fe478e", "score": "0.6195058", "text": "def api_constants\n if @api_constants.nil?\n require \"rex/post/meterprete...
3976e4b122a73ec2a3e0a40d22f1ffd0
PUT /inventories/1 PUT /inventories/1.json
[ { "docid": "0d5c49123fe723332879338757dca291", "score": "0.660218", "text": "def update\n @inventory = @user.inventories.find(params[:id])\n\n respond_to do |format|\n if @inventory.update_attributes(params[:inventory])\n format.html { redirect_to [@game, @user, @inventory], notice: 'I...
[ { "docid": "882c8317370987b86425c0adbf5bfe8c", "score": "0.6510542", "text": "def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "39bb21a0b69b1827b9d1cf596dd7a77d", "score": "0.6382559", "text": "def update\n\...
90cf25f9b41815fb7ff40cb9272435fd
Add this trigger to a worker
[ { "docid": "177e1425ed965196563285ea543cd1f9", "score": "0.651043", "text": "def addToWorker(worker, event)\r\n if (@interval != nil)\r\n Triggers.logger.debug {\"Attching worker '#{worker.id}' to timer '#{id}'\"}\r\n \r\n # Wait for start event\r\...
[ { "docid": "77d8ae80f63485bf1998ec75bccbb7dd", "score": "0.6836088", "text": "def addToWorker(worker, event)\r\n end", "title": "" }, { "docid": "ebe160635a70459416fb954eac715b1c", "score": "0.6830363", "text": "def add_worker\n end", "title": "" }, { "docid": "eb...
a60e19901a57f31fab80c53073c13e3c
Given a string and a sub string count the number of times the substring occurs in the string and print the number to the console.
[ { "docid": "69ef4bc3fe880944a76927ca0c9711a5", "score": "0.8190949", "text": "def str_count(str, sub_str)\n p str.scan(sub_str).count\nend", "title": "" } ]
[ { "docid": "69e573221f2f2234094b200185fb5838", "score": "0.8114977", "text": "def count(str,sub_str)\n str.scan(/#{sub_str}/i).count\n\nend", "title": "" }, { "docid": "6e385f738439046e47674f4660ad837a", "score": "0.79083693", "text": "def custom_count(string, substring)\n count = ...
50f9f185a7e0a4b735aeced6110bd841
Calculates hash code according to all attributes.
[ { "docid": "aefab4e9e1b0b25e02679e95705c400f", "score": "0.0", "text": "def hash\n [id, company, charge_to_id, charge_to_type, type, member, payment_method, classification, amount, billable_option, date, location_id, business_unit_id, notes, agreement, invoice_amount, taxes, _info].hash\n end", ...
[ { "docid": "d63333ed15c27e3f7526f0c6f8099546", "score": "0.7118691", "text": "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.70400536", "text": "def hash() end", "title": ...
a21798683167386f27aa84a4f7396c9e
with their corresponding output dictionaries (or errors) and the fixture description Edgar Cabrera, 2015
[ { "docid": "ed3612181f6135812fa1cdceadaf99c1", "score": "0.0", "text": "def configuration_fixtures\n {\n 'can create a single route' => {\n input: %q{\n /api:\n /resource:\n 1\n },\n output: {\n '/api/resource' => 1\n }\n },\n 'can create m...
[ { "docid": "8be6fd226cea73bb77babb6ce24f2406", "score": "0.5940991", "text": "def get_FailureDescription()\n \t return @outputs[\"FailureDescription\"]\n \tend", "title": "" }, { "docid": "f8526e9722b55854dfe0e11b10b15bcb", "score": "0.58836275", "text": "def gather_result...
598d27db0ada3fe81c88560c1393e862
callseq: to_s > string
[ { "docid": "c9e51ed08cb6df8e8067e33003811886", "score": "0.0", "text": "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "title": "" } ]
[ { "docid": "c114db28634e0820b9f99ac04bdaf2e7", "score": "0.79516506", "text": "def to_s\n if string?\n return emit\n end\n _c_slaw_to_string.emit\n end", "title": "" }, { "docid": "8b1fb58f6afe0db985d2335dcf091a8f", "score": "0.7904324", "text": "def to_s(*) end", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "01cb5eec59f5b7107601bb35fa890b9d", "score": "0.0", "text": "def set_arquivo\n @arquivo = Arquivo.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
1ba9c475190bf7bfc79f4cedfcbf6e34
clean up graph after DFS traversal
[ { "docid": "090bcf6f5b6a47f7ec9e252a11935bc9", "score": "0.7806317", "text": "def cleanup_dfs\n # clean up vertices attributes set during dfs\n @vertices.values.each do |vertex|\n vertex.color = nil\n vertex.predecessor = nil\n vertex.discovery = nil\n vertex.finish = nil\n ...
[ { "docid": "d826c609c52d33f2744eff7b35b0a2fe", "score": "0.7172283", "text": "def fill_destroy_graph( graph )\n fill_save_graph( graph )\n end", "title": "" }, { "docid": "007586da124f84b5eab794d155cc0d96", "score": "0.65560687", "text": "def destroy\n super do\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bb10447fc9987416671e69887eb15953", "score": "0.0", "text": "def slashdot_posting_params\n params.require(:slashdot_posting).permit(:title, :permalink, :urls)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69780594", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.678054", "text": "def strong_params\n params.requi...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d50d4ec3d0be0e2356de373936e50b62", "score": "0.0", "text": "def set_bloodpressure\n @bloodpressure = Bloodpressure.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
5d1ff2b5408abe5aabced81895bffc69
View helpers Pick which user of the trade presented first according to viewer's relationship. trade viewer If nil, would be the current user
[ { "docid": "e25457f34643b8ccb17ea527df5b65d1", "score": "0.62266946", "text": "def ordered_users_list(trade, viewer = nil)\n viewer ||= auth_user\n users = []\n if viewer.id == trade.buyer_id\n users << trade.seller\n users << trade.buyer\n else\n users << trade....
[ { "docid": "714139002b5fb9ea458a3402197f1a65", "score": "0.738447", "text": "def trade_requester(trade)\n User.find(trade.user_a_id)\n end", "title": "" }, { "docid": "b1048f9015e94b7ab27380006b5dc701", "score": "0.7060671", "text": "def find_viewer\n @viewer = User.find(@entr...
f5d1c62a7de4c39a0410c54207fe356a
Determine if this software version overridden externally, relative to the version declared within the software DSL file?
[ { "docid": "7cf036b9655cd1bf0232ef1dbc792c04", "score": "0.69045407", "text": "def overridden?\n # NOTE: using instance variables to bypass accessors that enforce overrides\n @overrides.key?(:version) && (@overrides[:version] != @version)\n end", "title": "" } ]
[ { "docid": "31c3675f9a05ff3d5e450c69315021d9", "score": "0.69030464", "text": "def overridden?\n # note: using instance variables to bypass accessors that enforce overrides\n @overrides.key?(:version) && (@overrides[:version] != @version)\n end", "title": "" }, { "docid": "a7607...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "b523f25803686125ea7caf50f77b49f0", "score": "0.0", "text": "def order_params\n params.require(:order)\n .permit(\n :category_id, :description, \n :user_id, :urgency,\n :start_order, :end_order,\n :order_status, :price, \n :paid, :addre...
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121862", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70524937", "text": "def expected_permitted_parameter_names; end", "title": "...
e7386b4249c5737342d051900ceb1540
Return a duplicate matrix, with all elements copied
[ { "docid": "6e7ec7d5425d611cfa2eb52cb08603bb", "score": "0.6666215", "text": "def dup\n (self.class).rows(self.rows.dup)\n end", "title": "" } ]
[ { "docid": "fb4f5ff7e8b48aec5799357559637da6", "score": "0.8056969", "text": "def clone\n cloned = Matrix.new(@rows,@columns)\n \n for i in 0...cloned.rows\n for j in 0...cloned.columns\n cloned.set(i,j,self.get(i,j))\n end\n end\n return cloned\n end", "title": "" ...
f812de0583dfd1070cb9a368276441a8
Compiler our catalog. This mostly revolves around finding and evaluating classes. This is the main entry into our catalog.
[ { "docid": "cc708f19726b4e1180e9082d8b063034", "score": "0.6691152", "text": "def compile\n Puppet.override( @context_overrides , _(\"For compiling %{node}\") % { node: node.name }) do\n @catalog.environment_instance = environment\n\n # Set the client's parameters into the top scope.\n ...
[ { "docid": "84073d86fa668c399f3ab0ad6748834d", "score": "0.63491774", "text": "def compile\n Tipsy::Runners::Compiler.new(@args, @site)\n end", "title": "" }, { "docid": "af92b783fa520483eae610dd5b1b64d3", "score": "0.6314799", "text": "def compile exp\n alloc_vtable_offse...
9741292c8e81877d87e600b7906c174a
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Object Initialization ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ { "docid": "1c8c8e883be1dd900a7461b9c646227c", "score": "0.0", "text": "def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)\n @dest_scroll_oy = 0\n super(x, y, w, h)\n @category = nil\n @dest_scroll_oy = self.oy\n self.layout = layout\n end", "title": "" } ]
[ { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.8763046", "text": "def initialize() end", "title": "" }, { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.8763046", "text": "def initialize() end", "title": "" }, { "docid": "a83980d1953a1624afdb6684da64...
e32ccf722121cc4e17d95db0eba30693
Unsubscribes a client from all routing keys he is bound to.
[ { "docid": "614b0e71dbc8234c810d49ff173ee525", "score": "0.6313085", "text": "def unsubscribe(subscription_id)\n @hash.keys.each do |routing_index|\n next if @hash[routing_index].nil?\n @hash[routing_index].delete(subscription_id)\n @hash.delete(routing_index) if @hash[routing_index].e...
[ { "docid": "4a1c3b2ee0c21a6c1e0f1a1e968d83ad", "score": "0.6862346", "text": "def unregister client\n\t\t\t@clients.delete client\n\t\tend", "title": "" }, { "docid": "9e01cdcf84a71918253e99c60a9edc0f", "score": "0.67572856", "text": "def unsubscribe_clients(channel)\n send_acti...
523347e58669e5feb558108004086bb4
Azure constructor, loads credentials and endpoint
[ { "docid": "938d9b2bd4f9966d98d8fb9d23a3557a", "score": "0.71250886", "text": "def initialize(host)\n @host = host\n @to_inst ={}\n\n @public_cloud_az_conf = YAML::load(File.read(AZ_DRIVER_CONF))\n\n if @public_cloud_az_conf['proxy_uri']\n ENV['HTTP_PROXY'] = @pub...
[ { "docid": "123d269ae8f206fae9b3d05a06d230fd", "score": "0.7939266", "text": "def initialize(credentials, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'credentials is nil' if credentials.nil?\...
591ca060d8197a16c2b777b23cd4b961
TODO put in real values for tos and privacy
[ { "docid": "58c9623a1b1e7de1f94881dd52f96725", "score": "0.0", "text": "def client_registration_request\n {\n \"application_type\": \"web\",\n \"response_types\": [\"id_token\"],\n \"grant_types\": [\"implict\", \"client_credentials\"],\n \"initiate_login_uri\": File.join(root_url...
[ { "docid": "ff69bf962098aa2257a95a8edd4e1c04", "score": "0.73688215", "text": "def tos\n end", "title": "" }, { "docid": "363eb6a466a57180483b3818a86a07b7", "score": "0.60057867", "text": "def privacy_state; end", "title": "" }, { "docid": "bba0d99d8049a28f5bceab16ef497f...
a2cef6efa34e0185e0c8fd1a285537ad
Returns the text displayed on the first suggestion (returns multiple lines when applicable)
[ { "docid": "be6ecad4933caf5b072a37a2320b8d2a", "score": "0.64088714", "text": "def get_first_search_result_text\r\n\r\n # TODO make sure the return value of the called method is not nil before calling the 'text' method on it\r\n get_first_search_results_div.text\r\n\r\n end", "title": "" } ...
[ { "docid": "039ad8ca9f37f71ced274bab4b87de08", "score": "0.77518284", "text": "def get_first_suggestion_text\r\n\r\n # TODO make sure the return value of the called method is not nil before calling the 'text' method on it\r\n get_first_suggestion_div.text\r\n\r\n end", "title": "" }, { ...
8b00bdcfe51e71e0f1da6a840cbfbe05
POST /motor_bikes POST /motor_bikes.json
[ { "docid": "cff666beb9b9d75d92cea59785f3720a", "score": "0.7032409", "text": "def create\n @motor_bike = MotorBike.new(motor_bike_params)\n\n respond_to do |format|\n if @motor_bike.save\n format.html { redirect_to @motor_bike, notice: 'Motor bike was successfully created.' }\n ...
[ { "docid": "72c47b7cb17f4a7d3ca035aaa2aea2df", "score": "0.63758606", "text": "def create\n @motorbike = current_user.motorbikes.new(params[:motorbike])\n @cart = current_cart\n\n respond_to do |format|\n if @motorbike.save\n format.html { redirect_to @motorbike, notice: 'Motorbike ...
07358b0fba77f4f9618d8b4d74985e66
This is what my program does By mlu
[ { "docid": "fa86e7054ab3c4074cd1e3ec4d2df0bb", "score": "0.0", "text": "def function_a\n#code\n\th = Hash.new\n\tFile.open('capitals.txt').each do |line|\n\t\ta = line.split(/,/)\n\t\ta[1][0] = ''\n\t\ta[1] = a[1].chomp(\"\\n\")\n\t\th[a[0].downcase] = a[1]\n\tend\n\twhile 1\n\t\tprint \"Ready: \"\n\t\t...
[ { "docid": "54daf6b93940e3e4e685ffea5be30ead", "score": "0.6188525", "text": "def alg; end", "title": "" }, { "docid": "3b4df29992323899033bb22a35a64989", "score": "0.6099781", "text": "def malts; end", "title": "" }, { "docid": "ad244bd0c45d5d9274f7612fa6fee986", "sc...
0f9d64c55db018aa86deba8930d8a0e6
The def keyword can be used to define a method
[ { "docid": "b1b3fa78e5484c765e795017684a0b24", "score": "0.0", "text": "def foo\n\treturn 'bar'\nend", "title": "" } ]
[ { "docid": "410acce3aabbb7b9adf35f889c493a83", "score": "0.7506503", "text": "def method\r\nend", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7482852", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", ...
aedce903a17a4c734eeb2065bb81a1c9
Match the value against the extracted mail text.
[ { "docid": "a66d142351aba55dc95256121dec765f", "score": "0.8012417", "text": "def match_text(val)\n _match_content(:text, val, scope.mail_text)\n end", "title": "" } ]
[ { "docid": "10498080e2ac81fd8fe953d3a57552ac", "score": "0.7184751", "text": "def match_body(val)\n _match_content(:body, val, mail.body.decoded)\n end", "title": "" }, { "docid": "c8cf7a16466f9e7169b2f0ee9a6d25fd", "score": "0.6849001", "text": "def match_subject(val...
3c672daad7210d00c99dbceac80ade53
Add a fact to a question
[ { "docid": "803762cf5b364a961c1e036bf9b75c28", "score": "0.68054026", "text": "def with_fact(entity_name, property_name, comparator_symbol, property_value)\n raise \"I can't add a fact to a #{@last_referenced.class}\" unless last_referenced.kind_of?(Question)\n question = last_referenced\n ...
[ { "docid": "ff8248e664bde5be47f26987534a4616", "score": "0.71265996", "text": "def add_question(qu)\n if qu && !@asked[qu.name][qu.type]\n @asked[qu.name][qu.type] = qu\n end\n end", "title": "" }, { "docid": "6c443a8316933bcb5b82db8b76287af6", "score"...
b137998d8663bbd59e229fa0288e5033
DELETE /alr_mntr_rngs/1 DELETE /alr_mntr_rngs/1.json
[ { "docid": "c0b368ebde1598093e88553be7067779", "score": "0.0", "text": "def destroy\n @alr_mntr_rng = nil\n if params[:alr_cat]=='qos'\n @alr_mntr_rng = Atr.find(params[:atr_id]).qos_mon\n else\n @alr_mntr_rng = Atr.find(params[:atr_id]).alr_mon\n end\n @alr_mntr_rng.destroy\n\n...
[ { "docid": "33ae3fbaabb68170de9f95477c22d5d1", "score": "0.7150866", "text": "def delete_json(path)\n retries = 0\n begin\n return resource(path).delete()\n rescue => e\n if e.kind_of?(RestClient::Exception) and e.http_code == 503 and retries < RETRY_503_MAX\n ...
9bc95ca75d9c0329342324798a3921f8
Generate host file and intall it.
[ { "docid": "8ed15e06cb2c26f8878c603b51870bcf", "score": "0.57990783", "text": "def call\n make_directories\n\n confdir.join('host.key').tap do |host_key|\n (BOOT_FILES.fetch(:pem).file? ? :mv : :cp).tap do |m|\n # move host.key when PEM file is present\n # because host.key has b...
[ { "docid": "4b77e46d3877c2ea31ede92e3fd74161", "score": "0.6789976", "text": "def generate_host_all\n\n begin\n open(\"/etc/hosts.nextdeploy\", File::RDWR|File::CREAT) do |f|\n f.flock(File::LOCK_EX)\n f.rewind\n\n Vm.find_each do |v|\n uri_suffix = \"#{v.name}#{Rai...
947cf22b5fdd5dea256320a8aab0bdc6
TODO Spaces inserted in words fails
[ { "docid": "f1e95726960893fa1a5797d845ca0d0e", "score": "0.0", "text": "def test_bo_page24\n table = table_to_array Tabula.extract_table(File.expand_path('data/bo_page24.pdf', File.dirname(__FILE__)),\n 1,\n ...
[ { "docid": "f9a0062e821758e4738093713386b91c", "score": "0.7211356", "text": "def sub_bad_words\n\n end", "title": "" }, { "docid": "c22742383d14f57fcf9edab7dfa2e13c", "score": "0.7192716", "text": "def words\n %w(\n shit\n shitty\n fuck\n fucked\n ...
e02344fd27943e1f084f788c8ef3c2e4
Compatible redirection with Rails API
[ { "docid": "0e0de226632251b5007810ad02b1056a", "score": "0.0", "text": "def after_sign_out_path_for(resource)\n if resource == :admin || resource.is_a?(Admin)\n new_admin_session_path\n else\n super\n end\n end", "title": "" } ]
[ { "docid": "40acb253304421be5bef381f49f083d1", "score": "0.7719592", "text": "def redirect(location, status = '302'); request.redirect(location, status); end", "title": "" }, { "docid": "40acb253304421be5bef381f49f083d1", "score": "0.7719592", "text": "def redirect(location, status =...
e39c1f15ea48a5fe8e70ca02c2cca0d3
TODO: This seems to be returning nil from Vimeo... not implemented?
[ { "docid": "2224793863b8c39db7d24effe8a02fe0", "score": "0.0", "text": "def get_portrait_url(user_id, options={})\n size = options[:size]\n\n sig_options = {\n :user_id => user_id,\n :method => \"vimeo.people.getPortraitUrl\"\n }\n sig_options.merge! :size =...
[ { "docid": "5d5016f6b1c44fb18af4030aacac673f", "score": "0.7409766", "text": "def vimeo\n vimeo_embed = \"<iframe src=\\\"http:\\/\\/player.vimeo.com\\/video\\/VIDEO_ID\\\" width=\\\"640\\\" height=\\\"390\\\" frameborder=\\\"0\\\" webkitAllowFullScreen mozallowfullscreen allowFullScreen><\\/iframe>\...
11c84284d1ce98e77d0a66e79307ba44
GET /control_stock GET /control_stock.json
[ { "docid": "141d224f38add4c348ef1319648a824a", "score": "0.72996664", "text": "def index\n @control_stock = ControlStock.all\n end", "title": "" } ]
[ { "docid": "8b2c3904737d50a57ecfc0c13f2b6e1d", "score": "0.75720304", "text": "def show\n render json: @stock\n end", "title": "" }, { "docid": "f2f6ecd26b5cc452a2f7f31a50066d0a", "score": "0.74418724", "text": "def index\n @stocks = Stock.all\n json_response(@stocks)\n en...
f6b00701d4cee91df205505687ccb70b
9. Write a Ruby program to compute the sum of all the elements. The array length must be 3 or more.
[ { "docid": "e26ce8c34b5162883c6352fdf49a9919", "score": "0.0", "text": "def sum_elements(array_of_numbers)\n return (array_of_numbers[0] + array_of_numbers[1] + array_of_numbers[2])\nend", "title": "" } ]
[ { "docid": "25e120c69f701a3ab3fc22aa139a06ab", "score": "0.8049307", "text": "def sum(arr); arr.sum end", "title": "" }, { "docid": "d111bd048a0200bfabbd1578087c3ec9", "score": "0.79653186", "text": "def sum arr\n result = 0\n for n in 0...arr.size\n result += arr[n]\n end\n r...
aee5545c036ff7e0d3465746f175c74d
Sum using 25% tax rate excluding taxes per ticket
[ { "docid": "1bed6018d70b0e7bd33e0342c74042c8", "score": "0.0", "text": "def tax25_net\n tax_net(tax_actual(event.tax25), 0.25)\n end", "title": "" } ]
[ { "docid": "16080cedb9da3f0c0c521da00e5cee65", "score": "0.8384974", "text": "def tax25_sum\n tax_sum(tax25, 0.25)\n end", "title": "" }, { "docid": "16080cedb9da3f0c0c521da00e5cee65", "score": "0.8384974", "text": "def tax25_sum\n tax_sum(tax25, 0.25)\n end", "title": ""...
59b457f0395247e1b2fe456d225b8a57
GET /name_records/new GET /name_records/new.xml
[ { "docid": "d76e963bc9941ac530cb27a980d853d6", "score": "0.7707252", "text": "def new\n @name_record = @domain.name_records.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @name_record }\n end\n end", "title": "" } ]
[ { "docid": "a83173640f77272bfb6f58a0a65c7e67", "score": "0.697846", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "title": "" }, { "docid": "508b7df31136f915bd9673ec5e282f83", "score": "0.67...
898fae229c1e1c27d6203749f26452d9
checks for networkscript existence and correctness
[ { "docid": "dd69e72ca5465a7038ed8ad64ed5db49", "score": "0.0", "text": "def exists?\n @@instance_rules_count += 1\n @config_file = \"#{@@config_dir}rule-#{@resource[:name]}\"\n\n # do not check file contents if the purpose is to ensure the file isn't there\n return File.exists?(@config_file)...
[ { "docid": "96098d9a912b973124d00dcce0d36b59", "score": "0.6561672", "text": "def hasNetwork\n response = Rho::Network.get({:url => \"http://www.google.com\"}).merge(TEXTHEADER)\n ret = (response[\"status\"] == \"ok\") ? true : false\n ret\n end", "title": "" }, { "docid": "febf04b...
1097a7e7758f08d32addfc88ea3fdcab
GET /users GET /users.json
[ { "docid": "b6f18358dae9db979c8f7d1725f10491", "score": "0.0", "text": "def index\n @users_grid = initialize_grid(User.all)\n end", "title": "" } ]
[ { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.84081405", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "543509c6588e2f79a8dbcd1cdcdaf7b9", "score": "0.836071", "text": "def users\...
92c9eecb94f75242cc800e7d9dfc1013
:tie, :dealer, :player, :dealer_busted, :player_busted
[ { "docid": "af78748cfc879b1eec550ad72715e8ee", "score": "0.0", "text": "def detect_result(dealer_cards, player_cards)\n player_total = card_total(player_cards)\n dealer_total = card_total(dealer_cards)\n\n if player_total > TARGET_NUMBER\n :player_busted\n elsif dealer_total > TARGET_NUMBER\n ...
[ { "docid": "53cd1d3089f094b63fd27e94cc29ac79", "score": "0.67251253", "text": "def affichage_player\n\n\n end", "title": "" }, { "docid": "ab4aa93b876444a399642e98bfb0d50a", "score": "0.6677319", "text": "def human_and_human_player(size)\n\t@player1 = \"player\"\n @player2 = \"pl...
2812a6c65113540baf52a944f4426ce2
Waits till user enters command
[ { "docid": "5be706f243cd3314a7f3751a9d323350", "score": "0.0", "text": "def getCommand(inputText)\n @LastCommand = @IO.ask(inputText) do |h|\n h.whitespace = :strip_and_collapse\n h.validate = nil\n h.readline = @UseReadline\n h.comp...
[ { "docid": "827590195a6c4fe99d48d0a7c01cdf9a", "score": "0.75131875", "text": "def wait\n\n gets\n\n end", "title": "" }, { "docid": "4dab9db12b600d36c5e5b7510e4345fe", "score": "0.7300947", "text": "def await_command(message = nil)\n puts message if message\n print \"#{@co...
cff00bff68bac7c6d3c232c9fb6b27f4
Remove (unmap) an OpenID from a primary key. Returns true.
[ { "docid": "71c6b387c62a63bdd007f2d1d2876f16", "score": "0.5932863", "text": "def unmap(user_or_identifier, primary_key)\n params = { 'apiKey' => @api_key,\n 'primaryKey' => primary_key }\n params['identifier'] = identifier_param(user_or_identifier)\n\n json = pars...
[ { "docid": "1482bbf9319bb66ee87669001234f708", "score": "0.6196916", "text": "def clear_primary_key\n @attributes[self.primary_key_attribute] = nil\n end", "title": "" }, { "docid": "5a30542ea93d8a47a2d17d670ae6da96", "score": "0.60633683", "text": "def delete_identity(identi...
756164e4caacaa0a859163c7eab87cce
Get the statistics of load balancer pool Returns the statistics of the given load balancer pool by given load balancer serives id and load balancer pool id. Currently, only realtime mode is supported.
[ { "docid": "80590e769bb08d3f6667835545eb38cf", "score": "0.67182785", "text": "def get_load_balancer_pool_statistics_with_http_info(service_id, pool_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.get_...
[ { "docid": "f01e9ec3d8950b35028a4a015332f77e", "score": "0.7202447", "text": "def pool_stats(galaxy_id)\n Pmg.Runner.poolStats(galaxy_id)\n end", "title": "" }, { "docid": "5aebdd40689f8d4974d8e8c68ecffe27", "score": "0.6839488", "text": "def get_load_balancer_pool_statistics_wit...
f8585011a6e815d5d7b713f0011b1869
Returns list of hashes Table is of form key key key key val val val val val val val val
[ { "docid": "20bc9d6d37b3f14a96804dd6b7746e07", "score": "0.65027225", "text": "def table_to_hashes(table)\n array_to_hashes(table_to_array(table))\nend", "title": "" } ]
[ { "docid": "d06e04fe218786ec13966a8a213922f2", "score": "0.76084745", "text": "def all_hash\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name};\")\n return array_list = make_object_array(results)\n end", "title": "" }, { "docid": "cc7ee4d373d03336e8819870547b876a", "...
e32377c145542c3ff215cae3938bf762
Refresh the display immediately (threadsafe).
[ { "docid": "f7633825fab0bed619fd96bcb62ef456", "score": "0.8451489", "text": "def refresh!\n @display_lock.synchronize do\n debug(\"refresh!\")\n @last_refresh = Time.now\n # clear\n move_to_top\n lines_on_screen.each_with_index { |(line,num), i| display line, row: i+1, num: ...
[ { "docid": "1bd2ab1938b4ca00fddc642903bff554", "score": "0.85051346", "text": "def refresh!\n @display_lock.synchronize do\n debug(\"refresh!\")\n @last_refresh = Time.now\n # clear\n move_to_top\n lines_on_screen.each_with_index { |(line,num), i| display(line, row: i+1, num:...
abafd833b60962ec0a7c7680792b6fd8
Prepare the data to be sent compute a hash_value using some parameters and sign them with sha1 add version to use add timestamp and convert keys to camelcase
[ { "docid": "b0fee0698da3fa7a82d1682692638f2e", "score": "0.6045421", "text": "def post_data(parameters)\n signature_string = @options[:merchant_id] + parameters[:unique_transaction_code] + parameters[:amt]\n\n parameters[:hash_value] = sign(signature_string)\n\n build_xml(parameters...
[ { "docid": "de2f1a4b89e71b7161eb2f8bcb6bd591", "score": "0.66950697", "text": "def compute_hmac_sha1(data)\n PaiementCic.hmac_sha1(usable_key, data).downcase\n end", "title": "" }, { "docid": "3a3e383076079d8b8e537b2bc45e1348", "score": "0.6472713", "text": "def calculate\n ...
b0e35e726f5242ab40884a3a6d1cba26
adds the 2 rolls of the frame to the total score
[ { "docid": "b0ed0e18d84aab7e62ff206574637781", "score": "0.71839905", "text": "def score\n while @current_roll < @rolls.size - 1 #roll tracker automatically runs when a roll occurs?\n init_roll\n # accounts for strikes, spares, and normal scores\n if strike?\n score_strike\n ...
[ { "docid": "d7c64674c33ba336fd48a5779966b4d9", "score": "0.8085543", "text": "def score_regular\n @total_score += @roll + @next_roll\n @current_roll += 2\n frame_counter\n end", "title": "" }, { "docid": "ae24dca43ff979526c90a9a504d02fa6", "score": "0.7971468", "text": "def...
5e13a4fd6b9b5f50a20d6ff39ddcd95a
get the woeid's for the hottrends countries; returns a dictionary of woeids
[ { "docid": "552142d87ceef1e649a576d1cae11143", "score": "0.7117238", "text": "def get_woeids (countries_to_grab)\n\t\tcountries_to_grab = countries_to_grab\n\t\tmysql_qr = 'select distinct woeid, name from country where '\n\t\tcountries_to_grab.each do |g|\n\t\t\tmysql_qr = mysql_qr + \"name = \\'\" + ...
[ { "docid": "3f7868b3cb85d28d2f939960991daa32", "score": "0.7401803", "text": "def get_hottrend_woeids (countries_to_grab)\n\t\t@countries_to_grab = countries_to_grab\n\t\t@mysql_qr = 'select woeid, name from country where '\n\t\t@countries_to_grab.each do |g|\n\t\t\t@mysql_qr = @mysql_qr + \"name = \\'...
10f2d1abe8001ebc53f8bf0b9b1aed26
Helper method to gather the activities returned from call to schedules
[ { "docid": "2f4245b8fe24a965dbc07ff9cda5ceab", "score": "0.65348566", "text": "def participant_activities(subject_schedules)\n activities = []\n if subject_schedules && subject_schedules[\"days\"]\n subject_schedules[\"days\"].values.each do |date|\n date[\"activities\"].each do |activ...
[ { "docid": "6fe5acdc8566b6a65b3fc591eb4e00f9", "score": "0.6995517", "text": "def get_activities_list\n parsed = JSON.parse RestClient.get(API_ENDPOINT + '/fitnessActivities', :params => API_PARAMS)\n\n @activities_list = parsed[\"items\"].collect do |activity|\n [ \"#{activity[\"type\"]} on...
abe4f9490de612db3f0b53f6b1b39144
This method generates an array of all moves that can be made after the current move.
[ { "docid": "d5cb90f691743fc8190328fac828b302", "score": "0.64661825", "text": "def children\n next_moves = []\n self.board.rows.each_with_index do |row, row_index|\n row.each_index do |col|\n if self.board.empty?([row_index, col])\n new_board = self.board.dup\n new_bo...
[ { "docid": "ab6b87d439d2ac15bdfbf3aebcff6da0", "score": "0.7375318", "text": "def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @...
f93cdc28d4b44d472253b26ace38091a
PATCH/PUT /catalog_items/1 PATCH/PUT /catalog_items/1.json
[ { "docid": "13056667c50be56d34cfedd8a0144f66", "score": "0.69751287", "text": "def update\n respond_to do |format|\n if @catalog_item.update(catalog_item_params)\n format.html { redirect_to @catalog_item, notice: 'Catalog item was successfully updated.' }\n format.json { render :sh...
[ { "docid": "ab7b511e7fdb14f278ada05c46659bfc", "score": "0.68325126", "text": "def _update_item(http, headers, path, body, name)\n resp = retry_request(http, \"PATCH\", path, body, headers)\n if resp.is_a?(Net::HTTPOK)\n Chef::Log.info(\"Updated keystone item '#{name}'\")\n else\n _raise_error(...
cfe86581d6ca6d46ad1c594aa4bf02eb
references have a low bit of 0 with the remaining bits being the reference
[ { "docid": "1016a253c8d11e8164635f6db92c5a15", "score": "0.0", "text": "def header_for_reference index\n header = index << 1 # shift value left to leave a low bit of 0\n pack_int header\n end", "title": "" } ]
[ { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.66824985", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.66824985", "text": "def references; end", "title": "" }, { "docid": "cfcf09308fb9b33f0deffc9ed6fb...
97b4f434c23a6c9634427f2df998febf
GET /inspections/1 GET /inspections/1.xml
[ { "docid": "cdd73c1f5211d3b0038a29864f16e4de", "score": "0.72598374", "text": "def show\n @inspection = Inspection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inspection }\n format.json { render :json => @inspection }\n...
[ { "docid": "cf98f2e2f7377fcd1a83ae6220780013", "score": "0.6970062", "text": "def show\n @inspection_history = InspectionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inspection_history }\n end\n end", "title": ...
fa34eb4da10aea672137026055ee5b37
setTruncateAtSize delete trigger file and recreate it called by ::new(), observeSize() and dealloc
[ { "docid": "6ff06ef4ed4ad41b0d0b3764071237ff", "score": "0.6193961", "text": "def truncate(bRecreate = YES)\n\n\t\tif !@oFile.nil?\n\t\t\t@oEMwatcher.detach() if !@oEMwatcher.nil?\n\t\t\t@oEMwatcher = nil\n\n\t\t\t@oFile.close()\n\t\tend # if 'connected'\n\n\t\t@iCountIncoming = 0;\n\n\t\t# delete if ex...
[ { "docid": "9fa2a2678d53efef809eb245f6079a2e", "score": "0.66849834", "text": "def truncate(offset=0)\n File.truncate(self, offset) if exists?\n end", "title": "" }, { "docid": "49afc5f3e75f589ac28174e0477347e3", "score": "0.66718006", "text": "def setTruncateAtSize(iNewSize = 10...
765f8fa00933d864f119b4588e413d03
Returns all the participants except the message sender
[ { "docid": "dee28667a02138d51a4be074a2b1bf96", "score": "0.81147003", "text": "def recipients(sender)\n participants.reject { |p| p.id == sender.id }\n end", "title": "" } ]
[ { "docid": "fe9655cb4121c6d535aec40211b62e85", "score": "0.71841216", "text": "def other_participants(user)\n all = recipients\n all.delete(user)\n all.delete(nil) # nil will appear when any of the user in the coversation is deleted later.\n all\n end", "title": "" }, { "docid":...
fffbbf0f03eb39c89fa3d35341c1eb53
dont want to apply to create
[ { "docid": "ea7c2f8cc7c6e3a609d253e3f3046d1c", "score": "0.0", "text": "def index\n @tasks = @chore.tasks.all\nend", "title": "" } ]
[ { "docid": "9738ba0d086d41a0369559bd81dec2fc", "score": "0.725523", "text": "def only_create!\n self.operation = :only_create\n end", "title": "" }, { "docid": "b3d999b966cf835dce997201bbaec1e6", "score": "0.71140736", "text": "def createonly()\n merge(createonly: ...
9c3f805c93a0b9245a3c64e0e742019e
returns T if x=F, else returns F
[ { "docid": "5c0f44e7910d95c32eb91147e0340c0a", "score": "0.0", "text": "def not(x)\n return !x if x.is_a?(TrueClass || x.is_a?(FalseClass))\n return true if x == false || x.nil? || x.empty?\n return false\n end", "title": "" } ]
[ { "docid": "15d1e4aaeec3a092b74ed7efb2ecda3c", "score": "0.624936", "text": "def _F\n _tmp = _letter(\"f\", \"F\")\n set_failed_rule :_F unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "b68306acada1db57505dcf5ba544ecbd", "score": "0.6103608", "text": "def f(x)\n...
55ec977f5d75ca0c6e0becce114a2063
digits in the number. Examples: my answer
[ { "docid": "ad1e353c9e9334c674bed610ddf02463", "score": "0.0", "text": "def digit_list(number)\n\n num = number.to_s.split(\"\")\n\n num.map do |n|\n n.to_i\n end\nend", "title": "" } ]
[ { "docid": "0b97f0ba8bd3a659b6ca01a1c2edc63b", "score": "0.7972151", "text": "def digitize(n)\r\n n.digits\r\nend", "title": "" }, { "docid": "094801f98cbccecc2fd5024a76ccb393", "score": "0.743437", "text": "def digits n \n\tMath.log10(n).to_i + 1\nend", "title": "" }, { ...
ab6c99de815694d34347b09172e2ad64
Enqueue something on another queue.
[ { "docid": "09b7152f215158442928e4ffff67c7b8", "score": "0.6272034", "text": "def enqueue(queue_name, message)\n Fiber.new do\n Henchman.enqueue(queue_name, message)\n end.resume\n end", "title": "" } ]
[ { "docid": "a3f11cc96940075d17bab916a0415440", "score": "0.77146506", "text": "def enqueue_to(queue, klass, *args); end", "title": "" }, { "docid": "96c1ea3b5cb2d9d21581b9be08cbc654", "score": "0.75328994", "text": "def push(x)\n q = @queue1.empty? ? @queue2 : @queue1\n q.push ...
de59fc0a2e86cafc7e6ac232a9f29930
i know sorting an array is probably the most inefficient way of doing things but this really looks pretty
[ { "docid": "a16865a3eaab5a613d5d9fc3f5f72371", "score": "0.0", "text": "def sorted?\n\t\tary = self.dup\n\t\toriginal = self.dup\n\t\tary.sort!\n\t\tif (ary == original)then return 1 end\n\t\tary.reverse!\n\t\tif (ary == original) then return -1 end\n\t\treturn false\n\tend", "title": "" } ]
[ { "docid": "d1fbc7b2f83e7b0b12629a42d67e8f70", "score": "0.7716106", "text": "def sort1(array)\n\nend", "title": "" }, { "docid": "b8997ac05cb9c62e9a09c720e75947bf", "score": "0.76538754", "text": "def orderly(array)\n p array.sort\nend", "title": "" }, { "docid": "77d...
323d0d08d5a48fb3bc1b03ae192c914a
Create a new Parser with +doc+ and +encoding+
[ { "docid": "730c9f943d2c691cbef7eaa741f7a408", "score": "0.5928811", "text": "def initialize(doc = Nokogiri::XML::SAX::Document.new, encoding = \"UTF-8\")\n @encoding = check_encoding(encoding)\n @document = doc\n @warned = false\n end", "title": "" } ]
[ { "docid": "b4f075cf092a81af0fc4e8a754034ea2", "score": "0.73607486", "text": "def parse(doc) new(doc).parse end", "title": "" }, { "docid": "9e824ab27b26484ca1da97ed5e9580f2", "score": "0.6667941", "text": "def new(*args)\n Parser.new(*args)\n end", "title": "" }, { ...
224f0598298ff3c95e7c54da181af567
metodos de upload de imagem
[ { "docid": "a4c2fb1f66f9e777f9bc9b6cd6be3e5e", "score": "0.0", "text": "def image=(value) #overload pesquisar\n if value.is_a?(String)\n super(value)\n small_image = value \n else\n #debugger\n img = AwsService.upload(value.tempfile.path, value.original_filename)\n super(i...
[ { "docid": "041c1675b36e52dacf0b07540159f134", "score": "0.71738756", "text": "def upload\n end", "title": "" }, { "docid": "041c1675b36e52dacf0b07540159f134", "score": "0.71738756", "text": "def upload\n end", "title": "" }, { "docid": "b3e38f83d9ebe67e4921568e640e321c...
af4a82f27c5bc862881244d46cc2fca3
Clear current base directory.
[ { "docid": "94334ede39964056897bd1d3fffd9f8f", "score": "0.7290841", "text": "def clear_base_location\n tmpdir = dir + \"base_removed\"\n base_location.move(tmpdir)\n base_location.mkdir\n tmpdir.delete\n end", "title": "" } ]
[ { "docid": "fc20d2f0e86997dc0cec7695470c3bf9", "score": "0.73474425", "text": "def reset!\n @base_dir = @path = nil\n end", "title": "" }, { "docid": "14c0e20fba00065240a572a6cf2c7e90", "score": "0.69286895", "text": "def purge\n\n FileUtils.remove_dir(@basepath)\n en...
63401e5e73bee4fa89d7dd7961738d2b
Attempts to merge an event with the previously occurring one, as in the case of a 2+ hour lecture
[ { "docid": "5aa66cfa394be4a391d39b437e6d4792", "score": "0.71362364", "text": "def attempt_merge(event, week, day, time)\n merged = false\n\n # Retrieve the events in the previous timeslot\n previous = previous_events(event)\n\n previous.each do |prev|\n if prev.summary == eve...
[ { "docid": "ab601ded99e489b95c032630a896d271", "score": "0.6672891", "text": "def merge(event)\n @total_time += event.total_time\n end", "title": "" }, { "docid": "0ab00687ff7a505327c4e1ed145a7ab1", "score": "0.6623762", "text": "def merge(event, destroy = true)\n begin\n ...
ff00b7180af41ef4adee219b7e3457f9
Date range select using Calender Date Select
[ { "docid": "ba154e6c392578eb132d1ba8813ef474", "score": "0.58813065", "text": "def date_range_select_tag(name_prefix, field, options = {})\n html = []\n [:start, :end].each do |part|\n html << calendar_date_select_tag(\n \"#{name_prefix}[#{field}][#{part}]\",\n (option...
[ { "docid": "1e62512f039761c443ce311c5d310ca2", "score": "0.6968154", "text": "def select_custom_date_filter(from_date, to_date)\n date_option_custom.click\n custom_date_from.text = from_date\n custom_date_to.text = to_date\n end", "title": "" }, { "docid": "0ab925509426ae2063a76785...
c12723197f70da673869d90a2f065c21
Access the Pricing Twilio Domain source://twilioruby//lib/twilioruby/rest/client.rb277
[ { "docid": "caa219048d87b63747fdd07fdb3e6e9d", "score": "0.0", "text": "def pricing; end", "title": "" } ]
[ { "docid": "d3fd64fd8066af15f7be11222915bfcb", "score": "0.6246712", "text": "def sample_twilio_response\n end", "title": "" }, { "docid": "32906a0debbc66edd1916a77a156b1c7", "score": "0.58067584", "text": "def client\n # put your own credentials here\n account_sid = ENV['ACCO...
1a3ad3d7ba3138762132c9fc7fb03fa1
GET get a bookmark of the user /users_bookmarks/json/show_user_bookmark_by_user_id_and_bookmark_id/:user_id/:bookmark_id /users_bookmarks/json/show_user_bookmark_by_user_id_and_bookmark_id/10000011/1.json Return > Success > head 200 OK
[ { "docid": "1e4f34cae699a14ea3005f537d4996de", "score": "0.7709292", "text": "def json_show_user_bookmark_by_user_id_and_bookmark_id\n\n respond_to do |format|\n\n if Bookmark.\n joins(:users_bookmarks).\n joins(:bookmarks_category).\n where('user_id = ? and bookmarks....
[ { "docid": "3036e8329e2044cb50da919638502b89", "score": "0.7886413", "text": "def list_bookmarks(user_id)\n url = \"#{@@request_url}/User.listBookmarks?appid=#{@@appid}&ID=#{user_id}\"\n end", "title": "" }, { "docid": "aa81639b18a464d08c75c4b418fe6a7d", "score": "0.7577296", "te...
3bbf35316c4aeb4304d53c466fab0a3d
The original exception object
[ { "docid": "f1b36efac653d63cd9d898b509b7e8a7", "score": "0.857425", "text": "def original_exception\n original_exceptions.first\n end", "title": "" } ]
[ { "docid": "ebf85c3b13d0c8cf0d1bc94d4193521f", "score": "0.76234657", "text": "def original_error\n @original_error\n end", "title": "" }, { "docid": "af355bec4a64326573706c2356f34938", "score": "0.76033354", "text": "def original_exceptions\n errors\n end",...
e509e237fd5b3f67e870beea88289c66
Gets the length of the media being played
[ { "docid": "4eeb82420c92591c729b98beef3a64f2", "score": "0.62248063", "text": "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "title": "" } ]
[ { "docid": "ec72cff54b4cee133f36e4505618a1ef", "score": "0.818547", "text": "def playable_length\n playable.length\n end", "title": "" }, { "docid": "f32ed9bf353a01d54d527cee15b2011e", "score": "0.77189726", "text": "def media_duration\n return @media_duration\n ...
78a91cde328b952db3fbcf36f61e3e05
Ask the player for his bet:
[ { "docid": "66273cd779b98f17ec2fcfcb71f1d9e5", "score": "0.7573894", "text": "def get_bet(player)\n puts \"You have #{player.funds}.\\n\\n\"\n\n bet = 0\n valid = false\n until valid\n puts 'What do you want to bet? Bet 0 to quit.'\n STDOUT.flush\n bet = gets.chomp\n # Quitting action:\n...
[ { "docid": "8709304473973841fea28dc5b10c6548", "score": "0.8489085", "text": "def ask_bets\n @active_players.each do |player|\n printf \"Player %s: please enter bet amount -> \" % player.name\n player.hand0.bet = Util.get_i()\n end\n end", "title": "" }, { "docid": "7a02c7b2...
522ec0f3fc0dafae346c7aa254a5ef86
Update every Resource in the 1:m Collection
[ { "docid": "60411e35eeb16ef8f00a8a3ddf1b8985", "score": "0.0", "text": "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "title": "" } ]
[ { "docid": "d90b470a5115e426bea3f7fa6052d9f4", "score": "0.7596342", "text": "def update(attributes, collection)\n #collection[0].model.last_query = [attributes, collection]\n fm_params = prepare_fmp_attributes(attributes)\n counter = 0\n collection.each do |resource|\n ...
6a1c817a230fd523095423db0e0363d0
Try to returns the best local directory path.
[ { "docid": "f52c061fe5f247aca27cdba5d3ab2804", "score": "0.5497518", "text": "def best_local_dumps_path\n spare_storage && spare_storage.local? ? spare_storage.path : Dir.tmpdir\n end", "title": "" } ]
[ { "docid": "fa6738044286a40e8e4c43faeef15540", "score": "0.67836654", "text": "def get_local_dir\n return @resource[:local_dir]\n end", "title": "" }, { "docid": "b32d2bebcd207d76c42e6a3ef815f790", "score": "0.66678035", "text": "def localstate_default_directory\n de...
b18d84ae474ba3bc126572b29872f6b2
TODO [11/9/10 4:36 PM] => REFACTOR_ITEM_SECTION_NAVIGATION_FOR_NEXT_AND_PREVIOUS
[ { "docid": "b38874a6a18cfeddad5647c52f9dbb7a", "score": "0.0", "text": "def introduction\n # enable_light_box\n @section = @current_user.project.sections.find params[:id]\n # @section = Section.find params[:id]\n @section.update_attribute(:is_intro_viewed, true) unless @section.is_intr...
[ { "docid": "507f83726627ba572ef9bb0f23addbb1", "score": "0.67434627", "text": "def prev_next_navigation_for(item,nav_id=false)\n nav = String.new\n \n if item.previous_sibling\n nav << link_to('&lt;', item.previous_sibling.expected_url)\n else\n nav << \"&lt;\"\n end\n \n ...
9f1aaed8bfebbe22aab64cab9cc7a032
def kth_largest(tree_node, k) arr = [] in_order_traversal(tree_node, arr, k) arr[arr.length k] end def in_order_traversal(tree_node, arr, k) return if tree_node.nil? in_order_traversal(tree_node.left, arr, k) arr.push(tree_node) in_order_traversal(tree_node.right, arr, k) end
[ { "docid": "041c9843d2313274522d6512141686e6", "score": "0.93448645", "text": "def kth_largest(tree_node, k)\n arr = []\n reverse_order_traversal(tree_node, arr, k)\n arr[k-1]\nend", "title": "" } ]
[ { "docid": "40cccb9cd01258c9114ac54b30b3c03d", "score": "0.92415494", "text": "def kth_largest(tree_node, k)\n reverse_in_order_traversal(tree_node)[k - 1]\nend", "title": "" }, { "docid": "98d718a31f0b6ff913f569c069f37719", "score": "0.9203817", "text": "def kth_largest(tree_node...
00af0dd1afabdf92aa78669346f75901
Examples reverseList([1,2,3,4]) == [4,3,2,1] reverseList([3,1,5,4]) == [4,5,1,3] Built in solution def reverse_list list list.reverse end Other solution
[ { "docid": "183577aede14e9e3ffb0fb19768ab5f1", "score": "0.7667892", "text": "def reverse_list list\n new_array = []\n x = list.length - 1\n while x >= 0\n new_array.push(list[x])\n x -= 1\n end\n new_array\nend", "title": "" } ]
[ { "docid": "056ee9862554ae119cc77883f2b4a4a1", "score": "0.87078863", "text": "def reverse_list list\n\tlist.reverse\nend", "title": "" }, { "docid": "c8e84a752c19bd40224134d998e62c55", "score": "0.8587265", "text": "def reverse!(list)\n list.reverse!\n end", "title": "" ...
2951260119d408ce534677faebb0c35c
4. What will the following code print to the screen?
[ { "docid": "45ed69f87d08ba791b6326b38f50b8c0", "score": "0.0", "text": "def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend", "title": "" } ]
[ { "docid": "a06dabbdf77cf221f12c544ddc4aed18", "score": "0.6765544", "text": "def print(out); puts out; end", "title": "" }, { "docid": "b37037fcdbf2daaaebcaa4fe29f082d3", "score": "0.66895926", "text": "def inspect_output; end", "title": "" }, { "docid": "f806f8c423fb123...
088ee41671ce4f4ceb6494c656481337
DEFINE NEW FUNCTION assemble_contigs()
[ { "docid": "d58e9ff395e67610291a835968854cb2", "score": "0.6050016", "text": "def assemble_contigs(ufn, cpu_count, verbose, debug)\n if debug\n puts \"entering assemble_contigs\"\n end\n ########\n # first find out whether cpu_count is greater or less than ufn\n # assign the lesser of the two va...
[ { "docid": "2a89d796499ade606127c0f2c492b369", "score": "0.61991394", "text": "def assemble\n @assembled = create_assemblages\n end", "title": "" }, { "docid": "7320946c99300c7b7975e98f0295fd8b", "score": "0.5944217", "text": "def contigs_path\n File.join result_direct...
f4af4b86806c12363e8a64bfd45c9cd1
this demo just produces a random, yet to be used job_id
[ { "docid": "02033b891a69b2decd306da163d43b2d", "score": "0.7302296", "text": "def next_job_id\n new_id = rand(10*5)\n get_job_status(new_id).nil? ? new_id : next_job_id\n end", "title": "" } ]
[ { "docid": "fdf6a9dbcfe671cb3240591f7e36003a", "score": "0.7214353", "text": "def job_identity(args)\n Digest::SHA1.hexdigest([ Time.now.to_f, rand, self, args ].join)\n end", "title": "" }, { "docid": "e3def7fe9ea3e29ebc9909baa81e4266", "score": "0.6506796", "text": "def...
a85344e6c640d22bf27c60bb2fcd5b39
Create a link to download a given file, by content type
[ { "docid": "277012523279a558f796fa871aab2fec", "score": "0.63466996", "text": "def download_path_for(content_type)\n file = file_for(content_type)\n return nil unless file\n\n h.download_dataset_task_path(dataset, object, file: files.index(file))\n end", "title": "" } ]
[ { "docid": "b3642509866df86c42097e914fde3b4a", "score": "0.73096514", "text": "def dl_file(full_url, to_here, require_type = false)\n require 'open-uri'\n writeOut = open(to_here, \"wb\")\n url = open(full_url)\n if require_type\n raise NameError unless require_type.index( url.content_type.strip....
93a9d12edc84a0457055f818da3f7775
GET /formapagamentoes/1 GET /formapagamentoes/1.json
[ { "docid": "7ac24ed63effcb6745d2a7ba93353a17", "score": "0.76400083", "text": "def show\n @formapagamento = Formapagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formapagamento }\n end\n end", "title": "" } ]
[ { "docid": "1fd51fa4be6df1a2def062678c70f3c7", "score": "0.75201195", "text": "def new\n @formapagamento = Formapagamentoe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formapagamento }\n end\n end", "title": "" }, { "docid": "e...
9d3d18444c5387388764434dabba34b2
Given a selector array, returns whether it contains any placeholder selectors with invalid names.
[ { "docid": "c3d39661965602698be12f8a2d52f335", "score": "0.8659272", "text": "def selector_has_bad_placeholder?(selector_array)\n extract_string_selectors(selector_array).any? do |selector_str|\n selector_str =~ /%\\w*#{INVALID_NAME_CHARS}/\n end\n end", "title": "" } ]
[ { "docid": "bfcc3459b0586406ed67eaaefd124f59", "score": "0.5912203", "text": "def known_unsupported_selector?(selector)\n tokenize_selector(selector).each do |type, text|\n return true if type == :IDENT && text.start_with?('@')\n return true if type == '@'\n end\n return false\n end"...
0c5dc17bf9f50e1d75f154894362aff1
Make and return a duplicate of this set's BinarySearchTree
[ { "docid": "0a06a5c676d6f9a154039d84f6e3bff9", "score": "0.7631419", "text": "def dup_tree\n return @bst.dup\n end", "title": "" } ]
[ { "docid": "fcfdad60c48e92d5651e889db7918f95", "score": "0.82428646", "text": "def dup\n result = BinarySearchTree.new\n result.set_root(structure)\n return result\n end", "title": "" }, { "docid": "2360039c93bbc27f533da630993960f8", "score": "0.77023214", "text": "def dup\...
8a4ab400d7b2937e54770ce2ffea8374
Generates the appropriate where clause for a JSON field based on the DB type
[ { "docid": "9be844b115088aa18de9be16cb60a190", "score": "0.6887547", "text": "def safe_json_where_clause(column:, hash_key:)\n return \"(#{column}->>'#{hash_key}' LIKE ?)\" unless mysql_db?\n\n \"(#{column}->>'$.#{hash_key}' LIKE ?)\"\n end", "title": "" } ]
[ { "docid": "d21c861090a0e53a1bad6701bdf412c3", "score": "0.705555", "text": "def where_condition_part(field, expression, value)\n case field[:type]\n when :guid then [\"#{field[:api_name]}.ToString()\", expression, \"\\\"#{value}\\\"\"]\n when :string the...
1456a769f8d21abd1123de77effdb971
False for backward compatibility
[ { "docid": "76332b03d147baab04e885b999c15b25", "score": "0.0", "text": "def configure(conf)\n super\n compat_parameters_convert(conf, :buffer)\n\n log.debug \"Logz.io URL #{@endpoint_url}\"\n\n if conf['proxy_uri']\n log.debug \"Proxy #{@proxy_uri}\"\n ENV['http_proxy']...
[ { "docid": "500e78c25ff0aa5489e4cf3a2b9da556", "score": "0.7374572", "text": "def worthless?\n false\n end", "title": "" }, { "docid": "189a32fe7825408fec9725c6755a2f5e", "score": "0.7294452", "text": "def non_conflict?\n return true\n end", "title": "" }, ...
2f04dc001fb2a29d797a7837da0c28b2
Represents CAZ ID in the backend API database.
[ { "docid": "9f0678d55913e9e72b28f4c9ecb8b88e", "score": "0.7062894", "text": "def id\n caz_data[:clean_air_zone_id]\n end", "title": "" } ]
[ { "docid": "90abe7ebd124ae4f01b5cabfb1a65de1", "score": "0.66795385", "text": "def id\n Encoding.encode @id\n end", "title": "" }, { "docid": "96350868e9e9009aaa1c8ec9806bb6bc", "score": "0.65530574", "text": "def id\n \"#{last_4}#{card_type.each_byte.map.inject { |a, e| a...
4867635d891f559f86dfc952f4d1a355
A ruleaction: Show label, nil, ANDSResearchDataAustraliaURL
[ { "docid": "61d8abf7fbbd5ecc1d9076509ba4ab58", "score": "0.5737091", "text": "def showinfo_url_ands_rda(order, action, label, xpath)\n args = nil\n @doc.elements.each(xpath.to_s_xpath){|e| args = e.text}\n args = \"?key=#{CGI.escape(args)}#{Config[:ands_rda_url_suffix]}\" if args\n HtmlHelpe...
[ { "docid": "beb5e1f0af933bf668a9c8ae6481fa01", "score": "0.5857664", "text": "def label(analysis, links, col, name)\n if not links[col]\n SITE_FAIL\n elsif analysis[2].include? col and not analysis[2][col].include? name\n SITE_WARN\n else\n SITE_PASS\n end\nend", "title": "" }, { ...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "02cadca29e957914a8ffbfa6d2594173", "score": "0.0", "text": "def update\n raise UnprocessableEntityError.new(@user.errors) unless @user.update(user_params)\n render partial: \"users/user\", :locals => { :user => @user }\n end", "title": "" } ]
[ { "docid": "f0686f191a0def3b6c3ad6edfbcf2f03", "score": "0.7243395", "text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n ...
f6a89bbee58ef6a21712248ad46c5dda
Waits until the given block returns true
[ { "docid": "54f08c30cecf19a3029160d82049fcf7", "score": "0.6852736", "text": "def wait_until\n poll do\n transition! if yield\n end\n end", "title": "" } ]
[ { "docid": "824229dc1308d1205e284865f5d406ef", "score": "0.7970039", "text": "def wait_until(timeout=10, &block)\n time = Time.now\n success = false\n until success\n if (Time.now - time) >= timeout\n raise \"Waited for #{timeout} seconds, but block never returned true\"\n...
65a144bf29432b3df89fbd355db19db0
PUT /albums/1 PUT /albums/1.xml
[ { "docid": "6e631f8f794f70d5ba88a917b5bfdb7b", "score": "0.6218871", "text": "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to(@album, :notice => 'Album was successfully updated.') }\n ...
[ { "docid": "86643bd4bca8c7d89ab162dacda9f330", "score": "0.6535423", "text": "def update\n @album.update(album_params)\n respond_with(@album, location: albums_url)\n end", "title": "" }, { "docid": "e23c1a5e94e9f4cd5a38dfcd9e8854c9", "score": "0.6433721", "text": "def update\n...
f8b5902e5036ba3669660a9a8cb8e559
class << self permissions method
[ { "docid": "c3985298de6f4524e299a8a36e179d2e", "score": "0.0", "text": "def can_view(option,viewer)\n res = false\n if viewer.nil? or (viewer == :false)\n #logger.info \"tis nil\"\n if self.privacy_option[option] == 2\n #logger.info \"tis allowed\"\n res = true\n else\...
[ { "docid": "e7fa55c996c89a154f6ff748543f9ee3", "score": "0.8093479", "text": "def define_permissions\n end", "title": "" }, { "docid": "73e508b62772b93fccb848de453d734f", "score": "0.7952888", "text": "def custom_permissions; end", "title": "" }, { "docid": "9414be29752f...
ceb207d7269d751723b68d5a44b49da1
DELETE /local_time_zones/1 DELETE /local_time_zones/1.json
[ { "docid": "a49864f060ba8823f40cbe1a244f7719", "score": "0.77296746", "text": "def destroy\n @local_time_zone = LocalTimeZone.find(params[:id])\n @local_time_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to local_time_zones_url }\n format.json { head :no_content }\n...
[ { "docid": "13dfb1df22457dcce8eca7914afe6826", "score": "0.7755989", "text": "def destroy\n @timezone.destroy\n respond_to do |format|\n format.html { redirect_to timezones_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fc0f4f7e1c11a75cb...