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
Show a single movie page
def show id = params[:id] @movie = Movie.find(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by unique ID\n # will render app/views/movies/show.<extension> by default\n end", "def show\n id = params[:id] # retrieve movie ID from URI route\n @movie = Movie.find(id) # look up movie by u...
[ "0.80090827", "0.80090827", "0.7872392", "0.7804057", "0.7804057", "0.7804057", "0.770676", "0.76332664", "0.7608977", "0.75263554", "0.7416698", "0.73925024", "0.7374953", "0.73438805", "0.7318688", "0.7309998", "0.7309998", "0.7309998", "0.7309998", "0.7309998", "0.7309998"...
0.76875836
8
Show the edit form for a movie
def edit @movie = Movie.find params[:id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t@movie = Movie.find_by_id(params[:id])\n\tend", "def edit\n movie = Movie.find(params[:movie_id])\n @review = Review.find(params[:id])\n @movie = Movie.find(params[:movie_id])\n end", "def edit\n\t\t@adminfilm = Film.find(params[:id])\n\tend", "def edit\n # Renders the edit form\n...
[ "0.825996", "0.76103204", "0.7520529", "0.70916474", "0.7088207", "0.70296353", "0.70012397", "0.70012397", "0.6998794", "0.6952281", "0.69053036", "0.68934786", "0.68934786", "0.6844361", "0.67545134", "0.67545134", "0.67545134", "0.6734904", "0.6734622", "0.67089564", "0.67...
0.8229228
3
Update a movie with given info from 'edit' form and redirect to the movie's page.
def update @movie = Movie.find params[:id] if @movie.update_attributes(movie_params) flash[:notice] = "#{@movie.title} was successfully updated." redirect_to movie_path(@movie) else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @movie = Movie.find params[:id]\n if @movie.update_attributes(params[:movie])\n flash[:notice] = \"#{@movie.title} was successfully updated.\"\n redirect_to movie_path(@movie)\n else\n render 'edit' # note, 'edit' template can access @movie's field values!\n end\nend", "def update\n ...
[ "0.8081152", "0.79287755", "0.79287755", "0.790696", "0.78645736", "0.78645736", "0.78550804", "0.7852934", "0.7849249", "0.77856565", "0.77856565", "0.77856565", "0.77856565", "0.77856565", "0.77856565", "0.77854705", "0.77325064", "0.77325064", "0.77325064", "0.77266264", "...
0.8066088
2
Delete a movie and redirect to the movies page.
def destroy @movie = Movie.find params[:id] @movie.destroy flash[:notice] = "Deleted '#{@movie.title}'." redirect_to movies_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n redirect_to root_path\n end", "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :ok }\n end\n end", "def d...
[ "0.8053855", "0.8044876", "0.801782", "0.8010855", "0.8010855", "0.8010855", "0.8010855", "0.8010855", "0.8010855", "0.8010855", "0.79602176", "0.79566145", "0.79566145", "0.79566145", "0.7895408", "0.7895408", "0.7895408", "0.7895408", "0.77677155", "0.77301943", "0.76772344...
0.8188732
1
Check if SSH connection is closed +connection+:: SSH connection to check
def closed?(connection) return true if connection.closed? begin # Hack to check connection isn't dead connection.exec!('true') unless connection.busy? rescue Net::SSH::Exception, SystemCallError => e return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n Timeout.timeout(3) { @connector.close }\n true\n rescue\n warn \"ssh connection could not be closed gracefully\"\n Metriks.meter('worker.vm.ssh.could_not_close').mark\n false\n ensure\n buffer.stop\n @buffer = nil\n end...
[ "0.72463757", "0.71900713", "0.7141059", "0.70817316", "0.70251876", "0.7020031", "0.66902846", "0.6634494", "0.6586284", "0.6509211", "0.6489014", "0.6468289", "0.64608103", "0.63966924", "0.63942343", "0.6351752", "0.6337756", "0.63358283", "0.631936", "0.62726146", "0.6252...
0.83323675
0
Check if SSH connection is busy +connection+:: SSH connection to check
def busy?(connection) connection.busy? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connected?\n start_ssh {|ssh| } # do nothing\n rescue *CONNECTION_EXCEPTIONS => ex\n @connection_error = ex\n return false\n else\n return true\n end", "def closed?(connection)\n return true if connection.closed?\n begin \n # Hack to check connection isn't dead\n connec...
[ "0.7125103", "0.7113677", "0.6865184", "0.67932945", "0.67154586", "0.66424054", "0.66414", "0.6624428", "0.6595834", "0.658586", "0.65762615", "0.65313566", "0.6405135", "0.63832116", "0.6379563", "0.6370428", "0.6370428", "0.63554823", "0.63304424", "0.63084054", "0.6288727...
0.7712347
0
Get new SSH connection
def get_new logger.debug "Establishing connection for #{creep.user}@#{creep.host} passwd:#{creep.password}" ssh = Net::SSH.start(creep.host, creep.user, {:password => creep.password, :verbose => (ENV['SSH_DEBUG'] && ENV['SSH_DEBUG'].to_sym) || :fatal }) ssh.send_global_request("keepalive@openssh.com") ssh rescue Net::SSH::Exception => ex logger.error "There was an exception in method get_new for SSConnection. Details #{ex}:\n#{ex.backtrace}" return nil rescue SystemCallError => ex logger.error "There was an system error in method get_new for SSConnection. Details #{ex}:\n#{ex.backtrace}" return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end", "def connection\n #N Without this check, we would get a new connection even though we already have a new one\n if @connection == nil\n #N Without this, we don't get feedb...
[ "0.7704465", "0.753015", "0.7499289", "0.7486356", "0.7360706", "0.7253392", "0.7141851", "0.7062906", "0.7006936", "0.68804973", "0.68083835", "0.6803162", "0.668882", "0.6650494", "0.66315615", "0.66134554", "0.65821123", "0.6515367", "0.6503821", "0.64943033", "0.64000446"...
0.7589419
1
Execute command on SSH connection +connection+:: SSH connection +command+:: command to execute
def execute(connection, command) stdout = "" stderr = "" connection.exec!(command) do |ch, stream, data| stderr << data if stream == :stderr stdout << data if stream == :stdout end [stdout, stderr] rescue Net::SSH::Exception => ex logger.error "There was an exception in method execute for SSHConnection. Details #{ex}:\n#{ex.backtrace}" kill_connection(connection) raise NoFreeConnectionError rescue SystemCallError => ex logger.error "There was an system error in method get_new for SSConnection. Details #{ex}:\n#{ex.backtrace}" kill_connection(connection) raise NoFreeConnectionError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end", "def execute_ssh_command(command)\n\t\tresult = ''\n\t\tNet::SSH.start(ip_string, settings.ssh[\"user\"]) do |ssh|\n\t\t\tresult = ssh.exec!(\"cmd /c #{command}...
[ "0.81134766", "0.7724965", "0.7619228", "0.73882395", "0.73754287", "0.7322456", "0.73076254", "0.72847396", "0.71318823", "0.7131707", "0.7095224", "0.7080898", "0.7080515", "0.7065923", "0.7028007", "0.70088345", "0.6996272", "0.69564044", "0.688075", "0.68699884", "0.68651...
0.7539133
3
Kill SSH connection +connection+:: SSH connection
def kill_connection(connection) connection.shutdown! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end", "def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end", "def disconnect\n @ssh.close if @ssh\n ...
[ "0.78902334", "0.74020976", "0.7323594", "0.7260872", "0.6967944", "0.68434197", "0.68269557", "0.67401654", "0.6717816", "0.66854787", "0.65052295", "0.6493948", "0.6479168", "0.64440835", "0.64433104", "0.64343905", "0.6426265", "0.6341712", "0.63246053", "0.6255591", "0.62...
0.74455947
1
Build a Response after a completed request.
def initialize(client, res) @client = client @status = res.status @headers = res.headers @env = res.env @body = res.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_response(connection, request); end", "def finish_request\n if (400..499).include? response.code\n set_error_body(response.code)\n end\n end", "def build_response\n { status: :success, data: {} }\n end", "def finish_request\n unless @error\n ...
[ "0.6723987", "0.64348507", "0.63734627", "0.63716674", "0.63516384", "0.619561", "0.614567", "0.6076125", "0.60224813", "0.60162836", "0.5997525", "0.59915036", "0.59800273", "0.59693545", "0.59434205", "0.59384334", "0.5905336", "0.5889386", "0.58407074", "0.58407074", "0.57...
0.0
-1
Turn parsed contents from an API response into a Resource or collection of Resources.
def process_data(hash) Array(hash).map do |hash| Resource.new(client, hash, resource_relations, resources_key) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n @resources ||= @response[@resource_field].to_a\n end", "def parse_resource(parsed_json)\n name, fields = parsed_json[0], parsed_json[1]\n res = CFDoc::Model::Resource.new(name)\n parse_element(res, fields)\n res\n end", "def api_get_resources(url...
[ "0.6266874", "0.6256729", "0.5978951", "0.5937778", "0.58817714", "0.580093", "0.57782364", "0.57701606", "0.556774", "0.55476534", "0.546559", "0.541274", "0.5399567", "0.5370187", "0.5341814", "0.53283954", "0.5315843", "0.5304021", "0.5290699", "0.5267092", "0.52644753", ...
0.49966282
51
Return name of the key in the response body hash where fetched resources are, like bookings or rentals
def resources_key decoded_body.keys.delete_if { |key| SPECIAL_JSONAPI_FIELDS.include?(key) }.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end", "def response_key\n self.class.response_key\n end", "def name\n response[\"name\"]\n end", "def key_name\n data[:key_name]\n end", "def entity_key\n resource_name.underscore.to_sym\n end",...
[ "0.6497969", "0.6203025", "0.5927049", "0.58522993", "0.5756338", "0.573681", "0.5632388", "0.5599015", "0.55635786", "0.5557683", "0.553708", "0.5508156", "0.5482203", "0.5472907", "0.54635125", "0.5448371", "0.5434228", "0.5426645", "0.54165304", "0.5405529", "0.54032314", ...
0.6574003
0
Return an array of Resources from the response body
def resources @resources ||= process_data(decoded_body[resources_key]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n @resources ||= @response[@resource_field].to_a\n end", "def resources\n body && [*body]\n end", "def elements\n begin\n if %w(tags posts).include?(@resource.to_s)\n return parsed_response[@resource.to_s][singular_r_name] || []\n el...
[ "0.7762595", "0.73285437", "0.69553196", "0.6887481", "0.6771974", "0.66755265", "0.661304", "0.661304", "0.661304", "0.642064", "0.6392817", "0.6371199", "0.634188", "0.6317118", "0.6308756", "0.62940305", "0.6287624", "0.62645566", "0.6253435", "0.625116", "0.6240897", "0...
0.73566824
1
Returns a Hash of relations built from given links templates. These relations are the same for each resource, so we calculate them once here and pass to every top level resource.
def resource_relations @resource_relations ||= Relation.from_links(client, decoded_body[:links]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def links\n _links = { self: polymorphic_url(record_with_ancestor_chain(@record)) }\n\n resources.each do |name, resource|\n _links.update(name => polymorphic_url(record_with_ancestor_chain(resource)))\n end\n\n sub_resources.each do |sub_resource|\n _links.update(sub_resource => ...
[ "0.6595661", "0.65907323", "0.654232", "0.64447886", "0.6328597", "0.62418365", "0.6220117", "0.615945", "0.6116255", "0.6105717", "0.60604036", "0.6035628", "0.6001539", "0.59550875", "0.5911503", "0.57904536", "0.5782197", "0.5757096", "0.5727869", "0.56643", "0.5663024", ...
0.62498623
5
Return a Hash of relations to other pages built from 'Link' response header
def relations @relations ||= process_rels end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_rels\n links = ( @headers[\"Link\"] || \"\" ).split(', ').map do |link|\n href, name = link.match(/<(.*?)>; rel=\"(\\w+)\"/).captures\n\n [name.to_sym, Relation.from_link(@agent, name, :href => href)]\n end\n\n Hash[*links.flatten]\n end", "def links\n data['links...
[ "0.7238136", "0.71838653", "0.71461916", "0.69504577", "0.690437", "0.6677724", "0.65880936", "0.65880936", "0.6564459", "0.6523548", "0.6505382", "0.6477203", "0.6468647", "0.6451345", "0.6440135", "0.63840115", "0.63826424", "0.6371537", "0.6371537", "0.6370116", "0.6357357...
0.0
-1
Returns a Hash of meta information taken from the response body
def meta @meta ||= decoded_body[:meta] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta\n json_body.fetch('meta', {})\n end", "def metadata\n {\n line: \"#{method.upcase} #{uri}\",\n headers: headers,\n body: body,\n }.compact\n end", "def meta\n @meta ||= begin\n arr = @header_str.split(/\\r?\\n/)\n arr.shift\n ...
[ "0.8209115", "0.703759", "0.6809584", "0.6728309", "0.6629828", "0.6614577", "0.6594861", "0.6567625", "0.6565107", "0.6482766", "0.64749366", "0.64748484", "0.6464112", "0.64502573", "0.6447846", "0.64390594", "0.6412634", "0.6396967", "0.6360413", "0.63546664", "0.63276446"...
0.7857405
1
PROBLEM: Given a string, write a method change_me which returns the same string but with all the words in it that are palindromes uppercased. input: string output: string (not the same object) rules: Explicit requirements: every palindrome in the string must be converted to uppercase. (Reminder: a palindrome is a word that reads the same forwards and backward). Palindromes are case sensitive ("Dad" is not a palindrome, but "dad" is.) Implicit requirements: the returned string shouldn't be the same string object. Data structure Algorithm Array > string create method change_me initialize variable result to store the final string split the string into each word by calling split initialize iterator to iterate through the array iterate through the array call method reverse on each word and check if it is the same as the original word if yes, the word is a palindrom, return the word in upcase if no, return the word as is finish iteration use .join with space to turn the array into a string.
def change_me(string) result = [] words = string.split iterator = 0 loop do break if iterator == words.size word = words[iterator] if word.reverse == word result << word.upcase else result << word end iterator += 1 end result.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rearranger(str)\nstr = str.split(' ')\nfinal = str.reverse.join(' ')\nfinal = final.downcase\nend", "def weirdcase(string)\n #gets array of strings, creates empty results array\n arr = string.split (' ')\n result = []\n\n #iterates over array of strings..\n arr.each do |i|\n #..breaking apart each st...
[ "0.71505433", "0.7049792", "0.6892113", "0.68268406", "0.6826752", "0.68225676", "0.6807951", "0.6806652", "0.6799156", "0.67507946", "0.67364055", "0.6729693", "0.6688976", "0.66532886", "0.66393644", "0.6638953", "0.66371673", "0.66154104", "0.6612245", "0.6607148", "0.6605...
0.7823821
0
GET /telefons/1 GET /telefons/1.xml
def show @telefon = Telefon.find(params[:id]) respond_with(@telefon) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end", "def show\n @telefone = Telefone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html....
[ "0.68341696", "0.6534509", "0.6450768", "0.6384626", "0.62680596", "0.62599754", "0.618201", "0.60888463", "0.6009699", "0.5956145", "0.5891114", "0.5880905", "0.58773136", "0.5776889", "0.5772216", "0.57183444", "0.56809086", "0.5665019", "0.5638449", "0.5620004", "0.5589512...
0.611009
7
GET /telefons/new GET /telefons/new.xml
def new @telefon = Telefon.new respond_with(@telefon) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tipo_telefone = TipoTelefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_telefone }\n end\n end", "def new\n @telefone = Telefone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ...
[ "0.7528302", "0.7430284", "0.71283233", "0.70270234", "0.6983166", "0.68951213", "0.68887883", "0.6811578", "0.6797174", "0.67958575", "0.67915595", "0.6783247", "0.6779791", "0.6730128", "0.6730128", "0.672596", "0.671277", "0.6712544", "0.67093104", "0.66870093", "0.6685129...
0.7050786
3
POST /telefons POST /telefons.xml
def create @telefon = Telefon.new(params[:telefon]) @telefon.save respond_with(@telefon) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @telefone_fornecedor = TelefoneFornecedor.new(telefone_fornecedor_params)\n\n respond_to do |format|\n if @telefone_fornecedor.save\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully created.' }\n format.json { render :show, status:...
[ "0.6541166", "0.6535863", "0.65159786", "0.6515896", "0.63069904", "0.5982625", "0.5920416", "0.59137285", "0.59093666", "0.59088534", "0.58931625", "0.5876067", "0.57747906", "0.5768522", "0.57538944", "0.56979185", "0.5676436", "0.56446403", "0.56440073", "0.5638536", "0.56...
0.6466172
4
PUT /telefons/1 PUT /telefons/1.xml
def update @telefon = Telefon.find(params[:id]) @telefon.update_attributes(params[:telefon]) respond_with(@telefon) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n if @tipo_telefone.update_attributes(params[:tipo_telefone])\n flash[:notice] = 'TipoTelefone was successfully updated.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { head :ok }\...
[ "0.66841274", "0.65371025", "0.6384179", "0.6306385", "0.6227374", "0.6210042", "0.61810344", "0.58926636", "0.5862392", "0.5760047", "0.56905603", "0.5678629", "0.5643345", "0.5629788", "0.5595618", "0.558561", "0.55845004", "0.5583074", "0.5550877", "0.5541985", "0.55403036...
0.6554062
1
DELETE /telefons/1 DELETE /telefons/1.xml
def destroy @telefon = Telefon.find(params[:id]) @telefon.destroy respond_with(@telefon) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tipo_telefone = TipoTelefone.find(params[:id])\n @tipo_telefone.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_telefones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self...
[ "0.6996788", "0.6774562", "0.67523956", "0.6710246", "0.65410715", "0.64671904", "0.64516807", "0.64513385", "0.6411109", "0.63485086", "0.62724715", "0.62665015", "0.62202954", "0.62144095", "0.61913216", "0.6165254", "0.6153367", "0.6115998", "0.6065057", "0.60490805", "0.6...
0.6356967
9
array of words array of integers output array of words sorted from a to z array of integers from lowest number to highest i need to sort from lowest to highest number starting with the most left 2 numbers when I need to perform an exchange then my loop does not break but when no exchanges happen then I break and have my solution.
def bubble_sort!(array) loop do done = true idx = 0 loop do if array[idx] > array[idx + 1] array[idx], array[idx + 1] = array[idx + 1], array[idx] idx += 1 done = false else idx += 1 end break if idx == array.size - 1 end break if done == true end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bubble_sort_by(array)\n while (array != array.sort_by { |word| word.length}) do\n for x in (0..array.length-2) do\n if (yield(array[x],array[x+1]) > 0)\n array[x], array[x+1] = array[x+1], array[x]\n end\n end\n end\n array\nend", "def bubble_sort(array)\n sorting = true\n\n while...
[ "0.7030257", "0.68429494", "0.66791314", "0.66459066", "0.6633959", "0.66083676", "0.6595324", "0.65758055", "0.6519745", "0.6516699", "0.65130115", "0.6500154", "0.6489104", "0.648644", "0.64823484", "0.6468318", "0.6461134", "0.6443252", "0.64390737", "0.6438569", "0.643664...
0.0
-1
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement.
def selects_the_titles_of_all_projects_and_their_pledge_amounts "SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY title" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_category_from_projects\n\"SELECT category FROM projects;\"\nend", "def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'musi...
[ "0.91978997", "0.7068997", "0.6991828", "0.6652033", "0.66230565", "0.6514643", "0.648783", "0.63246053", "0.6061025", "0.59403455", "0.59393066", "0.5937369", "0.59020996", "0.58835524", "0.58716", "0.58550864", "0.58536905", "0.58415705", "0.5820357", "0.5785234", "0.578322...
0.0
-1
Return the instance as a hash of simple (typeconverted) values suitable for Savon.
def to_savon hash = Hash.new() type_mappings.keys.each do |ivar_name| value = map_to_savon(ivar_name, instance_variable_get("@#{ivar_name}")) hash[ivar_name.to_sym] = value unless value.nil? end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [self.class, to_s].hash\n end", "def hash\n [self.class, to_s].hash\n end", "def to_hash\n { type: type, value: value }\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, ...
[ "0.75584674", "0.74956375", "0.7347888", "0.72963244", "0.72963244", "0.72963244", "0.71461827", "0.7145675", "0.7145675", "0.7145675", "0.7145675", "0.7145675", "0.7145675", "0.7104434", "0.7080353", "0.7060343", "0.70341825", "0.7027626", "0.70230806", "0.6978581", "0.69785...
0.69498456
21
Convert the instance to a JSON representation
def to_json(*a) result = {} self.type_mappings.keys.each { |key| result[key] = self.send(key).to_json } { 'json_class' => self.class.name, 'data' => result }.to_json(*a) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json\n self.to_h.to_json\n end", "def serialize\n self.to_hash.to_json\n end", "def to_json\n self.to_hash.to_json\n end", "def to_json\n\t\t\tself.instance_variable_hash\n\t\tend", "def to_json\n to_h.to_json\n end", "def to_json\n to_h.to_json\n end", "d...
[ "0.8448921", "0.83716893", "0.82706946", "0.826712", "0.8240175", "0.8240175", "0.82194114", "0.8210146", "0.81833684", "0.8115767", "0.8115767", "0.81033736", "0.80731463", "0.8025077", "0.80181783", "0.7999389", "0.79935306", "0.79813087", "0.79698694", "0.79698694", "0.795...
0.0
-1
Convert Ruby value to Savon data.
def map_to_savon(mapping_name, value) mapping = all_type_mappings[mapping_name] mapping = SavonHelper.define_missing_type_mapping(self.class, mapping_name, value, type_mappings, interface) if mapping.nil? return nil if value.nil? mapping.to_savon(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_data value\n if @to_data.nil?\n raise NoMethodError, \"#to_data not defined\"\n end\n \n @to_data.call value\n end", "def cast(value)\n value\n end", "def convert(value) value end", "def serialize(value)\n value\n end", "def cast_value(value)\n va...
[ "0.6590039", "0.6489713", "0.6469867", "0.640474", "0.63925123", "0.63593477", "0.6341933", "0.63269156", "0.6316254", "0.6297326", "0.6297224", "0.6290264", "0.62819254", "0.62817353", "0.627693", "0.6225975", "0.6225975", "0.6169046", "0.61522967", "0.61186796", "0.6052665"...
0.0
-1
GET /client_profiles GET /client_profiles.json
def index @client_profiles = ClientProfile.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n ...
[ "0.7066529", "0.7010263", "0.6964071", "0.6911514", "0.6817861", "0.6725345", "0.6717022", "0.6716054", "0.6711716", "0.6673309", "0.66695815", "0.6627569", "0.6627569", "0.6571033", "0.6540882", "0.6501271", "0.6496163", "0.6483836", "0.6454368", "0.64317626", "0.6431076", ...
0.7600032
0
GET /client_profiles/1 GET /client_profiles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @client_profiles = ClientProfile.all\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def profiles \n personid = params[:id]\n @response = JSON.parse(cur...
[ "0.7329758", "0.725613", "0.6942355", "0.69291705", "0.69083637", "0.6888077", "0.6789355", "0.6789012", "0.67808217", "0.6777584", "0.6694707", "0.6658725", "0.6655892", "0.66370904", "0.6620087", "0.6604809", "0.66047746", "0.66033864", "0.66033864", "0.65950316", "0.657737...
0.0
-1
POST /client_profiles POST /client_profiles.json
def create @client_profile = ClientProfile.new(client_profile_params) respond_to do |format| if @client_profile.save format.json { render :show, status: :created, location: @client_profile } else format.json { render json: @client_profile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @client_profile = current_client.build_client_profile(client_profile_params)\n\n authorize @client_profile\n\n respond_to do |format|\n if @client_profile.save\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully created.' }\n format.json { ...
[ "0.7382159", "0.6989375", "0.6530571", "0.63997746", "0.6383759", "0.6372186", "0.63159794", "0.6270599", "0.622642", "0.620696", "0.6149313", "0.60813195", "0.6047061", "0.6032439", "0.6006447", "0.6002127", "0.59745467", "0.5973002", "0.596753", "0.5955531", "0.59200394", ...
0.75950766
0
PATCH/PUT /client_profiles/1 PATCH/PUT /client_profiles/1.json
def update respond_to do |format| if @client_profile.update(client_profile_params) format.json { render :show, status: :ok, location: @client_profile } else format.json { render json: @client_profile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n ...
[ "0.72260207", "0.6723318", "0.657502", "0.64624083", "0.64601666", "0.64480466", "0.64459664", "0.63586", "0.6346588", "0.6324564", "0.6291774", "0.62917554", "0.6271877", "0.6262125", "0.6254571", "0.6247829", "0.6238143", "0.62135655", "0.6201705", "0.6189819", "0.6189684",...
0.739365
0
DELETE /client_profiles/1 DELETE /client_profiles/1.json
def destroy @client_profile.destroy respond_to do |format| format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n ...
[ "0.7570437", "0.6955545", "0.6902419", "0.68988854", "0.6881676", "0.6881446", "0.6881446", "0.68612945", "0.68560594", "0.68560594", "0.68560594", "0.68541515", "0.6840027", "0.6840027", "0.68260026", "0.68188083", "0.68188083", "0.68188083", "0.68188083", "0.68188083", "0.6...
0.7805865
0
Use callbacks to share common setup or constraints between actions.
def set_client_profile @client_profile = ClientProfile.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.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def client_profile_params params.require(:client_profile).permit(:client_id, :name, :bio) 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
Metodo para verificar si el empleado que va registar el medico es externo o interno.
def verificar_empleado_externo?(user) unless user.nil? @employee = Employee.find_by(user_id: user) unless @employee.nil? puts user puts @employee.provider_provider_id.nil? @employee.provider_provider_id.nil? end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_primo_as_external_system?\n @record.external_system.eql?(\"primo\")\n end", "def registrable?\n # Almost all Names in MO are potentially registrable, so use a blacklist\n # instead of a whitelist\n !unregistrable?\n end", "def external?\n crate.canonical_id.host != canonical_id.host\...
[ "0.6074028", "0.59400356", "0.5760218", "0.5754254", "0.56107455", "0.55920964", "0.5579983", "0.55697554", "0.55665636", "0.55474734", "0.5535004", "0.5509006", "0.5478742", "0.54525506", "0.54492146", "0.5436241", "0.54345965", "0.5431724", "0.540444", "0.5402924", "0.53946...
0.5514408
11
A presenter for selecting a work type to create this is needed here because the selector is in the header on every page
def create_work_presenter @create_work_presenter ||= create_work_presenter_class.new(current_ability.current_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_markup(type)\n if type == :selectable\n content = \"All Available #{attribute_name.to_s.sub('_id', '').titleize}\"\n specific_class = 'selectable'\n elsif type == :selection\n content = 'Current Selections'\n specific_class = 'selection'\n end\n\n content_...
[ "0.5845424", "0.55968153", "0.55542445", "0.5524932", "0.55233353", "0.55151033", "0.55022043", "0.5495173", "0.546521", "0.5424807", "0.53730696", "0.53561443", "0.53497624", "0.53457004", "0.5338135", "0.53283846", "0.5289929", "0.5268983", "0.52685225", "0.5262414", "0.524...
0.504682
47
changed to add feature flag for featured researcher
def display_featured_researcher? Flipflop.show_featured_researcher? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_flags\n 0\n end", "def get_required_features(features)\n end", "def set_featuring\n @featuring = Featuring.find(params[:id])\n end", "def has_feat ( f )\n return false\n end", "def append_features(mod) end", "def legit_feature?\n Flipflop.feature_set.features.map...
[ "0.68857735", "0.6830483", "0.67920166", "0.67553765", "0.6669886", "0.6636096", "0.66227627", "0.66180146", "0.65925425", "0.65370494", "0.65064836", "0.6467436", "0.6467381", "0.6466313", "0.64478", "0.64109653", "0.6382161", "0.6380248", "0.6368259", "0.6356401", "0.633846...
0.6318939
23
changed to add feature flag for featured work
def display_featured_works? Flipflop.show_featured_works? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature\n @job = Job.find(params[:id])\n @job.featured = true\n @job.save\n\n\t\t@job.update_job_featured_points(\"Featured\")\n\t\tflash[:notice] = 'Job successfully featured.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end", "d...
[ "0.67613715", "0.6695411", "0.6439379", "0.64391464", "0.64128065", "0.64128065", "0.639853", "0.6334965", "0.63262063", "0.63166547", "0.62993044", "0.62879825", "0.62879825", "0.62837744", "0.62624097", "0.6249091", "0.62483096", "0.61840636", "0.6171695", "0.6168008", "0.6...
0.6514683
2
changed to add feature flag for recently uploaded
def display_recently_uploaded? Flipflop.show_recently_uploaded? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_feature_flag\n featured = !params[:featured].nil?\n Array(params[:item_ids]).map do |uid|\n item = item_from_uid(uid)\n next unless item.scope == Scopes::SCOPE_PUBLIC && item.featured ^ featured\n\n item.update(featured: featured)\n item.current_user = @context.user\n item...
[ "0.64233935", "0.6312423", "0.6273116", "0.6238249", "0.62089956", "0.61934453", "0.6186336", "0.61829937", "0.6148449", "0.61480486", "0.6054983", "0.60345685", "0.5990625", "0.59495986", "0.5935935", "0.5893084", "0.58618206", "0.58581835", "0.5828518", "0.5825956", "0.5825...
0.55019933
50
Given a DDI metadata file, parse it and return study information Returns a Nesstar::Study object
def parse ddi_file @logger.info 'Parsing DDI file ' + ddi_file catalog = DDI::Catalog.new study = DDI::Study.new study_info_hash = Hash.new #TODO This will not work on windows since it depends on the unix tool file need to use a different way. Possibly use rchardet instead begin encode_type = `file --mime -br #{ddi_file}`.gsub(/\n/,"").split(';')[1].split('=')[1] rescue Exception => e end #have to convert to UTF-8 for libxml contents = File.open(ddi_file).read output = Iconv.conv("UTF-8", encode_type, contents) converted_file = File.join(File.dirname(ddi_file), "converted_file.xml") file = File.open(converted_file, 'w') file.write(output) file.close parser = LibXML::XML::Parser.file(converted_file) doc = parser.parse studynodes = doc.find('//stdyDscr') abstracts = studynodes[0].find('//abstract') abstract = "" abstracts.each {|ab| abstract << ab.content.strip} abstract.strip! study.abstract = abstract study.title = studynodes[0].find('//stdyDscr/citation/titlStmt/titl')[0].first.content.strip unless studynodes[0].find('//stdyDscr/citation/titlStmt/titl')[0] == nil study.id = studynodes[0].find('//IDNo')[0].first.content.strip unless studynodes[0].find('//IDNo')[0] == nil #start and finish dates for study dates = [] date = studynodes[0].find('//sumDscr/collDate') date.each do |d| a = d.attributes unless a.length == 0 study_date = DDI::StudyDate.new study_date.type = a.get_attribute('event').value.strip study_date.date = a.get_attribute('date').value.strip dates.push(study_date) end end study.dates = dates studynodes[0].find('//sampProc')[0] ? samp_node = studynodes[0].find('//sampProc')[0] : samp_node = nil unless samp_node == nil study.sampling_procedure = samp_node.first.content.strip unless samp_node.first == nil end # study.weight = studynodes[0].find('//sampProc')[0].first.content study.ddi_variables = get_variable_information doc return study end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ddi_metadata\n dataset = Dataset.find(dataset_id)\n ddi_parser = DDI::Parser.new\n all_variables = Variable.all(:conditions=> {:dataset_id => dataset_id})\n all_variable_ids = all_variables.collect{|var| var.id}\n parsed_variable_ids = []\n new_variables = []\n study = d...
[ "0.6062818", "0.5943793", "0.53857136", "0.5285459", "0.52500516", "0.5240419", "0.5210561", "0.5209262", "0.5196281", "0.5161175", "0.5157264", "0.51322967", "0.51322967", "0.51322967", "0.51322967", "0.51322967", "0.51322967", "0.51322967", "0.50869656", "0.50776047", "0.50...
0.73066497
0
information about the variables
def get_variable_information doc variables = [] variable_info_hash = Hash.new docnodes = doc.find('//dataDscr') vargroups = docnodes[0].find('//dataDscr/varGrp') vargroups.each do |vargroup| #hash which holds all the variable groups a = vargroup.attributes groups = a.get_attribute('var') if groups != nil groups = a.get_attribute('var') variable_info_hash[vargroup.find('./labl')[0].first.content] = groups.value.split(' ') unless vargroup.find('./labl')[0] == nil # else # variable_info_hash[vargroup.find('./labl')[0].first.content] = groups.value.split(' ') end end vars = docnodes[0].find('//dataDscr/var') vars.each do |var| variable = DDI::DDIVariable.new var_attr = var.attributes variable.id = var_attr.get_attribute('ID').value.strip unless var_attr.get_attribute('ID') == nil variable.name = var_attr.get_attribute('name').value.strip unless var_attr.get_attribute('name') == nil #if there is no name then it has no meaning or context next if variable.name == nil variable.file = var_attr.get_attribute('files').value.strip unless var_attr.get_attribute('files') == nil variable.interval = var_attr.get_attribute('intrvl').value.strip unless var_attr.get_attribute('intrvl') == nil variable.label = var.find('./labl')[0].content.strip unless var.find('./labl')[0] == nil #these things never seem consistent with the schema, might be an inner element, might be an attribute! if var.find('./labl')[0] == nil variable.label = var_attr.get_attribute('labl').value.strip unless var_attr.get_attribute('labl') == nil end rng = var.find('./valrng') if rng != nil if rng[0] != nil unless rng[0].first == nil range_attr = rng[0].first.attributes max_val = range_attr.get_attribute('max') variable.max = max_val.value.strip unless max_val == nil min_val = range_attr.get_attribute('min') variable.min = min_val.value.strip unless min_val == nil end end end q = var.find('./qstn') if q[0] != nil ql = q[0].find('./qstnLit') if ql != nil if ql[0] != nil variable.question = ql[0].first.content.strip end end iv = q[0].find('./ivuInstr') if iv != nil if iv[0] != nil variable.interview_instruction = iv[0].first.content.strip end end end stats = var.find('./sumStat') summary_stats = [] stats.each do |stat| a = stat.attributes # summary_stats[a.get_attribute('type').value] = stat.first.content statistic = DDI::SummaryStat.new statistic.type = a.get_attribute('type').value.strip statistic.value = stat.first.content.strip summary_stats.push(statistic) end variable.summary_stats = summary_stats catgry = var.find('./catgry') categories = [] #categories in ddi are value domains in mb catgry.each do |cat| category = DDI::Category.new valxml = cat.find('./catValu') if valxml != nil && valxml[0] != nil category.value = valxml[0].first.content.strip unless valxml[0].first == nil else category.value = 'N/A' end labxml = cat.find('./labl') if labxml != nil && labxml[0] != nil category.label = labxml[0].first.content.strip unless labxml[0].first == nil else category.label = 'N/A' end catstats = cat.find('./catStat') category_statistics = [] catstats.each do |catstat| category_statistic = DDI::CategoryStatistic.new a = catstat.attributes if a != nil && a.get_attribute('type') != nil category_statistic.type = a.get_attribute('type').value.strip category_statistic.value = catstat.first.content.strip unless catstat.first == nil category_statistics.push(category_statistic) end end category.category_statistics = category_statistics categories.push(category) end #what group is the variable in variable_info_hash.each_key do |key| if variable_info_hash[key].include?(variable.id) variable.group = key.strip break end end variable.categories = categories variables.push(variable) end return variables end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables; end", "def variables; end", "def vars\n variables.values\n end", "def vars\n variables.values\n end", "def local_variables() end", "def vars\n @vars ||= soln.keys\n @vars\n end", "def info_variables\n @queue << \"i v\"\n end", "def variables\n {}\n end", "d...
[ "0.8170768", "0.8170768", "0.7431272", "0.7431272", "0.71834475", "0.7038542", "0.7016133", "0.6988799", "0.6948198", "0.6921278", "0.68772167", "0.6808953", "0.6788339", "0.6788339", "0.67542815", "0.67542815", "0.6743187", "0.67061263", "0.66260576", "0.6624385", "0.6519377...
0.624098
44
GET /theloaisaches or /theloaisaches.json
def index @theloaisaches = Theloaisach.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@tea...
[ "0.6470635", "0.6407504", "0.6238453", "0.613327", "0.60264987", "0.59744483", "0.589963", "0.5894425", "0.5887093", "0.5886826", "0.5879474", "0.58148515", "0.5810373", "0.57945275", "0.5775904", "0.5772876", "0.57721025", "0.57721025", "0.574822", "0.5747134", "0.5746791", ...
0.649614
0
GET /theloaisaches/1 or /theloaisaches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@tea...
[ "0.64893997", "0.6244425", "0.624108", "0.6231589", "0.6109041", "0.6044681", "0.6042624", "0.60374546", "0.60374546", "0.6032156", "0.59931415", "0.59858245", "0.59789467", "0.59541863", "0.5933957", "0.5928734", "0.59261364", "0.59057224", "0.58881956", "0.58858454", "0.587...
0.0
-1
POST /theloaisaches or /theloaisaches.json
def create @theloaisach = Theloaisach.new(theloaisach_params) respond_to do |format| if @theloaisach.save format.html { redirect_to @theloaisach, notice: "Theloaisach was successfully created." } format.json { render :show, status: :created, location: @theloaisach } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @theloaisach.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @the_loai_sach = TheLoaiSach.new(the_loai_sach_params)\n\n respond_to do |format|\n if @the_loai_sach.save\n format.html { redirect_to @the_loai_sach, notice: \"The loai sach was successfully created.\" }\n format.json { render :show, status: :created, location: @the_loai_sach...
[ "0.62331986", "0.608334", "0.6050477", "0.60193133", "0.5928199", "0.59031975", "0.58509755", "0.58329386", "0.58242935", "0.580276", "0.57687545", "0.5760426", "0.57530797", "0.5752694", "0.5751293", "0.5714319", "0.57073456", "0.56998605", "0.5693231", "0.56797504", "0.5661...
0.6510152
0
PATCH/PUT /theloaisaches/1 or /theloaisaches/1.json
def update respond_to do |format| if @theloaisach.update(theloaisach_params) format.html { redirect_to @theloaisach, notice: "Theloaisach was successfully updated." } format.json { render :show, status: :ok, location: @theloaisach } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @theloaisach.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, stat...
[ "0.6350506", "0.62601316", "0.6170705", "0.61663663", "0.61515725", "0.6132433", "0.6128296", "0.6124237", "0.61210877", "0.61175823", "0.6057317", "0.60144114", "0.5969454", "0.59593225", "0.5950163", "0.59428006", "0.59189516", "0.5917302", "0.5913498", "0.59021586", "0.589...
0.6319693
1
DELETE /theloaisaches/1 or /theloaisaches/1.json
def destroy @theloaisach.destroy respond_to do |format| format.html { redirect_to theloaisaches_url, notice: "Theloaisach was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @thema.destroy\n respond_to do |format|\n format.html { redirect_to themata_url }\n format.json { head :no_content }\n end\n end", "def delete!( opts =...
[ "0.70291334", "0.69779515", "0.69654626", "0.6963724", "0.6958891", "0.6955817", "0.6955817", "0.6901878", "0.6884223", "0.6882267", "0.6878711", "0.6865196", "0.68605876", "0.685439", "0.6836049", "0.68346196", "0.68263817", "0.68033034", "0.6800072", "0.6792529", "0.6792154...
0.71921873
0
Use callbacks to share common setup or constraints between actions.
def set_theloaisach @theloaisach = Theloaisach.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.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def theloaisach_params params.require(:theloaisach).permit(:ma_sach, :ten_sach, :mtg, :mtl, :maNXB, :nxb) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Returns a single project segment
def segment(project_id, key_id, language_iso, segment_number, req_params = {}) params = { query: [project_id, key_id, language_iso, segment_number], req: req_params } data = endpoint(name: 'Segments', params: params).do_get resource 'Segment', data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project\n self.projects.first unless projects.empty?\n end", "def segment\n return asset_on_segment_history.segment rescue nil\n end", "def project\n self.format.try(:project)\n end", "def project_number\n segments = @audience.split \"/\"\n idx = segments.index \"projects\"\...
[ "0.62779295", "0.6224353", "0.6086003", "0.60174924", "0.60174924", "0.59211", "0.58989817", "0.5890216", "0.5889555", "0.5869268", "0.585898", "0.5847536", "0.5816321", "0.5809094", "0.5784023", "0.57799643", "0.57666916", "0.57666916", "0.57666916", "0.57666916", "0.5766691...
0.6414373
0
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.welcome.subject
def registration_confirmation(user) @user = user # attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png") mail(:to => "#{user.nickname} <#{user.email}>", :subject => "Registered") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject\n self['subject'] || msg['subject']\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n l...
[ "0.69021374", "0.67249674", "0.6719583", "0.66746026", "0.6665844", "0.6611136", "0.6576607", "0.6544792", "0.65094864", "0.65038246", "0.6457452", "0.64401805", "0.6402087", "0.63828045", "0.63603675", "0.63592607", "0.6348857", "0.63381743", "0.6324099", "0.63228494", "0.63...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.forgot_password.subject
def forgot_password @greeting = "Hi" mail to: "to@example.org" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def get_email_subject(email_type)\n email_subject = ...
[ "0.69499105", "0.6791501", "0.65838724", "0.65776485", "0.65767306", "0.65633065", "0.6562831", "0.65615106", "0.65575516", "0.65428513", "0.65345335", "0.6479871", "0.64787537", "0.64552516", "0.64471054", "0.64469117", "0.64234436", "0.6407296", "0.63911825", "0.6362709", "...
0.59637046
97
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) i = 0 j = 1 result = nil array = name_hash.collect do |key, value| value end result = array[i] while i < array.length while j < array.length if array[j] < result result = array[j] end j += 1 end i += 1 end name_hash.select do |key, value| if value == result return key end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n...
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585...
0.0
-1
set and return user name or sname or mname ( example for set> name('sname', 'Petrov' ) example for get> name('mname') )
def name(type, newval = nil) @usr_fio[type.to_sym] = newval.nil? ? @usr_fio[type.to_sym] : newval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_name_set(name)\n self.username.set name if nil_or_empty?(username[:value])\n end", "def name=(user_name)\n @first_name, @last_name = user_name.split\n # The above simplified code does the same as below!!!\n # names = user_name.split\n # @first_name = names[0]\n # @last_name ...
[ "0.7815543", "0.74298126", "0.7356613", "0.7242506", "0.71841085", "0.7146544", "0.71204895", "0.71081483", "0.70693624", "0.7037341", "0.7036977", "0.70038617", "0.6940672", "0.6915634", "0.6880692", "0.68647593", "0.68164897", "0.67650044", "0.67627645", "0.67559475", "0.67...
0.0
-1
set and return user rate: example > set_rate(4) if value user_rate is zero, user_rate sets random between from 1 to 5
def rate(user_rate = nil) @user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate=(value)\n @rate = value\n end", "def rate(rate)\n @rated_times += 1\n @average_rating = (@average_rating + rate) / @rated_times\n end", "def rate(stars, user, dirichlet_method=false)\n\n if can_rate? user\n rates....
[ "0.767989", "0.7085148", "0.70643735", "0.704562", "0.6980152", "0.6906819", "0.67577386", "0.6691674", "0.6688505", "0.66768706", "0.6667784", "0.66606396", "0.6628255", "0.6628255", "0.6628255", "0.6628255", "0.66172", "0.6570844", "0.6539932", "0.6525699", "0.64806056", ...
0.8673743
0
return users info (id, fio, rate, ocp) : example get_info(1010) > ID 3 Rate4 )
def info(inf = '1110') infarray = [] infarray.push("ID-#{@user_id}") unless inf[0].to_i.zero? infarray.push("ФИО-#{@usr_fio.values.join(' ')}") unless inf[1].to_i.zero? infarray.push("Rate-#{rate}") unless inf[2].to_i.zero? infarray.push("Occupation-#{occupation}") unless inf[3].to_i.zero? infarray.compact.join(' ').to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n\t@user = User.find(params[:id])\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def basicInfo (userid)\n\t\tname = nil\n\t\ticonid = nil\n\t\tnameError = nil\n\t\ticonidError = nil\n\t\t\n\t\tbegin\n\t\t\tname = db_select_user_name(userid)\n\t\tr...
[ "0.6873489", "0.6687257", "0.6669461", "0.6615454", "0.66069484", "0.66069484", "0.66069484", "0.651687", "0.650275", "0.6459174", "0.6429083", "0.64124054", "0.6400884", "0.63695914", "0.6352976", "0.6328135", "0.6317834", "0.6310971", "0.6308948", "0.6250193", "0.6221836", ...
0.6352683
15
add user in Usergroup
def add_user(newuser) @group_users.push(newuser) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_to_group(user, group)\n\t\t\tend", "def add_user(user)\n UserGroup.create(user_id: user.id, group_id: id)\n end", "def add_user(user)\n group_members.create(group: self, user: user, accepted: DateTime.now)\n end", "def addUserToGroup\n @user_to_add = User.find(params[:user_to_ad...
[ "0.866995", "0.80869144", "0.8024208", "0.80109406", "0.79968184", "0.7844103", "0.7824062", "0.7791386", "0.778691", "0.77759737", "0.7724631", "0.7705011", "0.7694962", "0.7667048", "0.7646646", "0.7646646", "0.7628266", "0.75875455", "0.7560802", "0.75232434", "0.75015485"...
0.8232307
1
delete user from Usergroup with user_id
def delete_user(deluser_id) @group_users.delete_if { |item| item.user_id == deluser_id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end", "def...
[ "0.81837416", "0.81311756", "0.80089074", "0.8001407", "0.7976349", "0.7850211", "0.77733505", "0.76814353", "0.7675185", "0.76748925", "0.7647359", "0.756417", "0.74978167", "0.7465452", "0.7449766", "0.7444721", "0.74442255", "0.7436912", "0.74138004", "0.7408918", "0.74005...
0.83215886
0
retur user with max rate
def best_user @group_users.max_by(&:rate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_user\n @group_users.min_by(&:get_rate)\n end", "def rate(user_rate = nil)\n @user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i))\n end", "def rate_limit\n return nil unless @client\n\n t = Time.now\n l...
[ "0.69234794", "0.65097123", "0.6312583", "0.6200378", "0.6195007", "0.61941636", "0.59912187", "0.58899343", "0.58846974", "0.5860604", "0.5834517", "0.5830606", "0.58122903", "0.5795221", "0.57940906", "0.5776754", "0.5765384", "0.57529", "0.5733467", "0.5733467", "0.5714975...
0.724183
0
retur user with min rate
def worst_user @group_users.min_by(&:get_rate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate(user_rate = nil)\n @user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i))\n end", "def best_user\n @group_users.max_by(&:rate)\n end", "def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(cu...
[ "0.68062645", "0.6316115", "0.6305841", "0.60808563", "0.60808563", "0.6027617", "0.5965653", "0.5944634", "0.5943455", "0.5893678", "0.5888269", "0.5888269", "0.5873097", "0.5870971", "0.58697945", "0.58389455", "0.58305746", "0.5807044", "0.5806139", "0.58017963", "0.578064...
0.66465753
1
retur list of all users
def list_user(param = '1110') @group_users.each { |item| puts item.info(param) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_users\n\n end", "def list\n @all_users = User.find(:all)\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def list\n get('users')['users']\n end", "def list_users\n @users = User.find(:all)\n end", "def list_users\n self.clas...
[ "0.8833515", "0.8803131", "0.8679127", "0.86482", "0.8521039", "0.8359296", "0.83026594", "0.8270918", "0.8204601", "0.8200361", "0.8174807", "0.8136294", "0.8136294", "0.81337243", "0.8125384", "0.8100758", "0.8097471", "0.8078178", "0.8075537", "0.8070859", "0.80555487", ...
0.0
-1
retur user with user_id
def user_by_id(user_id) @group_users.find { |item| item.user_id == user_id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user; User.find_by_id(user_id); end", "def get_user(user_id)\n return User.find(user_id)\n end", "def user(id:)\n User.find(id)\n end", "def user\n User.get user_id || User.new\n end", "def find_user(user_id)\n user = User.find(user_id)\n user\n end", "def get(user_id)\n User.fi...
[ "0.8010103", "0.79049844", "0.7816957", "0.7755731", "0.77448195", "0.77191335", "0.76655066", "0.7584223", "0.7582369", "0.7522907", "0.74880904", "0.74861926", "0.74617517", "0.7446088", "0.7444341", "0.743328", "0.7430964", "0.7425594", "0.74247503", "0.7401402", "0.739619...
0.7013424
77
Load platform specific implementation === Return true:: Always return true
def load_platform_specific if linux? require_linux elsif mac? require_mac elsif windows? require_windows else raise PlatformError.new('Unknown platform') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_for_platform?; true; end", "def system_load_ok?\n true\n end", "def installable_platform?\n # BACKCOMPAT If the file is coming out of a specified file, then we\n # ignore the platform. This code can be removed in RG 3.0.\n return true if @source.kind_of? Gem::Source::SpecificFile\n\n...
[ "0.74356", "0.7203914", "0.716804", "0.6986426", "0.69279", "0.6924712", "0.686197", "0.6847967", "0.6847967", "0.6847967", "0.68197435", "0.68130875", "0.68130875", "0.67595285", "0.67564553", "0.6748567", "0.6711085", "0.6637507", "0.6602516", "0.6598843", "0.656054", "0....
0.7198584
2
An alias for RUBY_PLATFORM === Return name(String):: RUBY_PLATFORM
def name RUBY_PLATFORM end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",...
[ "0.8385413", "0.80764323", "0.79234445", "0.79072535", "0.7794235", "0.76909053", "0.7668009", "0.76161766", "0.7599129", "0.75935096", "0.7548656", "0.7500768", "0.74804527", "0.7411195", "0.73644245", "0.7327517", "0.72889", "0.72582203", "0.7254949", "0.72412205", "0.72383...
0.8984987
0
Is current platform windows? === Return true:: If ruby interpreter is running on Windows false:: Otherwise
def windows? @windows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def windows_ruby?\n !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)\n end", "def windows?\n RUBY_PLATFORM =~ /mswin/\n end", "def windows?\n ::RUBY_PLATFORM =~ /mingw|mswin/\n end", "def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n ...
[ "0.89685285", "0.88856333", "0.8876175", "0.88279444", "0.88044524", "0.87782013", "0.87726754", "0.8738121", "0.8675495", "0.8602965", "0.85876185", "0.85861796", "0.85861796", "0.85363835", "0.853565", "0.84212756", "0.8397273", "0.83863753", "0.83777785", "0.8355444", "0.8...
0.6778876
62
Is current platform Mac OS X (aka Darwin)? === Return true:: If ruby interpreter is running on Mac false:: Otherwise
def mac? @mac end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac?\n (/darwin/ =~ ruby_platform) != nil\n end", "def mac?\n (/darwin/ =~ RUBY_PLATFORM) != nil\n end", "def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end", "def darwin?\n RUBY_PLATFORM.include?('darwin')\n end", "def mac?\n RUBY_PLATFORM =~ /darwin/i\nend", "def dar...
[ "0.8963423", "0.8803325", "0.8684129", "0.866403", "0.8634658", "0.861514", "0.8592091", "0.85783565", "0.85065717", "0.84583765", "0.84462", "0.8441988", "0.8429795", "0.8189937", "0.81176597", "0.8073296", "0.79785526", "0.7952804", "0.7930211", "0.78919923", "0.784425", ...
0.6322379
75
Is current platform linux? === Return true:: If ruby interpreter is running on Linux false:: Otherwise
def linux? @linux end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linux?\n /linux/.match(RUBY_PLATFORM)\n end", "def linux?\n RUBY_PLATFORM =~ /linux/\n end", "def linux?\n RUBY_PLATFORM.match(/linux/)\n end", "def linux?\n kind_of? Unix::Platform rescue false\n end", "def linux? ; RUBY_PLATFORM =~ /linux/i end", "def linu...
[ "0.9147632", "0.9111422", "0.9108628", "0.88047165", "0.87938666", "0.87110966", "0.8699413", "0.86540294", "0.8617134", "0.85832095", "0.85815465", "0.8543316", "0.8516964", "0.84376806", "0.84174037", "0.8249068", "0.8237718", "0.8211903", "0.8143571", "0.7845609", "0.76376...
0.8602709
9
Are we in an EC2 cloud? === Return true:: If machine is located in an EC2 cloud false:: Otherwise
def ec2? resolve_cloud_type if @ec2.nil? @ec2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end", "def on_ec2?\n ec2 != nil\n end", "def on_ec2?\n ec2 != nil\n end", "def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported\n true\nend", "def on_ec2?\n ec2 != ni...
[ "0.7770823", "0.77519435", "0.77519435", "0.7539143", "0.7538713", "0.7261664", "0.72427356", "0.72195977", "0.6968421", "0.6890333", "0.6847384", "0.68048495", "0.6792794", "0.6792794", "0.67596835", "0.6728041", "0.65887463", "0.6585326", "0.6583575", "0.651594", "0.6450099...
0.7923933
0
Are we in a Rackspace cloud? === Return true:: If machine is located in an EC2 cloud false:: Otherwise
def rackspace? resolve_cloud_type if @rackspace.nil? @rackspace end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_rackspace?\n rackspace != nil\n end", "def on_rackspace?\n rackspace != nil\n end", "def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend", "def on_rackspace?\n rackspace != nil\nend", "def rackspace?(node)\n node.key?('rackspace')\n end", "def ...
[ "0.73676956", "0.73676956", "0.71825504", "0.71666217", "0.70988107", "0.7036013", "0.70162314", "0.69914424", "0.6989146", "0.6876613", "0.6876613", "0.68709594", "0.6845766", "0.68402237", "0.6818065", "0.67730516", "0.6763897", "0.67538035", "0.6740978", "0.6740978", "0.66...
0.742828
0
Are we in a Eucalyptus cloud? === Return true:: If machine is located in an EC2 cloud false:: Otherwise
def eucalyptus? resolve_cloud_type if @eucalyptus.nil? @eucalyptus end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end", "def ec2?\n @ec2 ||= EC2.instance_id.include?('i-')\n end", "def cloud?(node)\n node.key?('cloud')\n end", "def on_rightscale_ec2_platform?\n return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only e...
[ "0.75492007", "0.7413398", "0.7403377", "0.7314464", "0.72841483", "0.72841483", "0.718199", "0.7144862", "0.68322986", "0.6804218", "0.6792275", "0.6792275", "0.67383534", "0.67111564", "0.66921395", "0.6677335", "0.66766465", "0.66143095", "0.66097546", "0.6541074", "0.6517...
0.63980865
25
Controller object === Return c(Controller):: Platformspecific controller object
def controller platform_service(:controller) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller\n @controller ||= ApplicationController.new\n end", "def controller\n @controller ||= controller_name.constantize\n end", "def controller\n @controller ||= MainController.new\n end", "def controller client\n client.env[CONTROLLER_NAME]\n end", "def control...
[ "0.7643023", "0.75106966", "0.72431034", "0.7160315", "0.7066273", "0.6995412", "0.69361246", "0.69347775", "0.68931943", "0.6866875", "0.67717665", "0.67452484", "0.67452484", "0.6734607", "0.6731051", "0.6721731", "0.67209756", "0.6696914", "0.6696914", "0.6620909", "0.6620...
0.78103113
0
Filesystem config object === Return fs(Filesystem):: Platformspecific filesystem config object
def filesystem platform_service(:filesystem) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filesystem_data\n self['filesystem2'] || self['filesystem']\n end", "def get_filesystem\n @@current_fake ? @@current_fake[:filesystem] : ''\n end", "def filesystem_impl=(impl)\n @filesystem_impl = impl\n end", "def filesystem_file(host)\n case host['platform']\n when %r{...
[ "0.6952392", "0.69179416", "0.65042853", "0.6335989", "0.632909", "0.63050026", "0.62324154", "0.60316855", "0.5980779", "0.5933646", "0.5915341", "0.58948094", "0.5754041", "0.57516235", "0.5748909", "0.5716312", "0.56952953", "0.5685673", "0.56470746", "0.56381303", "0.5623...
0.75143844
0
Shell information object === Return platform specific shell information object
def shell platform_service(:shell) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def system_info\n si = SysInfo.new\n si.to_hash\n rescue \n {}\n end", "def info\n [[\"about\", Mysh::DESCRIPTION],\n [\"version\", Mysh::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mysh\")\n .map{|s| s.versio...
[ "0.6689762", "0.6636347", "0.66170174", "0.6578006", "0.65085405", "0.6442196", "0.64024925", "0.6366687", "0.63666725", "0.6339518", "0.62957776", "0.6282682", "0.6281499", "0.62346214", "0.61682725", "0.6156232", "0.6148804", "0.61254436", "0.6071706", "0.6061344", "0.60520...
0.65523195
4
SSH information object === Return platform specific ssh object
def ssh platform_service(:ssh) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_info\n # Run a custom action called \"read_ssh_info\" which does what it says\n # and puts the resulting SSH info into the `:machine_ssh_info` key in\n # the environment.\n #\n # Ssh info has following format..\n #\n #{\n # :host => \"1.2.3.4\",\n ...
[ "0.7775004", "0.7382572", "0.7382572", "0.7382572", "0.7382572", "0.73283446", "0.70838785", "0.692864", "0.6861395", "0.68420076", "0.6628104", "0.6443306", "0.6394162", "0.6394162", "0.6394162", "0.63198215", "0.62954736", "0.6245317", "0.62439144", "0.6239657", "0.6238132"...
0.738389
1
Linux platformspecific platform object === Return instance of Platform::Linux:: If ruby interpreter is running on Linux nil:: Otherwise
def linux raise PlatformError.new("Only available under Linux") unless linux? require_linux return Linux.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linux?\n kind_of? Unix::Platform rescue false\n end", "def linux?\n /linux/.match(RUBY_PLATFORM)\n end", "def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend", "def linux?\n RUBY_PLATFORM =~ /linux/\n end", "def linux?\n RUBY_PLATFORM.match(/linux/)\n end", "def l...
[ "0.81641793", "0.81434256", "0.81431", "0.8081668", "0.8068725", "0.8013422", "0.7965977", "0.7919813", "0.7897795", "0.7783285", "0.77361685", "0.7702981", "0.76829845", "0.76795894", "0.76517737", "0.7591393", "0.7581479", "0.75757873", "0.755613", "0.74806726", "0.74346614...
0.8190539
0
Determines which cloud we're on by the cheap but simple expedient of reading the RightScale cloud file.
def resolve_cloud_type cloud_type = File.read(File.join(self.filesystem.right_scale_state_dir, 'cloud')) rescue nil @ec2 = false @rackspace = false @eucalyptus = false case cloud_type when 'ec2' then ec2 = true when 'rackspace' then @rackspace = true when 'eucalyptus' then eucalyptus = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cloud?(node)\n node.key?('cloud')\n end", "def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end", "def in_cloud?(file)\n File.dirname(file).start_with?(Kinksync.configuration.cloud_path)\n end", "def get_c...
[ "0.6666226", "0.64531565", "0.61970085", "0.60109115", "0.59555256", "0.59150255", "0.5889657", "0.568545", "0.5662921", "0.5646818", "0.5626254", "0.5564425", "0.5551584", "0.5496858", "0.54917866", "0.5428814", "0.540402", "0.5390353", "0.5338402", "0.5304133", "0.5275231",...
0.724408
0
formats the order number in 6 groups, e.g. a41793f76125f9032a10415705b20a66
def number_with_formatting if /^(.*)(.{6})(.{6})(.{6})(.{6})(.{6})/i.match(number_without_formatting) "#{$1}-#{$2}-#{$3}-#{$4}-#{$5}-#{$6}" else number_without_formatting end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_order_number(number)\n number.to_s.gsub(/[^\\w_]/, '').rjust(4, \"0\")[0...20]\n end", "def format_order_number(number)\n number.to_s.gsub(/[^\\w]/, '').rjust(4, '0')[0...20]\n end", "def format_order_number(number)\n number.to_s.gsub(/[A-Z]/, '').rjust(12,...
[ "0.73183244", "0.726796", "0.7087502", "0.6887272", "0.60761565", "0.60745347", "0.6074007", "0.600839", "0.5908821", "0.5887172", "0.5837277", "0.5827815", "0.57644016", "0.57526374", "0.56678563", "0.5646001", "0.5641444", "0.5597025", "0.55739653", "0.5566751", "0.5566751"...
0.64736897
4
e.g. "000001082011" for 1st in Oct 2011
def short_number self.new_record? ? self.number : "#{self.id.to_s.rjust(6, "0")}#{I18n.l(self.created_at, :format => "%m%Y")}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_year\n chars = @date.split('')\n chars.pop(4).join('').to_i\n end", "def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end", "def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end", "def good_date(dd)\n dd = dd.to_s\n dd ...
[ "0.6640362", "0.6465642", "0.6465642", "0.6465642", "0.63995576", "0.63748497", "0.6364608", "0.6320617", "0.6211488", "0.6190731", "0.6174991", "0.6163901", "0.61307484", "0.60894346", "0.6062938", "0.606069", "0.60377425", "0.60359275", "0.6032843", "0.59946954", "0.5964215...
0.0
-1
in case we need one, e.g. "Rechnung000001082011.pdf" Note: this is
def human_pdf_filename "Rechnung-#{self.short_number}.pdf" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filename(url)\n parts = url.split('/')\n dirname = parts[-2]\n filename = parts[-1].split('.')[0] + \"_ocr.pdf\"\n '990s/' + dirname + '/' + filename\nend", "def filename2seq(name)\n m = name.sub(\"_\",\"\").match(/([0-9]{12}).jpg/)\n return nil unless m\n return m[1].to_i\nend", "def number\n ...
[ "0.6600497", "0.6376852", "0.634441", "0.6344274", "0.63266385", "0.630589", "0.62819576", "0.62586564", "0.61954087", "0.6180131", "0.6180131", "0.617402", "0.616587", "0.61601573", "0.6150146", "0.6129026", "0.6111114", "0.6099381", "0.60984665", "0.60891366", "0.6083737", ...
0.68372995
0
returns "geschlossen" etc. for current_state
def human_current_state_name self.class.human_attribute_name("status_#{self.current_state}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_state_s\n self.current_state.to_s.humanize.downcase\n end", "def current_state_s\n self.current_state.to_s.humanize.downcase\n end", "def show_current_state\n {created: 'criado', ready: 'pronto', delivered: 'entregue', paid: 'pago'}[current_state.to_sym]\n end", "def state\n object...
[ "0.78282785", "0.78282785", "0.7298336", "0.7281511", "0.71969175", "0.70957404", "0.70547503", "0.70515317", "0.7040694", "0.70346314", "0.70282656", "0.70155334", "0.6997517", "0.6968779", "0.69068193", "0.6895653", "0.6894868", "0.6891493", "0.6859557", "0.6844566", "0.684...
0.6711958
34
only if we are an invoice with subscibable products
def update_service_periods if self.purchase_order payments = self.purchase_order.payments.recurring.find(:all, :order => "payments.id ASC") unless payments.empty? self.update_attributes(:service_period_start_on => self.service_period_start_on, :service_period_end_on => self.service_period_end_on) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_invoicing?\n # do we have an eventbooking for a BundleEvent\n if order.product.class == BundleEvent\n # and does self belong to a BundleEvent\n if event.class == BundleEvent\n # full invoice for bundle event\n false\n # or to a Subevent\n else\n # allow pa...
[ "0.71502197", "0.7053656", "0.68730384", "0.68404514", "0.67886543", "0.67886543", "0.6777313", "0.6727001", "0.6663362", "0.6630176", "0.659371", "0.64199907", "0.6404109", "0.63965225", "0.6280335", "0.62682736", "0.62649447", "0.6260845", "0.62414926", "0.62103385", "0.620...
0.0
-1
Array of products purchased part of this order
def line_item_products self.line_items.map(&:sellable).map {|s| s.respond_to?(:product) ? s.product : s}.compact.reject {|p| !p.is_a?(Product)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products_bought\n res = []\n\n @data.product_qty.each do |prd_id, qty|\n qty = qty.to_i\n if qty > 0\n res << [ qty, @data.products.with_id(prd_id) ]\n end\n end\n\n res\n end", "def products\n products_at_market = []\n vendors_at_market = self.vendors\n vendor...
[ "0.7324542", "0.7234469", "0.7231418", "0.7056456", "0.69550353", "0.69398594", "0.6922405", "0.68613017", "0.6790389", "0.6789984", "0.67376876", "0.6736284", "0.672384", "0.66453874", "0.65976536", "0.65903336", "0.65899014", "0.656392", "0.6547726", "0.64978963", "0.649789...
0.62258774
28
Array of products purchased part of this order
def line_item_product_subscriptions self.line_item_products.select(&:subscription?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products_bought\n res = []\n\n @data.product_qty.each do |prd_id, qty|\n qty = qty.to_i\n if qty > 0\n res << [ qty, @data.products.with_id(prd_id) ]\n end\n end\n\n res\n end", "def products\n products_at_market = []\n vendors_at_market = self.vendors\n vendor...
[ "0.7324542", "0.7234469", "0.7231418", "0.7056456", "0.69550353", "0.69398594", "0.6922405", "0.68613017", "0.6790389", "0.6789984", "0.67376876", "0.6736284", "0.672384", "0.66453874", "0.65976536", "0.65903336", "0.65899014", "0.656392", "0.6547726", "0.64978963", "0.649789...
0.0
-1
billing due is end of next billing period + 1 day
def update_billing_cycle if recurring_payment = self.purchase_order.payments.recurring.first recurring_payment = recurring_payment.decrement(:duration_occurrences) # udpate the billing period of the order only if recurring_payment.duration_occurrences > 0 nbp = self.next_service_billing_period if nbp && (!self.purchase_order.billing_due_on || nbp.include?(self.purchase_order.billing_due_on)) self.purchase_order.billing_due_on = nbp.last + 1.day self.purchase_order.save(false) end else self.purchase_order.cancel! end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_service_billing_period\n if self.purchase_order && self.purchase_order.recurring? && self.purchase_order.pending?\n payment = self.purchase_order.payments.recurring.find(:all, :order => \"payments.id ASC\").last\n (self.service_period_end_on + 1.day)..(self.service_period_end_on + (payment.in...
[ "0.76777565", "0.74972445", "0.7120942", "0.70368123", "0.70172274", "0.6989992", "0.69674504", "0.69435805", "0.69261986", "0.69202167", "0.68964934", "0.6803151", "0.6741143", "0.6684632", "0.66652316", "0.6659329", "0.66487676", "0.66462344", "0.6642693", "0.6580261", "0.6...
0.743061
2
e.g. Feb 26..Mar 25
def service_billing_period (self.service_period_start_on..self.service_period_end_on) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def month() end", "def month; end", "def month; end", "def date_move_formatter\n '%Y-%m'\n end", "def month_names; end", "def format_dates\n days = (1..@number_of_days_in_month).to_a\n days.map! do |d|\n d < 10 ? \" \" + d.to_s : d.to_s\n end\n # adds blank elements to the beginning ...
[ "0.6506498", "0.63980573", "0.63980573", "0.63571674", "0.63478774", "0.62980247", "0.62038165", "0.620357", "0.6190526", "0.6187881", "0.61655635", "0.61190826", "0.61137676", "0.6086431", "0.6058293", "0.601613", "0.59755987", "0.5934948", "0.5931032", "0.59181046", "0.5911...
0.0
-1
e.g. Mar 26..Apr 25
def next_service_billing_period if self.purchase_order && self.purchase_order.recurring? && self.purchase_order.pending? payment = self.purchase_order.payments.recurring.find(:all, :order => "payments.id ASC").last (self.service_period_end_on + 1.day)..(self.service_period_end_on + (payment.interval_length.to_i.send(payment.interval_unit || :month))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end", "def publish_month_and_year\n [publish_on.month, publish_on.year]\n end", "def friendly_date_range\n sessions.first.start.month == sessions.last.start.month ?\n \"#{...
[ "0.63647294", "0.6199413", "0.61113375", "0.6094005", "0.6038621", "0.60302895", "0.60302895", "0.59761244", "0.59347767", "0.5921026", "0.5909467", "0.58856434", "0.5880772", "0.5872523", "0.5821792", "0.57974696", "0.57964134", "0.57950217", "0.57830405", "0.57760036", "0.5...
0.0
-1
Subclasses may override or supplement validate to perform validation on the list subject
def validate(list) if super && list.length == 2 true else log_error(NAME) {"list must have exactly two entries: #{list.to_sxp}"} false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n return (@list_name && @to && @subject) ? true : false\n end", "def validate\n raise ValidationError, \"Subject is required\" if subject.nil?\n end", "def validate( _x )\n msg = 'ERROR: Item.validate() not implemented!'\n msg += \"\\nTODO: cover common type-base...
[ "0.6905453", "0.665453", "0.6402456", "0.63484466", "0.6278187", "0.6245461", "0.61760217", "0.60865796", "0.60128623", "0.58866715", "0.586856", "0.58012575", "0.5797134", "0.57723945", "0.57568765", "0.5695617", "0.56894886", "0.56894886", "0.56894886", "0.56894886", "0.568...
0.61858207
6
Index page for admin when they are successfully logged in The view greets admin and gives options for creating, searhing users It also has a button for admin to logout and view daily reports of user created..
def index #render plain: "Hey admin" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n\n # if ( !current_user || !current_user.isAdmin )\n # render :text => \"You are not authorized to see this page\", :layout => true\n #\n # return\n # end\n\n @users = User.all\n end", "def index\n @user = current_user\n if @user&& @user.role == \"admin\"\n @title ...
[ "0.76350015", "0.75969255", "0.758603", "0.75639075", "0.7499686", "0.74652964", "0.7464534", "0.74331856", "0.7423181", "0.741385", "0.7378951", "0.7376636", "0.733727", "0.73346597", "0.73291945", "0.7268962", "0.7268962", "0.7224708", "0.7223567", "0.7211335", "0.72104406"...
0.725182
17
These are the pieces of the current operation
def op; (@memblock[@ip]||0)/16; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operations; end", "def operations; end", "def operation; end", "def cops; end", "def cops; end", "def cops; end", "def operations\n @operations\n end", "def op; end", "def extra_state; end", "def operations\n @operations.dup\n end", "def operations\n @operations.dup\n ...
[ "0.7538386", "0.7538386", "0.70927846", "0.6371145", "0.6371145", "0.6371145", "0.6226398", "0.61545753", "0.6110984", "0.6107939", "0.6107939", "0.6034705", "0.60021824", "0.5908514", "0.58837104", "0.58732873", "0.5843514", "0.5820768", "0.5820768", "0.5820768", "0.5795889"...
0.0
-1
Some convenient accessor functions
def [](r); @registers[r]; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getters; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attr; end", "def get_attribute(name); end", "def get_attribute(name); end", "def attr_reader(*)\n end", ...
[ "0.7933522", "0.726432", "0.726432", "0.726432", "0.726432", "0.726432", "0.726432", "0.726432", "0.6936425", "0.6754643", "0.6754643", "0.6730236", "0.664818", "0.6643385", "0.6584442", "0.6584442", "0.6584442", "0.6584442", "0.6584442", "0.6584442", "0.6584442", "0.658444...
0.0
-1
Used to implement both addition and subtraction
def add(a,b) ret1 = a + b ret = ret1 & 0xff self[0xF] = (ret1!=ret)?1:0 ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def +(addend)\n self.plus(addend).to_sub\n end", "def add\n\t number_1 + number_2\n end", "def addition (a, b)\n a + b\nend", "def addition(a, b)\n\ta + b\nend", "def addition(a,b)\n\ta + b\nend", "def addition(a, b)\n\treturn a + b\nend", "def plus(number, other)\n\tnumber + other\nend", "d...
[ "0.76660156", "0.72986364", "0.7241014", "0.72101796", "0.71551204", "0.7151332", "0.7119813", "0.7087326", "0.70708287", "0.70606005", "0.7054963", "0.70482576", "0.6990657", "0.69749486", "0.6954543", "0.6927131", "0.6923979", "0.6921233", "0.6903691", "0.6889298", "0.68716...
0.0
-1
rubocop:enable Metrics/MethodLength rubocop:disable Metrics/MethodLength
def alb_5xx_datapoints @alb_5xx_datapoints ||= cloudwatch_client.get_metric_statistics( namespace: 'AWS/ApplicationELB', metric_name: 'HTTPCode_Target_5XX_Count', dimensions: [ { name: 'LoadBalancer', value: ENV['LOGIN_ALB_LOAD_BALANCER_NAME'], }, ], start_time: twenty_four_hours_ago.dup, end_time: TIME_ZONE.now, period: 300, statistics: ['Sum'], ).datapoints.sort_by(&:timestamp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def custom; end", "def custom; end", "def offences_by; end", "def suivre...
[ "0.78097546", "0.6550692", "0.6393907", "0.6393907", "0.63413805", "0.6341239", "0.6341239", "0.6341239", "0.6341239", "0.63261473", "0.6132386", "0.6132386", "0.6035665", "0.60181385", "0.59858197", "0.597906", "0.59612405", "0.58933866", "0.58933866", "0.5888103", "0.588810...
0.0
-1
Restores a DB Instance to a point in time ==== Returns response: body:
def restore_db_instance_to_point_in_time(source_db_name, target_db_name, opts={}) request({ 'Action' => 'RestoreDBInstanceToPointInTime', 'SourceDBInstanceIdentifier' => source_db_name, 'TargetDBInstanceIdentifier' => target_db_name, :parser => Fog::Parsers::AWS::RDS::RestoreDBInstanceToPointInTime.new, }.merge(opts)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_db_instance_to_point_in_time( options = {} )\n raise ArgumentError, \"No :source_db_instance_identifier provided\" if options.does_not_have?(:source_db_instance_identifier)\n raise ArgumentError, \"No :target_db_instance_identifier provided\" if options.does_not_have?(:target_db_instance_...
[ "0.65107757", "0.64428765", "0.5883472", "0.58691496", "0.5715699", "0.56337386", "0.55387205", "0.5503257", "0.54875857", "0.5471096", "0.5401708", "0.5356772", "0.5354623", "0.5327444", "0.53171396", "0.52862626", "0.5278093", "0.5264664", "0.5261498", "0.5260856", "0.52524...
0.6074114
2
Our handy snowman array ... that is slowly melting (oh no!)
def getWord() File.open("./corncob_lowercase.txt"){|f| line=nil rand(1..58110).times{line=f.gets} puts line return line.chomp() } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mmarray()\r\n\t#Using splat operator to create an array filled with range 1-100\r\n\tnums = *(1..100)\r\n\r\n\t#Will use .map method to replace our numbers\r\n\t#Mapping (iterating over) each value in the array. Uses val as a variable for the value at each index position.\r\n\t#Using an IF statement inside th...
[ "0.60561055", "0.5911244", "0.57994264", "0.5739985", "0.57292753", "0.57292753", "0.57221895", "0.5701122", "0.5691158", "0.5689374", "0.56052846", "0.5603371", "0.56029665", "0.55971795", "0.557868", "0.5549975", "0.55410516", "0.55379206", "0.5516704", "0.5503602", "0.5502...
0.0
-1
Returns the first ten responses that would be scheduled for the given protocol.
def execute @responses = [] @end_date = end_date @end_date = TimeTools.increase_by_duration(start_date, protocol.duration) if @end_date.blank? schedule_responses # Return at most ten responses @responses.sort_by! { |response| response[:open_from] } @responses[0...MAX_PREVIEW_RESPONSE_COUNT] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_ten\n Rails.cache.fetch('top_ten_resp', expires_in: 1.minutes) do\n conn = Faraday.new(url: @base_url) do |faraday|\n faraday.adapter(Faraday.default_adapter)\n end\n\n resp = conn.get do |req|\n req.url '/v1/cryptocurrency/listings/latest'\n req.headers['X-CMC_PRO_AP...
[ "0.6036598", "0.54201394", "0.52545935", "0.5220028", "0.5153872", "0.51267284", "0.5106063", "0.50040185", "0.4976269", "0.49652484", "0.48677963", "0.48536602", "0.48529062", "0.4844984", "0.48421723", "0.48193493", "0.48128352", "0.4751414", "0.47443113", "0.474421", "0.47...
0.5730701
1
8kyu I implemented a function which convert the given boolean value into its string representation.
def boolean_to_string(b) return b.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean_to_string(b)\n if true\n \"true\"\n else\n \"false\"\n end\nend", "def boolean_to_string(b)\n if b \n \"true\"\n else\n \"false\"\n end\nend", "def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anythin...
[ "0.8680349", "0.86385286", "0.833737", "0.79908687", "0.7712514", "0.7603247", "0.7601336", "0.7394316", "0.73607004", "0.73607004", "0.7343037", "0.73152786", "0.72638005", "0.7253689", "0.7247133", "0.7186867", "0.71535224", "0.7152073", "0.7102689", "0.7102689", "0.707875"...
0.8851261
0
Use callbacks to share common setup or constraints between actions.
def set_ad @cp = CompanyPart.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.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
GET /vehicle_armies GET /vehicle_armies.json
def index #@vehicle_armies = VehicleArmy.all @vehicle_armies = VehicleArmy.order(:v_army_no => :desc).all @search = VehicleArmy.search(params[:q]) @vehicle_armies = @search.result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @vehicle\n end", "def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js...
[ "0.68414515", "0.6673916", "0.65709573", "0.65295464", "0.6391356", "0.6357214", "0.6283317", "0.6254717", "0.6202203", "0.61548656", "0.61426264", "0.6133821", "0.6106734", "0.60786355", "0.60765475", "0.60387814", "0.60319215", "0.6030767", "0.6009398", "0.5986829", "0.5985...
0.6194811
9
GET /vehicle_armies/1 GET /vehicle_armies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @vehicle\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end", "def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"v...
[ "0.69964856", "0.6903795", "0.6844377", "0.6773009", "0.6669359", "0.65195805", "0.64644545", "0.646372", "0.63832116", "0.6360878", "0.63604254", "0.629952", "0.6226809", "0.6192622", "0.61595255", "0.6152078", "0.6140195", "0.6138111", "0.61216927", "0.6118195", "0.61150986...
0.0
-1
POST /vehicle_armies POST /vehicle_armies.json
def create @vehicle_army = VehicleArmy.new(vehicle_army_params) respond_to do |format| if @vehicle_army.save format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.created')} format.json { render action: 'show', status: :created, location: @vehicle_army } else format.html { render action: 'new' } format.json { render json: @vehicle_army.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def create_vehicles veh...
[ "0.6746426", "0.6452859", "0.63560665", "0.63560665", "0.63560665", "0.61956847", "0.61088204", "0.6034517", "0.59630686", "0.588549", "0.5882796", "0.5863898", "0.5844551", "0.5834354", "0.5832875", "0.58074296", "0.58066344", "0.5794564", "0.5791548", "0.5738122", "0.573647...
0.67126286
1
PATCH/PUT /vehicle_armies/1 PATCH/PUT /vehicle_armies/1.json
def update respond_to do |format| if @vehicle_army.update(vehicle_army_params) format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.updated') } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @vehicle_army.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n...
[ "0.6961523", "0.69212383", "0.6872287", "0.6872287", "0.6674775", "0.6674775", "0.6674775", "0.66632587", "0.66361785", "0.66121715", "0.6586705", "0.6449745", "0.6431252", "0.63984746", "0.63394976", "0.63379335", "0.6299391", "0.62926656", "0.62926656", "0.62907225", "0.629...
0.6881056
2