query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Meat is: the last N elements (messages, frames) in this dicussion roll See discussion_roll_mail_setup for explanation of opts
def on_discussion_roll_reply(opts) discussion_roll_mail_setup(opts) if @last_post_video_only verb, suffix = "sent", "video" else verb, suffix = "replied to", nil end @subject = subject_for(@poster_string_name, opts[:all_participants] - [opts[:posting_participant], opts[:receiving_participant]], verb, suffix) mail :from => "\"Shelby Mail\" <#{Settings::Email.discussion_roll['from_email']}>", :reply_to => "\"No Reply\" <#{Settings::Email.discussion_roll['from_email']}>", :to => opts[:receiving_participant_email_address], :subject => @subject end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discussion_roll_mail_setup(opts)\n @roll = opts[:discussion_roll]\n @recipient_string_id = opts[:receiving_participant].is_a?(User) ? opts[:receiving_participant].id.to_s : opts[:receiving_participant]\n @poster_string_name = nickname_for_user_or_email(opts[:posting_participant])\n @token =...
[ "0.6880473", "0.60566413", "0.5451117", "0.5448007", "0.54281896", "0.54281896", "0.52653056", "0.520472", "0.51923686", "0.5179006", "0.51269937", "0.5115845", "0.5111747", "0.51058537", "0.5100928", "0.5091655", "0.5051228", "0.5049355", "0.5042337", "0.50351167", "0.502936...
0.5953292
2
Subject must be unique and identical every time an email is sent for a given discussion roll This way email clients can nicely group the emails into a conversation NB: conversation_with is an array of User's or Strings (of email addresses)
def subject_for(from_name, conversation_with, verb="sent", suffix="video") case conversation_with.count when 0 "#{from_name} #{verb} you #{suffix}" when 1 "#{from_name} #{verb} you and #{nickname_for_user_or_email(conversation_with[0])} #{suffix}" when 2 "#{from_name} #{verb} you, #{nickname_for_user_or_email(conversation_with[0])} and #{nickname_for_user_or_email(conversation_with[1])} #{suffix}" else others = conversation_with[0..1].map { |p| nickname_for_user_or_email(p) } .join(", ") "#{from_name} #{verb} you, #{others} and #{pluralize(conversation_with.count-2, 'other')} #{suffix}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject\n self['subject'] || msg['subject']\n end", "def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connection.query(:xhdr, \"Subject\", range) do |status, data|\r\n if status[:code] == 221\r\n data.each do |line|\r\n message = Messag...
[ "0.62099266", "0.6137692", "0.60429883", "0.6023133", "0.5955242", "0.5950656", "0.58755374", "0.5761514", "0.57363385", "0.5670635", "0.5630169", "0.5601224", "0.5554262", "0.5551899", "0.5541676", "0.55005705", "0.54910916", "0.5460439", "0.54589164", "0.5450336", "0.538021...
0.6402764
0
Sets up the variables needed by the templates (and other common setup stuff) Expected opts: discussion_roll: the roll itself posting_participant: the UserObject of the person who created this dicussion roll receiving_participant: the UserObject or email address (as a String) of the person to whom this email is being sent receiving_participant_email_address: the email address (as a String) of the person to whom this email is being sent all_participants: an array (of UserObjects and/or email addresses as Strings) of everybody participating in this conversation this array includes both posting_participant and receiving_participant token: the cryptographic token used in links to grant access
def discussion_roll_mail_setup(opts) @roll = opts[:discussion_roll] @recipient_string_id = opts[:receiving_participant].is_a?(User) ? opts[:receiving_participant].id.to_s : opts[:receiving_participant] @poster_string_name = nickname_for_user_or_email(opts[:posting_participant]) @token = opts[:token] @permalink = "http://shelby.tv/mail/#{@roll.id}?u=#{CGI.escape(@recipient_string_id)}&t=#{CGI.escape(CGI.escape(@token))}" sendgrid_category Settings::Email.discussion_roll["category"] sendgrid_ganalytics_options(:utm_source => 'discussion_roll', :utm_medium => 'notification', :utm_campaign => "roll_#{@roll.id}") # Displaying context for the most recent frame only most_recent_frame = Frame.where(:roll_id => @roll.id).order(:score.desc).first @conversation_elements = conversation_elements_for([most_recent_frame], Settings::Email.discussion_roll['max_element_count']) # get the latest message from the latest frame, use that to determine if last posting was video-only most_recent_message = most_recent_frame.conversation.messages[-1] @last_post_video_only = !most_recent_message or most_recent_message.text.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_discussion_roll_creation(opts)\n discussion_roll_mail_setup(opts)\n\n # for initial roll creation, always calling out video aspect\n verb, suffix = \"sent\", \"video\"\n @subject = subject_for(@poster_string_name, opts[:all_participants] - [opts[:posting_participant], opts[:receiving_participant...
[ "0.65610695", "0.5546389", "0.52903676", "0.5288021", "0.5283603", "0.52437615", "0.52013147", "0.51456064", "0.51084447", "0.50973094", "0.5045929", "0.5034437", "0.5026867", "0.5018252", "0.4999274", "0.49959782", "0.49862295", "0.49790576", "0.4969466", "0.49646065", "0.49...
0.7382127
0
Use callbacks to share common setup or constraints between actions.
def set_entrega @entrega = Entrega.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Only allow a trusted parameter "white list" through.
def entrega_params params.require(:entrega).permit(:user_id, :solicitud_id, :user_id, :peso, :estadoresiduo, :oferta_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.71213365", "0.70527846", "0.6947171", "0.6901663", "0.67342883", "0.6717481", "0.668679", "0.667654", "0.6660948", "0.655484", "0.6525947", "0.64567953", "0.64502525", "0.6450165", "0.6446098", "0.6433068", "0.64118934", "0.64118934", "0.63903046", "0.6379847", "0.6379847"...
0.0
-1
se valida que el usuario actual sea recolector
def es_recolector if current_user.rol != 2 render json: {entrega: ["Operación no permitida para este rol de usuario"]}, status:401 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_usuario\n if current_usuario.tipo!='Administrador' || !current_usuario.activo\n redirect_to root_path\n end\n end", "def valida_usuario(correo, clave)\n data = Usuario.find_by(correo: correo, estado: ACTIVO, validado: VALIDADO)\n if data.blank?\n data1 = Usuario.find_b...
[ "0.6663286", "0.6659733", "0.66234523", "0.6526606", "0.62778205", "0.6246215", "0.6141433", "0.61207277", "0.61178446", "0.6086974", "0.6054923", "0.60480297", "0.60229635", "0.6002066", "0.59916514", "0.5989791", "0.5957678", "0.59379476", "0.5937551", "0.59356844", "0.5931...
0.5732455
39
se valida que el usuario sea propietario la entrega
def es_propietario set_entrega if @entrega.recolector != current_user render json: {entrega: ["No permitido para este usuario"]}, status:401 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_usuario\n if current_usuario.tipo!='Administrador' || !current_usuario.activo\n redirect_to root_path\n end\n end", "def validate_user \n errors.add(:user_id, 'user not presence') if User.find_by_id( self[:user_id] ) == nil\n end", "def validate_user\n errors.add(:user_i...
[ "0.6931838", "0.66709185", "0.6650675", "0.65705127", "0.6567209", "0.65503603", "0.6534783", "0.64886314", "0.64223063", "0.6413416", "0.6395836", "0.63747686", "0.63519466", "0.6345063", "0.6313635", "0.6307421", "0.62899977", "0.6287115", "0.6274331", "0.62426823", "0.6235...
0.6411987
10
Return Jonathans Twitter handle (i.e. the string "jonnyt") return users["Jonathan"][:twitter] Return Eriks hometown return users["Erik"][:home_town] Return the array of Eriks favorite numbers return users["Erik"][:favourite_numbers] Return the type of Avrils pet Colin users["Avril"][:pets]["colin"] Return the smallest of Erik's favorite numbers users["Erik"][:favourite_numbers].min Return an array of Avril's favorite numbers that are even
def evil_even_numbers(array_of_numbers) result = [] for number in array_of_numbers result.push(number) if(number % 2 == 0) end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user\n t = []\n ville = nom_ville\n\t\tville.each do |i|\n\t\t\tCLIENT.search(i).take(1).collect do |tweet|\n\t\t\t\tt.push(\"#{tweet.user.screen_name}\") \n\n\t\t\tend\n\t\t end\n\treturn t\nend", "def search_user(q)\n uri = \"https://api.twitter.com/1/users/search.json\"\n req = Typ...
[ "0.6199478", "0.59936893", "0.5949688", "0.5946414", "0.5847193", "0.5830048", "0.58209336", "0.5804246", "0.5681631", "0.5629093", "0.56256247", "0.562277", "0.56133693", "0.5611967", "0.56002957", "0.55331665", "0.55157465", "0.5496238", "0.5491353", "0.5489689", "0.5485701...
0.0
-1
GET /bergains/1 GET /bergains/1.json
def show @bergain = Bergain.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @bergain } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |f...
[ "0.72172624", "0.6625857", "0.6453416", "0.6446549", "0.6427885", "0.62696743", "0.6237457", "0.62229455", "0.6160867", "0.6137986", "0.6111228", "0.6093415", "0.60214454", "0.60139537", "0.6012164", "0.6005217", "0.59974134", "0.59900033", "0.59863573", "0.5977173", "0.59686...
0.6414556
6
GET /bergains/new GET /bergains/new.json
def new @bergain = Bergain.new respond_to do |format| format.html # new.html.erb format.json { render json: @bergain } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @basin = Basin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basin }\n end\n end", "def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end", "def ...
[ "0.729829", "0.7133235", "0.7116263", "0.7106272", "0.7104648", "0.70694786", "0.7067647", "0.7067647", "0.70175403", "0.69936925", "0.69935673", "0.6982095", "0.6941733", "0.6941733", "0.69229543", "0.691325", "0.69090563", "0.69029844", "0.68808866", "0.6870423", "0.6848309...
0.69288456
15
POST /bergains POST /bergains.json
def create @bergain = Bergain.new(params[:bergain]) respond_to do |format| if @bergain.save format.html { redirect_to @bergain, notice: 'Bergain was successfully created.' } format.json { render json: @bergain, status: :created, location: @bergain } else format.html { render action: "new" } format.json { render json: @bergain.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bergain = Bergain.new(params[:bergain])\n\n respond_to do |format|\n if @bergain.save\n format.html { redirect_to seller_bergains_url, notice: 'Bergain was successfully created.' }\n format.json { render json: @bergain, status: :created, location: @bergain }\n else\n ...
[ "0.64310306", "0.62091416", "0.6161791", "0.61363834", "0.6091899", "0.60626626", "0.5945299", "0.58681184", "0.58609897", "0.58495086", "0.58217216", "0.5803162", "0.57946414", "0.5791383", "0.5776417", "0.57703596", "0.5770161", "0.57658577", "0.5750607", "0.57414186", "0.5...
0.60661095
5
PUT /bergains/1 PUT /bergains/1.json
def update @bergain = Bergain.find(params[:id]) respond_to do |format| if @bergain.update_attributes(params[:bergain]) format.html { redirect_to @bergain, notice: 'Bergain was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @bergain.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.e...
[ "0.6157716", "0.6148664", "0.59884095", "0.5978622", "0.59205586", "0.59054434", "0.5889828", "0.58284706", "0.5823825", "0.58017004", "0.5775168", "0.5769116", "0.57621264", "0.57563853", "0.5749602", "0.57227343", "0.57035214", "0.5693564", "0.56874055", "0.56814146", "0.56...
0.5630421
26
DELETE /bergains/1 DELETE /bergains/1.json
def destroy @bergain = Bergain.find(params[:id]) @bergain.destroy respond_to do |format| format.html { redirect_to bergains_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @basin = Basin.find(params[:id])\n @basin.destroy\n\n respond_to do |format|\n format.html { redirect_to basins_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aos...
[ "0.7010904", "0.6948655", "0.6948579", "0.6903388", "0.6857917", "0.68468", "0.68303293", "0.6809724", "0.67643577", "0.6750448", "0.6746637", "0.67357963", "0.67311996", "0.6713396", "0.6712906", "0.6710447", "0.6694126", "0.66836226", "0.66836226", "0.66836226", "0.66836226...
0.6936367
3
called by from_mongo and to_mongo
def mongo_encode(doc, pattern, replacement, date_conv) if doc.is_a? Hash doc.keys.each do |key, value| new_key = key if key.is_a?(String) && key =~ pattern new_key = key.sub(pattern, replacement) doc[new_key] = value doc.delete key end mongo_encode(value, pattern, replacement, date_conv) ensure_date_encoding(value, doc, new_key, date_conv) doc[new_key] = value.to_s if value.is_a? Symbol end elsif doc.is_a? Array doc.each_with_index do |entry, i| mongo_encode(entry, pattern, replacement, date_conv) ensure_date_encoding(entry, doc, i, date_conv) doc[i] = entry.to_s if entry.is_a? Symbol end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mongoize(object)\n object.mongoize\n end", "def to_bson\n end", "def mongoize\n self\n end", "def mongoize(object)\n case\n when object.is_a?(Mongoid::Snappy) then object.mongoize\n when object.is_a?(String) then Mongoid::Snappy.new(object).mongoize...
[ "0.7504447", "0.7148762", "0.71047854", "0.69025415", "0.689388", "0.6807194", "0.676496", "0.67459154", "0.6657754", "0.6657754", "0.6657754", "0.6623584", "0.6592588", "0.6592588", "0.65590405", "0.65503675", "0.65356696", "0.65197194", "0.65102273", "0.64719474", "0.644007...
0.5941079
61
Metodo toString para mostrar por pantalla los atributos de la clase
def to_s resp = "\nNombre: #{name} \tNivel: #{combat_level}" if(level_change_against_cultist_player != 0) resp += "\nNivel contra sectarios: " + get_level_change_against_cultist_player.to_s end resp += "\nNiveles que ganas: #{get_levels_gained}" + "\tTesoros que ganas: #{get_treasures_gained}" + "\nMal rollo: " + bad_consequence.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n attrs = self.class.attributes.map do |attr|\n \"#{attr.name}=#{self.send(attr.name)}\"\n end.join(', ')\n\n \"[#{self.class.name.split('::').las...
[ "0.7785011", "0.73436695", "0.7208078", "0.7178978", "0.71743774", "0.71575946", "0.71259165", "0.71105665", "0.71084696", "0.7095903", "0.70790386", "0.7041087", "0.7033364", "0.7011339", "0.7009532", "0.69794756", "0.69698477", "0.69430345", "0.69430345", "0.6900666", "0.68...
0.0
-1
return a string in 20110131 format
def get_report_date(folder) last_day = Time.parse('2011-01-01') Dir["#{folder}/*.pdf"].each do |pdf| #puts pdf filename = File.basename(pdf).gsub('.pdf', '') fs = filename.split(' ') store_name = fs[0] dt = fs[-1] dt.gsub!('W', '') dt.gsub!('M', '') #puts dt dt = Time.parse(dt) last_day = dt if last_day < dt end date = last_day.strftime('%Y-%m-%d') return date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"#{year}-#{month.to_s.rjust(2, '0')}\"\n end", "def to_s\n # TODO this breaks the minus spec: strftime\n format \"#{year}-%02d-%02d\", month, day\n end", "def to_s\n \"#{'%04i' % year}-W#{'%02i' % index}\"\n end", "def to_s; \"%d-%02d\" % [@years, @months.abs] end", "def ...
[ "0.7127143", "0.6813594", "0.65019214", "0.64365053", "0.6415714", "0.6340493", "0.6331461", "0.6281235", "0.6281235", "0.6270653", "0.6183252", "0.61451316", "0.6118995", "0.6087823", "0.6057231", "0.6049389", "0.60398704", "0.60333294", "0.6009941", "0.60094005", "0.5909470...
0.0
-1
missing_credentials? This is written a little strangely because we can't modify the object inplace due to frozen strings used in rspec stubs. Thus, the Hash and Array cases reassign their contents, while the String case returns a new String.
def fix_encoding!(thing) case thing when Net::LDAP::Entry thing.each_attribute do |k| fix_encoding!(thing[k]) end when Hash thing.each_pair do |k, v| thing[k] = fix_encoding!(v) end when Array thing.collect! do |v| fix_encoding!(v) end when String sanitize_utf8(thing) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_no_credentials?\n self.crypted_password.blank?\n end", "def has_no_credentials?\n self.crypted_password.blank?\n end", "def has_no_credentials?\n self.crypted_password.blank?\n end", "def has_no_credentials?\n self.crypted_password.blank?\n end", "def has_no_credentials?\n self...
[ "0.53770965", "0.53770965", "0.53770965", "0.53770965", "0.53732276", "0.526923", "0.52112097", "0.5132489", "0.5093035", "0.50769085", "0.5061003", "0.5009931", "0.49911276", "0.49191004", "0.48835012", "0.48788288", "0.4862283", "0.48146164", "0.48101696", "0.47783664", "0....
0.0
-1
Push a value onto the stack
def push(asset) # IMPLEMENT ME! @data = LinkedListNode.new(asset, @data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(value)\n return \"Stack is full\" if is_full\n\n @stack.push(value)\n @current_size += 1\n end", "def add(value)\n @stack.push(value)\n end", "def push(x)\n @stack << x \n end", "def push(x)\n @stack << x\n end", "def push(x)\n @stack.push(x)\n end", "def push(val...
[ "0.8563555", "0.8531257", "0.8298897", "0.82781947", "0.8205244", "0.81969625", "0.8174969", "0.8150769", "0.81474", "0.81396604", "0.80902964", "0.80648404", "0.795523", "0.79373324", "0.79243076", "0.79227865", "0.79042894", "0.78440315", "0.78257644", "0.7730317", "0.77155...
0.0
-1
Pop an item off the stack. Remove the last item that was pushed onto the stack and return the value to the user
def pop # I RETURN A VALUE case object when condition @data nil then return print "nil\n" else print "{@data.asset}\n" @data = @data.next_node end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop()\n return \"Stack is empty\" if is_empty\n\n temp = @stack[-1]\n @stack.delete_at(-1)\n @current_size -= 1\n\n return temp\n end", "def pop()\n @stack.pop\n end", "def pop()\n\t\t@stack.pop\n\tend", "def pop()\n # if the stack is empty, return nil\n # (it would also b...
[ "0.8281595", "0.8271597", "0.82563424", "0.8236934", "0.82280934", "0.82206804", "0.8207868", "0.81872433", "0.8170618", "0.81693214", "0.8160252", "0.8160252", "0.81491375", "0.8129435", "0.8104122", "0.81022996", "0.81022996", "0.8091357", "0.80838317", "0.80675715", "0.805...
0.0
-1
Play Hangman from initial options
def play display_welcome while true choice = get_menu_choice choice_result = handle_menu_choice choice break if choice_result == :quit end puts "Thanks for playing Hangman :-) Play again soon." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n puts \"Welcome to the Hangman game. You will need 2 players.\"\n\n h = Hangman.new # this creates a new instance of the game\n h.getWord\n h.welcomePlayer2\n\n h.startGuess\n\n #h.displayHangman\n\nend", "def introduce_the_game\n @irc_server.puts \"Welcome to hangman!\"\n @irc_server.puts \"To g...
[ "0.69504535", "0.66483015", "0.63478583", "0.6293502", "0.6260353", "0.6097988", "0.6094184", "0.608561", "0.603234", "0.6023287", "0.5988306", "0.59870327", "0.59004456", "0.58870834", "0.5858443", "0.58269334", "0.58191603", "0.5811835", "0.5808089", "0.57792044", "0.577808...
0.63702863
2
Play a game of hangman (offering the opportunity to save the game)
def play_game while true @view.display_game_state(@word, @misses, @hits, @guesses_left) break if game_over? guess = get_guess break if guess == :save update_game_state guess end save_game if guess == :save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hangman\n game = Game.new\n game.new_or_load\n hangman if game.play_again\nend", "def start_game\n Dir.mkdir(\"save\") unless Dir.exists? \"save\"\n puts \"\"\n puts \"Welcome to Hangman!\"\n puts \"\"\n game_choice\n puts \"\"\n puts \"Try to guess the secret word. You have #{@guesse...
[ "0.81919104", "0.7544899", "0.74681777", "0.7465632", "0.7420688", "0.73773915", "0.7345595", "0.7342244", "0.73275864", "0.7320259", "0.7318772", "0.7302483", "0.72825", "0.72774035", "0.7251603", "0.72477084", "0.7235299", "0.7227015", "0.71524835", "0.7150582", "0.7135166"...
0.7818824
1
One time welcome message
def display_welcome puts "\t**************************" puts "\t*** Welcome To Hangman ***" puts "\t**************************" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome\n puts message_list[:welcome]\n # help\n end", "def welcome\r\n end", "def magic_welcome(event)\n # TODO: Ditch this call to report - move to report lib if necessary\n report \"#{event.from} welcome message: #{event.message}\"\n if (event.message =~ /(\\S+)!\\S+$/)\n @me = $1\...
[ "0.81495315", "0.7845505", "0.77892077", "0.7655088", "0.7621176", "0.7612295", "0.7593349", "0.7572082", "0.75670177", "0.7547656", "0.75437343", "0.7487602", "0.7476015", "0.7461549", "0.7376549", "0.7371658", "0.732853", "0.730973", "0.7309636", "0.7286397", "0.7285762", ...
0.7348568
16
Display main menu and get user's choice
def get_menu_choice choices = ["1. Play Hangman", "2. Load Saved Game", "3. Delete Saved Game", "4. List Saved Games", "5. Quit"] display_menu choices while true print "Enter Selection (1 - #{ choices.length }): " choice = gets.chomp.to_i return choice if choice.between?(1, choices.length) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_menu\n menu = [\n \"My Stats\",\n \"My Hikes\",\n \"Trails\",\n \"Quit\"]\n choice = nil\n while choice != \"Quit\"\n system 'clear'\n puts \"------MAIN MENU------\"\n choice = @prompt.select(\"What would you...
[ "0.82655966", "0.8160552", "0.815049", "0.8035662", "0.79972625", "0.7969904", "0.7906896", "0.7879877", "0.78299826", "0.78025043", "0.7754544", "0.77469045", "0.7730747", "0.76848626", "0.76721317", "0.76662695", "0.76249343", "0.76230127", "0.76120925", "0.76106876", "0.75...
0.0
-1
Display the main menu
def display_menu choices menu_array = ["\nHangman Options", "==============="] + choices menu_array.each { |menu| puts menu } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main()\n main_menu(SHOW_HEADER);\n end", "def display_main_menu(clear_screen = false)\n clear if clear_screen\n title_header(TITLES[:main_menu],\"_\",\"-\",false)\n\n Api.main_topics.each_with_index do |type, i|\n puts \"#{(\" \" * (PROFILE_SIDE / 2))}#...
[ "0.83937234", "0.8151924", "0.7955263", "0.78879446", "0.7859454", "0.7824178", "0.7810328", "0.77719575", "0.775094", "0.7699558", "0.76984763", "0.7619968", "0.7614419", "0.75906056", "0.7428091", "0.7362183", "0.73243356", "0.7318705", "0.73004526", "0.7291751", "0.7259528...
0.0
-1
Controller that calls the appropriate method based on the user's choice
def handle_menu_choice choice case choice when 1 then setup_game; play_game when 2 then load_game when 3 then delete_game when 4 then list_games when 5 then return :quit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_choice(choice)\n case choice\n when \"GET\" then get_choice\n when \"POST\" then post_choice\n when \"EXIT\" then @runs = false\n end\n end", "def make method\n if params.include?(:user)\n @payment_type_id = params[:user][:payment_type_id].to_i\n @form_url = @user.subscri...
[ "0.62969303", "0.62649393", "0.6223896", "0.619273", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175284", "0.6175221", "0.6121161", "0.61141604", "0.60795707", "0.60795707", "0.60608786", "0.60061574...
0.5381409
91
Intialize instance variables for a new game of Hangman
def setup_game @word = get_word.upcase @misses = [] @hits = [] @guesses_left = 10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n\t\tsystem \"clear\"\n\t\tputs \"Lets play hangman!\"\n \t\t@guess_count = 0\n \t\t@game_status = false\n \t\t@guessed_letters=[]\n \t\t@guessing_word=[]\n \tend", "def initialize\n @e_tanks = 4\n\n # alive (true) ; defeated (false)\n @bubble_man = false\n @air_man = false\n @quick...
[ "0.7327131", "0.7277354", "0.7059402", "0.701629", "0.69521576", "0.69360846", "0.68813413", "0.6866532", "0.68251973", "0.67986506", "0.6783143", "0.6746939", "0.67460454", "0.67450684", "0.6744188", "0.67381465", "0.67189497", "0.6708105", "0.67072695", "0.6679388", "0.6649...
0.69991446
4
Get a random word to be guessed during the Hangman game
def get_word begin File.readlines(DICTIONARY_FILENAME). select { |word| word.length.between?(6, 13) }.sample.chomp rescue puts "Unable to read from file '#{ DICTIONARY_FILENAME }'." nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guessed_word()\r\n\t\tresult = ''\r\n\r\n\t\t# TODO: fill in method body\r\n\t\t\r\n\t\treturn result\r\n\tend", "def get_word\n @word_to_guess.join\n end", "def random_word\n @words.fetch(rand(@words.length)).chomp\n end", "def random_word\n\t\tnumber = rand(@modified_dictionary.length)\n\t\t@mo...
[ "0.79652137", "0.77442485", "0.7551", "0.7517821", "0.7436595", "0.74268794", "0.74098486", "0.7365595", "0.7346129", "0.7307494", "0.7298214", "0.7283181", "0.72830784", "0.72780216", "0.7243165", "0.7234417", "0.72233987", "0.72081923", "0.7200267", "0.71997267", "0.7172983...
0.0
-1
Check if a game is over
def game_over? if @guesses_left <= 0 message_then_enter "\nSorry. No more guesses left."\ " The word was '#{ @word.capitalize }'." true elsif @word.split('').uniq.length == @hits.length message_then_enter "\nCongratulations...You got the word." true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_over?\n true\n end", "def over?\n \t@game_over = true\n end", "def gameIsOver\n\t\treturn frameNumber() > @lastFrameNumber\n\tend", "def game_is_over?\n (won? || draw? || full?) ? true : false\n end", "def game_over\n end", "def game_over?\n @game_over\n end", "de...
[ "0.880287", "0.8793957", "0.8166979", "0.81439126", "0.8086534", "0.80566823", "0.8043429", "0.80311227", "0.802161", "0.8012648", "0.79414487", "0.7906905", "0.78784204", "0.7869737", "0.78446007", "0.7836964", "0.77970713", "0.77834433", "0.7761446", "0.7751275", "0.7745889...
0.0
-1
After a guess is made, make appropriate changes to the game state
def update_game_state guess if @word.include?(guess) @hits << guess else @misses << guess @guesses_left -= 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computer_guess_turn\n feedback_engine\n sleep 2.5\n puts \"The computer is thinking...\"\n computer_change_guess\n puts \"Guess Board: #{@guess_board.state}\"\n end", "def guess\n state, cell, value = @alternatives.pop\n grid.set(state)\n cell.value = value \n true\...
[ "0.71898717", "0.71877104", "0.7121402", "0.7099333", "0.7031077", "0.69804436", "0.6976921", "0.6946356", "0.6824474", "0.6824474", "0.67830676", "0.67822546", "0.67692757", "0.6751864", "0.6747637", "0.6732397", "0.67163473", "0.6702852", "0.66795653", "0.66727126", "0.6662...
0.75073177
0
Get guess from the player (one letter) or 'save' to save the game
def get_guess while true guess = gets.chomp.upcase return :save if guess == "SAVE" || guess == "'SAVE'" if guess.between?('A', 'Z') && guess.length == 1 if @hits.include?(guess) || @misses.include?(guess) print "You guessed '#{ guess }' already. Select another letter: " next end return guess end print "Enter one letter for guess (or 'save' to save game): " end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_guess\n puts \"Guess a letter that has not been chosen yet or type 'save' to save game\"\n @input = gets.chomp.downcase\n @guess = (input.match(/[a-z]/) && input.length == 1) || input == 'save' ? input : '-'\n end", "def solicit_guess\n\t\tputs \"\\nPlease input a letter!\"\n\t\tguess = ...
[ "0.8209502", "0.79731876", "0.7910549", "0.78682166", "0.7824495", "0.77333856", "0.77190953", "0.74309194", "0.73901296", "0.73671865", "0.72809607", "0.7272136", "0.7267714", "0.7241885", "0.7195924", "0.7174577", "0.7109691", "0.70436954", "0.69391716", "0.6894063", "0.686...
0.845249
0
Load a previously saved game and resume game play from last save
def load_game all_saved_games = yaml_load(SAVED_FILENAME) game_name = get_game_name(all_saved_games, "load") return if game_name.nil? saved_game = YAML::load(all_saved_games[game_name]) message_then_enter "'#{ game_name }' successfully loaded." saved_game.play_game end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_game_from_save\n #TODO implement game state saving and loading\n end", "def load_game\n print_saves\n begin\n read_save\n rescue IOError, SystemCallError\n puts 'File not found'\n load_game\n end\n end", "def load_game\n\t\tload_gameplay = YAML.load(File.read 'saved...
[ "0.8245479", "0.746118", "0.7306961", "0.7003685", "0.6923872", "0.691414", "0.6909892", "0.6898701", "0.6855149", "0.67154264", "0.6691955", "0.6690254", "0.6635174", "0.6621412", "0.659606", "0.6544891", "0.6535775", "0.65208215", "0.6451219", "0.6393642", "0.6388279", "0...
0.75375783
1
Get the name of a game (to load or delete) from the user
def get_game_name(all_saved_games, task) game_names = all_saved_games.keys while true print "Enter name of game to #{ task }: " game_name = gets.chomp return game_name if game_names.include? game_name next if yes_or_no "'#{ game_name }' doesn't exists; #{ task } another game" message_then_enter "You chose to not #{ task } any game." return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_name\n fetch('sword_art_online.game_name')\n end", "def name\n @game_info['name']\n end", "def game_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_game_name(@handle.ptr)\n result...
[ "0.7992116", "0.7918673", "0.7022698", "0.6999774", "0.6825105", "0.6824538", "0.6782793", "0.67799544", "0.6714476", "0.6689993", "0.66881275", "0.66365457", "0.66026074", "0.6596694", "0.657428", "0.6509314", "0.6434285", "0.6423771", "0.6407837", "0.6388779", "0.63652664",...
0.72639954
2
Delete a previously saved game
def delete_game all_saved_games = yaml_load(SAVED_FILENAME) game_name = get_game_name(all_saved_games, "delete") return if game_name.nil? all_saved_games.delete(game_name) yaml_save(SAVED_FILENAME, all_saved_games) message_then_enter "'#{ game_name }' successfully deleted." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_game\n\t\tclear\n\t\tget_username\n\t\tfile_name = get_saved_games\n\t\tif file_name != \"menu\"\n\t\t\tputs \"Are you sure you want to delete the game: \"+File.basename(file_name,\".setgame\")+\"?\"\n\t\t\tFile.delete(file_name) if gets.chomp.downcase[0]==\"y\"\n\t\tend\n\tend", "def delete_saved_gam...
[ "0.82256603", "0.8146937", "0.74158055", "0.734698", "0.7296928", "0.72785014", "0.71073985", "0.70227736", "0.7006533", "0.700581", "0.6992012", "0.69474924", "0.6904172", "0.6863012", "0.68444896", "0.6838989", "0.68306273", "0.6785475", "0.67705786", "0.6768806", "0.676880...
0.8515317
0
Save a game in progress
def save_game all_saved_games = yaml_load(SAVED_FILENAME) game_name = get_save_name(all_saved_games) return if game_name.nil? game_string = self.to_yaml all_saved_games[game_name] = game_string yaml_save(SAVED_FILENAME, all_saved_games) message_then_enter "'#{ game_name }' successfully saved." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_game\n\t\t# If current game was previously saved, delete the old version of current game...\n\t\tif @running_saved_game != nil\n\t\t\tover_write_data\n\t\tend\n\t\t# And add new version of current game to saved data\n\t\tFile.open(@path, 'a+') do |f|\n\t\t\t\tf.puts \"#{@word.join},#{@guess},#{@wrong_lett...
[ "0.75464237", "0.75269324", "0.7448396", "0.72396153", "0.72199243", "0.7209335", "0.71532375", "0.7134466", "0.7071716", "0.7052457", "0.6999557", "0.69832164", "0.69699836", "0.6964754", "0.6877685", "0.68243", "0.6781489", "0.6738818", "0.6719366", "0.66736895", "0.6663417...
0.69011414
14
Get the name that the game in progress will be saved as
def get_save_name all_saved_games game_names = all_saved_games.keys while true print "Enter name to save game as: " game_name = gets.chomp next if game_name == "" return game_name unless game_names.include? game_name return game_name if yes_or_no "'#{ game_name }' already exists. Overwrite it" next if yes_or_no "Save game with a different name" message_then_enter "You chose to not save this game." return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @game_info['name']\n end", "def generate_filename(game)\n \"./data/#{Time.now.to_i}#{game.json.gamestate.opponent}.yml\"\n end", "def current_player_name\n Player.find(player_turn).name unless player_turn.nil?\n end", "def game_name\n fetch('sword_art_online.game_name')\n ...
[ "0.6969733", "0.682412", "0.6627701", "0.65858066", "0.6514677", "0.6444092", "0.6444092", "0.6345322", "0.63022304", "0.62978303", "0.6293685", "0.6284822", "0.627947", "0.6272518", "0.6237412", "0.6233601", "0.6219157", "0.620106", "0.61439955", "0.61439955", "0.6137059", ...
0.6740965
2
List the names of all previously saved games
def list_games all_saved_games = yaml_load(SAVED_FILENAME) game_string = "Saved Games\n===========\n" all_saved_games.keys.each { |game_name| game_string += "#{ game_name }\n"} message_then_enter game_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_saved\n\t\tputs Dir.glob(\"./saved_games/*\")\n\tend", "def get_save_name all_saved_games\n\t\tgame_names = all_saved_games.keys\n\n\t\twhile true\n\t\t\tprint \"Enter name to save game as: \"\n\t\t\tgame_name = gets.chomp\n\t\t\tnext if game_name == \"\"\n\t\t\treturn game_name unless game_names.includ...
[ "0.7366903", "0.70876217", "0.66351086", "0.6621169", "0.63993144", "0.6335849", "0.612223", "0.6055781", "0.60381716", "0.6026532", "0.60247284", "0.5974726", "0.5961545", "0.59478503", "0.59443456", "0.59434617", "0.5940125", "0.59362316", "0.59320354", "0.59198046", "0.591...
0.8249531
0
Load the contents of a file and convert it to an object with YAML
def yaml_load(filename) begin YAML::load(File.read filename) rescue puts "Unable to read from file '#{ filename }'." nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yml_file_to_object(options={})\n content = read_file_content(options)\n YAML.load(content)\nend", "def load_yaml(filename); end", "def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end", "def loa...
[ "0.8233501", "0.78425264", "0.7704821", "0.76582724", "0.7563641", "0.7563641", "0.7485994", "0.74460703", "0.74125373", "0.7372754", "0.7353208", "0.73426557", "0.73119974", "0.7277625", "0.7262874", "0.7256929", "0.7235613", "0.72314256", "0.71865624", "0.7184676", "0.71521...
0.66756874
57
Use YAML to save an object to file
def yaml_save(filename, to_save) begin File.open(filename, 'w') do |file| file.write(to_save.to_yaml) end true rescue puts "Unable to save to file '#{ filename }'." nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\ne...
[ "0.8966893", "0.89403033", "0.89403033", "0.89403033", "0.89403033", "0.89403033", "0.89403033", "0.89403033", "0.887623", "0.887623", "0.88475907", "0.8830506", "0.8318458", "0.7803265", "0.7561209", "0.7365749", "0.7357892", "0.7340802", "0.7324636", "0.73052925", "0.729007...
0.66873497
46
Return boolean response to a yes/no question from the user
def yes_or_no(question) while true print (question + " (y/n): ") response = gets.chomp.strip.downcase if response == 'y' || response == 'yes' return true elsif response == 'n' || response == 'no' return false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yes_no reply\n\tif reply == 'yes'\n\t\treturn true\t\n\telsif reply == 'no'\n\t\treturn false\n\telse\n\t\tputs \"Please answer yes or no\"\n\t\treturn nil\n\tend\nend", "def ask_boolean(question)\n yes? ask(question, true, ['y/n'])\n end", "def yes? response \r\n case response\r\n when \"y\", ...
[ "0.81545484", "0.8104073", "0.79222196", "0.7786147", "0.77118903", "0.76959395", "0.7680339", "0.7675007", "0.7636174", "0.75534624", "0.7551895", "0.7536992", "0.75200266", "0.7425014", "0.7391339", "0.7389808", "0.7365121", "0.7350209", "0.728548", "0.72570896", "0.724554"...
0.76056576
9
Display a message to the user and wait for user input to continue
def message_then_enter(message) print(message += "\nPress Enter to continue...") gets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_restriction\n puts \"Enter a Valid Input To Continue!\".red\n sleep(2)\n end", "def wait(str='Press ENTER to continue.')\n puts\n self.warning(str)\n STDIN.gets\n end", "def wait_for_message\n message = gets.strip\n publish_message(@current_user, message)\n ...
[ "0.79984224", "0.773115", "0.76078093", "0.7595329", "0.7409753", "0.73368937", "0.7149752", "0.70927507", "0.696557", "0.6965026", "0.68973184", "0.6810682", "0.6808272", "0.674812", "0.67429453", "0.66967726", "0.66887504", "0.6683571", "0.66487956", "0.6647096", "0.6623625...
0.69861305
8
start function creat block
def create @block = Block.new(params[:block]) if @block.save redirect_to :controller=>"blocks",:action=>"index",:pageId=>params[:block]["pageId"] else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_block(arg_type , frame_type)\n @callable.create_block(arg_type ,frame_type)\n end", "def blocks() end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def blo...
[ "0.7125281", "0.6617578", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", "0.64229137", ...
0.0
-1
end function creat block
def edit @blockId = params[:id] @a=Block.select('blocks.*,block_contents.id as id1,block_contents."blockId",block_contents."section1",block_contents."section2",block_contents."section3",block_contents."section4",block_contents."quote1",block_contents."quote2",block_contents."quote3",block_contents."languageCode"'). joins('LEFT JOIN block_contents ON blocks.id = block_contents."blockId"').where("blocks.id=?",@blockId) @block = @a.find(@blockId) @page =Page.where("id=?",@block.pageId) @listLanguages = Language.all @listIcons =Icon.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end"...
[ "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.694858", "0.6744916", "0.6663996", "0.662...
0.0
-1
start function update block
def update @block = Block.find(params[:id]) @paramsBlock = {"pageId"=>params[:block]["pageId"],"blockName"=>params[:block]["blockName"],"isAlternative"=>params[:block]["isAlternative"],"picture"=>params[:block]["picture"],"active"=>params[:block]["active"] } if params[:block]["id1"]=='' @paramsBlockContent = {"blockId"=>@block.id,"section1"=>params[:block]["section1"],"section2"=>params[:block]["section2"],"section3"=>params[:block]["section3"],"section4"=>params[:block]["section4"],"quote1"=>params[:block]["quote1"],"quote2"=>params[:block]["quote2"],"quote3"=>params[:block]["quote3"],"languageCode"=>params[:block]["languageCode"]} @blockContent = BlockContent.new(@paramsBlockContent) @blockContent.save @msg = 'Successfully saved !' else @paramsBlockContent = {"section1"=>params[:block]["section1"],"section2"=>params[:block]["section2"],"section3"=>params[:block]["section3"],"section4"=>params[:block]["section4"],"quote1"=>params[:block]["quote1"],"quote2"=>params[:block]["quote2"],"quote3"=>params[:block]["quote3"],"languageCode"=>params[:block]["languageCode"]} @id = Integer(params[:block]["id1"]) @blockContent = BlockContent.find(@id) @blockContent.update_attributes(@paramsBlockContent) end @block.update_attributes(@paramsBlock) redirect_to :controller=>"blocks",:action=>"index", :pageId=>params[:block]["pageId"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update() end", "def update ; end", "def update()\n end", "def update(&block)\n instance_eval(&block)\n end", "def update\n ;\n end", "def update(&block)\n @update_block = block\n end", "def update; end", "def update; end", "def update; end", "def update; end", "...
[ "0.75045866", "0.7212294", "0.71131235", "0.7088026", "0.70759904", "0.70677996", "0.6914439", "0.6914439", "0.6914439", "0.6914439", "0.6914439", "0.6914439", "0.6914439", "0.6914439", "0.68635774", "0.6856793", "0.68547416", "0.6816258", "0.67826605", "0.66960627", "0.66634...
0.0
-1
end function update block
def destroy @block = Block.find(params[:id]) @block.destroy redirect_to :back end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update() end", "def update\n ;\n end", "def update ; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update;end", "def update\n \n end", "def update()\n...
[ "0.7681421", "0.7578545", "0.74766845", "0.73044056", "0.73044056", "0.73044056", "0.73044056", "0.73044056", "0.73044056", "0.73044056", "0.73044056", "0.72896594", "0.7232451", "0.71868455", "0.71471", "0.7109022", "0.7042136", "0.6928708", "0.6928708", "0.68815464", "0.686...
0.0
-1
Check if the cache is valid and useable.
def valid? @valid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_valid?\n return false unless File.exist?(cache_path)\n return true if checksum.nil?\n checksum == file_digest(cache_path)\n end", "def cacheable?\n return false unless CACHEABLE_RESPONSE_CODES.include?(status)\n return false if cache_control.no_store? || cache_control.privat...
[ "0.7752887", "0.726279", "0.7220659", "0.7124914", "0.7010389", "0.6915741", "0.690005", "0.6873399", "0.6850447", "0.6757166", "0.67429966", "0.6697123", "0.6669442", "0.66629434", "0.6638964", "0.66243976", "0.6589056", "0.6575784", "0.656864", "0.6560738", "0.6557314", "...
0.0
-1
Remove all cached resources and empty out the cache directory.
def purge! return false unless valid? autorelease_pool do Dir.foreach(@cache_path) do |entry| path = File.join(@cache_path, entry) File.unlink(path) if File.file? path end end true rescue SystemCallError false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_all\n FileUtils.rm_rf(CACHE_DIR)\n end", "def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are ...
[ "0.8316178", "0.81105113", "0.7569809", "0.74797946", "0.74797946", "0.7470338", "0.7470338", "0.7457585", "0.74457014", "0.7442326", "0.73289967", "0.724199", "0.72192335", "0.71591246", "0.71524704", "0.71466404", "0.7133023", "0.7088302", "0.699119", "0.69715077", "0.69691...
0.0
-1
Compact the cache by removing resources which are no longer referenced. Internally this works by checking the hardlinke count of all files inside the cache directory and removing all with a link count less than 2.
def compact! return false unless valid? autorelease_pool do Dir.foreach(@cache_path) do |entry| path = File.join(@cache_path, entry) File.unlink(path) if File.stat(path).nlink < 2 end end true rescue SystemCallError false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_unnecessary_cache_files!\n current_keys = cache_files.map do |file|\n get_cache_key_from_filename(file)\n end\n inmemory_keys = responses.keys\n\n unneeded_keys = current_keys - inmemory_keys\n unneeded_keys.each do |key|\n File.unlink(filepath_for(key))\n end...
[ "0.68260294", "0.67973644", "0.67063093", "0.6537052", "0.6520091", "0.6439185", "0.6439185", "0.6398989", "0.630482", "0.6251173", "0.61982805", "0.61875933", "0.6181617", "0.6145845", "0.6016775", "0.59843755", "0.5905372", "0.58984494", "0.58150476", "0.58121455", "0.57884...
0.6766417
2
Check if the cache contains the resource at +path+. If found the original file at +path+ will be replaced my a hardlink to the cached resource. If not found a hardlink for the file at +path+ will be created in the cache for future use.
def cache_resource( path ) resource_hash = compute_hash(path) return true if find_resource(resource_hash) copy_resource(resource_hash, path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_resource( resource_hash, path )\n # NOTE: the whole caching assumes that two files with the same\n # resource hash contain the same data.\n cache_path = find_resource(resource_hash)\n unless cache_path.nil?\n File.unlink(cache_path)\n end\n\n cache_path = File.join(@cache_path, \"...
[ "0.695947", "0.6684801", "0.6523238", "0.6331892", "0.6022272", "0.59683704", "0.59377813", "0.59205884", "0.5918271", "0.59041023", "0.5879262", "0.5871114", "0.58165413", "0.5809605", "0.5798855", "0.5798588", "0.5755671", "0.5747455", "0.5725216", "0.5720542", "0.5719726",...
0.80705315
0
Compute a unique hash of the file contents at +path+ and return it in string form.
def compute_hash( path ) res = '0' autorelease_pool { res = NSData.sha1FromContentsOfFile(path) } res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def sha1(path)\n result = nil\n chunk_size = 10240\n File.open(path, \"r\") do |file|\n sha1 = Digest::SHA1.new\n\n while true\n chunk = file.read chunk_size\n break if ! chunk\n sha1.update chunk\n...
[ "0.7501175", "0.7312052", "0.7267653", "0.72653913", "0.71541595", "0.71220833", "0.70308334", "0.69989717", "0.696551", "0.6824768", "0.68020064", "0.6737963", "0.6672756", "0.66539884", "0.66484284", "0.66211677", "0.6500485", "0.6477016", "0.64415014", "0.64311135", "0.642...
0.7791914
0
Locate a resource file given it's resource hash.
def find_resource( resource_hash ) return nil unless valid? Dir.glob(File.join(@cache_path, "#{resource_hash}.*")).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_file(resource_directory, file)\n file_path = File.join resource_directory, file\n if File.exists?(file_path)\n file_path\n end\n end", "def locate(spec)\n spec = Artifact.to_hash(spec)\n File.join(local, spec[:group].split('.'), spec[:id...
[ "0.65337414", "0.610796", "0.60067755", "0.5930381", "0.59193987", "0.58928114", "0.58445406", "0.58109325", "0.5767511", "0.565055", "0.5646835", "0.5601913", "0.5583527", "0.5553507", "0.5553507", "0.554553", "0.5500834", "0.5497419", "0.54793996", "0.54537815", "0.5435223"...
0.7689201
0
Copy the file at +path+ into the cache using +resource_hash+ as the storage id. Internally the cache will be checked for an existing file matching +resource_hash+. If found this file will first be unlinked. Following this check a hardlink between the cache file and the original located at +path+ is created.
def copy_resource( resource_hash, path ) # NOTE: the whole caching assumes that two files with the same # resource hash contain the same data. cache_path = find_resource(resource_hash) unless cache_path.nil? File.unlink(cache_path) end cache_path = File.join(@cache_path, "#{resource_hash}#{File.extname(path)}") File.link(path, cache_path) true rescue SystemCallError false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end", "def cache_file(file)\n FileUtils.cp(file, path)\n end", "def copy_file(file_id, destination)\n synchronize do\n if cach...
[ "0.7250869", "0.57528096", "0.5703945", "0.56016165", "0.5565846", "0.55129224", "0.530239", "0.52865165", "0.5244784", "0.51926225", "0.51596266", "0.51512223", "0.50620484", "0.5013486", "0.49482006", "0.48527953", "0.48388007", "0.48222888", "0.4775096", "0.47533083", "0.4...
0.8058952
0
GET /vargessos GET /vargessos.json
def index @vargessos = Vargesso.where(user_id: current_user.id).order("id DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end", "def get_varrays(auth=nil, cert=nil)\n\t\trest_get(\"#{@base_url}/vdc/varrays\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : ce...
[ "0.64268935", "0.6408409", "0.6053613", "0.59624565", "0.5887085", "0.58649427", "0.58516276", "0.58437115", "0.5841745", "0.58327943", "0.57882595", "0.5788078", "0.57863945", "0.5784141", "0.5768851", "0.57620144", "0.57511187", "0.5723649", "0.570875", "0.5700527", "0.5691...
0.5629968
25
GET /vargessos/1 GET /vargessos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end", "def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { rend...
[ "0.61151934", "0.6101978", "0.5954104", "0.59473556", "0.5937285", "0.5887393", "0.5887393", "0.5849227", "0.583295", "0.58254546", "0.5817063", "0.5804472", "0.5797435", "0.5781924", "0.5781307", "0.5770215", "0.57589144", "0.5754593", "0.5732095", "0.5721557", "0.57181025",...
0.0
-1
POST /vargessos POST /vargessos.json
def create @vargesso = current_user.vargessos.build(vargesso_params) respond_to do |format| if @vargesso.save format.html { redirect_to @vargesso, notice: 'Vargesso was successfully created.' } format.json { render :show, status: :created, location: @vargesso } else format.html { render :new } format.json { render json: @vargesso.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vargesso_params\n params.require(:vargesso).permit(:user_id, :ano, :profundidade, :areaAplicacao, :teorCalcio)\n end", "def create\n @varience = Varience.new(varience_params)\n\n respond_to do |format|\n if @varience.save\n format.html { redirect_to @varience, notice: 'Varience was ...
[ "0.6051926", "0.58743495", "0.5856221", "0.58055484", "0.5707497", "0.57014376", "0.5692925", "0.5636187", "0.5629566", "0.5624502", "0.56223667", "0.55535567", "0.55518776", "0.5546741", "0.5546592", "0.5546083", "0.54289407", "0.5424694", "0.5424501", "0.5416451", "0.537002...
0.6568733
0
PATCH/PUT /vargessos/1 PATCH/PUT /vargessos/1.json
def update respond_to do |format| if @vargesso.update(vargesso_params) format.html { redirect_to @vargesso, notice: 'Vargesso was successfully updated.' } format.json { render :show, status: :ok, location: @vargesso } else format.html { render :edit } format.json { render json: @vargesso.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_pat...
[ "0.66866046", "0.64722985", "0.6425174", "0.64218205", "0.63731396", "0.61969095", "0.6184843", "0.61606044", "0.6082787", "0.60651094", "0.60651094", "0.6016754", "0.6015713", "0.6001262", "0.59550464", "0.59550464", "0.5949379", "0.59020805", "0.58992594", "0.58915335", "0....
0.58184236
25
DELETE /vargessos/1 DELETE /vargessos/1.json
def destroy @vargesso.destroy respond_to do |format| format.html { redirect_to vargessos_url, notice: 'Vargesso was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standa...
[ "0.7290173", "0.6924094", "0.691229", "0.6852584", "0.6816154", "0.68042594", "0.67901915", "0.6726434", "0.66569155", "0.6648823", "0.6609653", "0.6606347", "0.66030306", "0.6594429", "0.65860224", "0.6576126", "0.6555466", "0.6549432", "0.65465164", "0.6537066", "0.65230995...
0.66861373
8
Use callbacks to share common setup or constraints between actions.
def set_vargesso @vargesso = Vargesso.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def vargesso_params params.require(:vargesso).permit(:user_id, :ano, :profundidade, :areaAplicacao, :teorCalcio) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
slices this one works
def new_hq_slice_attributes=(hq_slice_attributes) hq_slice_attributes.each do |attributes| hq_slices.build(attributes) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice *args\n b, l = get_beginning_and_length *args\n if l.nil?\n self.at b\n else\n e = b + l - 1\n r = self.to_avi\n r.frames.each_with_index do |f, i|\n unless i >= b && i <= e\n f.data = nil\n end\n end\n r.frames\n ...
[ "0.74878645", "0.7228833", "0.7188829", "0.71833205", "0.71593934", "0.68503594", "0.68153834", "0.68153834", "0.6719295", "0.66204065", "0.66171", "0.655352", "0.6506526", "0.64925563", "0.64602286", "0.6389715", "0.63872993", "0.6297073", "0.62925357", "0.62925357", "0.6269...
0.0
-1
diskarrays this one works
def new_hq_diskarray_attributes=(hq_diskarray_attributes) hq_diskarray_attributes.each do |attributes| hq_diskarrays.build(attributes) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_extent_array\n bytecounts, byteoffsets, startblocks, fileoffsets, partitions = [], [], [], [], []\n @extentinfo[:extent].each do |f|\n bytecounts << f[:bytecount]\n byteoffsets << f[:byteoffset]\n startblocks << f[:startblock]\n fileoffsets << f[:fileoff...
[ "0.6114302", "0.60259414", "0.581991", "0.5775413", "0.5759602", "0.57086027", "0.5656369", "0.56306446", "0.56300986", "0.56208915", "0.56053364", "0.5593654", "0.5578444", "0.55697817", "0.5535661", "0.5496106", "0.54666495", "0.5466595", "0.5462477", "0.5461333", "0.544376...
0.5432909
24
First method will use an iterator and second will use recursive principle
def fibs(n) arr = [0, 1] (n-1).times do arr << arr[-1] + arr[-2] end return arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive => nil", "def traverse; end", "def deep_each\n \n end", "def recursive_solution\n\n end", "def iterate(itr)\n itr.call(@leaf)\n end", "def iterate(itr)\n @left.iterate(itr)\n @right.iterate(itr)\n end", "def run_recursive_loop &block\n results = yield\n return results\ne...
[ "0.69737864", "0.6534821", "0.6504392", "0.61961937", "0.612035", "0.6006995", "0.6003524", "0.59709257", "0.58989525", "0.5882559", "0.5882559", "0.58632016", "0.57267874", "0.5722852", "0.5702235", "0.5698411", "0.5694388", "0.56870574", "0.5681679", "0.5676611", "0.5675688...
0.0
-1
If you want to just display the nth value in the sequence
def show_fib(n) return 0 if n == 0 return 1 if n == 1 show_fib(n-1) + show_fib(n-2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seq(i)\n\t\tif (i % 2 == 0)\n\t\t\treturn i / 2\n\t\telse\n\t\t\treturn i * 3 + 1\n\t\tend\n\tend", "def nthterm(first, n, c)\n #first is an array\n # first = first num in array\n # n = index value we want\n # c = constant add between terms\n sequence = [] \n sequence.push(first)\n #puts \"#{sequenc...
[ "0.6761991", "0.6681942", "0.65907806", "0.65312386", "0.64764225", "0.6361793", "0.63517886", "0.63505083", "0.6341358", "0.63384783", "0.6262007", "0.6247587", "0.62230974", "0.6211305", "0.62003475", "0.617645", "0.61654043", "0.6161797", "0.61507535", "0.61402637", "0.610...
0.0
-1
GET /grant_rounds/1 GET /grant_rounds/1.json
def show @grant_round = GrantRound.find(params[:id]) render json: @grant_round end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @grant_round = GrantRound.new(grant_round_params(params[:grant_round]))\n\n if @grant_round.save\n render json: @grant_round, status: :created, location: @grant_round\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end", "def update\n @grant...
[ "0.6574804", "0.6303521", "0.6297159", "0.59546804", "0.5684905", "0.5604054", "0.55961215", "0.5567295", "0.55013156", "0.54587185", "0.5404429", "0.53626806", "0.5357462", "0.53246164", "0.53246164", "0.53016365", "0.52994055", "0.52834517", "0.5273851", "0.5202888", "0.519...
0.7232588
0
POST /grant_rounds POST /grant_rounds.json
def create @grant_round = GrantRound.new(grant_round_params(params[:grant_round])) if @grant_round.save render json: @grant_round, status: :created, location: @grant_round else render json: @grant_round.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @grant_round = GrantRound.find(params[:id])\n\n if @grant_round.update(grant_round_params (params[:grant_round]))\n head :no_content\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end", "def create_rounds\n Round.create_rounds(id)\n\n\n en...
[ "0.6264875", "0.5942781", "0.5942781", "0.5720064", "0.57191443", "0.57124346", "0.5698458", "0.5643997", "0.5638932", "0.5637804", "0.55844456", "0.55760145", "0.557147", "0.54831064", "0.54622304", "0.5449626", "0.54019666", "0.53975177", "0.53915256", "0.5386423", "0.53790...
0.74327177
0
PATCH/PUT /grant_rounds/1 PATCH/PUT /grant_rounds/1.json
def update @grant_round = GrantRound.find(params[:id]) if @grant_round.update(grant_round_params (params[:grant_round])) head :no_content else render json: @grant_round.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @grant = Grant.find(params[:id])\n\n respond_to do |format|\n if @grant.update_attributes(params[:grant])\n format.html { redirect_to root_url, notice: 'Training was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" ...
[ "0.66332", "0.66036344", "0.658247", "0.6530699", "0.63430417", "0.6190109", "0.6128842", "0.59954906", "0.59816784", "0.5768203", "0.5750233", "0.5738519", "0.57231826", "0.569101", "0.5661459", "0.5661459", "0.563101", "0.56114036", "0.5599562", "0.5571986", "0.55699646", ...
0.77392834
0
DELETE /grant_rounds/1 DELETE /grant_rounds/1.json
def destroy @grant_round = GrantRound.find(params[:id]) @grant_round.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @grant = Grant.find(params[:id])\n @grant.destroy\n\n respond_to do |format|\n format.html { redirect_to grants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @grant.destroy\n respond_to do |format|\n format.html { redirect_to grants_url, notice: \"G...
[ "0.6785335", "0.66401356", "0.66355854", "0.65101945", "0.6417004", "0.6381775", "0.6332533", "0.6302542", "0.6267824", "0.6246247", "0.62305", "0.62305", "0.62305", "0.60873616", "0.59931564", "0.5984523", "0.5981868", "0.59775776", "0.5960169", "0.594473", "0.594473", "0....
0.76820797
0
This is the method that Swing will call to ask what size to attempt to set for this window.
def getPreferredSize # use the default size calculation; this would of course also be accomplished # by not implementing the method at all. super # Or, you can override it with specific pixel sizes (width, height) # Dimension.new(700, 560) # Or, use the line below to make it the full screen size: # Toolkit.get_default_toolkit.screen_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_size(w=nil, h=nil)\n @window_width = w if w.is_a?(Numeric) && w > 0 # TODO: > min_width\n @window_height = h if h.is_a?(Numeric) && h > 0 # TODO: > min_height\n super(@window_width, @window_height)\nend", "def size_default\n start_time = 0\n xdotool \"windowsize #{@id} #{@default.join(\"...
[ "0.7536047", "0.68291473", "0.67819756", "0.6737219", "0.63471746", "0.61729044", "0.6090852", "0.60902685", "0.60902685", "0.60902685", "0.6060795", "0.6048206", "0.60143214", "0.60114455", "0.59960634", "0.5987764", "0.59475785", "0.59235406", "0.5893958", "0.58632255", "0....
0.6719571
4
Creates an empty FIFO.
def initialize; @ary = []; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mkfifo(name)\n File.unlink name rescue nil\n system \"mkfifo -m 600 #{name}\"\n end", "def fifo()\n if ! File.pipe?(FIFO_PATH)\n # there's no native ruby way to do this?\n %x{#{mkfifo()} #{FIFO_PATH}}\n end\n return FIFO_PATH\n end", "def mkfifo( path )\n %x[mkfifo \"#{path}...
[ "0.6769331", "0.6616947", "0.6538363", "0.5831242", "0.5532893", "0.53430146", "0.5334373", "0.5232786", "0.50861233", "0.5081206", "0.501582", "0.5014214", "0.4997289", "0.49876356", "0.49809304", "0.49809304", "0.4966918", "0.4959901", "0.49589083", "0.49412322", "0.4916395...
0.0
-1
Appends _objects_ to the end of this FIFO. Returns self.
def push(*objects) @ary.push(*objects) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push!(obj)\n @objs << obj\n end", "def << (obj)\n @objects << obj if obj\n end", "def add(*objects)\n objects.each do |object|\n @objects << object\n end\n self\n end", "def <<(anObject)\n queue << anObject\n if queue.size >= max_queue_...
[ "0.6320862", "0.62817246", "0.62074196", "0.6152586", "0.61006445", "0.5869479", "0.58627766", "0.5720471", "0.57008475", "0.5683603", "0.568056", "0.5676982", "0.56663656", "0.56356883", "0.5605854", "0.5587203", "0.5580768", "0.55575544", "0.5496139", "0.5481302", "0.546990...
0.64497536
0
Converts this FIFO to a String.
def to_s "FIFO#{@ary.inspect}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @stringio.string\n end", "def to_s\n to_io.read(nil)\n end", "def to_s\n rv = ''\n write rv\n rv\n end", "def to_string\n io.string\n end", "def to_s\n to_buffer.to_s\n end", "def to_s\n\t\t\treturn @buffer.to_s\n\t\tend", "def to_s\n ...
[ "0.6886889", "0.6866942", "0.67954445", "0.6778762", "0.67405695", "0.67217714", "0.6693904", "0.66509056", "0.66491234", "0.66053265", "0.66053265", "0.66053265", "0.66053265", "0.6582136", "0.6582136", "0.65703416", "0.6527835", "0.6527835", "0.6527835", "0.6527835", "0.652...
0.7736053
0
if you are logged_in and tried to edit someone's profile show specific user depending on the id
def show @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n unless @user==User.find(params[:id])\n flash[:notice]= \"You can only see your own profile.\"\n redirect_to root_path\n end\n @user=User.find(params[:id])\n end", "def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profil...
[ "0.7691571", "0.76914155", "0.76810485", "0.75788087", "0.7497994", "0.74894613", "0.74894613", "0.74157786", "0.7413152", "0.7386759", "0.7357521", "0.73476136", "0.7347583", "0.7347067", "0.7337377", "0.7335653", "0.7312651", "0.72957754", "0.7288409", "0.7280811", "0.72766...
0.0
-1
init' a new user
def new @user = User.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user() @user = DiggUser.new end", "def setup_user\n User.new( \n age: 5,\n bio: \"My test bio\",\n password: SecureRandom.hex(6),\n email: SecureRandom.hex(4) + \"@example.com\",\n picture: \"blah.jpg\",\n sex: \"M\",\n username: SecureRandom.hex(4)\n )\n end", "de...
[ "0.7594177", "0.75789756", "0.75123674", "0.748089", "0.74646574", "0.74579114", "0.7421897", "0.7412031", "0.7401792", "0.738168", "0.73175555", "0.725899", "0.72542506", "0.72282207", "0.72000694", "0.71547115", "0.71502346", "0.7140887", "0.7137462", "0.71234393", "0.71105...
0.69009143
43
Registering a new user when he signup and he/she will automatically get log in
def create @user = User.new(user_params) if @user.save log_in @user flash[:success] = "Prof-Folio welcomes you onboard!" redirect_back_or #redirect_to @user else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend", "def sign_up\n @user = User.new\n end", "def register!(user)\n raise \"Already registred\" if user and not user.guest?\n self.us...
[ "0.76221", "0.7562729", "0.7551277", "0.749038", "0.74826884", "0.7475711", "0.7456268", "0.7438572", "0.7438572", "0.7433637", "0.73860645", "0.73499537", "0.7344879", "0.72918165", "0.72918165", "0.7283061", "0.7279171", "0.72720927", "0.72385484", "0.7196148", "0.71638364"...
0.0
-1
when a user wants to edit his/her profile, this method is called
def edit @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_profile_edit\n\n\n end", "def edit_profile\n end", "def edit_profile\n \t@user = current_user\n end", "def profile_edit\n @user = User.find(current_user.id)\n end", "def edit\n @user = current_user\n @profile = current_user.profile\n end", "def edit\n\t\t@user = User.find( params[...
[ "0.8617056", "0.86120033", "0.82008135", "0.8016178", "0.7738562", "0.7729312", "0.77285355", "0.7679579", "0.7618866", "0.76187533", "0.761339", "0.75926447", "0.7590888", "0.7582732", "0.75766", "0.7575096", "0.75680983", "0.7422893", "0.73935074", "0.7380267", "0.73668516"...
0.0
-1
before filters comfirms a logged in user for security
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_filters\n set_user\n authorize\n end", "def before_filter\n if current_user\n true\n end\n end", "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def before_filter; end",...
[ "0.78171587", "0.7538971", "0.7245296", "0.68182003", "0.6793294", "0.6589802", "0.6471281", "0.64641947", "0.64495635", "0.64275473", "0.6406224", "0.64031744", "0.64028394", "0.6379794", "0.6376574", "0.63620895", "0.6333597", "0.62232643", "0.62226796", "0.6216757", "0.621...
0.0
-1
Comfirms the correct user
def correct_user @user = User.find(params[:id]) redirect_to(root_url) unless current_user?(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def correct_user(user)\n user == current_user\n end", "def corrent_user\n\t@user = User.find(params[:id])\n\tredirect_to(root_url) unless ...
[ "0.69294626", "0.68347377", "0.6795285", "0.663792", "0.662208", "0.6613541", "0.6608377", "0.6606488", "0.660191", "0.6594039", "0.6574713", "0.6572459", "0.6571981", "0.6571284", "0.6553836", "0.6546742", "0.646462", "0.6462291", "0.64492965", "0.64402705", "0.64194137", ...
0.0
-1
form validation, prevent mass assignment vulnerability
def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid; end", "def validation; end", "def validation; end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def validated?; end", "def your_attributes_valid\n do_validate_attributes('your')\n end", "def validated; end", "def val...
[ "0.6511301", "0.64580774", "0.64580774", "0.642856", "0.642856", "0.63675255", "0.6333226", "0.62426376", "0.62318015", "0.62318015", "0.62318015", "0.62318015", "0.6229757", "0.6225109", "0.6225109", "0.6225109", "0.62125534", "0.6206692", "0.6206692", "0.6163483", "0.615427...
0.0
-1
redirects to stored location (or to the default).
def redirect_back_or(default) redirect_to(session[:forwarding_url] || default) session.delete(:forwarding_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end", "def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end", "def redirect_ba...
[ "0.8107985", "0.8034801", "0.7636486", "0.76222956", "0.7412404", "0.7341673", "0.7290278", "0.7163519", "0.7152072", "0.7131469", "0.7069455", "0.704326", "0.7033379", "0.70246804", "0.70125157", "0.7009527", "0.7002724", "0.69978774", "0.698725", "0.6977732", "0.69768393", ...
0.0
-1
Stores the url trying to be accessed.
def store_location session[:forwarding_url] = request.original_url if request.get? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_location\n # store last url as long as it isn't a /users path\n\tsession[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/ or request.fullpath =~ /\\/json/ or request.fullpath =~ /\\/static/\n\t\n end", "def store_location\n\t\tif request.get?\n\t\t\tcookies[:previous_url] = r...
[ "0.70334125", "0.68873394", "0.6857498", "0.6857498", "0.6857498", "0.6857498", "0.6857498", "0.6857498", "0.6855729", "0.6693769", "0.66616243", "0.6638029", "0.66331434", "0.66216826", "0.6618288", "0.6601687", "0.65920895", "0.65920895", "0.65920895", "0.65920895", "0.6568...
0.0
-1
Options: url (required), content_type, access_level, key (destination on s3)
def store_on_s3(options) # Deleting :url from options because we don't want it in the options that we pass to s3 # and removing some characters that aren't allowed in urls url = options.delete(:url).gsub(/ /, '%20').gsub(/\^/, '%5E') file = open(url) key = options.delete(:key) AWS::S3::S3Object.store(key, file, @bucket, options) # Return location on s3 "http://s3.amazonaws.com/" + @bucket + "/" + key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_S3_bucket_url_get(opts)\n if opts[:method] == :write\n opts[:obj].url_for(opts[:method], expires: 30.days, content_type: 'text/plain')\n else\n opts[:obj].url_for(opts[:method], expires: 30.days)\n end\n end", "def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\...
[ "0.7616379", "0.70911175", "0.70848083", "0.6966969", "0.69305545", "0.69188815", "0.6884549", "0.684006", "0.67821604", "0.6776867", "0.6675158", "0.6628062", "0.65868205", "0.65844613", "0.65805537", "0.6515453", "0.65040946", "0.6438879", "0.6428283", "0.6386645", "0.63810...
0.76563823
0
In controller actions, use this private method to access sea params from forms.
def sea_params params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params() request.params end", "def form_fields\n params\n end", "def form_params\n params[:form]\n end", "def params\n controller.params\n end", "def params\n @controller.params\n end", "def params\n @controller.params\n end", "def controller_params...
[ "0.70820314", "0.7014796", "0.69446135", "0.69291383", "0.6849251", "0.6849251", "0.6613801", "0.6535867", "0.6535169", "0.6525966", "0.64968646", "0.64948964", "0.6487594", "0.6487594", "0.647657", "0.64127517", "0.64103043", "0.64103043", "0.64103043", "0.63878864", "0.6386...
0.0
-1
Handles week dates of selected week
def call if second_week_selected == false handle_first_week elsif second_week_selected handle_second_week elsif second_week_selected.nil? clear_back_button_dates end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_week_of date\n monday = date - date.wday + 1\n friday = monday + 4\n select_range(monday, friday)\n end", "def week; end", "def select_current_week\n select_week_of Date.today\n end", "def change_week\n @tasks = @company.tasks\n @timesheet = Timesheet.new\n @timesheet.timesh...
[ "0.7161699", "0.71419305", "0.7090581", "0.68558514", "0.6768556", "0.6749568", "0.6727322", "0.66664743", "0.6568979", "0.6563157", "0.6559211", "0.6544042", "0.65303725", "0.6510937", "0.64698166", "0.645941", "0.645748", "0.64471656", "0.6442897", "0.6440571", "0.6386128",...
0.6847053
4
Stores first week back button date Removes all selected dates from session
def handle_first_week session[:first_week_back_button] = session[:first_week_start_date] session[:first_week_start_date] = nil session[:vehicle_details]['dates'] = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_back_button_dates\n session[:first_week_back_button] = nil\n session[:second_week_back_button] = nil\n end", "def handle_second_week\n session[:second_week_back_button] = session[:second_week_start_date]\n session[:second_week_start_date] = nil\n session[:vehicle_details]['d...
[ "0.85574585", "0.70094407", "0.6878741", "0.62005025", "0.6184343", "0.60150886", "0.5949783", "0.5796058", "0.5649616", "0.5598964", "0.5587097", "0.5512408", "0.55109024", "0.5476496", "0.54602516", "0.5423918", "0.5394549", "0.537574", "0.53741366", "0.5340379", "0.5340259...
0.8166558
1
Stores second week back button date Removes second week dates from session
def handle_second_week session[:second_week_back_button] = session[:second_week_start_date] session[:second_week_start_date] = nil session[:vehicle_details]['dates'] = disable_week(session[:first_week_start_date]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_back_button_dates\n session[:first_week_back_button] = nil\n session[:second_week_back_button] = nil\n end", "def handle_first_week\n session[:first_week_back_button] = session[:first_week_start_date]\n session[:first_week_start_date] = nil\n session[:vehicle_details]['dates...
[ "0.846894", "0.7645675", "0.61061215", "0.6059644", "0.59826857", "0.5731077", "0.5707717", "0.570693", "0.56867516", "0.5674106", "0.5627197", "0.562717", "0.56258404", "0.5551381", "0.5524808", "0.55210835", "0.5473964", "0.54698145", "0.545434", "0.542528", "0.5419363", ...
0.79072785
1
Clears both weeks back button dates
def clear_back_button_dates session[:first_week_back_button] = nil session[:second_week_back_button] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_calendar\n end", "def handle_first_week\n session[:first_week_back_button] = session[:first_week_start_date]\n session[:first_week_start_date] = nil\n session[:vehicle_details]['dates'] = []\n end", "def display_back_start_day\n display_start_day_of_week(period)\n end", "de...
[ "0.6943014", "0.6627319", "0.6220352", "0.60315514", "0.60257804", "0.60128903", "0.5999674", "0.5975555", "0.5864189", "0.5864189", "0.58210766", "0.57930595", "0.57829565", "0.5721126", "0.5692927", "0.56921566", "0.5655046", "0.5640556", "0.56382567", "0.5630907", "0.55819...
0.8693099
0
Move the first letter of each word to the end of it, then add "ay" to the end of the word. Leave punctuation marks untouched. Iterate over the words in the given string, and transform each into their pig latin equivalent Input: a string containing one or more words Punctuation is not included in the words Output: a string containing the pig latin values of the given words Move first letter of the word to the end of the word Add 'ay' to the end of the word Make sure I don't move any punctuation Maintain the case of all characters Examples pig_it('Pig latin is cool') igPay atinlay siay oolcay Pig => igP => igPay latin => atinl => atinlay pig_it('Hello world !') elloHay orldway ! Algorithm: Split up the input string into an array of words Iterate over the words, transforming as follows Next iteration if punctuation Move first character to the end of the word Append ay Join with ' ' delimiter and return string result
def pig_it(sentence) sentence.split.map do |word| if ('a'..'z').cover?(word.downcase) word[1..-1] + word[0] + 'ay' else word end end.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pig_it text\n\n # split string into array of words\n text_array = text.split(\" \")\n \n #for each word take first character from index [0] and move to last character index [-1] + 'ay', remove first character\n latin_array = text_array.map do |word|\n new_word = word + word[0] + \"ay\" \n new_word...
[ "0.8572142", "0.8463625", "0.8369375", "0.83493626", "0.83162314", "0.8313072", "0.8233264", "0.8154935", "0.8076044", "0.80078864", "0.80078095", "0.7985065", "0.7983783", "0.7975871", "0.7956212", "0.79484385", "0.794035", "0.7914071", "0.7906031", "0.7902359", "0.7900232",...
0.7883379
22
DELETE /vip_phones/1 DELETE /vip_phones/1.xml
def destroy @vip_phone.destroy respond_to do |format| format.html { redirect_to(admin_vip_phones_url) } format.xml { head :ok } end website.add_log(user: current_user, action: "Deleted a amx vip phone: #{@vip_phone.phone}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.ht...
[ "0.6860093", "0.6728651", "0.6727244", "0.6702415", "0.6698911", "0.66733325", "0.66554886", "0.66427493", "0.6622559", "0.6621793", "0.66081727", "0.65984875", "0.65856636", "0.65836096", "0.6459741", "0.64055115", "0.64036226", "0.635286", "0.6351725", "0.63440907", "0.6312...
0.71718454
0
GET /standard_units GET /standard_units.json
def index @standard_units = StandardUnit.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foods_units\n get('/foods/units.json')\n end", "def update\n if @standard_unit.update(standard_unit_params)\n render :show, status: :ok, location: @standard_unit\n else\n render json: @standard_unit.errors, status: :unprocessable_entity\n end\n end", "def index\n response = H...
[ "0.7401382", "0.6443082", "0.6424642", "0.6421105", "0.64155406", "0.62630224", "0.6217981", "0.62058634", "0.61837095", "0.61517185", "0.6119284", "0.60843855", "0.60843855", "0.60843855", "0.60843855", "0.60843855", "0.60843855", "0.6043516", "0.6013545", "0.6004442", "0.59...
0.7373037
1
GET /standard_units/1 GET /standard_units/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foods_units\n get('/foods/units.json')\n end", "def index\n @standard_units = StandardUnit.all\n end", "def show\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit_of_measure }\n end...
[ "0.7284985", "0.72707283", "0.68480104", "0.670525", "0.66994977", "0.65994805", "0.64936334", "0.64402825", "0.64402825", "0.64402825", "0.64300317", "0.6391067", "0.6345283", "0.63443196", "0.6220063", "0.62035346", "0.6161095", "0.61558884", "0.6119678", "0.611051", "0.610...
0.0
-1
POST /standard_units POST /standard_units.json
def create @standard_unit = StandardUnit.new(standard_unit_params) if @standard_unit.save render :show, status: :created, location: @standard_unit else render json: @standard_unit.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standard_unit_params\n params.require(:standard_unit).permit(:name)\n end", "def update\n if @standard_unit.update(standard_unit_params)\n render :show, status: :ok, location: @standard_unit\n else\n render json: @standard_unit.errors, status: :unprocessable_entity\n end\n end", ...
[ "0.71420324", "0.64748985", "0.63843375", "0.638204", "0.6314976", "0.6311011", "0.6265376", "0.62029266", "0.61535805", "0.6112119", "0.6037738", "0.6035721", "0.6020345", "0.6015021", "0.6002429", "0.6002429", "0.59995246", "0.59835476", "0.5904348", "0.5904226", "0.5883282...
0.73122644
0
PATCH/PUT /standard_units/1 PATCH/PUT /standard_units/1.json
def update if @standard_unit.update(standard_unit_params) render :show, status: :ok, location: @standard_unit else render json: @standard_unit.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n respond_to do |format|\n if @base_unit.update(base_unit_params)\n format.html { redirect_to @base_unit, notice: 'Tray type was successfully update...
[ "0.7222465", "0.6715038", "0.6663638", "0.6583913", "0.6544932", "0.6536766", "0.6483831", "0.6466127", "0.639179", "0.63881433", "0.6372778", "0.63624084", "0.6357908", "0.635727", "0.63526505", "0.6313081", "0.63096", "0.6244281", "0.6214702", "0.6208322", "0.6207229", "0...
0.7450118
0
DELETE /standard_units/1 DELETE /standard_units/1.json
def destroy @standard_unit.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @base_unit.destroy\n respond_to do |format|\n format.html { redirect_to base_units_url }\n format.json { head :no_content }\n end\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Autho...
[ "0.7625142", "0.7387347", "0.7291347", "0.7235781", "0.7235781", "0.7235781", "0.7235781", "0.7210871", "0.720147", "0.71926165", "0.7188656", "0.71701986", "0.71639055", "0.7163536", "0.71441334", "0.71233857", "0.71072197", "0.7098981", "0.70986474", "0.70378184", "0.702187...
0.7338672
2
Use callbacks to share common setup or constraints between actions.
def set_standard_unit @standard_unit = StandardUnit.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def standard_unit_params params.require(:standard_unit).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Receive the name from the user
def initialize(name) @name = name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_user_name\n puts \"Please enter your name: \"\n name = gets.chomp\n end", "def get_user_name\n\tputs \"Quel sera ton nom pour cette partie ?\"\n\tprint \"> \"\n\tname = gets.chomp\n\treturn name\nend", "def req_name\n\t\tputs \"What is your name?\"\n\t\t@name = gets.chomp\n\tend", "def get...
[ "0.8131631", "0.7985759", "0.7943557", "0.7711318", "0.7683341", "0.7655077", "0.7645622", "0.7624299", "0.76142347", "0.74671954", "0.7383562", "0.736905", "0.73289657", "0.7297595", "0.72644275", "0.72014517", "0.7199548", "0.7199548", "0.7174797", "0.71539634", "0.7142932"...
0.0
-1
Gracefully return the name if asked
def to_s "#{self.name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name\n (name.empty? || name.nil?) ? '' : name\n end", "def get_name\n return \"#{name}\"\n end", "def get_name\n # The last sentence in a function is always returned so no need to mention return\n @name\n end", "def original_name\r\n return @name\r\n end", "def naming\n...
[ "0.7862403", "0.78622043", "0.7704219", "0.76406735", "0.7586576", "0.7582237", "0.75328445", "0.75328445", "0.7529123", "0.7515023", "0.7515023", "0.75018054", "0.75018054", "0.75018054", "0.74821776", "0.74558806", "0.74340844", "0.74171203", "0.74171203", "0.74081033", "0....
0.0
-1
GET /registro_videoconferencia GET /registro_videoconferencia.json
def index @registro_videoconferencia = RegistroVideoconferencium.all render json: @registro_videoconferencia end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end", "def index\n @participante_videoconferencia = ParticipanteVideoconferencium.all\n render json: @participante_videoconferencia\n end", "def create\n @registro_videoconferencium = RegistroVideoconfer...
[ "0.7014022", "0.6932151", "0.6614689", "0.6514121", "0.6396124", "0.63498515", "0.62812436", "0.627072", "0.6265119", "0.62557036", "0.6179464", "0.6175161", "0.6164366", "0.6164366", "0.6164366", "0.6164366", "0.6164366", "0.6164366", "0.6164366", "0.6164366", "0.6164366", ...
0.7446193
0
GET /registro_videoconferencia/1 GET /registro_videoconferencia/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @registro_videoconferencia = RegistroVideoconferencium.all\n render json: @registro_videoconferencia\n end", "def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end", "def index\n @participante_videoconferencia = ParticipanteVideoconferencium...
[ "0.7591745", "0.7213528", "0.71278024", "0.65936935", "0.6518876", "0.647241", "0.6432397", "0.6425373", "0.6362164", "0.63570774", "0.63390714", "0.6334977", "0.63314843", "0.63314843", "0.63314843", "0.63314843", "0.63314843", "0.63314843", "0.63314843", "0.63314843", "0.63...
0.0
-1
POST /registro_videoconferencia POST /registro_videoconferencia.json
def create @registro_videoconferencium = RegistroVideoconferencium.new(registro_videoconferencium_params) respond_to do |format| if @registro_videoconferencium.save format.html { redirect_to @registro_videoconferencium, notice: 'Registro videoconferencium was successfully created.' } format.json { render :show, status: :created, location: @registro_videoconferencium } else format.html { render :new } format.json { render json: @registro_videoconferencium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registro_videoconferencium_params\n params.require(:registro_videoconferencium).permit(:estado, :fecha, :hora, :descripcion, :videoconferencia)\n end", "def create\n params[:video][:fecha] = DateTime.strptime(params[:video][:fecha], \"%Y-%m-%d %H:%M:%S UTC\")\n @video = Video.new(video_params)\...
[ "0.73241967", "0.7229517", "0.7002079", "0.6946003", "0.6913733", "0.69066614", "0.6903843", "0.6891531", "0.6826155", "0.67904294", "0.67337", "0.6706991", "0.6704616", "0.6683732", "0.66809833", "0.66770035", "0.6672941", "0.66521055", "0.66498446", "0.65276885", "0.6525682...
0.76216257
0
PATCH/PUT /registro_videoconferencia/1 PATCH/PUT /registro_videoconferencia/1.json
def update respond_to do |format| if @registro_videoconferencium.update(registro_videoconferencium_params) format.html { redirect_to @registro_videoconferencium, notice: 'Registro videoconferencium was successfully updated.' } format.json { render :show, status: :ok, location: @registro_videoconferencium } else format.html { render :edit } format.json { render json: @registro_videoconferencium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @video.update(video_params)\n render json: @video\n end", "def update\n respond_to do |format|\n if @demanda_videomonitoramento.update(demanda_videomonitoramento_params)\n format.html { redirect_to @demanda_videomonitoramento, notice: 'Demanda videomonitoramento was successfull...
[ "0.6657814", "0.6642695", "0.6566486", "0.65051895", "0.64917237", "0.6420386", "0.64182496", "0.64071727", "0.6363297", "0.6329276", "0.6314783", "0.62917626", "0.62592393", "0.6252212", "0.6208935", "0.6208935", "0.6208935", "0.6208935", "0.6208935", "0.62079245", "0.620428...
0.70241773
0