query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a67a6534a82e3319c8d32651c093e95e
Return Value The object in the receiver's internal item list corresponding to the last item selected from the popup list, or nil if no item is selected.
[ { "docid": "2607b84dd4721b6d26931c02aa96369a", "score": "0.71461236", "text": "def object_value_of_selected_item\n if @options_menu.nil?\n return nil\n end\n\n @options[@options_menu.selection]\n end", "title": "" } ]
[ { "docid": "0a474f7f532264e56a6fa5be06d293dd", "score": "0.66289246", "text": "def item_selected\n if @last_frame < Graphics.frame_count\n @option_window.item.value = popup.selected_value\n @option_window.refresh\n close_popup\n else\n popup.activate\n end\n end", "titl...
0c72f39ae54220e555427b4a7ed9b80e
POST /bank_account_classes POST /bank_account_classes.json
[ { "docid": "318a4c0a421f713698c155f4e672d05e", "score": "0.69528323", "text": "def create\n @breadcrumb = 'create'\n @bank_account_class = BankAccountClass.new(params[:bank_account_class])\n @bank_account_class.created_by = current_user.id if !current_user.nil?\n \n respond_to do |f...
[ { "docid": "32ea779ce07dbae2bec233fcb4c618d1", "score": "0.63004214", "text": "def create\n @account_class = AccountClass.new(params[:account_class])\n\n respond_to do |format|\n if @account_class.save\n flash[:notice] = 'AccountClass was successfully created.'\n format.html { r...
99f48aff40b89e9a31b8437299d54ceb
Append operator Override Logger's append so log messages always have formatting, and are always appended at :debug level.
[ { "docid": "adf1d47f31f088e4c6c667ce2b04ada1", "score": "0.67259127", "text": "def <<( message )\n\t\tunless self.logdev.nil?\n\t\t\tself.add( Logger::DEBUG, message )\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "79987b1aa1c9f733c681aae7253723f9", "score": "0.67253995", "text": "def append(message)\n @logger.formatter = proc do |severity, datetime, _progname, msg|\n \" #{msg}\"\n end\n @writer.formatter = proc do |severity, datetime, _progname, msg|\n \" #{msg}\"\n end\n @log...
6a7597b71698772b682c8ed5b458b9dc
Find the first instance matching conditions
[ { "docid": "c59bcff71065f7644a5bbe1ff50d8af1", "score": "0.7112152", "text": "def find_first(conditions)\n\t\t\t\t\tklass.first(conditions)\n\t\t\t\tend", "title": "" } ]
[ { "docid": "e14216c9cc32d4cc2068e5b457703941", "score": "0.7474752", "text": "def first(conditions)\n self.each do |item|\n matches = 0\n conditions.each_key{|cond| matches += 1 if item[cond] == conditions[cond] }\n return item if matches == conditions.count\n end\n return nil\n ...
035e0afed8206c5477aeaa0b4acbcfa6
POST /blerts POST /blerts.json
[ { "docid": "23b81bc654270602bb1fc4fbb01c1f89", "score": "0.6559004", "text": "def create\n @blert = current_user.blerts.build(params[:blert])\n\n\n respond_to do |format|\n if @blert.save\n flash[:success] = 'Alert was successfully created.'\n format.html { redirect_to alerts_pa...
[ { "docid": "e11d934d0eea833314ad79c40b2efc0b", "score": "0.5981674", "text": "def alert!\n message = \"ALERT: The page at #{TARGET} has changed.\"\n puts message\n uri = URI.parse(SLACK)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n response = http.post(uri.path, {text: messag...
0a90e7844b5624296c23e721be283301
PATCH/PUT /checkpoints/1 PATCH/PUT /checkpoints/1.json
[ { "docid": "ed775629961537eec23b59f6f55ec125", "score": "0.59832054", "text": "def update\n respond_to do |format|\n if @checkpoint.update(checkpoint_params)\n format.html { redirect_to @checkpoint, notice: 'Checkpoint was successfully updated.' }\n format.json { render :show, stat...
[ { "docid": "53dfa08dcb84e9d70371256378c0dcd6", "score": "0.6855606", "text": "def update\n respond_to do |format|\n if @check_point.update(check_point_params)\n format.html { redirect_to @check_point, notice: 'Check point was successfully updated.' }\n format.json { render :show, s...
514ed46bbec385dd23388327a3ce54dc
Modify the color index of a pixel
[ { "docid": "00f165115135b2dec950b43dca4e0fe0", "score": "0.67304945", "text": "def []=(x, y, color)\n pixels unless @pixels\n check_bounds(x, y)\n @pixels[y, x] = color\n if pixel_width == 2\n @pixels[y, (x % 2 == 0) ? x + 1 : x - 1] = color\n end\n end", "title": ...
[ { "docid": "ecd7745ad7e09849bdbe37213a6efe66", "score": "0.74728", "text": "def set_pixel(x, y, color); end", "title": "" }, { "docid": "e772d1d59c0aa4bafac0ddd966f138b2", "score": "0.74474216", "text": "def colour(x, y, c) \n @bitmap.image[y-1][x-1] = c \n end", ...
bd4181762e1755b542babb906e3d1dcf
PUT /blogs/1 PUT /blogs/1.xml
[ { "docid": "bb1fb04a577b0346b6fa7ebfef625a8d", "score": "0.0", "text": "def update\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n flash[:message] = 'Settings updated successfully.'\n format.html { redirect_to(edit_admin_blog_path) }\n format.xml { he...
[ { "docid": "2db8510634a8588feaf130b0ace4c384", "score": "0.69723415", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :api_key => 'testapikey',\r\n :blog_post => {:title => 'API Test Post',\r\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7a7295c421b0439223f100cfcc5e72fb", "score": "0.0", "text": "def set_plannedmaintanance\n @plannedmaintanance = Plannedmaintanance.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163443", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.604317", "text": "def action_hook; ...
d746e3502ea7f2ca00f94f4a7ab3eb26
token (string): access token id (string): The Id of the message to retrieve fields (array): An array of field names to include in results user (string): The user to make the call for. If nil, use the 'Me' constant.
[ { "docid": "2acca1d48aeebb0310fec0a7fe2bf6e4", "score": "0.63980055", "text": "def get_message_by_id(token, id, fields = nil, user = nil)\n request_url = user_context(user) << \"/Messages/\" << id\n request_params = nil\n\n unless fields.nil?\n request_params = { '$select' => field...
[ { "docid": "0674ce85936bf7454058c181999109b6", "score": "0.59945625", "text": "def message\n @token.message\n end", "title": "" }, { "docid": "271fc09ddd8ee8b875baf713555aef5e", "score": "0.5974835", "text": "def get_contact_by_id(token, id, fields = nil, user = nil)\n r...
80d852c02a2a69b5ba0d5c30dd812138
DELETE /households/1 or /households/1.json
[ { "docid": "43a08ac5a42017f94193b114105d24af", "score": "0.0", "text": "def delete\n @household = Household.find(params[:id])\n if $adminBOOLEAN == 1\n render('delete')\n else\n redirect_to(controller: 'member_view', action: 'index')\n end\n end", "title": "" } ]
[ { "docid": "7e5c721ec24e3d7f3239e2d484871a23", "score": "0.7513613", "text": "def destroy\n @household = Household.find(params[:id])\n @household.destroy\n\n respond_to do |format|\n format.html { redirect_to households_url }\n format.json { head :no_content }\n end\n end", "t...
553b991feb2cc881b6bd12de981505d3
GET /corrections GET /corrections.json
[ { "docid": "5a4f43b5faec74eecabc50abd3faa835", "score": "0.0", "text": "def index\n @assignments = Assignment.eager_load(assignment_schedules: :corrections).order(number: :asc).all\n end", "title": "" } ]
[ { "docid": "0fb1ced3efcf858650627cd8dd88a78b", "score": "0.72927713", "text": "def corrections\n if PRIVATE_TOKEN != params[:private_token]\n render text: {\"message\" => \"401 Unauthorized\"}.to_json(), status: :unauthorized\n else\n view = params[:view]\n page = params[:page]\n ...
6575bd374c6242008eb15992f0b2a666
DELETE /attend_rules/1 DELETE /attend_rules/1.json
[ { "docid": "536fa935c066a6ac0d14384387934d95", "score": "0.7418147", "text": "def destroy\n @attend_rule.destroy\n respond_to do |format|\n format.html { redirect_to attend_rules_url, notice: 'Attend rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",...
[ { "docid": "94835745ecfd4ebb29982e86d7dfba58", "score": "0.7012963", "text": "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "title": "" }, { "docid": "02049c43c5acd33b2f06681f94e00153", "score": "0.6950971", "text": "def clear_rules\n r...
1c43d6e4689bc2228b354b25f2327427
GET /message_logs/new GET /message_logs/new.json
[ { "docid": "5dcbb36a76e8ee5a4c92634b4eb10f64", "score": "0.8184379", "text": "def new\n @message_log = MessageLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_log }\n end\n end", "title": "" } ]
[ { "docid": "81f08d663480121de1d46fcae45c4211", "score": "0.77385104", "text": "def new\n @outgoing_message_log = OutgoingMessageLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing_message_log }\n end\n end", "title": "" }, { ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "47f1d152f263224266033400d5b00e3d", "score": "0.0", "text": "def curso_params\n #params.require(:curso).permit(:identificador, :url, :nombre, :imagen, :proveedor_id, :universidad_id, :tematica, :informacion, :conocimientos_previos, :esfuerzo_estimado, :lenguaje_signos, :precio_auditado, ...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
edd88e3df3e36f4ab5e00baad96da0ca
POST /controller_actions POST /controller_actions.json
[ { "docid": "2f47a38900f93b38494fc173969c260f", "score": "0.6581542", "text": "def create\n @controller_action = ControllerAction.new(params[:controller_action])\n\n respond_to do |format|\n if @controller_action.save\n format.html { redirect_to new_controller_action_path(:current_part_...
[ { "docid": "27917a16b8aed0ab5f26ce4f4e527523", "score": "0.66886365", "text": "def actions\n client.actions\n end", "title": "" }, { "docid": "4fa509ee1a18b89b5b2cbf4bc3600899", "score": "0.66666913", "text": "def actions\n raise B1Admin::Exce...
e17e279a3da85a1c58859ff77f8ed080
GET /mlps/new GET /mlps/new.json
[ { "docid": "4520b3730bc56370081f6eb884262149", "score": "0.813006", "text": "def new\n @mlp = Mlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mlp }\n end\n end", "title": "" } ]
[ { "docid": "0f3162a5a62018d73d78455facdff03c", "score": "0.75192136", "text": "def new\n @mlp_query = MlpQuery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mlp_query }\n end\n end", "title": "" }, { "docid": "fdcaca77255414d14d...
a1f68105c93444199ed033ae59a52f96
Mark this category as touched (e.g. for cache invalidation). Categories are touched whenever Content instances are added to or removed from them.
[ { "docid": "832172221699e1c330016d1737a83b44", "score": "0.67533135", "text": "def touch(attrib=nil)\n super(attrib) if attrib\n Category.touch(category_id)\n end", "title": "" } ]
[ { "docid": "5040512268a71548ab3404a62a416fa1", "score": "0.6228313", "text": "def touch_category\n self.category.touch\n end", "title": "" }, { "docid": "f0884c1d80e6962636a4ef6a5a463243", "score": "0.5582495", "text": "def touch_category_lists\n\t\tcategory_lists.map &:touch\n\t...
4bf2d634bc2968cfb23a964b4b70bc4b
Render battery status as a string.
[ { "docid": "1ea30f4f48e505b88c8af349a2904087", "score": "0.0", "text": "def render\n parse!\n format(format_string, to_h)\n end", "title": "" } ]
[ { "docid": "03a492d71d73f888bcf72c2f4287e2b0", "score": "0.72456336", "text": "def battery_level(bat_level)\r\n puts \"Battery: \" + bat_level.to_s + \"%\"\r\n end", "title": "" }, { "docid": "adc6fc19281e2ca9f29e1a180bfffec0", "score": "0.7113614", "text": "def battery_hea...
57903957d9e97a9bcda280ddaae0859f
DELETE /twodstructureregions/1 DELETE /twodstructureregions/1.json
[ { "docid": "466c8ab5d814bd220142d3cf66284916", "score": "0.76227945", "text": "def destroy\n @twodstructureregion.destroy\n respond_to do |format|\n format.html { redirect_to twodstructureregions_url, notice: 'Twodstructureregion was successfully destroyed.' }\n format.json { head :no_co...
[ { "docid": "e47e35389af04ec536dd9e2e5b81d117", "score": "0.66440225", "text": "def destroy\n @twentyeight.destroy\n respond_to do |format|\n format.html { redirect_to twentyeights_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e5d8c1ef5e...
cbdba85ade76282afb85984e1fd3c4a2
Highlight the current page
[ { "docid": "bc0243dda2b4093cdf354ccdbd0dbce8", "score": "0.54349655", "text": "def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end", "title": "" } ]
[ { "docid": "b7336a6c5aed3c4db290dafeb030faac", "score": "0.7219725", "text": "def highlight_if_clicked(url)\n current_page?(url) ? \"hilite\" : \"\"\n end", "title": "" }, { "docid": "04fd9a9f5bef09585b3f1f72136de038", "score": "0.6775005", "text": "def highlights; end", "tit...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "ba467988ff7ec19dab4278a6f00e1f6b", "score": "0.0", "text": "def student_params\n params.require(:student).permit(:name, :email, :password, :address, :phone_number)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7475058", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71668744", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist ...
718f199beb2824f7af6844e0b730e72b
The actual sorting method
[ { "docid": "5de12f85ff0951e67ee6b9ae352699db", "score": "0.0", "text": "def merge_helper(arr1, arr2)\n merged = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n merged << arr2.shift\n elsif arr2.empty?\n merged << arr1.shift\n elsif arr1.first < arr2.first\n merged << a...
[ { "docid": "b66eefef3423b43e3a85240c573376d9", "score": "0.79255825", "text": "def sort_entries; end", "title": "" }, { "docid": "e7b663fbb8195f18a964090afd1c04a0", "score": "0.7449255", "text": "def sort_params; end", "title": "" }, { "docid": "e7b663fbb8195f18a964090afd...
bb27b9fa45327aba1a3dd4a6eaaa83fe
HSV values in [0..1] returns HTML [r, g, b] values (e.g. ff0324)
[ { "docid": "32fb80f7311fe8309724ba58a027881e", "score": "0.68872577", "text": "def hsv_to_rgb(h, s, v)\n hp = (h*6) % 6\n h_i = hp.to_i\n c = v * s\n x = c * (1-(hp % 2 - 1).abs)\n\n r, g, b = c, x, 0 if h_i==0\n r, g, b = x, c, 0 if h_i==1\n r, g, b = 0, c, x if h_i==2\n r, g, b...
[ { "docid": "6bf3fac2ae59d18137d1d009d94089a0", "score": "0.7179251", "text": "def hsv2rgb(h,s,v) # h in [0,1], s in [0,1], v in [0,1]\n r = g = b = 0.0 ;\n\n if(s == 0.0) then\n r = g = b = v ;\n else\n hv = 360 * h ;\n hi = ((hv / 60).to_i) % 6 ;\n f = (hv/60) - hi ;\n ...
258e3d444fa39ebdf5d3220ecbc66857
Renders the academic year in a more commonly used format
[ { "docid": "88d5e2ddf4f45804e7309f33ff3dcb19", "score": "0.77884233", "text": "def full_academic_year\n unless academic_year.blank?\n academic_year.to_s + '-' + (academic_year + 1).to_s\n end\n end", "title": "" } ]
[ { "docid": "d52f1f401899df3fb8b1925dc0d756d0", "score": "0.77191067", "text": "def format_year(year)\n \"#{year}-#{year+1}\"\n end", "title": "" }, { "docid": "a9206a2872eeddaf24cc28e10cccc71d", "score": "0.76629096", "text": "def academic_year\n academic_year = case quart...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5b36a5181deb222a0a199a401403d7f7", "score": "0.0", "text": "def set_formulariosobsuser\n @formulariosobsuser = Formulariosobsuser.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...
8a8ab442210b77df49962460315391bd
Path to this method
[ { "docid": "6ab56a0e88b625ab27c78fa0d897b639", "score": "0.0", "text": "def path\n \"#{@parent.path}##{@aref}\"\n end", "title": "" } ]
[ { "docid": "51d18e01dc1a61349562ef4028ff4408", "score": "0.75545543", "text": "def method\n @method\n end", "title": "" }, { "docid": "51d18e01dc1a61349562ef4028ff4408", "score": "0.75545543", "text": "def method\n @method\n end", "title": "" }, { ...
b134a47178a79107a4aaded023bfd46c
GET /children/1 GET /children/1.json
[ { "docid": "5f8a8c8c26e9e44459fbc250c171668b", "score": "0.0", "text": "def show\n @hires = Hire.where(\"child_id = ?\", params[:id]).order(created_at: :desc)\n end", "title": "" } ]
[ { "docid": "8b9bd57d3f61741554401c7645932af7", "score": "0.7499588", "text": "def children\n @pages = @page.children\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "6b5...
cedb42fec77c970072661c99ce293227
Flushes data in the queue. Data in the queue will be sent either immediately irrespective of what sender is being used.
[ { "docid": "018a38e7e91fd4cc26594ecd4bf62996", "score": "0.67450947", "text": "def flush\n self.channel.flush\n end", "title": "" } ]
[ { "docid": "bb7e20cab0719339a879dc472fb9cd32", "score": "0.8323054", "text": "def flushQueue() \n done=0\n while (!@data.empty?) do\n done=done+1\n @sender_plugin.send_data(@data.pop)\n end\n @@log.info \"Flushed \"+done.to_s\n end", "title": "" }, { "docid": "91776899...
05112ac58834d3b2aba1406d7fd4fdcd
Sign up user based on provided parameters
[ { "docid": "e0baa8bb8b59788870913a33d3b8fbe8", "score": "0.0", "text": "def sign_up\n @user = User.new(sign_up_params)\n unless @user.save\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "title": "" } ]
[ { "docid": "70f76f66576bc9212995c41f9c8911f4", "score": "0.8197383", "text": "def signup\n enterCredentials\n create_new_user\n end", "title": "" }, { "docid": "050793658b14df6a7aa961d926b5c5ea", "score": "0.7691849", "text": "def signup\r\n SignUp.fill(ENV['EMAIL...
0b2d6fb1def0a707947ac8c8374d77bb
Nstance fires async events from its own thread pool, so if we need to do DB work, we need to do it on ActionCable's event loop where ActiveRecord's DB connections are properly pooled.
[ { "docid": "4f84a47756611467bb4615e7e2628fdf", "score": "0.65476656", "text": "def on_event_loop(&block)\n connection.worker_pool.async_exec self, connection: connection, &block\n end", "title": "" } ]
[ { "docid": "d2017c792b5cb4a29d674d3213c78c5b", "score": "0.68062854", "text": "def async_executor; end", "title": "" }, { "docid": "74e2e6969635fe3986e6f96d62587433", "score": "0.66144145", "text": "def async\n raise \"A block must be provided\" unless block_given?\n if Async.e...
d75c5252914c8ec61248da5b83e15805
while this JRuby bug exists in 9.2.X.X we must scale down the numerator and denominator to fit Java Long values.
[ { "docid": "affc9601a690a7537ed15e5dcfe1a2d5", "score": "0.6198289", "text": "def jruby_scale_down_rational(rat)\n return rat if rat.numerator <= java.lang.Long::MAX_VALUE\n [10, 100, 1000].each do |scale_by|\n new_numerator = rat.numerator / scale_by\n if new_numerator ...
[ { "docid": "eb9d521b7a306ca9eeed34ed50dd0405", "score": "0.6191606", "text": "def real64\n\n int0, int1 = int32u, int32u\n\n (((int0 < 2147483648) ? int0 : (int0 - 4294967296)).to_f *\n (1.0 / 4294967296.0)) + 0.5 + \n ((int1 & 0x001FFFFF).to_f * (1.0 / 9007199254740992.0))\n\n ...
5188d445aafb653ba73c97d079f69c8a
The current user full name
[ { "docid": "b11f0d7484568d21bbe847535fb473c3", "score": "0.74062693", "text": "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "title": "" } ]
[ { "docid": "0bfe8fd1b47e95215f554ef52c06d7ca", "score": "0.8520515", "text": "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "title": "" }, { "docid": "e721494723e4739e9accf8af3ac4d5f2", "score": "0.85183835", ...
5ccfa5cf15cefae4999bfe836d8d8fc5
Set action to index page
[ { "docid": "7a49f34a2a1f7d6e3c5f411ac06153fe", "score": "0.0", "text": "def index_page\n\n # For search action \n if params[:search] && params[:search] != \"\"\n Order.index(sort_column, sort_direction, params[:page], params[:search])\n else\n Order.index(sort_column, sort_d...
[ { "docid": "80493c9ab5328e0192276ca5f141dae6", "score": "0.79787666", "text": "def action\n \"index\"\n end", "title": "" }, { "docid": "75e61bae670027e59742bdebdfbbf03c", "score": "0.7289561", "text": "def index\r\n end", "title": "" }, { "docid": "762c548255a...
1166906650916a5dc4fea0ff26639217
returs a floating point number corresponding to the OpenCL version of the Platform
[ { "docid": "6d62e5c62dda1d018066d9ac4758dafc", "score": "0.78278327", "text": "def version_number\n ver = self.version\n n = ver.scan(/OpenCL (\\d+\\.\\d+)/)\n return n.first.first.to_f\n end", "title": "" } ]
[ { "docid": "e51dd619c630ecabdd1ec2531f15d1b2", "score": "0.7216916", "text": "def opencl_c_version_number\n ver = self.opencl_c_version\n n = ver.scan(/OpenCL C (\\d+\\.\\d+)/)\n return n.first.first.to_f\n end", "title": "" }, { "docid": "502d9277acf56280d77d6e7c8c...
d6ecdfa8ee8d916927c68dcee6f18838
Generate a visitor id for this hit. If there is a visitor id in the cookie, use that, otherwise use the guid if we have one, otherwise use a random number.
[ { "docid": "09f352af14f896c504295873970b43c1", "score": "0.8111848", "text": "def get_visitor_id(guid, account, user_agent, cookie)\n\n #If there is a value in the cookie, don't change it.\n return cookie unless cookie\n\n message = \"\"\n if guid && guid != \"\"\n #Create the visitor id using th...
[ { "docid": "9e259f9a522a8e503f3b684f27530496", "score": "0.7160094", "text": "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "title": "" }, ...
692e5e0e5eb793c2a53f9fffc7e4a172
Sets positional parameters for the query
[ { "docid": "9d67e5cce2d6a0c8171cf5b23ab54f4c", "score": "0.7143505", "text": "def positional_parameters(positional)\n @positional_parameters = positional\n @named_parameters = nil\n end", "title": "" } ]
[ { "docid": "bb2aa4f668df83c7824df5af0fe52b51", "score": "0.67169946", "text": "def set_position_query\n @position_query = PositionQuery.find(params[:id])\n end", "title": "" }, { "docid": "89b8bd669818305bf5c2e87c10207c34", "score": "0.67079216", "text": "def positional_param...
60947bc1046af8ea8d7af8fe1d83935b
PATCH/PUT /expenses/1 PATCH/PUT /expenses/1.json
[ { "docid": "5d378eec0e1ae4e1c577d2432be30a37", "score": "0.62408704", "text": "def update\n @expense.date = expense_params[:date]\n @expense.description = expense_params[:description]\n @expense.amount = expense_params[:amount].to_f\n @expense.expense_categories.clear\n\n expense_params[:...
[ { "docid": "305e19c27110be9d2a906473fd648535", "score": "0.71344393", "text": "def update\n if @expense.update(expense_params)\n head :no_content\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0663db37a7d335be...
2a2f96f5892cd300ffe8dedbfb1bce0d
PATCH/PUT /tipounidadeoperacionais/1 PATCH/PUT /tipounidadeoperacionais/1.json
[ { "docid": "07d8e8d6e90dd9efcde427b9ef0cf9cd", "score": "0.70236725", "text": "def update\n respond_to do |format|\n if @tipounidadeoperacional.update(tipounidadeoperacional_params)\n format.html { redirect_to @tipounidadeoperacional, notice: 'Tipounidadeoperacional was successfully updat...
[ { "docid": "0e4ae83ed22505766439caaddc55660d", "score": "0.69260114", "text": "def update\n respond_to do |format|\n if @tip_operacion.update(tip_operacion_params)\n format.html { redirect_to @tip_operacion, notice: 'Tip operacion was successfully updated.' }\n format.json { render...
ef4a29ceb023beb816b1b0b19ed24d6c
select_every_even takes in an array returns a list of evenindexed items from the input
[ { "docid": "0e5052703be501dc69666cc1a909d92f", "score": "0.8320192", "text": "def select_every_even (array)\n array.values_at(*array.each_index.select {|i| i.even?})\n #.values_at - returns values at given keys; can be used on hashes as well\n #.each_index - passes index of selected value\n #.selec...
[ { "docid": "d2dcdc7625ba976e3950f1e539033cb9", "score": "0.8749304", "text": "def select_every_even arr\n ans = []\n arr.each_with_index do |item, i|\n if i%2 == 0 \n ans.push item\n end\n end\n ans\nend", "title": "" }, { "docid": "5bebc72643aa53ef296df9ba1b00df97", "scor...
cff35224baf813420852c463004bc20f
Summary of the licenses of the transitive dependencies of the project. It is in the form of: ... This product includes inifile 3.0.0 which is a 'ruby_bundler' dependency of 'chef', and which is available under a 'MIT' License. For details, see: /opt/opscode/LICENSES/ruby_bundlerinifile3.0.0README.md ...
[ { "docid": "3b53de665b245bb4b631e0b481604c5d", "score": "0.7501688", "text": "def dependencies_license_summary\n out = \"\\n\\n\"\n\n dep_license_map.each do |dep_mgr_name, data|\n data.each do |dep_name, data|\n data.each do |dep_version, dep_data|\n projects = dep_...
[ { "docid": "f83d18b014485fe97ccc4ff8d47a06ce", "score": "0.6770781", "text": "def components_license_summary\n out = \"\\n\\n\"\n\n license_map.keys.sort.each do |name|\n license = license_map[name][:license]\n license_files = license_map[name][:license_files]\n version = ...
b6f65fde49cdc9006bce10c446b54700
return an array in ascending order sorted by the number of characters in the string
[ { "docid": "f7d121d5a1b565401b5957e539d4ffc6", "score": "0.7163137", "text": "def sort_array_char_count(array)\n array.sort do |a, b|\n a.length <=> b.length\n end\nend", "title": "" } ]
[ { "docid": "09e6c7b1b8c9f193c188cf71b7610607", "score": "0.77329755", "text": "def sort_array_char_count(strings)\n strings.sort_by {|word| word.length}\nend", "title": "" }, { "docid": "b1a4c529127331fd4be872090c6b5664", "score": "0.7457213", "text": "def sort_array_char_count(stri...
89554eeb322f22f7054e91da26c7d966
PATCH/PUT /skin_diets/1 PATCH/PUT /skin_diets/1.json
[ { "docid": "65309cd49efd68fe4ea6717c0e5e85e7", "score": "0.73331857", "text": "def update\n respond_to do |format|\n if @skin_diet.update(skin_diet_params)\n format.html { redirect_to @skin_diet, notice: 'Skin diet was successfully updated.' }\n format.json { render :show, status: ...
[ { "docid": "236dae0eb146f53b55a8fa0eb0899019", "score": "0.65342003", "text": "def set_skin_diet\n @skin_diet = SkinDiet.find(params[:id])\n end", "title": "" }, { "docid": "faa4b33a0e27cd4eac76c42ed8f28049", "score": "0.6403169", "text": "def replace_skin(skin_id, file: nil,...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "e60c8e80e55678fb067fd31081a866f8", "score": "0.0", "text": "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.ht...
[ { "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 ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "cff3aae3bdf3f549e56314c0c44eed4f", "score": "0.0", "text": "def post_params\n params.require(:post).permit(:title, :content, :comments)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
56db0796025ebb89191372c4b90f57d1
The expected data in the collection as an outcome after running this test.
[ { "docid": "d77d0e6fc18ef9a8320ccb2fa422ba05", "score": "0.673599", "text": "def outcome_collection_data\n @outcome['collection']['data'] if @outcome && @outcome['collection']\n end", "title": "" } ]
[ { "docid": "f9165669e809a652efbdd2b90a038243", "score": "0.7380165", "text": "def verify_collection_data(actual_collection_data)\n expected_collection_data = test_instance.outcome_collection_data\n if expected_collection_data.nil?\n expect(actual_collection_data).to be nil\n ...
660b92391d57680db8ad8ddd12466cf5
Given a username, gets the user records for the user's followers
[ { "docid": "8d2d76e19146c4a1e5bcf745d905900a", "score": "0.77696973", "text": "def get_followers(username, count=5000)\n follower_usernames = get_follower_usernames(username, count)\n users = get_users_for_usernames(follower_usernames)\n return users\n end", "title": "" } ]
[ { "docid": "f0d1c569caa422a51baf7f55344fc214", "score": "0.7964498", "text": "def followers!(username)\n Users.user_for_username!(username).followers\n end", "title": "" }, { "docid": "4d52b960fa24fa59670f6e7365ff4b29", "score": "0.7542149", "text": "def get_user_follows\...
22e56bc446ecd696aa6a9db7fccd4405
Adds an Organisation Date
[ { "docid": "fe6f6ce176cdddbcf69719030c030839", "score": "0.6133695", "text": "def add_date_with_http_info(id, api_date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganisationsApi#add_date ...\"\n end\n \n # verify the require...
[ { "docid": "7f930031df5556d1a57906e9781623ec", "score": "0.6289607", "text": "def add_date(date_val = T.unsafe(nil)); end", "title": "" }, { "docid": "49f05f3406d42fd990b8b6758349e983", "score": "0.62800366", "text": "def add_date\n self.date = Time.now if self.date.blank?\n ...
1c757e51c8ce735ce83f7c3f0a3c0265
Convert centimeters or inches to Word specific emu format source://sablon//lib/sablon/content.rb241
[ { "docid": "aa3372925323ef01bbea2e1ff11d25b1", "score": "0.0", "text": "def convert_to_emu(dim_str); end", "title": "" } ]
[ { "docid": "128b0ddbc115b6ae4bbe7c445495662b", "score": "0.70052624", "text": "def in_to_cm(inches, cm)\n return inches.to_f * cm\nend", "title": "" }, { "docid": "30d29a692cc5bd3328c5b8c507528044", "score": "0.69973594", "text": "def convert_inches_to_cm length\n in_to_cm = 2.54...
3ec418436c3da38205f2c7293c0a63d1
Converts the vector to a point.
[ { "docid": "eda165a97d8d14d37e0855f276c5480c", "score": "0.7117958", "text": "def to_point\n Point.new(x, y)\n end", "title": "" } ]
[ { "docid": "274c969e42f73d7943e1e4306a53ba61", "score": "0.7623457", "text": "def vector_to(point)\r\n end", "title": "" }, { "docid": "0a4c59d452ee7d131df2033d17a48205", "score": "0.73947173", "text": "def CGPointFromCGVector(vector)\n\tCGPointMake(vector.dx, vector.dy)\nend", ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "82b0ee5d2ca05b7f79abab764aea91ec", "score": "0.0", "text": "def post_params\n params.require(:post).permit(:description, :post_type, :media_url)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79438955", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6958061", "text": "def permitted_params\n params.permit!\n end", "title"...
d8cc95a5d411c54adeafd1260c80a79f
GET /supports/1 GET /supports/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "66aa8d6a1775ddd4afb04ded12594c7b", "score": "0.6666582", "text": "def supports\n @supports ||= {}\n end", "title": "" }, { "docid": "57ac7b1791361c42c72702f74cd2f39d", "score": "0.65524733", "text": "def index\n @functionalsupports = FunctionalSupport.all\n\n ...
6c2b1d6663a934babeb554f9b00349e5
set the edit anchor inside the ethernetswitching stanza we will need to 'upout' when making changes to the unit information, like description
[ { "docid": "30ab46f88b3d0f777d277e070a80294d", "score": "0.0", "text": "def xml_at_element_top( xml, name )\r\n xml.interface {\r\n xml.name name\r\n xml.unit { \r\n xml.name '0'\r\n return xml\r\n }\r\n } \r\n end", "title": "" } ]
[ { "docid": "80647dd9dfb97f7f7ad5200fb484efcb", "score": "0.56514525", "text": "def anchor=(value)\n @anchor = value\n end", "title": "" }, { "docid": "a407cc76f01145f434b26acaa2770699", "score": "0.5546782", "text": "def set_ethernet\n @ethernet = Ether...
4ae56cd0da1832326cfc5f5ad104a2ba
=== Use below to allow certain pages to hve no Auth skip_before_action :require_login, only: [:index]
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "4dcd2227e42222635f40f87dcc743476", "score": "0.7343916", "text": "def require_not_logged_in\n if logged_in?\n redirect_to :root\n end\n end", "title": "" }, { "docid": "e87f1f3be5a06a5f0044c78fd03be2d1", "score": "0.72221994", "text": "def skip...
874f64c4e1a5b1883ce0d2c0e9b67dbe
GET /castigos or /castigos.json
[ { "docid": "52c2e8e73d8acfbd75713d7480c5a23a", "score": "0.6463642", "text": "def index\n @castigos = Castigo.all\n end", "title": "" } ]
[ { "docid": "acd74cde71b08a23e4856119b424896d", "score": "0.6177535", "text": "def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "title": "" }, { "docid": "632fb85aa77b0a540cbbbd18d3cde633", ...
e6c4be5c67444a3eef99b2d39b5cf1d2
Convert to json. If no_index is false then the index will NOT be included in the JSON thus created.
[ { "docid": "823956c799272b82441cc805727eb6a7", "score": "0.8631276", "text": "def to_json no_index=true\n if no_index\n self.to_a[0].to_json\n else\n self.to_a.to_json\n end\n end", "title": "" } ]
[ { "docid": "5ddfadf997efe6b2457f7466ba43dd74", "score": "0.8659804", "text": "def to_json no_index=true\n if no_index\n to_a[0].to_json\n else\n to_a.to_json\n end\n end", "title": "" }, { "docid": "1497843162ee9f140ca957c9bfe9a378", "score": "0.7837619", ...
a1e5462fdb06111603d1c2ca6e93ed93
GET /sources GET /sources.json
[ { "docid": "2944ef5d81dc6c60d3482ec2c36168a1", "score": "0.73274654", "text": "def index\n @sources = @person.sources.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sources }\n end\n end", "title": "" } ]
[ { "docid": "1df9f023b7a402900d1a3e740648b5c4", "score": "0.8337333", "text": "def sources(params={})\n path = '/sources'\n response = @client.get path, params\n Source.new path, @client, response\n end", "title": "" }, { "docid": "7979823eddb5f7c3dd1e22d62e88187a", ...
3e1e2b5199800ca9f55e72b58966a38b
Serialize this DataType into an JSON object hash format to be saved to Parse. The default implementation returns an empty hash.
[ { "docid": "915fbeef5b28ccd0784b39cd83df4030", "score": "0.0", "text": "def as_json(*args)\n {}.as_json\n end", "title": "" } ]
[ { "docid": "db8659e9b101279684ca2babd58e29e8", "score": "0.77036613", "text": "def to_hash\n @to_hash ||= Util::NonNilHashBuilder.build do |h|\n h.add(type, data)\n end\n end", "title": "" }, { "docid": "4d0ab92f59f618d010abfd31c0eeacc4", "score": "0.73473746"...
085aee1debdc507a833313a2fcae3771
CREATES A TABLE FULL OF MOVIE TITLES
[ { "docid": "74201ca0926f290f3970f855f32cfee2", "score": "0.70797217", "text": "def create_movie_table\n\t\t\t@line_size = ((winsize.last - 165) / 2)\n\t\t\ttable = Terminal::Table.new :title => @list_header,:headings => [\"NUM\".center(31),\"MOVIES\".center(80),\"YEAR\",\"RATING\"], :rows => create_rows...
[ { "docid": "700eda4f82713b121d4404a6253cee64", "score": "0.6587218", "text": "def table_creation(table_title, webpage_url, parameter_for_table = nil)\n table = [table_title]\n text = table_text(webpage_url, parameter_for_table)\n (0...text.length / 2).each do |i|\n table[i + 1] = \"#{text[...
a058c3366fd734357e227db11270a1b0
=begin rdoc Instantiate a Module. =end
[ { "docid": "87047f63d90e03346fe02a7e5a97f34d", "score": "0.61673105", "text": "def module(ident)\n path = ModuleModelItem.instance_path(self.root.path, ident)\n ModuleModelItem.new self, path\n end", "title": "" } ]
[ { "docid": "9de4306501711176ab8084b28395030d", "score": "0.73293185", "text": "def module; end", "title": "" }, { "docid": "4a4a8cd851c7d10fc309ce6a2af45bd3", "score": "0.72938836", "text": "def new\n @mod = Mod.new\n end", "title": "" }, { "docid": "64795c817d25dd731...
4eb158912722d6f8b1be304bf1043e29
PUT /properties/1 PUT /properties/1.json Function to update property
[ { "docid": "5ff6241221aa0390bdd9b3970639f484", "score": "0.72335047", "text": "def update\n #Finds selected property\n @property = Property.find(params[:id])\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: '...
[ { "docid": "da85474cf831002c90329630e2072088", "score": "0.7807616", "text": "def update\n property = Property.find(params[:property_id])\n if property.update(property_params)\n render json: { properties: property }, status: :ok\n else\n render json: { errors: property.errors }, statu...
339310deea24e82514aac91435b4c503
Escapes the string representation of `obj` and escapes it for use in XML.
[ { "docid": "f1e6d3f6bb3e362bd63c685f107bf500", "score": "0.7908022", "text": "def escape_xml(obj)\n Merb::Parse.escape_xml(obj.to_s)\n end", "title": "" } ]
[ { "docid": "b04bc93b56b1b99d26da57f4f05c43c9", "score": "0.78829545", "text": "def escape_xml(obj)\n Erubis::XmlHelper.escape_xml(obj.to_s)\n end", "title": "" }, { "docid": "2e146150f447c5008760cd09d3b5bc14", "score": "0.76797867", "text": "def escape_xml(obj)\n obj.to_...
0dfea3c28e7252f5d2202d0bb668baae
The cleanup routine for plugins gives them a chance to undo any actions they may have done to the framework. For instance, if a console dispatcher was added, then it should be removed in the cleanup routine.
[ { "docid": "eab10ebb8cbf3140c3e1b08c484509a1", "score": "0.6886237", "text": "def cleanup\n\t\t# If we had previously registered a console dispatcher with the console,\n\t\t# deregister it now.\n\t\tremove_console_dispatcher('DbFun')\n\tend", "title": "" } ]
[ { "docid": "a7e4a7b0ca6a88df6ff4ae3f7b18fbd3", "score": "0.75051075", "text": "def cleanup_hook; end", "title": "" }, { "docid": "8277d2bcb74c930552b795b703ef6a79", "score": "0.6917012", "text": "def cleanup\n end", "title": "" }, { "docid": "8277d2bcb74c930552b795b703...
3277b456e560ebb06b0d8e6d070a95b0
Redefine this method in descendants to avoid caching calls with certain arguments
[ { "docid": "e5f288926b1fbac9c09273cc6e464259", "score": "0.6249771", "text": "def cache_item?(klass:, method_name:, args:)\n true\n end", "title": "" } ]
[ { "docid": "1f2074ca5d4f0294d4e1bbdc8c27d3e1", "score": "0.7430882", "text": "def cached; end", "title": "" }, { "docid": "1f2074ca5d4f0294d4e1bbdc8c27d3e1", "score": "0.7430882", "text": "def cached; end", "title": "" }, { "docid": "1f2074ca5d4f0294d4e1bbdc8c27d3e1", ...
dbc35d47525ff4874916dd7dfeb36e48
=> fail Use assert to test the following: define a method to sum the values of an array. Make this method defend against nils and other errors
[ { "docid": "9e807a31c4395c068ddb2c90f089a732", "score": "0.0", "text": "def sum(numbers)\n\tresult = 0\n\tnumbers.collect do |i|\n\tresult += i if i.is_a? Integer\n\tend\n\tresult\nend", "title": "" } ]
[ { "docid": "49c3b81f6b6c22f096fce94cdfa3d98b", "score": "0.8254029", "text": "def test_sum_empty_array\n expected_sum = 0\n assert_equal expected_sum, Stats.sum(Array.new)\n end", "title": "" }, { "docid": "538dd011b12419cbf6d534b3992c12d4", "score": "0.79758584", "text": "def...
0faa8dc25e0881ecd045f6badbf8b720
Instantiates a new Pocketknife.
[ { "docid": "46a26fc25a5e5767d44d62c8045954ab", "score": "0.0", "text": "def initialize(opts={})\n self.verbosity = opts[:verbosity]\n self.can_install = opts[:install]\n self.runlist = opts[:runlist]\n self.transfer_mechanism = opts[:transfer_mechanism] || :rsync\n\n self.node_manag...
[ { "docid": "68f9c8fa46f322f279b13b40289eda78", "score": "0.7681106", "text": "def initialize(name, pocketknife)\n self.name = name\n self.pocketknife = pocketknife\n self.connection_cache = nil\n end", "title": "" }, { "docid": "38ea7de7bfa9102b32571784575c19f7", "score...
3b4b1bc71c71695241eb13e2dcac98d4
Start workers scaling for given params
[ { "docid": "025f55d5eea83f2d1a0e551ae0103651", "score": "0.56343436", "text": "def start(experiment)\n planned_finish_time = Time.now + (@workers_scaling_params[:experiment_execution_time_limit] || 0).minutes\n\n algorithm = if @workers_scaling_params[:plgrid_default]\n expe...
[ { "docid": "327e70434115a69608250d9bee2e4c51", "score": "0.6420092", "text": "def set_initial_workers(strategy = nil, &system_factory)\n strategy ||= BinaryScalingStrategy.new\n system_factory ||= lambda {|queue| SpecifiedQueueSystem.new([queue])} \n @scalers.each do |queue, scaler|...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "ceb1ca525784b629e67cd6e1a38e17e9", "score": "0.0", "text": "def factory_params\n params.require(:factory).permit(station_ids: [])\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
3ee2ce739beddd1aa21daeceb8c328d9
Returns columns as array.
[ { "docid": "3225d708c6816b30ee4c3b3f213190df", "score": "0.8455868", "text": "def to_a\n columns\n end", "title": "" } ]
[ { "docid": "aff8e257bf756c1c8edc471f8916c1f5", "score": "0.84597725", "text": "def cols_array\n arr = Array.new\n @columns_hash.each{|k,v| arr << k}\n return arr\n end", "title": "" }, { "docid": "41aeddef77bb6141288f1d4f38f8c589", "score": "0.7914774", "text": "def...
acd31545ce4c1329784399cc2cba08c7
user_tags and user_ingredients use the list_alphabetically method defined in application_record.rb using drop(1) in user_ingredients removes the blank ingredient but still returns the array, unlike .shift
[ { "docid": "cd99776176d2e3d8bcf73556a252a5a4", "score": "0.507663", "text": "def user_recipes(user, object)\n object.recipes.select{|r| r.user == user }\n end", "title": "" } ]
[ { "docid": "e02ef7f8897bb42029ab3235383d3be0", "score": "0.625111", "text": "def get_ingredients\n recipe_ingredients.map{|rec_ingredient| rec_ingredient.ingredient}.uniq\n end", "title": "" }, { "docid": "b5c2eff763acc5b2321465970e168cdd", "score": "0.6229868", "text": "def vege...
73ad14633528207819c2ec3b8139e739
GET /products/1 GET /products/1.xml
[ { "docid": "8502351891907c06b08a1f78fdf61722", "score": "0.6840511", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end", "title": "" } ]
[ { "docid": "41a0f3182ee06604892e4ac28609ab4f", "score": "0.74081284", "text": "def index\n @products = get_products(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end", "title": "" }, { ...
0e66ece448f21db3603941cadcef8538
GET /lesson_applies GET /lesson_applies.json
[ { "docid": "06219c65f37726109ea55efffc93a3de", "score": "0.7480215", "text": "def index\n @lesson_applies = LessonApply.all\n end", "title": "" } ]
[ { "docid": "767a02ff0b6386020242d8217c323344", "score": "0.6083192", "text": "def update\n respond_to do |format|\n if @lesson_apply.update(lesson_apply_params)\n format.html { redirect_to @lesson_apply, notice: 'Lesson apply was successfully updated.' }\n format.json { render :sho...
bb7b7dd1bd843c7b295ec283076bd599
SYNOPSIS HTTP::Message.new ARGS N/A DESCRIPTION Create a instance of HTTP request or HTTP response. Specify statusCode for HTTP response.
[ { "docid": "41e85f3d094ec5f8017ed4fcca7a980c", "score": "0.526735", "text": "def initialize\n @isRequest = nil\t# true, false and nil\n @httpVersion = 'HTTP/1.1'\n @bodyType = nil\n @bodyCharset = nil\n @bodySize = nil\n @bodyDate = nil\n @headerItem = []\n @chunk...
[ { "docid": "197f6608e658f618f8066e6f49c8a786", "score": "0.6710881", "text": "def initialize(status_code, headers={}, body='')\n @status_code = status_code.to_i\n @headers = headers\n @body = body\n end", "title": "" }, { "docid": "7b6dc9f6f5826fd2bddfe743803e3145", "sc...
36fa64c695375a7a795a1f5afda184b1
GET /inventorylevel1masters/1 GET /inventorylevel1masters/1.xml
[ { "docid": "92c2fcbfb3b7225ffcad0a6e8ed20b5a", "score": "0.73789674", "text": "def show\n @inventorylevel1master = Inventorylevel1master.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventorylevel1master }\n end\n end", ...
[ { "docid": "b0acfb14d4b549f2b9b430d79ef0d361", "score": "0.72453755", "text": "def show\n @inventorylevel2master = Inventorylevel2master.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventorylevel2master }\n end\n end", ...
0b9da61e35b531328eae349c7dc965d6
GET /file_infos/1 GET /file_infos/1.json
[ { "docid": "3a8766788dfb81e8926e5501907b4a38", "score": "0.77652097", "text": "def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end", "title": "" } ]
[ { "docid": "59d3ecc9594eff00a4e3d8c44d40e5a5", "score": "0.6982991", "text": "def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_info }\n end\n end", "title": "" }, { "docid": "3273a7060c52b934de8...
9619d1649e6729399e465f78ae2c6ef9
The version of this device, or the UPnP version if the device did not define it
[ { "docid": "61daa9eea1f6e45ea9b3e83efe73e5d4", "score": "0.80575377", "text": "def version\n if self.class.const_defined? :VERSION then\n self.class::VERSION\n else\n UPnP::VERSION\n end\n end", "title": "" } ]
[ { "docid": "08718ff24e076e1b33ef2a607f074c7b", "score": "0.7555279", "text": "def version\n get_prop('firmwareVersion')\n # get_prop(:ProductVersion)\n end", "title": "" }, { "docid": "8edde8a892b309461b5f53713acebba4", "score": "0.7508565", "text": "def device_ver...
f835c146cf811b26ae709209a568b5bb
POST /payments POST /payments.json
[ { "docid": "e5e608361536cd84e75f7833a49d4791", "score": "0.0", "text": "def create\n cheil_solution = CheilSolution.find(params[:payment][:solution_id])\n invalid_op if cheil_solution.org_id != @cur_user.org_id\n\n @payment = Payment.new(params[:payment])\n if @payment.save\n brief = ch...
[ { "docid": "8ba9b964d12747b2e03088984fbea896", "score": "0.7119252", "text": "def create\n @payment = Payment.new(params[:payment])\n\n if @payment.save\n render json: @payment, status: :created, location: @payment\n else\n render json: @payment.errors, status: :unprocessable_entity\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ef5b4577b3e238bfda585faac8f7c28e", "score": "0.0", "text": "def set_payment_token\n @payment_token = Payment::Token.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "de...
463897051671a4dce113df0babe62d22
POST /issues POST /issues.json
[ { "docid": "05586f4fc659b54793af30c4bc3e8ea6", "score": "0.0", "text": "def create\n respond_to do |format|\n current_report = Report.first_or_create\n if current_report.report_parts.empty?\n format.html do\n redirect_to reports_path, alert: 'No issue group found in current ...
[ { "docid": "5a97feea30b1cba612f94ed1196a1c5c", "score": "0.71993804", "text": "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_url, notice: 'Issue was successfully created.' }\n format.json { render jso...
df747814520f65d6391f00d8cc0db347
Upload with NAS, anything in tmp folder
[ { "docid": "3e71446dd68f3403b5413a240c30fe2e", "score": "0.6247148", "text": "def do_nas_upload_all(option)\n @dst_full_path = option[:dst_full_path]\n if @dst_full_path =~ %r{/$}\n @dst_full_path.chop!\n end\n @nas_cookies = login_nas.cookies\n notify \"Upload all to #{...
[ { "docid": "a5800993c0f4943eb7299c88945f2d4f", "score": "0.6309874", "text": "def sudo_upload(file_path, to)\n filename = File.basename(to)\n to_directory = File.dirname(to)\n execute \"mkdir -p /tmp/cap_upload\"\n upload! file_path, \"/tmp/cap_upload/#{filename}\"\n execute \"sudo mv /tmp/cap_uplo...
0e59cb36ca7c2bb85593a688449d2f32
Returns whether or not SandboxFileUtils protection for +::FileUtils+ is active.
[ { "docid": "ba85dca8b5f191d94bbde54a1dabfd10", "score": "0.7572383", "text": "def activated?\n ::FileUtils == self\n end", "title": "" } ]
[ { "docid": "be772ad6b1d08c6ac9381c1b4ed8c87b", "score": "0.62980974", "text": "def authorized_to_run?\n File.owned?(qualify_file(\"/conf/configuration.yml\"))\n end", "title": "" }, { "docid": "989c09f6d924000d9f24f0fd17543d3d", "score": "0.6166523", "text": "def fileutils\n ...
ddfff5e7da2eb3fbc3a0f02f2dae4829
Write the meme out. top_line: The text to show at the top bottom_line: the text to show at the bottom out_file: The output goes here, defaults to stdout
[ { "docid": "fe344ee2aac06d414cb332a5dc65c3a9", "score": "0.67737824", "text": "def write(top_line,\n bottom_line, out_file = STDOUT)\n \n\n template = ERB.new(File.read(template_file))\n out_file.puts(template.result(binding))\n end", "title": "" } ]
[ { "docid": "3a4eb7849df8e685c2b72ca8653fcc0f", "score": "0.6099222", "text": "def write(out)\n out.puts @parts.join(' ')\n end", "title": "" }, { "docid": "bf7b68a933dcb6cf43b9156a77868afa", "score": "0.60342574", "text": "def writeOut\n\t\t\n\tend", "title": "" ...
e0afe9d7fdb70c337930b778e96b5cad
This method is for child classes to override. It is executed in `run` method.
[ { "docid": "6d1a758eb9c38fa150b5501cb7fbcfdf", "score": "0.0", "text": "def filter(vmhs)\n vmhs\n end", "title": "" } ]
[ { "docid": "e1e04dc87a1c7ec5308e0b4058f11cc0", "score": "0.7549074", "text": "def run\n raise NotImplementedError, \"subclass responsibility\"\n end", "title": "" }, { "docid": "9bc804f0df0e6630968e5c73a36b7cf8", "score": "0.75364757", "text": "def run\n super\nend", "ti...
6a340da028e6b127272c24bf595fab3e
Return the Hash of bindings.
[ { "docid": "640ae0daca1f4000b9cf26065c119055", "score": "0.74920064", "text": "def bindings\n @bindings\n end", "title": "" } ]
[ { "docid": "7a25015b9d8dcd4ee7a17fbebff2d842", "score": "0.74005145", "text": "def bindings\n @bindings ||= []\n end", "title": "" }, { "docid": "fd7f7336d76fb647e354320b05b97f21", "score": "0.66037065", "text": "def binding\n @binding ||= {}\n end", "title": "" ...
a17f4ac34a4b9412bfc2754bf1b26daa
POST /courses or /courses.json
[ { "docid": "17ae32bae4f914ed3462ca3ea453d154", "score": "0.0", "text": "def create\n fields = params[:fields]\n selected_tags = fields.select {|key, value| value == 1.to_s}\n new_course = Course.last.id+1\n selected_tags.each do |one_tag, value|\n\n Field.create!(course_id: new_course,\n ...
[ { "docid": "16ee815215044ae60ed7fb0ac14b1d68", "score": "0.73350203", "text": "def create\n # render plain: params[:courses].inspect\n @courses = Courses.new(courses_params)\n\n respond_to do |format|\n if @courses.save\n format.html { redirect_to @courses, notice: 'Course was succe...
cb4b11fd6bc3f1861ac18fb8680bb5e6
GET /email_attachments/1 GET /email_attachments/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "64c3c95b677e79c4addd874eabb528d2", "score": "0.71497566", "text": "def show\n @attachment = Attachment.find(params[:id])\n respond_to do |format|\n format.json { render json: @attachment.as_json(methods: [:file_url, *AttachableWithMetadata::ATTACHMENT_METADATA_FIELDS.map { |m| \"f...
5315c537337cc563f1791fe8091f8cf2
Execution context id which is used by JS, each frame has it's own context in which JS evaluates.
[ { "docid": "d6ca268cd96b79b9fa5cf09a8b0eee27", "score": "0.5673979", "text": "def execution_id\n value = @execution_id.value\n return if value.instance_of?(Object)\n\n value\n end", "title": "" } ]
[ { "docid": "d192db1b4ad0aa3d92ce416e98ffc735", "score": "0.6845661", "text": "def execution_context\n raise \"Execution Context is not available in detached frame \\\"#{frame.url}\\\" (are you trying to evaluate?)\" if @_detached\n\n @_context_promise.value\n end", "title": "" }, { ...
aaaf86728112ad3e6f9220b7e776fe64
Disable check on this method because it's throwing a false positive. See
[ { "docid": "0d7443fbdf65c508fdc92125d8794ae6", "score": "0.0", "text": "def server_cookies(response)\n raw_cookies = response.headers['Set-Cookie']\n return if raw_cookies.blank?\n\n raw_cookies.map { |ck| parse_server_cookie(ck) }\n end", "title": "" } ]
[ { "docid": "1c9638c4105bad04838fbcc7088f1cde", "score": "0.7365889", "text": "def check\n raise NoCheckMethodError\n end", "title": "" }, { "docid": "07231fa582ae5df1e654851131d761dd", "score": "0.71018845", "text": "def check_validity!\n # nothing\n end", "title"...
e30fe95250917f8834587b532bdf7a4f
Test Ack Conn No Ack Reget: Send a messsage Subscribe with ack, and receive Never send an ACK Reconnect and subscribe with ack => auto Rereceive the same message Expectation: no client errors, and no server crashes.
[ { "docid": "c1fd1d04a0259f82265ffd42e024103a", "score": "0.8128889", "text": "def test_0020_ack_conn_no_ack_reget\n received = no_ack_get()\n #\n disconnect_conn()\n #\n sleep @reconnect_stagger # Let server clean up\n open_conn()\n received_02 = get_again(\"auto\")\n #\n ass...
[ { "docid": "8c082bf3d7317cd63b5c0912b78c7f6e", "score": "0.81268746", "text": "def test_0030_ack_conn_no_ack\n received = no_ack_get()\n #\n disconnect_conn()\n #\n sleep @reconnect_stagger # Let server clean up\n open_conn()\n received_02 = get_again(\"client\")\n #\n assert...
22f0d08560a4835d571262720e683bfa
Shortcut to logger method
[ { "docid": "805cc8ec3409d32bf03b5666e6e316c3", "score": "0.0", "text": "def log *args\n options.logger.log *args unless options.quiet\n end", "title": "" } ]
[ { "docid": "5f6a5a5b87d242d7ee00054f5ad92955", "score": "0.81599593", "text": "def logger; end", "title": "" }, { "docid": "5f6a5a5b87d242d7ee00054f5ad92955", "score": "0.81599593", "text": "def logger; end", "title": "" }, { "docid": "5f6a5a5b87d242d7ee00054f5ad92955", ...
663a0defc00a13eccce572f9b950631f
GET /prova_livros/1 GET /prova_livros/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "40600f77055960ddc31c4cf5710a6e6b", "score": "0.75432855", "text": "def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\n end\n end", "title": "" }, { "docid": "72ed84df5a...
1c5a205b8f05b7a5f48dc85997193453
Create Method for Check_if_Lost If guess_count is equal to number_guess set game_over to 2
[ { "docid": "d7729715501681bfdcdf194f8a170a88", "score": "0.885472", "text": "def check_if_lost\n\t\tif @guess_count == @number_guess + 1\n\t\t\t@game_over = 2\n\t\tend\n\t\t@game_over\n\tend", "title": "" } ]
[ { "docid": "d3728fdbcf71b0814ee01098d83d072a", "score": "0.77312636", "text": "def check_lost\n if @guess_count == MAX_GUESS\n puts \"\\tYou lost! You've used up all your guesses!\"\n self.new_round\n end\n end", "title": "" }, { "docid": "7bdaf24370742b3e0b81e90085b11600", ...
620949a43612914b75c67482346c5ca3
"square(5)" below passes in a value of 5 to "square(num)"
[ { "docid": "7e8a87c02404e4fc244ff6d0efd3295b", "score": "0.0", "text": "def square(num)\n # Line below executes as \"num as 5\"\n puts \"num is #{num}\"\n\n # Line below passes the value of 5 to the \"square(5)\" method block\n # so that the \"puts\" statement printed out is:\n # \"yield(num) has a...
[ { "docid": "2d6fcb8d23b1dc3e202b9d93923e546b", "score": "0.81231856", "text": "def square(num)\n num * num\n end", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.798845", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { ...
c836fea849797d415d6c672f9641d12b
Exercise 4 Variables Nothing. Puts is missing. Exercise 5 Variables
[ { "docid": "5080c78ab0e153fc1a60b2eff0ca4873", "score": "0.0", "text": "def scream(words)\n\twords = words + \"!!!!\"\nend", "title": "" } ]
[ { "docid": "13fc8ae73ebed7ff7d2e8d2b04f458b6", "score": "0.5892177", "text": "def first_deal(pack, suits, player, aces, computer, computer_aces)\n # 180 LOCATE 10,3\n # 190 PRINT\"YOU\";SPC(15);\"HOUSE\"\n puts \"You#{' ' * 15}House\"\n # 200 LOCATE 3,5\n # 210 GOSUB 740\n value = deal(pack, suits...
908b0b946f997feb412b9b0b7141faf3
POST /adminsessions POST /adminsessions.json
[ { "docid": "b8ac0ee262c8dbac5b0034e0c5da90ac", "score": "0.7116092", "text": "def create\n @adminsession = Adminsession.new(adminsession_params)\n\n respond_to do |format|\n if @adminsession.save\n format.html { redirect_to @adminsession, notice: 'Adminsession was successfully created....
[ { "docid": "dd31801c2c16dbb87c10687481b57952", "score": "0.7366217", "text": "def create\n @admin_session = AdminSession.new(params[:admin_session])\n\n respond_to do |format|\n if @admin_session.save\n format.html { redirect_to @admin_session, notice: 'Admin session was successfully c...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "79e034884d943dfbc48cb41f323516d8", "score": "0.0", "text": "def set_hdfs_data_source\n @hdfs_data_source = HdfsDataSource.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60328794", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6017492", "text": "de...
1097a7e7758f08d32addfc88ea3fdcab
GET /users GET /users.json
[ { "docid": "3a76c019ab75611f007a8ee164b329b0", "score": "0.0", "text": "def index\n scroll_list_setup_instance_variables(nil)\n\n respond_to do |format|\n format.html\n format.json { render json: @current_page }\n end\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\...
8ba1ba7aa6c2a10a7df26b40a23a381f
checks a token against a hash if they match, true is returned, false otherwise
[ { "docid": "a8004939fd1f3f39c8a6ee7b094217ef", "score": "0.62632596", "text": "def check(hashin, token)\n tnow = Time.now\n @hash = hashin\n digest, timestamp = @hash.split(\"___\")\n tthen = Time.parse(timestamp)\n if (MiniCaptcha.timeout_minutes == 0 || (tnow - tthen)/60 <= Mi...
[ { "docid": "3b165c851b8bc5cc8fd8b2cf297128a7", "score": "0.788585", "text": "def matches?(hash, *tokens)\n hash = new_from_hash(hash)\n\n #return if the hash is nil or empty to save time\n return false if hash.nil? || hash == {}\n\n tokens = tokens.first # we no longe...
eb7b49e007110d57de64bf48ebf8c3eb
See the total amount the passenger has been charged
[ { "docid": "13d92d35e6378f9e0c2ba66f746c827d", "score": "0.6618368", "text": "def total_charged\n return self.trips.sum(&:cost)\n end", "title": "" } ]
[ { "docid": "2a397f5bd1d441f4a3ee4a7cf9b1a93e", "score": "0.69644725", "text": "def de_total\n @printer << \"Dealer has #{session[:dealer].hand_total}\" if !session[:dealer].blackjack?\n @printer << \"Dealer busts!\" if session[:dealer].bust? \n if session[:dealer].blackjack?\n @printer << ...
49da1f866ad149ad8015b219e795e3d7
Custom attribute writer method with validation
[ { "docid": "5303fbf2e9f6b7958fa64dfde9d6f8fd", "score": "0.0", "text": "def channel_customer_no=(channel_customer_no)\n if !channel_customer_no.nil? && channel_customer_no.to_s.length > 50\n fail ArgumentError, 'invalid value for \"channel_customer_no\", the character length must be smaller ...
[ { "docid": "5a0bcdaca95c21b13aacca36f9fad742", "score": "0.6955513", "text": "def _write_attribute(attr_name, value); end", "title": "" }, { "docid": "5812dd7a37c0eccc3d9481c23d74c649", "score": "0.69278884", "text": "def write_attribute(attr_name, value); end", "title": "" }, ...