query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
3f8c5f848e94f49c72d0b19d19f62ead
POST /game_days POST /game_days.json
[ { "docid": "e66a7820763110698e5e57fa6275862a", "score": "0.7011042", "text": "def create\n @game_day = GameDay.new(game_day_params)\n\n respond_to do |format|\n if @game_day.save\n format.html { redirect_to @game_day, notice: 'Game day was successfully created.' }\n format.json ...
[ { "docid": "7dcaeaab77775a6da866fda3f26b4dfb", "score": "0.6776518", "text": "def create\n @day = Day.new(params[:day])\n\n if @day.save\n render json: @day, status: :created, location: @day\n else\n render json: @day.errors, status: :unprocessable_entity\n end\n end", "title"...
e26bf488da707a027dee43b0155da8c8
determine whether the right angle of the printed triangle will be at the upperleft, upperright, lowerleft, or lowerright corner.
[ { "docid": "a9379d0524f2f55a80c09f6d36aac0f9", "score": "0.0", "text": "def triangle(n, upper_or_lower, left_or_right)\n if upper_or_lower == 'upper'\n str = '*' * n\n target_size = 0\n elsif upper_or_lower == 'lower'\n str = ''\n target_size = n\n end\n \n until str.size == target_size...
[ { "docid": "da9bd822cfcd12a5627be09874c5aa66", "score": "0.6901104", "text": "def is_right? x1, y1, x2, y2\n sides = [\n \tx1**2 + y1**2,\n \tx2**2 + y2**2,\n \t(x2-x1)**2 + (y2-y1)**2\n ].sort\n sides[0] != 0 and sides[0] + sides[1] == sides[2]\nend", "title": "" }, { "docid": "382e7c...
6d99b7f4ddc8080d10ffbb767eb93b3a
DELETE /wdireports/1 DELETE /wdireports/1.xml
[ { "docid": "b872fd1392f0e3abe446dba88460cd61", "score": "0.71057963", "text": "def destroy\n @wdireport = Wdireport.find(params[:id])\n @wdireport.destroy\n\n respond_to do |format|\n format.html { redirect_to(wdireports_url) }\n format.xml { head :ok }\n end\n end", "title":...
[ { "docid": "bbde00cd0df0589225125874ac6d1100", "score": "0.65600926", "text": "def destroy\n @xsd.destroy\n\n respond_to do |format|\n format.html { redirect_to '/wsdl/' }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "df26116eb86dbadafed7137f9e3c2f9e...
9902f33a565ac3287862e9eef9c43f20
A callback for the actual new item event
[ { "docid": "642f6d5573e1127d3cab579b1ec92406", "score": "0.0", "text": "def onNew(packet, opts = {})\n model_class.new(opts)\n end", "title": "" } ]
[ { "docid": "9415a4fb983f62ce6f0cc8fc08a84703", "score": "0.76668507", "text": "def new_item(data)\n end", "title": "" }, { "docid": "d39a3d6759c1102043011e876ceb99a6", "score": "0.70116585", "text": "def item_new\n @new_item = Item.new\n end", "title": "" }, { "d...
fe190cb8c80734aa665f921013fbebf3
PATCH/PUT /api/v1/campaign_invitations/1 PATCH/PUT /api/v1/campaign_invitations/1.json
[ { "docid": "e736b0882a83c184b77f4f5835b112a4", "score": "0.748324", "text": "def update\n respond_to do |format|\n if @api_v1_campaign_invitation.update(api_v1_campaign_invitation_params)\n format.html { redirect_to @api_v1_campaign_invitation, notice: 'Campaign invitation was successfull...
[ { "docid": "e9f240d119a2f4bd15e0e07ddfad8c59", "score": "0.7181752", "text": "def set_api_v1_campaign_invitation\n @api_v1_campaign_invitation = Api::V1::CampaignInvitation.find(params[:id])\n end", "title": "" }, { "docid": "5bdb04f9fbea0d2f9de16576761098a2", "score": "0.7003739...
f211772291f9b8f7de9b2a89a5324150
GET /records GET /records.json
[ { "docid": "16c954cd62a9435d3a73093518877f36", "score": "0.0", "text": "def index\n # In case the user clicks the search button on a Records page\n unless params[:q].nil?\n redirect_to :controller => 'catalog', action: \"index\", q: params[:q]\n end\n status = status_filter()\n respo...
[ { "docid": "39554b904e5600b09262f2d6d1191664", "score": "0.8381202", "text": "def records\n get '/records'\n end", "title": "" }, { "docid": "b8d837b25915c998796985ecb86fd0be", "score": "0.75950336", "text": "def list_records\n session_check!\n begin\n output = J...
303eab05213b88f4b43be56a8f9064f1
DELETE /postarticles/1 DELETE /postarticles/1.json
[ { "docid": "13621c813df3460cfac04d808f5f2977", "score": "0.7267574", "text": "def destroy\n @postarticle.destroy\n respond_to do |format|\n format.html { redirect_to spot_postarticle_url, notice: '説教をやめました' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "69841214643e03d2e662b4f05e2ebf37", "score": "0.7741853", "text": "def destroy\n @articles1.destroy\n respond_to do |format|\n format.html { redirect_to articles1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb09546270e1fe7...
912c0e0cf8816366872f1b29941d2de1
DELETE /events/1 DELETE /events/1.json
[ { "docid": "fa954c666b3b09ddee63a90f048c0e9e", "score": "0.0", "text": "def destroy\n @event = Event.find(params[:id])\n\t\n\tif !@event.can_modify?(current_user)\n\t\traise Exceptions::AccessDeniedException\n\tend\n name = @event.name\n\t@event.destroy\n\n\tflash[:notice] = \"Successfully deleted...
[ { "docid": "11f7138ce2d6d84fa0d9949fbd14cb07", "score": "0.769507", "text": "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "...
85c1a8dd9a9f7bdd6b74b8a16ec83850
July 6, 2013 Tealeaf course 1 Pine's 'How to Program' Grandfather clock. Write a method that takes a block and calls it once for each hour that has passed today. That way, if I were to pass in the block: do puts 'DONG!' end it would chime (sort of) like a grandfather clock. Test your method out with a few different blo...
[ { "docid": "8e19a38c5f8f21d06eb99baa90eab60b", "score": "0.8488876", "text": "def grandfather_clock &block\n\n times_to_call = ( ((Time.new.hour)%12 == 0)? 12 : Time.new.hour%12 )\n times_to_call.times do\n block.call\n end\n\nend", "title": "" } ]
[ { "docid": "5b970ef62469ef4d6ab5c92a4f9e0849", "score": "0.89807874", "text": "def grandfather_clock(&block)\n time_parts = Time.now.to_a\n #calls the block once for each hour that has passed today\n for i in (1..time_parts[2]%12) do\n block.call\n puts \"It was \"+i.to_s+\" O'clock.\"\n end\n...
ed880aa1001b0d97af32001febb8e6f7
Returns true if the contents were last fetched from the remote server, false if fetched from cache.
[ { "docid": "0880e6acdcbddbc77c8bba252639d70a", "score": "0.60829675", "text": "def remote?\n @remote == true\n end", "title": "" } ]
[ { "docid": "cfd5adfdc00fb058cd6289ef91321078", "score": "0.7358795", "text": "def latest?\n remote_checksum == local_checksum\n end", "title": "" }, { "docid": "323991326ce4b3b6bd6607a5ce9151f1", "score": "0.7029388", "text": "def changed?\n if @content # we have a cached co...
61281af6a154255d1e5659f0f1e7be59
Send email to myself to alert of new agency signup
[ { "docid": "fdea37d1dbe826e15f242f2b81d99b7e", "score": "0.82087404", "text": "def send_new_account_alert(agency)\n setup_email\n body[:agency] = agency\n recipients 'ben.hinton@intura.co.uk'\n subject \"New Agency #{agency.name} has registered on ClockOff.com\"\n end", "title": "" } ...
[ { "docid": "880df0999df9ebb1e7bf9f9e43843671", "score": "0.759253", "text": "def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end", "title": "" }, { "docid": "834c53cca9c2f138d...
8401156fdb0233e0780e2e760f71409e
Create object presenter for use in views.
[ { "docid": "2d54d2289c52ad7f54a61b99331396d5", "score": "0.7596842", "text": "def present(object, klass = nil)\n klass ||= \"#{object.class}Presenter\".constantize\n presenter = klass.new(object, self)\n yield presenter if block_given?\n presenter\n end", "title": "" } ]
[ { "docid": "45487d9a0d4fec56a3ec6811637fdec3", "score": "0.8047573", "text": "def present object\n \"#{object.class.base_class.to_s}Presenter\".constantize.new object, view_context\n end", "title": "" }, { "docid": "671cb54a302e622c86e368769a05ad6e", "score": "0.7703022", "text":...
ff5eb8742d591cb835f531d0dd4c1ee4
Delegate behavior to the session that's storing our stream state.
[ { "docid": "55fa1ea80627eee0f10c44b6327088a8", "score": "0.0", "text": "def method_missing(name, *args)\n @session.send(name, *args)\n end", "title": "" } ]
[ { "docid": "88555a692535e42e4ad8536eb5d6bbe0", "score": "0.6679057", "text": "def live_stream=(stream); end", "title": "" }, { "docid": "37c2dd6502246705ebf58e7b88dc5140", "score": "0.6654803", "text": "def store_session(_)\n raise NotImplementedError, \"Implement this method ...
ad57e56a6dd6f1c34587b84fd1ac3e0b
to show one particular image, currently this action is not called in our flow
[ { "docid": "6793c5476ab256881a0da0ff5b613914", "score": "0.0", "text": "def show\n\t@users = User.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bcd4fd28fedcb794725beef49637b8c0", "score": "0.80441165", "text": "def show\n @menu = \"user\"\n @board = \"myimage\"\n @section = \"show\"\n \n @myimage = Myimage.get(params[:id])\n \n render 'myimage'\n\n end", "title": "" }, { "docid": "66...
7bfce2c4c7b230f39d67284a2b573f86
O(1) ammortized; O(n) worst case. Variable because of the possible resize.
[ { "docid": "49b5f55fbd365f038396ad703eff0624", "score": "0.0", "text": "def push(val)\n resize! if @length + 1 > @capacity\n # @length += 1\n # @store[length - 1] = val\n @store[length] = val\n @length += 1\n end", "title": "" } ]
[ { "docid": "83415dea3d7100c1aaecd6d3d6b40414", "score": "0.6275779", "text": "def largest_contiguous_subsum(list) #O(n^2)\n sub_arrs = [] #O(1)\n num = list.first #O(1)\n (0...list.length).each do |i| #O(n)\n (i...list.le...
b3aa1a8af22b84d137d5e9706640dc42
, only: [:new, :create, :update, :destroy]
[ { "docid": "7b8a40acc78a8140047686b0ae174023", "score": "0.0", "text": "def new\n @user = User.new\n @question = Question.new\n end", "title": "" } ]
[ { "docid": "24a57a508286bcf2874fbb259007d9e8", "score": "0.72807854", "text": "def new_actions\n [:new, :create]\n end", "title": "" }, { "docid": "610e67d143d8e3529160b5e2e5b4e2a5", "score": "0.6847316", "text": "def update\n destroy\n create\n end", "title": "" }, ...
6c9bf7ea592cfbbe6d8949ca648294c4
Filter array with strings and integers, return integers only
[ { "docid": "f045a7c3cd377a1ca157f54dc1030795", "score": "0.81330144", "text": "def filter_out_strings(arr)\n arr.select { |num| num.is_a? (Integer)}\nend", "title": "" } ]
[ { "docid": "e2f644cbab24802de99a281d341b97a0", "score": "0.8128636", "text": "def filter_out_integers(arr)\n arr.select { |num| num.is_a? (String) }\nend", "title": "" }, { "docid": "b8997b865bf786e2eaa77c5833913ed2", "score": "0.80926955", "text": "def filter_out_integers(arr)\n a...
93b01ec01b691c2d36e5d99ee9c580cd
This behavior can be used to refactor lots of code
[ { "docid": "192244b36bb0c0af37fff20fcb7d6c4c", "score": "0.0", "text": "def play\n\temulate do |emulator|\n\t\temulator.play(self)\n\tend\nend", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7389879", "text": "def private; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6543314", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a...
5a946e1b50778e1a147a10cb778d5ca7
Returns the current state of the call AGI:
[ { "docid": "123d18ced32ccd850b35ac75054f2b9f", "score": "0.0", "text": "def status(options={})\n case @current_call.state\n when 'RINGING'\n status = 4\n when 'ANSWERED'\n status = 6\n else\n status = 0\n end\n @agi_response + status.to_s + \"\\n\"\n ...
[ { "docid": "f6c5dcf1bc5760089ab82b790f9ab936", "score": "0.7277543", "text": "def state\n @gapi.state\n end", "title": "" }, { "docid": "600edf5d7a417ee05d78efdd116c04bd", "score": "0.7198227", "text": "def state()\n info[:state]\n end", "title": "" }, ...
baee0491559f678bafeb7aa06438a472
Allows controllers to access the current_user variable. This method will load the user from the session if it can, otherwise it will return the anonymous user object. ==== Returns User:: The currently logged in user, or an anonymous user.
[ { "docid": "bc9edff2be8a07e0b24f32fff188cfd7", "score": "0.8702921", "text": "def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound...
[ { "docid": "389c529f3fc0cb7de4f719351477ca87", "score": "0.87527263", "text": "def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end", "title": "" }, { "docid": "631698ea2f9f935ff3566cebedd99491", "score": "0.8727629"...
adff6701c5d97845805cd10244b361a2
POST /criterios POST /criterios.json
[ { "docid": "697bea4d67a8e769c63c490c23aa13cc", "score": "0.65286267", "text": "def create\n @criterio = Criterio.new(params[:criterio])\n\n @criterio.estado = true\n\n respond_to do |format|\n if @criterio.save\n format.html { redirect_to @criterio, notice: 'Criterio was successfull...
[ { "docid": "590d8915211898bb04f914dd33e45f91", "score": "0.7076142", "text": "def create\n @criterium = Criterium.new(params[:criterium])\n\n respond_to do |format|\n if @criterium.save\n format.html { redirect_to @criterium, notice: 'Criterium was successfully created.' }\n for...
23fd0082cc5e90f6d102482d5c8110e4
Grants the player the specified number of Buys, and returns an action suitable for hanging more things off.
[ { "docid": "6758b35f3ee559ae5324c8d71264e183", "score": "0.6094299", "text": "def add_buys(num, parent_act)\n # Add _num_ buys to the Player.\n # First, check that it's the player's turn\n raise RuntimeError.new(\"Not Player #{id}'s turn\") unless cash\n\n # Store off the parent_act we've be...
[ { "docid": "10ceee4eb75a4487e6952855ec9eae17", "score": "0.63771784", "text": "def GCBuy(quantity)\n\t\tquantity.to_i.times do\n\t\t\tWin.Action(\"Accept\")\n\t\t\tWin.Action(\"Left\")\n\t\t\tWin.Action(\"Accept\")\n\t\tend\n\tend", "title": "" }, { "docid": "c7f404531f326ce268e46b5999691d1b...
889e093059439af3c868ccffd8902467
POST /questions or /questions.json creates and saves a new question
[ { "docid": "38d623f9119c4d7f12bd24999e07ece6", "score": "0.0", "text": "def create\n\t\tassessment = Assessment.find(params[:question][:assessment_id])\n\t\tuser = User.find(assessment.user_id)\n\t\t# check if user should be able to create a new question\n\t\tif !logged_in? || (!admin? && !(current_use...
[ { "docid": "24c2c8a79c07ce318e9ebbb74b06b4af", "score": "0.78675324", "text": "def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question, status: :created, location: @question\n else\n render json: @question.errors, status: :unprocessable_en...
94ace3f7b2dda2a0317f52da304f4938
The raw bytes of the key
[ { "docid": "38c32dbcfa90a9f09977a791ced903fa", "score": "0.77791643", "text": "def to_bytes\n @private_key\n end", "title": "" } ]
[ { "docid": "688e0c594dc736bf0ef615770d41411e", "score": "0.88408786", "text": "def to_bytes\n @key_bytes\n end", "title": "" }, { "docid": "58894db08f16e5ff01e25972c6777098", "score": "0.8365993", "text": "def key_bytes\n self.class.key_bytes\n end", "title": ...
23c69d904e9affacd03d106d55e01843
o reteta trebuie sa aibe mai multe medicamente
[ { "docid": "5b7a0763e4a97780b161d06185a7eda5", "score": "0.0", "text": "def show\n @pacient = Pacient.find(params[:pacient_id])\n @retetum = Retetum.find(params[:id])\n respond_to do |format|\n format.html\n #format.pdf do\n #send_data Raport.new.reteta(@retetum, @pacient), :fi...
[ { "docid": "27da807579da5b73f37f4f74308ef7b2", "score": "0.58580405", "text": "def terreno\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el terreno\n #usado de cada ingrediente segun el peso de este\n @lista.zip(@list...
1de428643a430961b6a81de5b012be19
GET /test_objects/1 GET /test_objects/1.json
[ { "docid": "d13738100f45399ce6956de1e0448a22", "score": "0.679977", "text": "def show\n @test_object = @customer.test_objects.find(params[:id])\n #@test_object = TestObject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_ob...
[ { "docid": "876a7fb34bf1585f8743401bcc6a8054", "score": "0.7088639", "text": "def show\n @testobject = Testobject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testobject }\n end\n end", "title": "" }, { "docid": ...
0502bd39e606da8d39419cdef2813dc0
SQL DDL ON DELETE fragment to use, based on the given action. The following actions are recognized: :cascade Delete rows referencing this row. :no_action (default) Raise an error if other rows reference this row, allow deferring of the integrity check. :restrict Raise an error if other rows reference this row, but do n...
[ { "docid": "ae8a4bb1623fef3cfd07d00a9b19a4b2", "score": "0.8199177", "text": "def on_delete_clause(action)\n case action\n when :restrict\n RESTRICT\n when :cascade\n CASCADE\n when :set_null\n SET_NULL\n when :set_default\n SET_DEFA...
[ { "docid": "b4addd6d7a2df2cdf59cf2226b441d95", "score": "0.8192991", "text": "def on_delete_clause(action)\n case action\n when :restrict\n RESTRICT\n when :cascade\n CASCADE\n when :set_null\n SET_NULL\n when :set_default\n SET_DEFAULT\n else\n ...
b8f3e7d35e579d52327117a629ea5aa5
Retrieve a single page of WorkerChannelInstance records from the API. Request is executed immediately.
[ { "docid": "dde32c7287a8ef25d4c40c75f850e929", "score": "0.0", "text": "def get_page(target_url); end", "title": "" } ]
[ { "docid": "6187d690496469c71cdab6bb5557ad13", "score": "0.60838383", "text": "def get_instance(payload)\n WorkerChannelInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid])\n end", "title": "" }, {...
e330a4387c039d58dfb9ae2430bd7646
Problem 6: Write the code to give the value of a number after it is reversed. Must use recursion. (Don't use any reverse methods!)
[ { "docid": "bcf2c3bcc40c85f66cf4504b53f2e1a9", "score": "0.0", "text": "def reverse(number)\n return number if number.to_s.length == 1\n length = number.to_s.length\n if number.to_s.split(\"\")[0...-1].length == 1\n return (number.to_s.split(\"\").last.to_s + reverse(number.to_s.split(\"\")[0]).to...
[ { "docid": "acdce650758e965f8e749ee8c76219aa", "score": "0.7933364", "text": "def reverse(number)\n \nend", "title": "" }, { "docid": "b63dd0794aa45dbb05be712473c78c68", "score": "0.78836155", "text": "def reverse(number)\n\nend", "title": "" }, { "docid": "1fd30cdc3bc54...
e2007266afe1fd6c47e975cf3320b19f
Set the value of the StartIndex input for this Choreo.
[ { "docid": "3c04155fcf3f127245723d2e6a96645a", "score": "0.6832372", "text": "def set_StartIndex(value)\n set_input(\"StartIndex\", value)\n end", "title": "" } ]
[ { "docid": "f6effe28bee2f82e238551cd3c8ba495", "score": "0.65263045", "text": "def set_StartIndex(value)\n set_input(\"StartIndex\", value)\n end", "title": "" }, { "docid": "ebabc15cf63bb8d4d9e37a30d4b4bb74", "score": "0.5469026", "text": "def set_Index(value)\n ...
35c96b1a74e3e8b6fefa78d4adf8ea07
only needed with DHT
[ { "docid": "9c9e11350e665cc36b38f5d371b33729", "score": "0.0", "text": "def send_port(socket, listen_port)\n if $verb\n puts \"Sent port message\"\n end\n socket.write([3, 9, listen_port].pack(\"Ncn\"))\n end", "title": "" } ]
[ { "docid": "a6ade7da71c94d2b97a96c89876cb396", "score": "0.6319425", "text": "def transmission; end", "title": "" }, { "docid": "3db157d82460cb0632778815b62dbc35", "score": "0.6234509", "text": "def dh; end", "title": "" }, { "docid": "bb5b9df99cd033e36edfd01a2b429e3c", ...
0fc038d561e53a3de226d5f535f3ccf5
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Set the visible property of the controls in the user control SET
[ { "docid": "5889696c104dba8c51927d5a3cb7c65c", "score": "0.6792571", "text": "def visible=(visible)\n @visible = visible\n @cEquipKind.visible = visible\n @ucIcon.visible = visible\n @cEquipName.visible = visible\n end", "title": "" } ]
[ { "docid": "79cbef4223b0664fe07a9dc775708077", "score": "0.8559344", "text": "def visible=(visible)\n @visible = visible\n for i in 0 .. @ucControls.size-1\n @ucControls[i].visible = visible\n end\n end", "title": "" }, { "docid": "db1e50cfe744f4165ae0559de9f4da53", "score...
f440396e31f00933ac471838d526a71a
Registering an actor involves setting up the actor within the window, adding them to the list of things that need to be drawn and then registering any eventst that they might have.
[ { "docid": "3298efdd751b71937ba9212725754a94", "score": "0.8046128", "text": "def register_actor(actor_factory)\n registering_actor = actor(actor_factory.name)\n registering_actor.window = window\n registering_actor.show\n\n drawers.push(registering_actor)\n updaters.push(regist...
[ { "docid": "aa1629ee149332d64ae2eba26e5c5f48", "score": "0.6688868", "text": "def register(name, actor)\n unless actor.is_a?(Actor)\n raise ArgumentError, \"only actors may be registered\"\n end\n\n registered = @@registered.receive\n begin\n registered[name] = actor\n ...
da926932f0c85586adeaea8092559648
Write a method vigenere_cipher(message, keys) that accepts a string and a keysequence as args, returning the encrypted message. Assume that the message consists of only lowercase alphabetic characters. A Vigenere Cipher is a Caesar cipher, but instead of a single key, a sequence of keys is used. For example, if we encr...
[ { "docid": "ee5dc9bbaaa8dc3e8986eb3f34b1063d", "score": "0.8264714", "text": "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n message.each_char.with_index do |char, idx|\n char_idx = alpha.index(char)\n char_idx = (char_idx + keys[idx % keys.length]) % 26\n ...
[ { "docid": "674b721d3decd5e62085938d500e82f5", "score": "0.8470029", "text": "def vigenere_cipher(message, keys)\n alpha = ('a'..'z').to_a\n new_message = ''\n\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n key = keys[idx % keys.lengt...
e92f85ac4f131a2300e973c10e5e73fd
GET /order_items GET /order_items.xml
[ { "docid": "aefac8b2b630a68a76d62ec421ab7489", "score": "0.70830727", "text": "def index\n @page_title = \"Transactions\"\n @admin_section = true\n\n @order_items = OrderItem.page(params[:page]).per(10) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { rend...
[ { "docid": "595d4a4886df27a3b339535361d6ae57", "score": "0.7855349", "text": "def index\n @order = Order.find(params[:order_id])\n @order_items = @order.order_items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @order_items }\n format.xml ...
0331c1448f1ebcc2755a224148ff3c5a
Gets the imageinfo property 'size' for the image.
[ { "docid": "15823c21b0ec35024d7390f84703c2b3", "score": "0.0", "text": "def get_image_sizes(image)\n params = {\n action: 'query',\n prop: 'imageinfo',\n iiprop: 'size',\n titles: image\n }\n\n response = post(params)\n page...
[ { "docid": "256835c82e609022e8ace5cae95fbdb8", "score": "0.7841376", "text": "def image_size\n @image_size ||= MiniMagick::Image.open(image_file_path.path)\n end", "title": "" }, { "docid": "03ff47902d8add9a5f6b0b3b0c87770e", "score": "0.78082293", "text": "def size\n @info[:s...
1d84d4dba4e666158f1444b10755884f
GET /paiementsolutions GET /paiementsolutions.json
[ { "docid": "5fb604fd93aa21608ee8b26d93eab2cc", "score": "0.65933394", "text": "def index\n @paiementsolutions = Paiementsolution.all\n add_breadcrumb \"solutions de paiement\", paiementsolutions_path\n end", "title": "" } ]
[ { "docid": "54a08c4bf5ebb8bf26649ad65599bda4", "score": "0.7036885", "text": "def index\n @solutions = Solution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "title": "" }, { "docid": "922a608951514ae...
df898045cc5776eea3a4b258660516fe
example curl 'localhost:3000/admin/set_sharding?trustme=puppieva&state=false' v example curl 'localhost:3000/admin/set_sharding?trustme=puppieva&state=true' v
[ { "docid": "04ca4913c2eaf3b0761c5dc07edfb87c", "score": "0.7764696", "text": "def set_sharding\n Rails.application.config.allow_sharding = params[:state]\n render :get_sharding\n end", "title": "" } ]
[ { "docid": "9aa0a9080951d56923f068cbff91af57", "score": "0.5915997", "text": "def is_cassandra_node settings\n has_role settings, \"cassandra_node\"\n security_group 'cassandra_node' do\n authorize :group_name => 'cassandra_node'\n authorize :network => '70.91.172.41/29', :from_port => \"9160\",...
cc68e6f2b43ff27528f52e904b68b8ac
GET /photos GET /photos.xml
[ { "docid": "1a3c215de2d9102fc82ad9756bfdabe8", "score": "0.75760174", "text": "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "title": "" } ]
[ { "docid": "82e74448d926ef2e6724d5f7a40720a3", "score": "0.745873", "text": "def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photos.to_xml }\n end\n end", "title": "" }, { "docid": "a08befcf351bca4...
2e8689ad4992bd19505c39a29c6d97e5
GET /site_plans GET /site_plans.json
[ { "docid": "d3783b0ee2d7d0ff608fac2e4f831761", "score": "0.7966808", "text": "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "title": "" } ]
[ { "docid": "48e86503f0f02a89c2f4c589d190d3a6", "score": "0.78812605", "text": "def plans(params = {})\n scope 'default'\n get('plans/', params)\n end", "title": "" }, { "docid": "41a9a758497eff5131d52abc1c7b367d", "score": "0.76484454", "text": "def index\n @plans = P...
23a94c257378b3616a8f8c7b04da8a85
TODO: Decouple fetching from page parsing
[ { "docid": "fbf15568d915cb2a69b690445695a9ac", "score": "0.0", "text": "def initialize(the_url, opts={})\n @url = the_url \n @qc_url = make_qc_url( @url ) \n # this URL seems to be used by quantcast in their internal system, independent of the \n # URL passed into the...
[ { "docid": "24a6164abb256568c0786f7f17673c7e", "score": "0.75988895", "text": "def fetch_page(page); end", "title": "" }, { "docid": "f722941431f094db310ff22019d5cfe0", "score": "0.7094969", "text": "def parsed_page\n response = Nokogiri::HTML(open(self.page_url))\n\n response....
c4c96d6e4cb70bebb712babcf6345eb8
Process a message sent to a variable. The messages that can be sent are restricted to a certain limited subset. :to_r is a noop and :to_i truncates to an integer. All singlecharacter function calls are converted to a call to the macro of the same name. :truncate serves only to apply the current scale to the value; its ...
[ { "docid": "0a414416c334c5dba6d676bf02872b11", "score": "0.4722032", "text": "def process_message(node, invocant, message, *args)\n if %i[+ - * / % ** +@ -@ to_r to_i truncate].include?(message)\n @factory.process(node).to_s\n elsif message == :sqrt\n process(args[0]) << ...
[ { "docid": "d16f7c734e633d726f59dd542b72c82a", "score": "0.56518203", "text": "def truncate(message)\n if message.length > 10_000\n message[0...9985] << \"... (truncated)\"\n else\n message\n end\n end", "title": "" }, { "docid": "ae134706169b05c3202c602e7b365...
fd5ba88c94926afc35e88ca9b6baf192
specifies if the cells that have the style containing this protection
[ { "docid": "5b344ed36092a29b0796d4f926afa739", "score": "0.0", "text": "def locked; end", "title": "" } ]
[ { "docid": "7a39e8303daff433b87cc94ceca4ec40", "score": "0.6195921", "text": "def custom_alignment?(cell)\n cell['cols']\n end", "title": "" }, { "docid": "5abaf56325737d52f2fe0ab33ad1204e", "score": "0.61650676", "text": "def only_cell_option?(key)\n [:colspan]....
f854df20c601d6caecdf1cb4d973de25
Something is jamming your communications with Santa. Fortunately, your signal is only partially jammed, and protocol in situations like this is to switch to a simple repetition code to get the message through. In this model, the same message is sent repeatedly. You've recorded the repeating message signal (your puzzle ...
[ { "docid": "98d79d68597d63c766880898b87019a4", "score": "0.0", "text": "def transpose input\n input.map { |line| line.strip.chars }.transpose\nend", "title": "" } ]
[ { "docid": "489343bf7ae42efeef139ac6cf6b926b", "score": "0.60116255", "text": "def dr_evils_cipher(coded_message)\n #downcasing all the messaages and splitting them for each character. The result will be in this syntax [\"m\", \"^\", \"a\", \"e\", \"r\", \"x\", \"%\", \"e\", \"&\", \"g\", \"s\", \"o\",...
6085837bc6b05baa237b12512a7485bc
Validamos las acciones, en caso de que haya objetos, los recoge
[ { "docid": "680d419fcf3e5eedf97009100f7690a4", "score": "0.0", "text": "def process_action input\n cond = false\n room = @rooms[@actual_room.to_sym]\n action = room.actions[:action]\n\n if(action[0].downcase == input)\n #Comprobamos si hay objetos\n if(room.objects?)\n cond ...
[ { "docid": "856377556f8244c0b44388ea2cdc5b52", "score": "0.62045234", "text": "def initialize\n self.recurso_validado = []\n self.validacion = {}\n end", "title": "" }, { "docid": "3fc507f88b3c38582481160a91cfc790", "score": "0.6089937", "text": "def validacion(respuesta)\n ...
ffec27c2c882dae61501d9c40309f5bf
gets the registrant before anything else
[ { "docid": "2f8315b10c6e7a8d3f92fce5b3d6c60d", "score": "0.0", "text": "def new\n\t\t#bind a user object to the new user form\n\t\t@user = User.new\n\tend", "title": "" } ]
[ { "docid": "da4a0caec79d6c5ddcbbe141d7135bb2", "score": "0.7184836", "text": "def registrations; end", "title": "" }, { "docid": "da4a0caec79d6c5ddcbbe141d7135bb2", "score": "0.7184836", "text": "def registrations; end", "title": "" }, { "docid": "da4a0caec79d6c5ddcbbe141...
316d9fa173bbeb3629cfcdc1ce67394e
function to process each line of a file and extract the song titles
[ { "docid": "bb81dbb3dc8b2ffeba11461a2cdddbdc", "score": "0.0", "text": "def process_file file_name\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tIO.foreach file_name do |line|\n\n\t\t\ttitle = cleanup_title line # clean up title\n\n\t\t\tunless title.eql? nil # check if passed test for only English c...
[ { "docid": "0046229efaef44a20e81380287029250", "score": "0.7167768", "text": "def extract_data(song)\n # Songs have to start with the header, so the next is true\n in_header = true\n\n song.split(\"\\n\").each do |line|\n # Ignore comments. Never hurts to have comments in a file format\n next i...
412c043ce4065fc38e5091d654a8fc17
Provides List of VPC security group elements that the DB instance belongs to
[ { "docid": "e2cac3d0d5efb648236b3dd7798d7619", "score": "0.8240463", "text": "def vpc_security_groups\n vsgs = []\n @dbi.vpc_security_groups.each do |vsg|\n vsgs << vsg.vpc_security_group_id if vsg.status == 'active'\n end\n vsgs\n end", ...
[ { "docid": "686c6fbc479797ee971ea936251b5158", "score": "0.8138303", "text": "def vpc_security_groups\n data[:vpc_security_groups]\n end", "title": "" }, { "docid": "686c6fbc479797ee971ea936251b5158", "score": "0.8138303", "text": "def vpc_security_groups\n data[:vpc_sec...
afc7148716518fd24487cbb4aed259d7
Pull images of services
[ { "docid": "710ddd4e102b13daf0d7ca76e5f1390c", "score": "0.5769625", "text": "def pull(*services)\n run!('pull', *services)\n end", "title": "" } ]
[ { "docid": "4f2fb574bde0e853f8e425f1f6fb733b", "score": "0.6919536", "text": "def images\n Vultr::Resource::OS.new(@faraday)\n end", "title": "" }, { "docid": "cf6c5ed3b2bbe566bb52884c57110923", "score": "0.6782918", "text": "def images\n IbmCloudRest.get \"#{@uri}/image...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "d997d2bfe1f908893db5ce9978fc2752", "score": "0.0", "text": "def update!(**args)\n @trust_prop = args[:trust_prop] if args.key?(:trust_prop)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
c0403f03ebd82e4d867f918bd564f9e1
Get the allowance an address has to spend another's token.
[ { "docid": "3d4a5ef09798d457c6640458ff56d84f", "score": "0.52385074", "text": "def allowance( owner:, spender: ) ## _owner: address, _spender: address\n @allowed[owner][spender]\n end", "title": "" } ]
[ { "docid": "0d74008eb7a6fa10bb8e92e87834741b", "score": "0.6250571", "text": "def allowance( owner:, spender: ) ## _owner: address, _spender: address\n a = Allowance.find_by( addr: addr, key1: owner, key2: spender )\n a ? a.value : 0\n end", "title": "" }, { "docid": "8a0046f5df9bac5...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "74f82c398f9cbc63e84f40880697488b", "score": "0.0", "text": "def set_vinculacion\n @vinculacion = Vinculacion.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310596", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6014974", "text": "de...
70e5f6fd2902adf550e3b6052f4451a2
Public: This is what destroies the session, when someone using a social media site logs out of the site.
[ { "docid": "5dffdd2c1263fd2d2080dcfb0800b915", "score": "0.0", "text": "def destroy\n session[:user_id] = nil\n redirect_to root_path\n end", "title": "" } ]
[ { "docid": "ad50f7a78c66caa1015274239cd6736d", "score": "0.78744066", "text": "def log_out_of_facebook\n session[:_rfacebook_fbsession_holder] = nil\n session[:_rfacebook_fbparams] = nil\n @fbsession_holder = nil\n end", "title": "" }, { "docid": "42de0291fd89a39684...
2cc17045bdbe867c70ec547982f38290
Compute the optimal bit lengths for a tree and update the total bit length for the current block. IN assertion: the fields freq and dad are set, heap[heap_max] and above are the tree nodes sorted by increasing frequency. OUT assertions: the field len is set to the optimal bit length, the array bl_count contains the fre...
[ { "docid": "c2893a1269ca49afd4da6bfdb178f82c", "score": "0.6730203", "text": "def gen_bitlen(s, desc)\n tree = desc.dyn_tree\n max_code = desc.max_code\n stree = desc.stat_desc.static_tree\n extra = desc.stat_desc.extra_bits\n base = desc.stat_desc.extra_base\n max_length = desc.stat_d...
[ { "docid": "2b17b3cb4924ca2d18484bc98405d930", "score": "0.5536887", "text": "def build_tree(s, desc)\n tree = desc.dyn_tree\n stree = desc.stat_desc.static_tree\n elems = desc.stat_desc.elems\n max_code = -1\n\n s.heap_len = 0\n s.heap_max = HEAP_SIZE\n\n for n in 0 ... elems\n ...
cc691b6dba1ebb8ab058b947309472c3
Gets a Follow record for the Email
[ { "docid": "e8b963b90423f3c9b20f2a46dc59e6d5", "score": "0.0", "text": "def get_follow(id, opts = {})\n data, status_code, headers = get_follow_with_http_info(id, opts)\n return data\n end", "title": "" } ]
[ { "docid": "829235c86175fb82f03e92ef0247ae74", "score": "0.6888113", "text": "def get_follow( followed )\n\t\t\t\tFollow.active.for_follower( self ).for_followed( followed ).first\n\t\t\tend", "title": "" }, { "docid": "2a59e749ab3f43a5bcfdc922f0f92196", "score": "0.64122283", "text"...
d4ceafff6219e8f3f2ca1cb5908978e6
Read the actual source
[ { "docid": "4bbec1920cdf165a6f109675468d1c7e", "score": "0.0", "text": "def read_configuration_source_or_croak(srceSpec, &srceBlok)\n eye = :'r_cfg_src'\n\n $DEBUG && logger_me(eye, logger_fmt_kls(srceSpec: srceSpec), logger_fmt_kls(srceBlok: srceBlok))\n\n srceType = is_value_configuration_sou...
[ { "docid": "32e08f804458d32dca72848143e127e5", "score": "0.82772815", "text": "def read\n source.read\n end", "title": "" }, { "docid": "8cc438a80b4ad4c97a44e282226e4670", "score": "0.8107427", "text": "def read_source\n raise NotImplementedError\n end", "title": "" ...
379788f1f9fec6ea691e993d64b5f1e5
This should return the minimal set of attributes required to create a valid Chore. As you add validations to Chore, be sure to update the return value of this method accordingly.
[ { "docid": "8011fc75c86ef3fddd26acf1e113b67b", "score": "0.6252651", "text": "def valid_attributes\n {\"title\" => \"test chore\",\n \"user_id\" => 1,\n \"email_id\" => 1,\n \"choretype_id\" => 1,\n \"context_id\" => 1,\n \"project_id\" => 1\n }\n end", "title": "" } ]
[ { "docid": "244c19aa0f232271edf2d0831c8f7ce0", "score": "0.6692825", "text": "def required_attributes()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "94edea92e6730f5c263b1951c6a9e07b", "score": "0.6459956", "text": "def mandatory_at...
0abee2320a589e80875901bfff2c0789
Update a 'storage.FlexFlashControllerProps' resource.
[ { "docid": "06b0e3c5ae0cd9c7de5673870754e0a0", "score": "0.69294703", "text": "def patch_storage_flex_flash_controller_props(moid, storage_flex_flash_controller_props, opts = {})\n data, _status_code, _headers = patch_storage_flex_flash_controller_props_with_http_info(moid, storage_flex_flash_contr...
[ { "docid": "0279053fcdb7ffdc289b34248510782a", "score": "0.7349575", "text": "def update_storage_flex_flash_controller_props(moid, storage_flex_flash_controller_props, opts = {})\n data, _status_code, _headers = update_storage_flex_flash_controller_props_with_http_info(moid, storage_flex_flash_cont...
4980fc9ca56e4fbfd337196ba444f39f
Whether or not the set is empty
[ { "docid": "2c0dcf8b1d4db48215804c1173927e10", "score": "0.0", "text": "def empty?\n @capstones + @flats == 0\n end", "title": "" } ]
[ { "docid": "db392026b399561853e9ac9385e89676", "score": "0.9216404", "text": "def empty?\n @set.empty?\n end", "title": "" }, { "docid": "00f6a9d6145dda2586630350e93cf790", "score": "0.91727537", "text": "def empty?\n set.empty?\n end", "title": "" }, { "docid...
f35ae925a11c6e8b8721a0e76c5d09a1
~ OVERWRITE Calculate Damage
[ { "docid": "204c6c2ddb45a97bfaad35c998275257", "score": "0.0", "text": "def make_damage_value(user, item)\r\n value = item.damage.eval(user, self, $game_variables)\r\n puts \"Damage : \" + value.to_s\r\n value *= item_element_rate(user, item)\r\n if @result.critical\r\n value = apply_cr...
[ { "docid": "c31615387abddf3c9b2d80ccc3ed4b62", "score": "0.7518942", "text": "def damage_mod; 0; end", "title": "" }, { "docid": "caf0158b8715f389ca3930e908532b8c", "score": "0.7301889", "text": "def damage\n end", "title": "" }, { "docid": "71fc5f8311cc8a5ec005d87e7...
5ac8c1d6efd1f6ab98f86ccf9ce207f0
Displays the Favourites Table
[ { "docid": "25b46cea90117f7227bef6d1b049d590", "score": "0.64575076", "text": "def display_favourites\n system(\"clear\")\n favourites_font = TTY::Font.new(:doom)\n favourites_title = Pastel.new\n puts favourites_title.cyan.bold(favourites_font.write(\"FAVOURITES\", letter_spacing: 2))\n ...
[ { "docid": "774fc08503eeaf197d19764baf0a082b", "score": "0.75327307", "text": "def display_favorites\n if @alive == true\n favorites_header\n else\n offline_header\n end\n if @fav_list.length == 0\n puts \"You have no favourites!!!\".center(@header_le...
2988c6797a92823561b73122ff9c7e05
query the monitor to determine the average CPU load return (Float) average CPU load (percentage)
[ { "docid": "2e9f732483f2a1c4815f67d0595173f5", "score": "0.7020572", "text": "def cpu_load\n return @config['hw']['cpu']['load']\n end", "title": "" } ]
[ { "docid": "8db4f231ea6c7e7a16e8b2e860414bc8", "score": "0.776525", "text": "def mgmt_cpu_avg\n get_cpu_usage[:mgmt_cpu_avg]\n end", "title": "" }, { "docid": "f4882377859389df43c398c422268c6e", "score": "0.77058643", "text": "def get_total_cpu_percentage\n result = execute_wm...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5c03ad68d05632704a5892dbbf4b7082", "score": "0.0", "text": "def set_week\n @week = Week.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...
60f846bb50b195ddc4addb622d6f2060
asks if you would like to play again then exits, starts the game over, or prompts the question again
[ { "docid": "df796f69048aeab866203e8dc062327d", "score": "0.7618288", "text": "def play_again\n\tprint \"Would you like to play again (y or n)? \"\n\t@answer = gets.chomp.strip\n\tputs \"\\n\"\n\n\tif @answer.downcase == \"y\"\n\t\t@userPoints = []\n\t\t@computerPoints = []\n\n\t\tdic_game()\n\telsif @an...
[ { "docid": "9785ff61e6d0756595f8ed952f2c6872", "score": "0.8688936", "text": "def play_again\n\t \tputs \"Do you want to play again ? yes or no ?\"\n\t \tanswer = gets.chomp\n\t \t\tif answer == \"yes\"\n\t \t\tputs \"Here we go again\"\n\t \t\tGame.new.go\n\t \t else puts \"That is OK, we can stop pla...
8d8db15657f5c3a89e71ad153b95bbc5
Whether the data format is "CSV".
[ { "docid": "b5aad5def02af7db17e9d0c599f847e3", "score": "0.8198346", "text": "def csv?\n @gapi.source_format == \"CSV\"\n end", "title": "" } ]
[ { "docid": "2120a80eb7518ddcb3639d33cc9ddebd", "score": "0.8219627", "text": "def csv?\n val = @gapi.configuration.load.source_format\n return true if val.nil?\n val == \"CSV\"\n end", "title": "" }, { "docid": "2120a80eb7518ddcb3639d33cc9ddebd", "score"...
5fbcfd01bfc00814dacf30f60dadef1d
DELETE /entity_types/1 DELETE /entity_types/1.json
[ { "docid": "f34ca517b331b75fd5930fee36f3dd70", "score": "0.76281387", "text": "def destroy\n @entity_type.destroy\n respond_to do |format|\n format.html { redirect_to entity_types_url, notice: 'Entity type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"...
[ { "docid": "c48bfe5312b4856f2d347d3e75619ba2", "score": "0.76672435", "text": "def destroy\n @collection = @entity_type.collection\n @entity_type.destroy\n respond_to do |format|\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfull...
519fc47f93fa718988071928cf5331a9
correlate to crit_id from
[ { "docid": "b7e2a3ef2b2fe01cf75084895334e2aa", "score": "0.60634226", "text": "def crit=(crit)\n \n \n @crit = crit\n \n puts \"crit: #{crit}\"\n #\n @crit_id = GroupCriter.find_by_name(crit).id.to_i\n puts \"in crit.. setting also @crit_id: #{@crit_id.inspect}\"\n end", "t...
[ { "docid": "6151678e1ad374fcb1a143b4e983bb1d", "score": "0.55142224", "text": "def set_ccriterion\n @ccriterion = Ccriterion.find(params[:id])\n end", "title": "" }, { "docid": "80ca5707de5876f65835438e97c82066", "score": "0.53819007", "text": "def set_criterion\n @crite...
31cb284851cf8922e7ecdabe140caa0d
Builds a path to a file in $HOME/.config/google (or %APPDATA%/google, on Windows)
[ { "docid": "a223ffe03e158a19da833511918e0b30", "score": "0.8059353", "text": "def well_known_path_for(file)\n if OS.windows?\n dir = ENV.fetch('HOME'){ ENV['APPDATA']}\n File.join(dir, 'google', file)\n else\n File.join(ENV['HOME'], '.config', 'google', file)\n end\n ...
[ { "docid": "55cf1d61a9625125f292d96ae6a32d7b", "score": "0.81135154", "text": "def well_known_path_for(file)\n if OS.windows?\n dir = ENV.fetch('HOME'){ ENV['APPDATA']}\n File.join(dir, 'google', file)\n else\n File.join(ENV['HOME'], '.config', 'google', file)\n end\n end", ...
01302c6bc1f96294bc3b1b7b6ff17427
Sahil Palnitkar Part 1
[ { "docid": "1a198e10c4025e003c3ef4abbe1326cb", "score": "0.0", "text": "def sum(arr)\n sum = 0\n for element in arr\n sum = sum + element\n end\n return sum\nend", "title": "" } ]
[ { "docid": "0f4fb165548b4d7ab8c74f1e99d3f784", "score": "0.63338804", "text": "def stahp\n end", "title": "" }, { "docid": "d56bb8a6a87f6f876bb52ca3625ac3de", "score": "0.6184055", "text": "def determinant_bareiss; end", "title": "" }, { "docid": "3b4d73bb1e37c76863888...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "88430d9718b8f7bb27dc6ecfa57aca3f", "score": "0.0", "text": "def activity_params\n params.require(:activity).permit(:std_activity_id, :description, :score, :date, :exam_item_id, :class_org_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
e11a9797da340fb1cb5b0d38ccde85f3
Return true if the 'str' express integer, else return false.
[ { "docid": "a3f5e7bc033fd049a4d79ebf11c77ed2", "score": "0.0", "text": "def integer?\n self.class.integer?(self)\n end", "title": "" } ]
[ { "docid": "a7388fbb999f7bffd7742aef496ed343", "score": "0.86553204", "text": "def integer?(str)\n true if Integer(str)\n rescue ArgumentError, TypeError\n false\n end", "title": "" }, { "docid": "606b2613411447e4a230d5c4c7caa331", "score": "0.84788305", "text": "def ...
0d0c098066d5ccd46708c919fd3b83a1
POST /check_points POST /check_points.json
[ { "docid": "71e82cbf3956bf4307bbc7017e0e60b0", "score": "0.7136305", "text": "def create\n begin\n @check_point = CheckPoint.create!(check_point_params)\n render template: 'check_points/show', status: :created\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, statu...
[ { "docid": "27eed85a063c78b9f431669e89732263", "score": "0.6875695", "text": "def create\n @check_point = CheckPoint.new(params[:check_point])\n @check_point.user = current_user\n\n respond_to do |format|\n if @check_point.save\n format.html { redirect_to check_points_path, notice: ...
5942553e9f12aa9208181ed30db06d0a
Compile phases that should not run during preload
[ { "docid": "c3044040254869da9648f8de7fa81c00", "score": "0.60029244", "text": "def compile_ohai_plugins\n return super unless $CHEFSPEC_MODE\n return if $CHEFSPEC_PRELOAD\n\n super\n end", "title": "" } ]
[ { "docid": "64a54535d70b9269145542bac880f804", "score": "0.69285274", "text": "def precompile_assets; end", "title": "" }, { "docid": "ece31c254fbc7e912e5e5f0b4b609575", "score": "0.6691067", "text": "def precompile_assets=(_arg0); end", "title": "" }, { "docid": "08c146e...
82fbc00998d6be453ce9cc458d788f46
reduce 571 omitted reduce 572 omitted
[ { "docid": "d80eecf1df40a6f0c3d6fbf6beb55543", "score": "0.0", "text": "def _reduce_573(val, _values, result)\n result = :\"**#{val[1]}\"\n \n result\nend", "title": "" } ]
[ { "docid": "3cae03b0b71145c3925184be78edbbed", "score": "0.71745634", "text": "def _reduce_598(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "a8bd851ea077dd5d3684a05c36012ebe", "score": "0.71703583", "text": "...
ec5291acc3de3b4c2ee110e4482840d7
End Method: search method: Report Generation
[ { "docid": "2c31b006a10b573fb91a9414d34a9c4a", "score": "0.0", "text": "def organizationeport\n\t\t@organizations = Organization.find(:all)\n\n\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf,...
[ { "docid": "dfa246bd237534d14f835057a4c0e786", "score": "0.71340674", "text": "def search\n \n end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.7132442", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37...
c165d014b6c1c4df6911ae5e4561b8c1
Convets to printable model name to show in view or email.
[ { "docid": "808ac65f3faba3d55213cbaf1fc50078", "score": "0.0", "text": "def printable_name\n \"#{self.printable_type} (#{id})\"\n end", "title": "" } ]
[ { "docid": "2e972d12a82514d5bccdacfee1accc4f", "score": "0.76997894", "text": "def to_s\n self.class.model_name.human\n end", "title": "" }, { "docid": "bb4a7d44d00d8c5dc217a6e24268b932", "score": "0.7276358", "text": "def to_s\n \"#{ self.class.name.gsub(/.+::/, '') }...
d669ba3ddfe1a54cbd40ab9de1ba3735
_____________ this method print What do we have to ??????????
[ { "docid": "68b9ce202d288c869ba0422722c26c77", "score": "0.0", "text": "def test_exception_on_find_overdue_books() \n begin\n @l.libIsOpen() \n rescue Exception => e # or you can test for specific exceptions\n expect1=\"The library is not open\"\n assert_equal(expect1, e.message)\n ...
[ { "docid": "e680de9b8a73f1e9e53daf2ab59fb422", "score": "0.6722899", "text": "def print\n\t#\t\tputs to_s\n\t\tend", "title": "" }, { "docid": "954c5828178f6e4a659c40ef92736547", "score": "0.66932666", "text": "def helpful!\n\n\t\tend", "title": "" }, { "docid": "359626ce...
91c855a0ec83fdb0b091b319ea7214c4
my own reducelike methods
[ { "docid": "a9b6af0b825520f68711683041a1de45", "score": "0.0", "text": "def reduce_to_total(array,starting_point=0)\n total = starting_point\n counter = 0 \n while counter < array.size do \n total += array[counter]\n counter += 1\n end\n total\nend", "title": "" } ]
[ { "docid": "b1dd18126817e33276e5277c4159328f", "score": "0.8016121", "text": "def _reduce_1(val, _values, result); end", "title": "" }, { "docid": "2dedbdb031c83467e07cdef739ee0114", "score": "0.7895463", "text": "def _reduce_21(val, _values, result); end", "title": "" }, { ...
4c8c582e3973ddd68a89fa27a977f9f8
Writes a snippet extracted from the asciidoc file into the snippets directory.
[ { "docid": "905941d164aa29cc8aabfd61c9506266", "score": "0.682726", "text": "def write_snippet(block, snippet, uri)\n info block: block, message: \"writing snippet #{uri}\"\n write_proc = block.document.attr 'write_snippet'\n if write_proc\n # Delegate to a proc for copying if one ...
[ { "docid": "cf197a10b34f8ab4e7588e790ccdc946", "score": "0.6773088", "text": "def write_snippet(block, snippet, uri)\n info block: block, message: \"writing snippet #{uri}\"\n write_proc = block.document.attr 'write_snippet'\n if write_proc\n # Delegate to a proc for copying if one is defi...
3c4d0aa73c2244ffce6f498e4b3f781c
write chunk to temp file
[ { "docid": "448aaf6812dd9ecdb79b8e710e85ec9c", "score": "0.0", "text": "def handle_new_chunk(file_checksum, offset, content)\n if offset == @streams[file_checksum].file.pos\n FileReceiver.write_string_to_file(content, @streams[file_checksum].file)\n if Params['log_debug_level'] >= 1 ...
[ { "docid": "c5088136c7d2dab5b6cf9b8fb9a961c4", "score": "0.73167294", "text": "def write(chunk); end", "title": "" }, { "docid": "c5088136c7d2dab5b6cf9b8fb9a961c4", "score": "0.73167294", "text": "def write(chunk); end", "title": "" }, { "docid": "c5088136c7d2dab5b6cf9b8f...
0c6d6b8e0fa81c129b2c9f2ed581ae0f
pretty format of +time_in+
[ { "docid": "a3e3f4839b02542a6a68a5cc8cce0254", "score": "0.73620474", "text": "def time_in_str\n \"#{time_in.strftime(FULLTIME).gsub(/ 0(\\d\\D)/, ' \\1')}\"\n end", "title": "" } ]
[ { "docid": "26dce9454adcc02fc8439f89ac6a8ddb", "score": "0.7644599", "text": "def pretty_time(time)\n time.strftime '%l:%M %p'\n end", "title": "" }, { "docid": "808fc0cf7d33feeb1f74995e59adc4c6", "score": "0.7619488", "text": "def format_time(time); end", "title": "" }, ...
dc22dbf39fd5a37d9f60989f17806b76
Resolve +dependencies+, downloading from +sources+. Uses a separate JRuby runtime to avoid polluting the classpath with Aether and SLF4J classes.
[ { "docid": "53f627d660fe08c00e11e849f9c103f7", "score": "0.79328537", "text": "def resolve(dependencies, sources)\n with_ruby_container do |c|\n c.put 'path', File.dirname(__FILE__).to_java\n c.put 'deps', Marshal.dump(dependencies).to_java\n c.put 'repos', Marshal.dump(sources...
[ { "docid": "a2363e90c05ed4d43780249d5a55a6ae", "score": "0.6321374", "text": "def resolve(*dependencies)\n Bundler.logger.info \"Calculating dependencies...\"\n\n resolved = Resolver.resolve(dependencies, self)\n resolved && GemBundle.new(resolved.all_specs)\n end", "title": "" }...
6f22cfccdfe9d6b9d356195c186b76b2
Instance method to return a specific FarMar::Product object linked to the FarMar::Sale object
[ { "docid": "79c68a38609ad102dc7b266694044e4c", "score": "0.71969396", "text": "def product\n FarMar::Product.find(self.product_id)\n end", "title": "" } ]
[ { "docid": "1e36497d767fca4273f573e2be8f4484", "score": "0.7649576", "text": "def product_sale\n @product_sale ||= ProductSale.find_by(id: params[:id])\n end", "title": "" }, { "docid": "de976eafe355fe6bbac1a98d7a443f6e", "score": "0.7370032", "text": "def product\n return Far...
a346044aff0bab9de3254610a9345234
Makes a Hg commit.
[ { "docid": "c407c8840cb6009e841d32a6beaad8de", "score": "0.0", "text": "def commit(message=nil,options={})\n arguments = []\n \n if message\n arguments << '-m' << message\n end\n\n if options[:paths]\n arguments += [*options[:paths]]\n end\n\n return run(...
[ { "docid": "6c4379e04d84ac2ce5ad1e9850cb3ebd", "score": "0.6881374", "text": "def gcommit; end", "title": "" }, { "docid": "c65da722966b2812c7d9cfee6b91be77", "score": "0.6674506", "text": "def commit_changes(description)\n git :add => '-A'\n git :commit => %Q(-qm \"thegarage-templ...
189a8efe16dfd0992cfd9e4b1ac8e104
Returns MODULE_PAYLOAD to indicate that this is a payload module.
[ { "docid": "a26a7b0b0c56a281094e6b13c3da888c", "score": "0.8195018", "text": "def type\n\t\treturn MODULE_PAYLOAD\n\tend", "title": "" } ]
[ { "docid": "1db23c6ba23c90e1e8f20108ca76eeec", "score": "0.7217039", "text": "def payload\n\t\treturn module_info['Payload'] ? module_info['Payload']['Payload'] : nil\n\tend", "title": "" }, { "docid": "2a0954f531f37c36e5ddb853f2402855", "score": "0.6751915", "text": "def payload\n ...
942b77f5d6091e3a5620914261f323c4
an id 'spaceship' for tasks
[ { "docid": "49b1d3392f675c3244e103e1efcd64f6", "score": "0.0", "text": "def id_order(task1, task2)\n\t\treturn -1 if task1.id > task2.id\n\t\t1\n\tend", "title": "" } ]
[ { "docid": "ec9b670ffef7eaba30eb6fd9591cd925", "score": "0.5843458", "text": "def load_spaceship\n @Spaceship = Spaceship.find(params[:id])\n end", "title": "" }, { "docid": "dbc90ec064561fae62e2c1ea3ac6c190", "score": "0.5735895", "text": "def set_space(space_id = params[:id])\n...
c2004eb93e029eb468d9c3107987c333
Initialise the policy for the given model.
[ { "docid": "65f27194b7e590754d371383fe0be7f4", "score": "0.5264372", "text": "def initialize model\n @model = model\n end", "title": "" } ]
[ { "docid": "5260156c65b2f1785eed1dc3ce8d1d3b", "score": "0.67154217", "text": "def start_policy(_element, _attributes)\n\t\t\t\t\t@policy = Risu::Models::Policy.create\n\t\t\t\tend", "title": "" }, { "docid": "fc806470e177ca13e8828c62432eb74a", "score": "0.6237957", "text": "def set_...
fd241bf85c8d42eaabecc37275204425
The content of the node
[ { "docid": "1dac2ff184999fb0029f6cade1009a03", "score": "0.0", "text": "def content\n\t\t\t\t@end_tags.last.content\n\t\t\tend", "title": "" } ]
[ { "docid": "faf94b297afd93cf41f03a8c34cb32ad", "score": "0.90506095", "text": "def content\n @node.inner_text\n end", "title": "" }, { "docid": "b9d0815b6fc3debbf8d58a2aad64eff1", "score": "0.8770908", "text": "def content\n node.content\n end", "title": "...
496a07a9b759b0d2e6889a75974f77c2
PATCH/PUT /veterinaria/1 PATCH/PUT /veterinaria/1.json
[ { "docid": "cea97f77a7a18dcdf062a1eb42695f5e", "score": "0.65657645", "text": "def update\n respond_to do |format|\n if @veterinarium.update(veterinarium_params)\n format.html { redirect_to @veterinarium, notice: 'La veterinaria fue modificada' }\n format.json { render :show, statu...
[ { "docid": "e283bc2c564258897ab0627a4907df6b", "score": "0.67411834", "text": "def update\n @voto = Voto.find(params[:id])\n\n if @voto.update(voto_params)\n head :no_content\n else\n render json: @voto.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { ...
c31f6276518ce5ec0e654c47870e8638
Test our validations for new blogs
[ { "docid": "5da3d66dd79da8020dc373e99717fa98", "score": "0.74640113", "text": "def test_create\n\t\tblog_post = get_fixture(BlogPost, \"blog_post_valid_and_posted\")\n\n\t\tauthorized_to_blog_to(blog_post)\n\t\t\n\t\tassert blog_post.valid?\n\t\t\n\t\tblog_post.blog_id = nil\n\t\tassert !blog_post.valid...
[ { "docid": "c71e8f11f2d46207c2781d07cded840e", "score": "0.6673907", "text": "def test_validation\n post4 = BasicPost.new(text: 'Post', position: 4)\n assert_equal(post4.valid?, false)\n end", "title": "" }, { "docid": "80a95523d1d516e9d4ff81ec3160b76f", "score": "0.6550913", ...
9171a12ff9316890c9e959feb269adbe
Produces a random book publisher
[ { "docid": "65fb9ff3e321e85796aaf4899afb0f80", "score": "0.5530605", "text": "def publisher; end", "title": "" } ]
[ { "docid": "8d553af8b8466ba706923ba47ccf40bd", "score": "0.6613304", "text": "def one_of_their_books\n reading_lists.sample.book\n end", "title": "" }, { "docid": "2ea4e1c16592efbe57c3a6fb9d22edbf", "score": "0.627082", "text": "def get_publisher #returns for a specific object/in...
ab829f23468d7c3c8d5acba7b6cb3ce5
PATCH/PUT /raft_checks/1 PATCH/PUT /raft_checks/1.json
[ { "docid": "39ab438302f3141e8de28a99e3ec3275", "score": "0.6874426", "text": "def update\n respond_to do |format|\n if @raft_check.update(raft_check_params)\n format.html { redirect_to @raft_check, notice: 'Raft check was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "dfecd2df787ec066e5daea90463e8cdf", "score": "0.60670596", "text": "def update\n @check = Check.find(params[:id])\n\n respond_to do |format|\n if @check.update_attributes(params[:check])\n format.html { redirect_to @check, notice: 'Check was successfully updated.' }\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "fcd45ff1373bf38cfde38d8e3707666e", "score": "0.0", "text": "def sponge_params\n params[:sponge]\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
c26c3fb36d45b22738554b8be77eb766
Resolve file information about a single file
[ { "docid": "06ae23675fde39f4f61bd07bcae24484", "score": "0.5616192", "text": "def file_info(path)\n stat = path.stat\n return FileInfo.new(path, stat.mtime, stat.size)\n end", "title": "" } ]
[ { "docid": "dd881ada3fcb97934dd602325e8fb38b", "score": "0.7097587", "text": "def file_info\n @file_info ||= begin\n doc = options[:file_info_doc] || fs.files_collection.find(_id: file_id).first\n if doc\n File::Info.new(Options::Mapper.transform(doc, ...
4f35ccaa728f1d2b5b3e0a392443d650
Splits the text by separator removing empty parts
[ { "docid": "811081edd792f704d27f0ee8a97364d7", "score": "0.7279379", "text": "def split_field(text, separator = DocTemplate::Tables::Base::SPLIT_REGEX)\n text.to_s\n .split(separator)\n .map(&:squish).reject(&:blank?)\n end", "title": "" } ]
[ { "docid": "222ce590d24dd646aa53540fdfbbadf8", "score": "0.7755209", "text": "def split(text)\n text.gsub(/\\r\\n/, \"\\n\").sub(/\\A(?:\\s*?\\n)*/m, \"\").split(/\\n\\n/)\n end", "title": "" }, { "docid": "b89fb555659f1c88b6aa4f3d496da244", "score": "0.69048274", "text": "de...
f31c0cfbef8f0488d757d3c4d1eccdaa
TODO: Implement the methods to retrieve all recipes, create, or destroy recipes TODO: Implement a save method that will write the data into the CSV And don't forget to use this save method when you have to modify something in your recipes array.
[ { "docid": "a56bda787bbc1c689662aebe0f6c8a39", "score": "0.0", "text": "def all\n @contents\n end", "title": "" } ]
[ { "docid": "89191677df76e238f5c8127bc5d2f882", "score": "0.80540085", "text": "def save_data\n csv_options = { col_sep: ',', force_quotes: true, quote_char: '\"' }\n filepath = @csv_path\n\n CSV.open(filepath, 'wb', csv_options) do |csv|\n @recipes.each do |recipe|\n csv << [recipe....
849d92651d318f7a5c48c548f4f8981f
store kelvin, convert to all
[ { "docid": "cf97f403a6ccbe20431089a0accf674b", "score": "0.54554296", "text": "def k=(k)\n return if !k || !(k.is_a?(Integer) || k.is_a?(Float))\n @kelvin = k.to_f\n @celsius = Data::Temperature.k_to_c(k.to_f)\n @fahrenheit = Data::Temperature.k_to_f(k.to_f)\n end", "title": "...
[ { "docid": "79e629b2fe9a56ded49c5da5ff6cd2df", "score": "0.66016", "text": "def convertKelvin\n case self.myScale\n when 'F'\n self.myDegrees = (self.myDegrees + 459.67) * (5.0/9.0)\n self.myScale = 'K'\n when 'C'\n self.myDegrees = (self.myDegrees + 273.15)\n ...
40ff48c99290d8c8f0eb9309e5e8ba72
Returns the max value for the code, filtered by ID
[ { "docid": "fe94d08fe75c9f677186c297a58cd54f", "score": "0.740183", "text": "def features_max_with_id(code, data_id)\n features_with_id(code, data_id).collect {|ft| ft.value}.max\n end", "title": "" } ]
[ { "docid": "d422af9b58397adddf3677c715d76c46", "score": "0.7055191", "text": "def max\n\t\tcheckrecords = Labcentral.count\n\t\tif checkrecords == 0\n\t\t\tmaxvalue = \"CEN/1\"\n\t\telse\n\t\t maxid = Labcentral.maximum('id') + 1 #Maximum of Id \n maxvalue = \"CEN/\" + maxid.to_s()\n\t\tend\...
82d3b04ec275073b80df965cd7af758f
code your input_to_index and move method here!
[ { "docid": "28a75ae9f739641c56f63d995a982f70", "score": "0.0", "text": "def input_to_index(num)\n index= num.to_i\n index= index - 1\nend", "title": "" } ]
[ { "docid": "cbc59d25a99ba9f0daab01f5c0e0e6cf", "score": "0.78082955", "text": "def input_to_index(move)\n index = move.to_i - 1\nend", "title": "" }, { "docid": "2f317f684d596164f64a913b1d1827e5", "score": "0.7650569", "text": "def input_to_index(move)\n move.to_i - 1\nend", "t...
ed8c4ca546c7df16a963aa006a1c7633
Choose a fontawesome icon string for a particular phone type.
[ { "docid": "91d3365d3f782c3921c92b0bd46aa21d", "score": "0.83761734", "text": "def phone_icon_for(type)\n return 'fa fa-phone-square' if %w[voice hotline].include?(type)\n return 'fa fa-print' if type == 'fax'\n return 'fa fa-tty' if type == 'tty'\n return 'fa fa-mobile' if type == 'sms'\n ...
[ { "docid": "80381e2a62785a5b420551415fee0f77", "score": "0.6912056", "text": "def to_font_awesome_type\n @icon.split('.').first.strip\n end", "title": "" }, { "docid": "02be74281f510a565f5cc86779aa8dac", "score": "0.6498595", "text": "def fontawesome_icon(icon = \"\",...