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
GET /employee/edit/1 GET /employee/edit/1.json
def edit @employee = Employee.find(params[:id]) @employee_contact = @employee.employee_contact.blank? ? EmployeeContact.new : @employee.employee_contact @employee_ec_contact = @employee.employee_ec_contact.blank? ? EmployeeEcContact.new : @employee.employee_ec_contact @employee_job = @employee.employee_job.blank? ? EmployeeJob.new : @employee.employee_job @employee_salary = @employee.employee_salary.blank? ? EmployeeSalary.new : @employee.employee_salary @employee_qualification = @employee.employee_qualification.blank? ? EmployeeQualification.new : @employee.employee_qualification @employee_membership = @employee.employee_membership.blank? ? EmployeeMembership.new : @employee.employee_membership @employee_spouse = @employee.employee_spouse.blank? ? EmployeeSpouse.new : @employee.employee_spouse @form_id = 'edit-form' @users = User.order(:username).all @supervisors = Employee.all @designations = Designation.order(:title).all @employment_statuses = EmploymentStatus.order(:name).all @job_categories = JobCategory.order(:name).all @departments = Department.order(:name).all respond_to do |fmt| fmt.html { render :partial => 'form' } fmt.json { render :json => @employee } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @employee = Employee.find(params[:id])\n end", "def edit\n @employee = Employee.find(params[:id])\n respond_to do |format|\n # format.html { render action: \"index\" }\n format.js\n # format.json { render json: @employee }\n end\n end", "def edit\n @employee = Employe...
[ "0.80351394", "0.7999853", "0.7531273", "0.75276196", "0.7290397", "0.72233635", "0.7132575", "0.7132575", "0.7114641", "0.7065122", "0.7040112", "0.7040112", "0.7040112", "0.7016973", "0.69972116", "0.69102955", "0.6908866", "0.6908866", "0.6908866", "0.6908866", "0.6908866"...
0.71566314
6
Move the given register to temporary storage and rewrite reads from it to point to the new location.
def spill(reg) spill_move = Move.new(reg, SPILL_REG, true) @moves.each do |move| move.src = SPILL_REG if move.src == reg end @moves << spill_move end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shiftRight(register)\n\tregister.unshift(0).pop\nend", "def pop_reg reg\n @fisk.pop reg.to_register\n end", "def with_register name = \"temp\"\n reg = register(name)\n yield reg\n release_register reg\n end", "def register name = \"temp\"\n Registers::Temp.new name, \"r64\"\n end", ...
[ "0.55005604", "0.5304445", "0.52626455", "0.5249074", "0.5239891", "0.5112067", "0.51108605", "0.5095372", "0.4973654", "0.49369252", "0.49340752", "0.48452878", "0.4843692", "0.48028213", "0.47891957", "0.47784686", "0.4710739", "0.46858305", "0.46796703", "0.46791205", "0.4...
0.54092324
1
Return an array of Move objects in the order they should be executed.
def sort # Find a cycle in the move graph and pick a register to spill to break it. spillee = nil each_strongly_connected_component do |component| if component.size > 1 fail if spillee # There is one cycle with 3 registers. spillee = component.first.src end end # Break the cycle. spill(spillee) if spillee tsort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end", "def moves \r\n move = []\r\n move_directions do |dir|\r\n move += grow_unblocked_moves_in_dir(*dir)\r\n end\r\n move\r\n end", "...
[ "0.70720303", "0.7055909", "0.68432826", "0.68365794", "0.68076944", "0.6777615", "0.6764118", "0.6701747", "0.66412926", "0.65923786", "0.6579858", "0.6551193", "0.65377843", "0.6524724", "0.6505313", "0.6501989", "0.6492492", "0.64846724", "0.64798087", "0.646525", "0.64517...
0.0
-1
Implements the calling convention from
def call(dest, *args) # Split into register and stack args stack_args = args.dup reg_args = stack_args.slice! 0...3 # Push all the stack arguments in reverse order stack_args.reverse.each do |arg| SET push, arg end # Set the argument registers MoveSorter.new(reg_args).sort.each do |move| SET move.dst, move.src end JSR dest # Clean up the stack arguments ADD sp, stack_args.size if stack_args.size > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call\n\n\tend", "def call\n\n\tend", "def call() end", "def call\n # implement in subclasses\n end", "def call(*) end", "def call(*) end", ...
[ "0.78853166", "0.78853166", "0.78853166", "0.78853166", "0.78853166", "0.78853166", "0.78853166", "0.78853166", "0.7607828", "0.7607828", "0.759717", "0.74952185", "0.74685013", "0.74685013", "0.7387357", "0.73359966", "0.7205347", "0.7205347", "0.7180994", "0.7045674", "0.70...
0.0
-1
Allocate storage for local variables on the stack.
def locals(&blk) @stack_usage ||= 0 num_locals = blk.arity # Allocate stack space locals = (0...num_locals).map do |i| offset = -(@stack_usage+i+1) PlusRegister.new j, (offset & 0xFFFF) end @stack_usage += num_locals SUB sp, num_locals yield *locals # Deallocate stack space ADD sp, num_locals @stack_usage -= num_locals end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_variables() end", "def push_local\n <<-CODE\n next_int;\n stack_push(fast_fetch(c->locals, _int));\n CODE\n\n # \"next_int; stack_push(fast_fetch(cpu_current_locals(state, c), _int));\"\n end", "def new_local(name)\n name = name.name if name.is_a? Identifier\n @variables[nam...
[ "0.6657945", "0.6476294", "0.63291484", "0.6280848", "0.6264493", "0.62583894", "0.62052745", "0.61316067", "0.6096079", "0.60400754", "0.60282224", "0.5930591", "0.5871734", "0.58600366", "0.58068335", "0.57896346", "0.5743584", "0.57284284", "0.5661522", "0.5649867", "0.564...
0.6802815
0
incomplete shouldn't do anything
def incomplete puts "not a feature of GoalTracker" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incomplete\r\n\r\n end", "def private; end", "def probers; end", "def missing; end", "def remaining; end", "def missing?; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def ignores; end", "def complete?; end", "def suivre; end", "def internship_passed; end", "def schubert; end...
[ "0.75019497", "0.7479263", "0.7039842", "0.69246954", "0.6788856", "0.6705853", "0.66968834", "0.6696005", "0.6681822", "0.6651681", "0.6605049", "0.6603852", "0.6597086", "0.65584797", "0.65584797", "0.65584797", "0.65584797", "0.65046865", "0.6494277", "0.64641196", "0.6424...
0.0
-1
returns if data has been sent
def is_complete? # check if an individual rep, complete reps of day if not if self.rep_parent.nil? self.repititions. where(:show_date => Date.current).each do |rep| if !rep.is_complete? return false end end return true else return self.state == Activity::COMPLETE end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sent?\n status.sent? || status.received? || status.read?\n end", "def msg_sent?\n true\n end", "def sent?\n @sent\n end", "def request_sent?\n !response.nil?\n end", "def sent?\n !@sent_at.nil?\n end", "def sent?\n !@id.nil?\n end", "def can_send?\n !s...
[ "0.7570652", "0.7502323", "0.7289277", "0.6952359", "0.69519824", "0.69459414", "0.6929616", "0.68513554", "0.6805283", "0.6805283", "0.67984354", "0.6748324", "0.6733153", "0.66976255", "0.6686635", "0.66778404", "0.66710746", "0.66611874", "0.6648253", "0.6633918", "0.65776...
0.0
-1
:secret => 'a988443081447099355cae80d988cbaa' See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password
def error_messages_for(object_name) object = instance_variable_get("@#{object_name}") if object msg = "" puts "================" puts object.errors.inspect object.errors.each do | attr, msg| msg = content_tag(:p, Column[attr]+msg) break end end content_tag(:div, msg, :id => "errorExplanation") unless msg.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secret_params\n params.require(:secret).permit(:body, :password, :expiration, :unlock_password)\n end", "def secret\n decrypt_secret\n end", "def secret\n decrypt_secret\n end", "def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_...
[ "0.67574555", "0.67557096", "0.67557096", "0.66757953", "0.6570936", "0.6537558", "0.64591116", "0.6381581", "0.6324565", "0.6238957", "0.6231013", "0.6228836", "0.6201663", "0.6189981", "0.6186701", "0.6186701", "0.6158133", "0.6133264", "0.61268026", "0.6115818", "0.6115818...
0.0
-1
using hashes as method parameters
def area(options) #taking one hash instead of multiple parameters, imagine you had to pass 10 parameters... options[:width] * options[:length] #the use of symbols :key is a convention for hash method parameters end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params=(hash); end", "def params=(hash); end", "def method(hash)\n p hash # {\"location\"=>\"SF\", \"color\"=>\"red\", \"size\"=>100}\nend", "def method(hash)\n p hash # {\"location\"=>\"SF\", \"color\"=>\"red\", \"size\"=>100}\nend", "def hash_for_json(*_arg0); end", "def hash\n hash_args...
[ "0.7405891", "0.7405891", "0.7006835", "0.69985807", "0.6968216", "0.69272965", "0.6813502", "0.675658", "0.675658", "0.6680257", "0.6644106", "0.6567214", "0.65349287", "0.6517277", "0.6472143", "0.6435197", "0.6363558", "0.6345563", "0.63415986", "0.6314929", "0.6264529", ...
0.0
-1
Execute file using associate app
def run file_name application = select_app file_name system "#{application} #{file_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run file_name\n\t\tapplication = select_app file_name\n\t\tsystem \"#{application} #{file_name}\"\n\tend", "def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end", "def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{applica...
[ "0.7812446", "0.77878755", "0.77824914", "0.76077783", "0.74816865", "0.70978063", "0.6927364", "0.6513946", "0.62575394", "0.62202096", "0.6184521", "0.6184521", "0.6108953", "0.6071891", "0.6021347", "0.59654903", "0.5828118", "0.5815852", "0.57904077", "0.57484615", "0.574...
0.77640027
4
Given file, look up matching application
def select_app file_name ftype = file_type( file_name ).downcase @app_map[ ftype ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_app file_name \n ftype = file_type( file_name ).downcase\n @app_map[ ftype ]\n end", "def select_app( file_name )\n ftype = file_type( file_name )\n @app_map[ ftype ]\n end", "def select_app file_name \n\t\tftype = file_type( file_name ).downcase\n\t\t@app_map[ ftype ]\n\tend", "def ...
[ "0.7087219", "0.7029745", "0.6963543", "0.693891", "0.69037956", "0.66919976", "0.6542444", "0.6382299", "0.6157495", "0.60503167", "0.601646", "0.5859156", "0.5818461", "0.57572633", "0.57046884", "0.5678892", "0.56743115", "0.5649614", "0.5636007", "0.5610509", "0.56057966"...
0.7122727
0
Initialize class, and set default strategy to :user
def initialize super @strategy = :user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(strategy)\n @strategy = strategy\n end", "def configure_user_search_strategy(strategy)\n @user_search_strategy =\n case strategy.to_s\n when \"default\"\n GitHub::Ldap::UserSearch::Default.new(self)\n when \"global_catalog\"\n GitHub::Ldap::UserSearc...
[ "0.67172897", "0.6685895", "0.668033", "0.6675152", "0.66650766", "0.654373", "0.65173364", "0.6514021", "0.6514021", "0.6514021", "0.6506571", "0.6500203", "0.6500203", "0.6496486", "0.6461032", "0.6426161", "0.6419987", "0.63515323", "0.63169116", "0.63151526", "0.625627", ...
0.82145846
0
Set the Twitter lookup strategy to :search or :user
def strategy=(strategy) case strategy when :user, :search @strategy = strategy end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_user_search_strategy(strategy)\n @user_search_strategy =\n case strategy.to_s\n when \"default\"\n GitHub::Ldap::UserSearch::Default.new(self)\n when \"global_catalog\"\n GitHub::Ldap::UserSearch::ActiveDirectory.new(self)\n else\n GitHub::L...
[ "0.6899154", "0.60859466", "0.60526884", "0.58958787", "0.5813516", "0.56575435", "0.5576044", "0.5574021", "0.55738586", "0.5396325", "0.53547204", "0.5337322", "0.5326187", "0.530415", "0.5301709", "0.52801555", "0.52781755", "0.52741367", "0.5263843", "0.523065", "0.519487...
0.6275252
1
Set the Twitter user to find
def user=(user) @user = user @twitter_user = nil load_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end", "def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end", "def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end", "d...
[ "0.8349216", "0.8345023", "0.72438496", "0.70895934", "0.70694596", "0.7068223", "0.70290947", "0.7006494", "0.6889445", "0.6876138", "0.6872724", "0.6866049", "0.68649864", "0.68396765", "0.6833791", "0.68009865", "0.6795352", "0.6794126", "0.6772457", "0.676607", "0.6763045...
0.7091827
3
Set the Twitter user to find
def term=(term) @term = term @twitter_search = nil load_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end", "def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end", "def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end", "d...
[ "0.8349216", "0.8345023", "0.72438496", "0.7091827", "0.70895934", "0.70694596", "0.7068223", "0.70290947", "0.7006494", "0.6889445", "0.6876138", "0.6872724", "0.6866049", "0.68649864", "0.68396765", "0.6833791", "0.68009865", "0.6795352", "0.6794126", "0.6772457", "0.676607...
0.0
-1
Get the words from the file
def load_words case @strategy when :user @words = twitter_user.status.text.split(/\s/) when :search @words = twitter_search(@term).statuses.map(&:text).join(" ").split(/\s/) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_from_file( f )\n result = Array.new\n File.foreach( f ) do | line |\n result << self.words_from_string( line )\n end\n result.flatten\n end", "def prepare_words(filename)\n @words = []\n File.readlines(filename).each do |line|\n line.split.each {|word| @words << word}\n ...
[ "0.8049222", "0.7622496", "0.753984", "0.7527045", "0.74274397", "0.7357578", "0.7262832", "0.7232927", "0.7181514", "0.7048082", "0.7045214", "0.7034308", "0.7008517", "0.6906711", "0.6897604", "0.68760556", "0.6840481", "0.6836829", "0.6836829", "0.6827689", "0.6820445", ...
0.6163481
59
Return a search result from Twitter
def twitter_search(term) TwitterClient.new.search(term) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_twitter()\n search_call = \"#{@api_endpoint_twitter}?ors=#{@search_term}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @response = http_get search_call\n end", "def twitter_search\n @search = TwitterAuthor.client.user_search(params[:twitter_search]).collect\n flash[:notice] = \...
[ "0.8690462", "0.7994195", "0.7743022", "0.77180386", "0.7610012", "0.75524044", "0.7549618", "0.73038965", "0.7235854", "0.7158196", "0.7112229", "0.70813894", "0.7063754", "0.7062807", "0.7028427", "0.7021699", "0.70064896", "0.69585836", "0.69265914", "0.6892464", "0.687170...
0.78962815
2
Return a specified user from Twitter
def twitter_user @twitter_user ||= TwitterClient.new.user(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_from_twitter_as_hash(screen_name_or_twitter_id)\n Rails.cache.fetch(\"/users/show/#{screen_name_or_twitter_id}\", :expires_in => 2.hours) { twitter.get(\"/users/show/#{screen_name_or_twitter_id}\") }\n end", "def get_user_detail_by_twitter_id(twitter_id)\n @user = User.find(:select=>\"*\",:co...
[ "0.7574586", "0.757112", "0.7473761", "0.74678403", "0.7417528", "0.73607737", "0.7356598", "0.7271338", "0.71384966", "0.7107479", "0.7039584", "0.70374835", "0.7031068", "0.7017989", "0.68920445", "0.68843776", "0.6844438", "0.6824777", "0.67040557", "0.65976465", "0.658888...
0.7708476
0
Use during getting, prepend the ID to any exception
def identify_error begin yield rescue => ex ex.message.insert(0, "#{@id} error: ") raise end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id\n _id rescue nil\n end", "def invalid_id_number; end", "def error_id\n Apartment::Tenant.current.to_s + \"/\" + id.to_s\n end", "def fix_id(id, format, extra)\n id << \".\" + format if !format.blank?\n id << \".\" + extra if !extra.blank?\n return id\n end", "def id\n raise \...
[ "0.6401947", "0.63159853", "0.6027114", "0.5939986", "0.5810798", "0.57606584", "0.57374054", "0.5703896", "0.56836647", "0.5671199", "0.56609386", "0.5619931", "0.5540316", "0.55389", "0.55183214", "0.5501152", "0.5497123", "0.5494911", "0.5491441", "0.5470526", "0.5465639",...
0.5382579
39
Parse out a percentage (as a float)
def parse(text) text.gsub(/[\s%]/, '').strip.to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(string)\n string = string.tr(\",\", \".\").delete(\"~\")\n if (match = string.match(/^(\\d*\\.?\\d*)$/))\n match[1].to_f\n elsif (match = string.match(/^(\\d*\\.?\\d*)%$/))\n match[1].to_f / 100\n elsif (match = string.match(/^(\\d*\\.?\\d*)[:\\/](\\d*\\.?\\d*)$/))\n match[1].t...
[ "0.73787385", "0.72825503", "0.69483334", "0.68342865", "0.6810938", "0.67334825", "0.67295235", "0.6727258", "0.6716521", "0.6677001", "0.66509783", "0.6631067", "0.6560657", "0.65534985", "0.6470235", "0.64059305", "0.63977706", "0.6391433", "0.6383352", "0.63677", "0.63518...
0.74519306
0
this doesnt work for 40!! its 39. float issue?
def test_change_margin_check_margin() @item1.change_margin(40) assert_equal(40, @item1.margin) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fractional; end", "def Float(p0) end", "def fahr_freezing_temp\n puts (32 - 32) * 0.5556#.round\nend", "def prec_f() end", "def irpoliinsaturadas\n vag=(grasaspoli * 100) / 70\n vag.round(2)\n end", "def irpoliinsaturadasp\n vag=(valorgrasaspolip...
[ "0.6774252", "0.672812", "0.6570865", "0.65675396", "0.6512004", "0.64751947", "0.646948", "0.6417826", "0.6384445", "0.63770753", "0.6364956", "0.6363551", "0.63534266", "0.634874", "0.6340488", "0.6296843", "0.6268328", "0.62656295", "0.61920637", "0.6189428", "0.61871594",...
0.0
-1
Authentication page for user
def new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loginpage\n end", "def authenticate_user\n \tif !logged_in?\n \tredirect_to login_url\n \tend\n end", "def authentication\n if UserSession.find.nil?\n respond_to do |format|\n format.html { redirect_to(\"/login\", :notice => 'You must be logged in') }\n end\n end\n...
[ "0.7355386", "0.72648567", "0.72240555", "0.71717376", "0.7170952", "0.7103944", "0.7039346", "0.7037468", "0.70302737", "0.7024364", "0.70205873", "0.7002982", "0.69805145", "0.6974057", "0.6970712", "0.6958569", "0.69407356", "0.692904", "0.69278985", "0.6924855", "0.691858...
0.0
-1
Authenticate user based on email and password
def create result = @api_service.sign_in(params.slice(:email, :password).as_json) if result&.dig("user", "auth_token").present? cookies[:auth_token] = result&.dig("user", "auth_token") redirect_to edit_user_path(id: 1), notice: "Signed in successfully" else flash.now[:alert] = result&.dig("error", "message") render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end", "def authenticate(email, password)\n user = User.find_for_authentication(email: email)\n ...
[ "0.8652116", "0.8289102", "0.82730454", "0.82612836", "0.82458925", "0.8162527", "0.7993756", "0.7990024", "0.79389846", "0.7835821", "0.7797384", "0.77341723", "0.77281624", "0.7726959", "0.7725414", "0.77238226", "0.7695794", "0.76811177", "0.76717466", "0.76545775", "0.762...
0.0
-1
Private method to load API service
def load_api_service @api_service = ApiService.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api\n @api ||= PrismicService.init_api\n end", "def data_service\n DataServicesApi::Service.new(url: api_service_url)\n end", "def method_missing(method_sym, *arguments, &block)\n if self.class.service_class(method_sym)\n # load service from cache if available\n service = i...
[ "0.68924063", "0.6859681", "0.6827161", "0.68155384", "0.67120504", "0.6692524", "0.65503263", "0.6486344", "0.6486344", "0.6456455", "0.6454877", "0.64273906", "0.6424875", "0.6351732", "0.6325336", "0.6222585", "0.615099", "0.6147298", "0.6120337", "0.6119487", "0.61189526"...
0.873317
0
For when Mailchimp is testing that our webhook works
def confirm_webhook render :json => "ok", :status => 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webhook\n puts \"webhook params: #{params.inspect}\"\n if GoCardless.webhook_valid?(params[:payload])\n render :text => \"true\", :status => 200\n else\n render :text => \"false\", :status => 403\n end\n end", "def webhook\n @config = ZipMoney::Configuration \n @_webhook =...
[ "0.67869085", "0.6571325", "0.6552353", "0.6531604", "0.63817245", "0.6359207", "0.63590926", "0.6242446", "0.6233506", "0.62312764", "0.6208684", "0.61513346", "0.61503863", "0.6099582", "0.607256", "0.6063292", "0.6039634", "0.601697", "0.59806085", "0.59806085", "0.5965347...
0.6655412
1
Fetch and store Mailchimp Lists, Groupings and Groups
def refresh_lists settings = current_user.settings_for("mailchimp") unless settings && settings.settings["api_key"] flash[:warning] = "You need to configure your Mailchimp API key!" redirect_to(root_url) and return end counts = Mailchimp.refresh_lists_for(current_user) flash[:notice] = "Successfully cached #{pluralize counts[:lists], 'list'}, #{pluralize counts[:groupings], 'grouping'}, and #{pluralize counts[:groups], 'group'}." redirect_to(root_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mailing\n gb = Gibbon.new\n @lists = Hash.new\n for i in 1..gb.lists['total'] do\n list_id = gb.lists['data'][i - 1]['id']\n name = gb.lists['data'][i - 1]['name']\n @lists[name] = []\n members = gb.list_members({:id => list_id})\n members['data'].map { |m| @lists[name].push(m...
[ "0.7106344", "0.6650071", "0.62344825", "0.6084809", "0.60549235", "0.6026354", "0.59572196", "0.58818847", "0.5798306", "0.57596856", "0.56996727", "0.56779045", "0.56779045", "0.5629777", "0.5627818", "0.5622494", "0.5601823", "0.55877674", "0.5560389", "0.5520661", "0.5502...
0.6590449
2
"type": "subscribe", "fired_at": "20090326 21:35:57", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054",
def customer_mailchimp_subscribed { :list_id => data['list_id'], :fired_at => params['fired_at'], :mailchimp_id => data['id'], :email => data['email'], :email_type => data['email_type'], :merges => data['merges'], :ip_opt => params['ip_opt'], :ip_signup => params['ip_signup'], :human => "#{data['email']} subscribed to Mailchimp list with ID #{data['list_id']}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subscribers\n subscriber_data = RunrWatcherServer.runr_session_get(\"subscribers\")\n return [] unless subscriber_data.present?\n list = subscriber_data[:subscribers][\"list\"]\n return [] unless list.present?\n JSON.parse list\n end", "def http_raw_notify_data\n {\n \"id\"=>\"b98...
[ "0.5999414", "0.5978768", "0.57443494", "0.5717597", "0.5698974", "0.56845605", "0.5588418", "0.55851257", "0.5563251", "0.55236775", "0.5500315", "0.5499309", "0.547075", "0.54653543", "0.54242164", "0.5415669", "0.5391406", "0.53794944", "0.5363186", "0.53216493", "0.530618...
0.64715093
0
"type": "unsubscribe", "fired_at": "20090326 21:40:57", "data[action]": "unsub", "data[reason]": "manual", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054",
def customer_mailchimp_unsubscribed { :list_id => data['list_id'], :fired_at => params['fired_at'], :mailchimp_id => data['id'], :email => data['email'], :email_type => data['email_type'], :merges => data['merges'], :ip_opt => params['ip_opt'], :campaign_id => data['campaign_id'], :human => "#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successful_unsubscribe\n end", "def unsubscribed\n @attributes[:unsubscribed]\n end", "def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end", "def unsubscribe; end", "def subid\n unsubscribe[:subid]\n end", "def unsubscribe\n end", ...
[ "0.7093893", "0.67585737", "0.6753457", "0.654267", "0.6537029", "0.64951944", "0.64703214", "0.64703214", "0.6458982", "0.64323497", "0.64226466", "0.63964117", "0.63964117", "0.63933295", "0.6350215", "0.6344921", "0.6344216", "0.6323642", "0.62809145", "0.6274924", "0.6273...
0.7201231
0
"type": "profile", "fired_at": "20090326 21:31:21", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054",
def customer_mailchimp_profile_updated { :list_id => data['list_id'], :fired_at => params['fired_at'], :mailchimp_id => data['id'], :email => data['email'], :email_type => data['email_type'], :merges => data['merges'], :ip_opt => params['ip_opt'], :human => "#{data['email']} updated Mailchimp profile information." } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trackgen_info;\treturn @json_data['trackgen_info'];\tend", "def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end ...
[ "0.5621395", "0.549105", "0.5414451", "0.5411209", "0.53774613", "0.53614426", "0.532061", "0.52865446", "0.5200691", "0.5182363", "0.5174451", "0.50722224", "0.50630736", "0.5050609", "0.50498444", "0.503773", "0.5036641", "0.50324535", "0.501359", "0.501359", "0.50117403", ...
0.56294674
0
"type": "upemail", "fired_at": "20090326\ 22:15:09", "data[list_id]": "a6b5da1054", "data[new_id]": "51da8c3259",
def customer_mailchimp_email_updated { :list_id => data['list_id'], :fired_at => params['fired_at'], :new_mailchimp_id => data['id'], :new_email => data['new_email'], :old_email => data['old_email'], :human => "#{data['email']} updated their email address on Mailchimp, from '#{data['old_email']}' to '#{data['new_email']}'." } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned fr...
[ "0.6213054", "0.57850266", "0.5681093", "0.5540804", "0.55029696", "0.53624773", "0.53202635", "0.5304917", "0.53043294", "0.52784836", "0.52484655", "0.5196279", "0.51936203", "0.519108", "0.5152175", "0.5138144", "0.51369935", "0.5114219", "0.5059403", "0.5059069", "0.50580...
0.61849403
1
"type": "cleaned", "fired_at": "20090326 22:01:00", "data[list_id]": "a6b5da1054", "data[campaign_id]": "4fjk2ma9xd", "data[reason]": "hard",
def email_cleaned { :list_id => data['list_id'], :fired_at => params['fired_at'], :campaign_id => data['campaign_id'], :email => data['email'], :reason => data['reason'], :human => "#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [campaign, number, customer, scheduled_start, child, description, category_type, overview, priority, date_event, product_event, phone, event_name, event_number, time_difference, type_event, primary_phone_call_id, parent_phone_call_id, product_name, product_name_g, scheduled_start_parent, descriptio...
[ "0.5644173", "0.5541001", "0.54635406", "0.5271407", "0.5236314", "0.5213901", "0.51805097", "0.51797944", "0.5157291", "0.5120727", "0.5099303", "0.5061041", "0.5058922", "0.50314", "0.5026635", "0.5021494", "0.50193137", "0.5004807", "0.4940935", "0.49341482", "0.4931532", ...
0.6565988
0
"type": "campaign", "fired_at": "20090326 21:31:21", "data[id]": "5aa2102003", "data[subject]": "Test Campaign Subject", "data[status]": "sent", "data[reason]": "", "data[list_id]": "a6b5da1054"
def campaign_status { :list_id => data['list_id'], :campaign_id => data['id'], :subject => data['subject'], :status => data['status'], :reason => data['reason'], :human => "Campaign Status (ID: #{data['id']}) - Subject: '#{data['subject']}', Status: '#{data['status']}', Reason: '#{data['reason']}'" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned fr...
[ "0.5975898", "0.5762865", "0.5715143", "0.569575", "0.56628025", "0.5376054", "0.5373471", "0.53494716", "0.53301656", "0.5320408", "0.5264978", "0.5246386", "0.52330554", "0.52212316", "0.52072406", "0.52053136", "0.50999343", "0.5090078", "0.5073651", "0.50715154", "0.50434...
0.6306562
0
Returns the set of line numbers corresponding to the lines that were changed in a specified file.
def modified_lines_in_file(file) subcmd = 'show --format=%n' @modified_lines ||= {} @modified_lines[file] ||= Overcommit::GitRepo.extract_modified_lines(file, subcmd: subcmd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_modified_lines(file)\n git_range_info_line_regex = /^@@ .+\\+(?<line_number>\\d+),/\n git_modified_line_regex = /^\\+(?!\\+|\\+)/\n file_info = git.diff_for_file(file)\n line_number = 0\n lines = []\n file_info.patch.split(\"\\n\").each do |line|\n starting_line_number ...
[ "0.76706094", "0.7519632", "0.7404835", "0.71209306", "0.7103931", "0.7047567", "0.70006347", "0.6767158", "0.67452025", "0.6700643", "0.6094435", "0.6069913", "0.60499334", "0.60404664", "0.60083395", "0.5993386", "0.59645873", "0.5940394", "0.5920645", "0.588639", "0.587020...
0.7196825
3
Returns whether the commit that triggered this hook is the first commit on the branch.
def initial_commit? return @initial_commit unless @initial_commit.nil? @initial_commit = !Overcommit::Utils.execute(%w[git rev-parse HEAD~]).success? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end", "def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end", "def single_commit?\n commit_range? && (first_commit == last_commit)\n end", "def detached_head?\n reba...
[ "0.7892316", "0.7892316", "0.7040554", "0.67317414", "0.6728145", "0.6632289", "0.6598481", "0.64903975", "0.6471433", "0.64154357", "0.63823813", "0.63488525", "0.63393813", "0.63331914", "0.6328761", "0.63133544", "0.62486887", "0.62273306", "0.6138494", "0.61362016", "0.60...
0.7954759
0
method to create an array of event times. Will use this to create array of start_at times and endat times
def make_event_times_array(dates_array, hour, min) event_times = Array.new dates_array.each_index do |index| event_times[index] = create_event_time(dates_array[index],hour, min) end return event_times end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt...
[ "0.77758896", "0.6993386", "0.6827037", "0.6825186", "0.67938447", "0.6713517", "0.65722907", "0.65666837", "0.655617", "0.6547934", "0.6458089", "0.6405242", "0.6352919", "0.63423306", "0.63409716", "0.6257865", "0.6253482", "0.62533295", "0.62227345", "0.6215372", "0.618292...
0.75218064
1
Method to combine :start_at and :end_at to make hash for each event and put them in an array.
def create_event_array(start_at_array, end_at_array, event_name, activity_id) events_array = Array.new start_at_array.each_index do |index| event_hash = Hash.new event_hash[:start_at] = start_at_array[index] event_hash[:end_at] = end_at_array[index] event_hash[:name] = event_name event_hash[:activity_id] = activity_id events_array[index]= event_hash end return events_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_events\n mapped_timeline = Timeline.new\n self.each do |time,events|\n mapped_timeline[time] = events.map{|event| yield event }\n end\n mapped_timeline\n end", "def index\n @events = Event.where('event_start >= ?', Date.today).order(:event_start, :time_begin)\...
[ "0.63486975", "0.6328946", "0.6306188", "0.6238378", "0.62371016", "0.61670715", "0.6133689", "0.6112115", "0.6023875", "0.5979033", "0.5974558", "0.5967543", "0.5954405", "0.59527653", "0.5941525", "0.58745205", "0.5859826", "0.58438385", "0.584312", "0.58239293", "0.5814451...
0.74076563
0
GET /microposts GET /microposts.json
def index @microposts = Micropost.paginate(page: params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @microposts = Micropost.all\n end", "def index\n @microposts = Micropost.all\n end", "def index\n @mymicroposts = Mymicropost.all\n end", "def index\n\t\t@microposts = Micropost.paginate(page: params[:page])\n\tend", "def index\n # @microposts = Micropost.all\n @microposts = Mic...
[ "0.7812569", "0.7812569", "0.7795536", "0.7666757", "0.7602911", "0.7551813", "0.7445781", "0.72913843", "0.72909546", "0.7278202", "0.7275811", "0.7269476", "0.7181516", "0.7176857", "0.7170947", "0.7094121", "0.7088447", "0.7085954", "0.70824647", "0.7075361", "0.7058888", ...
0.74457556
7
GET /microposts/1 GET /microposts/1.json GET /microposts/new
def new @micropost = Micropost.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @micropost = Micropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end", "def new\n \t@micropost = Micropost.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micro...
[ "0.8062003", "0.8042192", "0.7933891", "0.78684115", "0.77133733", "0.7521373", "0.7361078", "0.7349607", "0.7314839", "0.7298307", "0.7269954", "0.72609794", "0.7194115", "0.7168874", "0.71598667", "0.7147803", "0.7127726", "0.7127726", "0.71215975", "0.71042645", "0.7083248...
0.75707436
5
POST /microposts POST /microposts.json
def create @micropost = current_user.microposts.build(micropost_params) respond_to do |format| if @micropost.save format.html { redirect_to root_url(:anchor => "ideas"), notice: 'Micropost was successfully created.' } format.json { render :show, status: :created, location: @micropost } else format.html { render :new } format.json { render json: @micropost.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @micropost = current_user.microposts.new(micropost_params)\n respond_to do |format|\n if @micropost.save\n format.html do\n redirect_to @micropost, notice: t('created', name: 'Micropost')\n end\n format.json { render :show, status: :created, location: @micropos...
[ "0.74312764", "0.7217986", "0.71826017", "0.7145193", "0.6962739", "0.6956072", "0.69354075", "0.69113517", "0.6891886", "0.6889804", "0.68856466", "0.686241", "0.68548185", "0.684824", "0.6820386", "0.68123066", "0.6808733", "0.6805246", "0.6805246", "0.6800926", "0.68007153...
0.7220905
1
PATCH/PUT /microposts/1 PATCH/PUT /microposts/1.json
def update @micropost = Micropost.friendly.find(params[:id]) respond_to do |format| if @micropost.update(micropost_params) format.html { redirect_to @micropost, notice: 'Micropost was successfully updated.' } format.json { render :show, status: :ok, location: @micropost } else format.html { render :edit } format.json { render json: @micropost.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @micropost.update(micropost_params)\n format.html do\n redirect_to @micropost, notice: t('updated', name: 'Micropost')\n end\n format.json { render :show, status: :ok, location: @micropost }\n else\n format.html { render :ed...
[ "0.71863025", "0.71819925", "0.71427673", "0.711474", "0.7065061", "0.70081484", "0.68871725", "0.68864113", "0.6832735", "0.67563313", "0.67409426", "0.66877484", "0.6571116", "0.6467749", "0.6337864", "0.6337864", "0.6337864", "0.6337864", "0.6337864", "0.633658", "0.631759...
0.7089813
4
DELETE /microposts/1 DELETE /microposts/1.json
def destroy @micropost = Micropost.friendly.find(params[:id]) @micropost.destroy flash[:success] = "Micropost deleted" redirect_to request.referrer || root_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to microposts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @micrropost = Micrropost.find(params[:id])\n @micrropost.destroy\n\n ...
[ "0.8095181", "0.8050301", "0.7961507", "0.7866971", "0.7772134", "0.7753939", "0.7753939", "0.77040315", "0.7667724", "0.7625753", "0.7614404", "0.7515454", "0.75125194", "0.7483781", "0.7454637", "0.74388146", "0.7401005", "0.73189944", "0.73029476", "0.7197533", "0.7157698"...
0.7403803
16
Confirms an admin user.
def admin_user unless current_user && current_user.admin? redirect_to login_url, notice: "admin can only do this action." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end", "def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless cu...
[ "0.79044944", "0.767215", "0.76483077", "0.76210374", "0.7605678", "0.7605678", "0.75945777", "0.7588445", "0.7588445", "0.7503662", "0.74675834", "0.7451482", "0.7424005", "0.7411313", "0.74107665", "0.7402138", "0.73993605", "0.7358812", "0.7329228", "0.73179626", "0.731276...
0.7173976
27
Use callbacks to share common setup or constraints between actions.
def set_landing @landing = Landing.friendly.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 landing_params params.require(:landing).permit(:slug, :name, :item_id, :code, :css_file, :js_file, :is_published) 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
this is making a call to get the location of the user
def geolocation response = HTTParty.post("https://www.googleapis.com/geolocation/v1/geolocate?key=#{ENV['GEO_API_KEY']}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location\n\n end", "def user_location_info\n if current_user.present? && current_user.current_sign_in_ip != \"127.0.0.1\"\n @user_info = Geocoder.search(current_user.current_sign_in_ip).first\n elsif request.remote_ip != \"127.0.0.1\"\n @user_info = Geocoder.search(request.remote_ip).f...
[ "0.75264525", "0.7472244", "0.74630344", "0.72805846", "0.72765505", "0.7267583", "0.7236195", "0.7168454", "0.7167036", "0.7105202", "0.7100908", "0.710027", "0.7080792", "0.7072434", "0.70597965", "0.70534915", "0.6952847", "0.6907835", "0.69028264", "0.687186", "0.6865438"...
0.6375141
65
get the place object of the nearest open coffee shop to current location
def places(lat, lng) response = HTTParty.post("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}") return response['results'][1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locate(place)\n locations, = get :q => place\n return locations.first\n end", "def find_closest\n find_target_coordinates\n location = build_query.geo_near(@target_cord).first\n\n return nil if location.nil?\n [(location.phone_numbers & customer_numbers).first, location.geo_name]\n end", ...
[ "0.66048163", "0.6569624", "0.6480491", "0.63710266", "0.63396525", "0.6246378", "0.62188107", "0.6194003", "0.6173839", "0.6153958", "0.61313677", "0.61065006", "0.6084064", "0.60752493", "0.6071899", "0.60263085", "0.6021436", "0.59754795", "0.5966822", "0.5964702", "0.5964...
0.5638887
45
work method receives message payload in raw format in our case it is JSON encoded string which we can pass to RecentPosts service without changes
def work(raw_post) RecentPosts.push(raw_post) ack! # we need to let queue know that message was received end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payload; message[:payload]; end", "def message_content\n JSON.parse(body).with_indifferent_access\n end", "def work(raw_post)\n email_params = JSON.parse(raw_post).with_indifferent_access\n send_simple_message(params)\n ack! # we need to let queue know that message was received\n end", "def...
[ "0.62695724", "0.6134371", "0.61125296", "0.5968066", "0.5938257", "0.5886663", "0.5837624", "0.57817066", "0.57671666", "0.57564956", "0.5671648", "0.5660459", "0.56560004", "0.56298965", "0.56298965", "0.5619777", "0.56071836", "0.5584202", "0.55171144", "0.5515163", "0.549...
0.59386694
4
=begin General command to create Guide in all pages =end
def create_guide(title, description) result = "" result << "<div class='explanation-unit'>" result << "<h1>#{title}</h1>" result << "<p>#{description}</p>" result << "</div>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_guide\n @title = \"Template Guide\"\n end", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def create\n @guide = Guide.new(guide_params)\n\n respond_to do |format|\n action...
[ "0.6416863", "0.6237102", "0.61921793", "0.6040167", "0.6040167", "0.60146636", "0.6002858", "0.5998762", "0.59902966", "0.59401906", "0.5919527", "0.590134", "0.5863649", "0.57965535", "0.57965535", "0.57965535", "0.57774985", "0.5767953", "0.5760136", "0.57329845", "0.57219...
0.61946714
4
GET /members/1 GET /members/1.json
def show @member = Member.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @member } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end", "def members\n raw_response = get_request('users/members')\n ...
[ "0.802443", "0.7435711", "0.7342297", "0.7342297", "0.7342297", "0.7323629", "0.72980005", "0.7221314", "0.72195596", "0.7147893", "0.7134981", "0.70929253", "0.70929253", "0.7075791", "0.70524216", "0.7036332", "0.70284396", "0.6977145", "0.69389415", "0.69389415", "0.693894...
0.71454585
16
GET /members/new GET /members/new.json
def new @member = Member.new respond_to do |format| format.html # new.html.erb format.json { render json: @member } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end", "def new\n @member = Member.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m...
[ "0.79043746", "0.7789812", "0.76272595", "0.75811505", "0.7581038", "0.7546918", "0.7513603", "0.7477062", "0.7446343", "0.74113417", "0.7382035", "0.72367895", "0.72031033", "0.71898484", "0.7185999", "0.7159002", "0.7158302", "0.7136005", "0.7136005", "0.7136005", "0.713469...
0.78913903
6
POST /members POST /members.json
def create @member = Member.new(params[:member]) respond_to do |format| if @member.save format.html { redirect_to @member, notice: 'Member was successfully created.' } format.json { render json: @member, status: :created, location: @member } else format.html { render action: "new" } format.json { render json: @member.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_member_to_list(user, list, member_id, options={})\n post(\"/#{user}/#{list}/members.json\", options.merge(:id => member_id))\n end", "def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.ge...
[ "0.6734318", "0.6707801", "0.6686722", "0.66615456", "0.66511947", "0.6612481", "0.6595865", "0.6569636", "0.65571123", "0.65534073", "0.6552213", "0.6539384", "0.6535769", "0.6534659", "0.6526704", "0.6526704", "0.6526704", "0.6526704", "0.6507443", "0.6491895", "0.64855516"...
0.6571146
8
PUT /members/1 PUT /members/1.json
def update @member = Member.find(params[:id]) respond_to do |format| if @member.update_attributes(params[:member]) format.html { redirect_to @member, notice: 'Member was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @member.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n params.require(:member).permit(:name)\n if @member.update(member_params)\n format.html { redirect_to @member, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n ...
[ "0.6593529", "0.64914197", "0.64502794", "0.6438251", "0.6406436", "0.6386342", "0.6386342", "0.6386342", "0.6386342", "0.6386342", "0.6386342", "0.6386342", "0.6386342", "0.6386342", "0.6333237", "0.6329286", "0.6317044", "0.6317044", "0.6271256", "0.6264795", "0.625334", ...
0.640992
8
DELETE /members/1 DELETE /members/1.json
def destroy @member = Member.find(params[:id]) @member.destroy respond_to do |format| format.html { redirect_to members_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n \n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to me...
[ "0.7680797", "0.76410586", "0.76410586", "0.76106364", "0.76106364", "0.75673884", "0.75673884", "0.7557034", "0.7353036", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.7305875", "0.72848064", "0.727338...
0.75450885
12
Updates the lesson at which a student left off
def update_left_off(lesson_id) update_attribute(:left_off, lesson_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubmit_students\n # self.lesson.students - self.students\n self.grades_course.students - self.students\n end", "def kick_out\n @students = students.shift\n end", "def update_scheduledlessons\n starts_on = Time.now\n course.lessons.all(order: :position).each do |lesson|\n unless schedu...
[ "0.60317314", "0.5915387", "0.5874263", "0.58734745", "0.5734091", "0.5722048", "0.5700454", "0.56862485", "0.5613513", "0.5599763", "0.5597632", "0.55835813", "0.55756336", "0.55720216", "0.5566742", "0.5560592", "0.55529946", "0.5512913", "0.5481752", "0.5480805", "0.548057...
0.69948167
0
funcionalidad: accesible_by(current_ability)) 1) rails g cancan:ability
def save_ctacte_pdf_to(filename,entity) require 'prawn' pdf = Prawn::Document.new(:left_margin => 35, :top_margin => 35,:page_size => "LETTER", :page_layout => :portrait) offset = 0 pdf.repeat(:all, :dynamic => true) do pdf.draw_text ("Cuenta corriente de " + entity.first.try(:cliente).razonsocial + " impreso el " + Date.today.strftime("%d/%m/%Y")) , :at => [5,745],:style => :bold, :size => 10 pdf.draw_text "Hoja Nro.: " + pdf.page_number.to_s.rjust(4,"0"), :at => [300, 745],:style => :bold, :size => 8 end data = [["Fecha","Tipo Cp","Numero","Importe","Fecha Vto","impreso"],[] ] saldo = 0 entity.each do |r| data << [r.fecha.blank? ? '' : r.fecha.strftime("%d/%m/%Y"), r.type, r.numero, r.total_comprobante, r.fechavto.blank? ? '' : r.fechavto.strftime("%d/%m/%Y"), r.printed_at.blank? ? '' : r.printed_at.strftime("%d/%m/%Y")] saldo += r.total_comprobante end data << ["" ,"Totales","",saldo.to_s,"","" ] pdf.table(data, :column_widths => [65, 100, 60, 65, 65, 65], :cell_style => { :font => "Times-Roman", :size => 10,:padding => [2,3,4,2], :align => :left, :valign => :center }, :header => true , :row_colors => ["F0F0F0", "FFFFCC"] ) do column(2...3).align = :right row(0).column(0..6).align = :center end pdf.render_file(filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_ability\n current_user.ability\n end", "def current_ability\n \t\t@current_ability ||= Ability.new(current_usuario)\n\tend", "def current_ability\n \t\t@current_ability ||= Ability.new(current_usuario)\n\tend", "def current_ability\n @current_ability ||= ::Ability.new(current_usuario)\n ...
[ "0.8099499", "0.7991816", "0.7991816", "0.79580015", "0.7881289", "0.78747946", "0.7872564", "0.78693116", "0.7868123", "0.778758", "0.7787095", "0.77726537", "0.77496505", "0.77385414", "0.77385414", "0.77225846", "0.77225846", "0.7721969", "0.77085435", "0.76616055", "0.765...
0.0
-1
returns an array of possible moves from position parameter (an array with 2 elements) (e.g. [0,0] means piece is at position 0,0)
def possible_moves(position, board, color) out_array = [] x = position[0]-1 y = position[1]-1 (x..x+2).each do |row| break if row > 7 (y..y+2).each do |column| break if column > 7 if !board[row][column] || board[row][column].color != color out_array.push([row, column]) end end end out_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_positio...
[ "0.83037543", "0.81232154", "0.8114779", "0.79245496", "0.7867993", "0.78561664", "0.7849601", "0.781421", "0.77758414", "0.77155554", "0.7640597", "0.76276886", "0.7614111", "0.75958157", "0.7573149", "0.7551012", "0.75299513", "0.75269735", "0.75191516", "0.75015783", "0.75...
0.7763802
9
GET /efemerides GET /efemerides.json
def index @efemerides = Efemeride.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n ...
[ "0.6595957", "0.64276004", "0.637383", "0.63241476", "0.63241476", "0.63241476", "0.6243483", "0.62248427", "0.6222056", "0.62212324", "0.6218299", "0.6201375", "0.6197122", "0.61910653", "0.6160749", "0.61554456", "0.61273766", "0.60763806", "0.6061175", "0.6049678", "0.6048...
0.72936547
0
GET /efemerides/1 GET /efemerides/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @efemerides = Efemeride.all\n end", "def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: ...
[ "0.7028929", "0.66010743", "0.6528467", "0.6506149", "0.6490034", "0.6457086", "0.6443732", "0.6412965", "0.6411595", "0.63869244", "0.6370031", "0.6360404", "0.6359589", "0.6352082", "0.6347313", "0.63429946", "0.6333767", "0.63324493", "0.63312924", "0.632442", "0.6313106",...
0.0
-1
POST /efemerides POST /efemerides.json
def create @efemeride = Efemeride.new(efemeride_params) respond_to do |format| if @efemeride.save format.html { redirect_to @efemeride, notice: 'Efemeride ha sido creada.' } format.json { render :show, status: :created, location: @efemeride } else format.html { render :new } format.json { render json: @efemeride.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @edrife = Edrive.new(edrife_params)\n\n respond_to do |format|\n if @edrife.save\n format.html { redirect_to @edrife, notice: 'Edrive was successfully created.' }\n format.json { render :show, status: :created, location: @edrife }\n else\n format.html { render :new...
[ "0.6362536", "0.6338888", "0.6289659", "0.62379044", "0.6176653", "0.6022605", "0.6013906", "0.5988079", "0.5895292", "0.5869615", "0.5860972", "0.5858056", "0.58465064", "0.58321863", "0.5808621", "0.58060694", "0.57956755", "0.5773347", "0.5754637", "0.57378435", "0.5728085...
0.70247984
0
PATCH/PUT /efemerides/1 PATCH/PUT /efemerides/1.json
def update respond_to do |format| if @efemeride.update(efemeride_params) format.html { redirect_to @efemeride, notice: 'Efemeride ha sido actualizada.' } format.json { render :show, status: :ok, location: @efemeride } else format.html { render :edit } format.json { render json: @efemeride.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @ephem.update(ephem_params)\n format.html { redirect_to @ephem, notice: 'Ephem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ephem.errors,...
[ "0.657859", "0.6500946", "0.6267927", "0.6232415", "0.6207815", "0.62031585", "0.61929935", "0.619094", "0.6172974", "0.61641216", "0.61198616", "0.60809433", "0.60808015", "0.6070673", "0.60662687", "0.6058941", "0.6054351", "0.60444343", "0.6042393", "0.6036405", "0.6032921...
0.65653116
1
DELETE /efemerides/1 DELETE /efemerides/1.json
def destroy @efemeride.destroy respond_to do |format| format.html { redirect_to efemerides_url, notice: 'Efemeride ha sido eliminada.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @ephem.destroy\n respond_to do |format|\n format.html { redirect_to ephems_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @cl...
[ "0.72305256", "0.7032952", "0.6986585", "0.69046986", "0.6896647", "0.6895572", "0.68844205", "0.6877227", "0.6868776", "0.6852742", "0.6849682", "0.68482864", "0.6842759", "0.68418604", "0.6829235", "0.68260795", "0.68242365", "0.6818047", "0.68178713", "0.6808849", "0.67938...
0.7296594
0
Use callbacks to share common setup or constraints between actions.
def set_efemeride @efemeride = Efemeride.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 efemeride_params params.require(:efemeride).permit(:numero, :descripcion) 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
GET /empresas_grandes GET /empresas_grandes.json
def index @empresas_grandes = EmpresasGrande.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @degres = Degre.all\n end", "def show\n render json: @grupo...
[ "0.6267364", "0.6222571", "0.60442704", "0.589569", "0.58901346", "0.58424026", "0.58141", "0.5804504", "0.57948494", "0.5785185", "0.5765662", "0.5742184", "0.5738538", "0.5729949", "0.56681836", "0.5662469", "0.56457037", "0.5637877", "0.56318474", "0.56205976", "0.5607145"...
0.72416115
0
GET /empresas_grandes/1 GET /empresas_grandes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @empresas_grandes = EmpresasGrande.all\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format....
[ "0.710647", "0.6306237", "0.620093", "0.6176882", "0.60206455", "0.6013953", "0.59929407", "0.599071", "0.5975804", "0.59522134", "0.5949048", "0.5939722", "0.5928647", "0.59245807", "0.5911114", "0.58957636", "0.5878798", "0.5870293", "0.58664495", "0.58569115", "0.584997", ...
0.0
-1
POST /empresas_grandes POST /empresas_grandes.json
def create @empresas_grande = EmpresasGrande.new(empresas_grande_params) respond_to do |format| if @empresas_grande.save format.html { redirect_to @empresas_grande, notice: 'Empresas grande was successfully created.' } format.json { render :show, status: :created, location: @empresas_grande } else format.html { render :new } format.json { render json: @empresas_grande.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @gran_unidad = GranUnidad.new(gran_unidad_params)\n\n respond_to do |format|\n if @gran_unidad.save\n format.html { redirect_to @gran_unidad, notice: 'Gran unidad was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gran_unidad }\n ...
[ "0.6418323", "0.59974456", "0.5931636", "0.58654153", "0.5831695", "0.582175", "0.5781392", "0.57767004", "0.5761897", "0.5749735", "0.57318324", "0.56716955", "0.5668795", "0.5646195", "0.5613132", "0.560302", "0.5595234", "0.55907357", "0.55776787", "0.5546996", "0.5543814"...
0.6476368
0
PATCH/PUT /empresas_grandes/1 PATCH/PUT /empresas_grandes/1.json
def update respond_to do |format| if @empresas_grande.update(empresas_grande_params) format.html { redirect_to @empresas_grande, notice: 'Empresas grande was successfully updated.' } format.json { render :show, status: :ok, location: @empresas_grande } else format.html { render :edit } format.json { render json: @empresas_grande.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @gran_unidad.update(gran_unidad_params)\n format.html { redirect_to @gran_unidad, notice: 'Gran unidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { ren...
[ "0.6492887", "0.64774734", "0.6374838", "0.62955874", "0.6279331", "0.62629515", "0.62590384", "0.62122184", "0.62020576", "0.6188772", "0.6187928", "0.61781293", "0.61756694", "0.61731726", "0.6166238", "0.61631745", "0.6154509", "0.6141572", "0.6134362", "0.6133993", "0.612...
0.66714966
0
DELETE /empresas_grandes/1 DELETE /empresas_grandes/1.json
def destroy @empresas_grande.destroy respond_to do |format| format.html { redirect_to empresas_grandes_url, notice: 'Empresas grande was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { he...
[ "0.7241906", "0.71171665", "0.7002369", "0.69909877", "0.69902223", "0.69559526", "0.69471467", "0.69358104", "0.69334406", "0.69239676", "0.6916203", "0.69143885", "0.68470216", "0.6842328", "0.6841625", "0.6840756", "0.6837575", "0.6836073", "0.68325824", "0.68270934", "0.6...
0.72367156
1
Use callbacks to share common setup or constraints between actions.
def set_empresas_grande @empresas_grande = EmpresasGrande.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def empresas_grande_params params.require(:empresas_grande).permit(:nombre, :representante_legal_rut, :dv, :aux1, :aux2, :aux3, :image) 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
initializer to start process
def initialize TYPES.each do |type| transform_files!(Files.type_files(type), type) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start!\n process.start\n end", "def start\n @process = ChildProcess.build(*parameters)\n process.start\n end", "def initialize(process); end", "def initialize(process)\n self.process = process\n end", "def initialize(process)\n\t\t\t\tsuper(IO.popen(process, Writeable))\n\t\t\t...
[ "0.8170848", "0.79551566", "0.7647669", "0.759407", "0.7112839", "0.7075482", "0.7041341", "0.7032578", "0.6981403", "0.69229776", "0.68864155", "0.6859371", "0.67045236", "0.668854", "0.6649972", "0.664344", "0.6642851", "0.65024316", "0.65007013", "0.6498543", "0.6498041", ...
0.0
-1
walks all files and converts them all to the new format
def transform_files!(files, type) files.each do |file| @file = file @type = type parsed = "" @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory namespaces = LANGUAGES.collect do |lang| if type == 'views' namespace = [lang] + @dirnames else namespace = [lang, type] + @dirnames end puts "Converting: " + file + " into namespace: " puts namespace.map {|x| "[\"#{x}\"]"}.join("") Namespace.new(namespace,lang) end contents = Base.get_file_as_string(file) parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type) # write the app/type/file with new i18n format instead of gettext File.open(file, 'w') { |file| file.write(parsed)} namespaces.each do |ns| new_file_handler(ns) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end", "def git_convert_all!\n Dir[\"#{@path}/**/*.erb\"].each do...
[ "0.67649734", "0.6670742", "0.6469586", "0.633741", "0.62945455", "0.6190535", "0.61411077", "0.6111291", "0.6109648", "0.60937256", "0.60236865", "0.6023474", "0.598543", "0.5969204", "0.5932392", "0.593233", "0.5889535", "0.5884787", "0.5871994", "0.58075887", "0.5750295", ...
0.69372356
0
directory will be created in config/locales/type/ in dump_yaml!
def create_filepath(language) @dirpath = File.join(LOCALE_DIR + @type + '/' + @dirnames.first) File.join(@dirpath + '/' + language + '.yml') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end", "def create_local\n template \"config/locales/en.rb\", \"config/locales/#{class_name.underscore}.en.yml\"\n end", "def file_dumps\r\n Dir.new(translation_base)....
[ "0.69399136", "0.6430094", "0.62637156", "0.61745507", "0.605668", "0.6015132", "0.600937", "0.5980962", "0.5938675", "0.5921478", "0.5842158", "0.5831651", "0.5827498", "0.58187544", "0.58163184", "0.58013827", "0.574444", "0.5665773", "0.56035733", "0.55927724", "0.5578496"...
0.6269849
2
dumps the translation strings into yml files
def dump_yaml!(filepath,translations) return if translations.blank? FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath) File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end", "def save!\n FileUtils.mkdir_p File.dirname(self.file)\n\n File.open(self.file, \"w+\") do |f|\n f << %(#{self.namespace}.translations || (#{self....
[ "0.7478688", "0.6756288", "0.6724751", "0.65271837", "0.6494844", "0.6396262", "0.63741976", "0.63378483", "0.62018317", "0.61155903", "0.6104265", "0.6073624", "0.6061962", "0.59855217", "0.59820116", "0.5876098", "0.5857729", "0.5797701", "0.5760566", "0.5747575", "0.572560...
0.6956579
1
cleanup empty keys recursivley
def cleanup!(content) content.each do |key, value| cleanup!(value) if value.is_a? Hash content.delete(key) if value.blank? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup!\n self.reject! { |k, v| v.empty? }\n end", "def strip_empty_entries(hash)\n return hash unless hash.is_a?(Hash)\n\n hash.inject({}) do |m, (k, v)|\n m[k] = strip_empty_entries(v) unless v&.empty?\n m.delete(k) if m[k].nil? || m[k].empty?\n m\n end\nend", "def strip_nulls!...
[ "0.6784451", "0.6473593", "0.6402198", "0.63760006", "0.6329877", "0.6300712", "0.62988967", "0.62974083", "0.6265873", "0.6232406", "0.6119637", "0.60819286", "0.6034449", "0.60061765", "0.5996029", "0.5963863", "0.5957308", "0.5938296", "0.5932182", "0.5932182", "0.5921553"...
0.6214484
10
A generalized method to handle tablesorter queries. It's meant to be used in the corresponding Controller action. Params: clazz: The model's primary class base_query: If there are any relevant joins or so > pass the AR relation here partial (optional): path to the partial to be rendered
def create_query_html_response(base_query, partial: 'row', locals: {}) resp_data = ts_ajax_handler.query_data(base_query) records = resp_data.delete(:records) resp_data[:data] = render_response_html(records, partial: partial, locals: locals) resp_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_table(klass, objects)\n # get links from class' helper\n links = send(\"#{klass.table_name}_index_links\", objects).compact\n\n # if there are any batch links, insert the 'select all' link\n batch_ops = !links.reject{|l| !l.match(/class=\"batch_op_link\"/)}.empty?\n links.insert(0, select_...
[ "0.5548069", "0.5349646", "0.53415644", "0.5231635", "0.515947", "0.5149141", "0.5112904", "0.51075965", "0.51056933", "0.50279224", "0.5010953", "0.50074697", "0.49906096", "0.49256086", "0.49144667", "0.49069282", "0.4898878", "0.48711687", "0.4863244", "0.48568588", "0.483...
0.5000707
12
Render the html rows for the given records and an optional named partial. Returns HTML string or nil
def render_response_html(records, partial: 'row', locals: {} ) output = render_to_string(partial: partial, locals: { records: records }.merge(locals)) # if the query has no results, it will return a string which causes jquery to crash output = nil unless records.any? output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_record_from_config(record, renderer = record_select_config.label)\n case renderer\n when Symbol, String\n # return full-html from the named partial\n render :partial => renderer.to_s, :locals => {:record => record}\n\n when Proc\n # return an html-cleaned descriptive string\n ...
[ "0.67454976", "0.6625903", "0.6348517", "0.60518867", "0.59954494", "0.5915619", "0.58751804", "0.5839854", "0.57700557", "0.56415856", "0.5578389", "0.5541731", "0.54972696", "0.5467913", "0.54628384", "0.5453182", "0.54108423", "0.53909916", "0.5385601", "0.5363377", "0.535...
0.7949676
0
skip_before_filter :override_db, :only => [:index, :edit]
def new @shop_product = ShopProduct.new #@shop_product.product_id = 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n prevent_non_admin\n end", "def before_filter; end", "def prevent_edit\n !can_edit?\n end", "def index\n index_filter\n end", "def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filte...
[ "0.6871658", "0.6593347", "0.6203222", "0.6157025", "0.6057748", "0.5893718", "0.5893718", "0.5893718", "0.5859201", "0.5828274", "0.56969804", "0.5652371", "0.5652371", "0.5652371", "0.5639119", "0.5633347", "0.563103", "0.56298286", "0.56046116", "0.5591556", "0.5588635", ...
0.0
-1
TeleSign RestClient, useful for making generic RESTful requests against the API. +customer_id+ Your customer_id string associated with your account. +api_key+ Your api_key string associated with your account. +rest_endpoint+ (optional) Override the default rest_endpoint to target another endpoint. +timeout+ (optional) How long to wait for the server to send data before giving up, as a float.
def initialize(customer_id, api_key, rest_endpoint: 'https://rest-api.telesign.com', proxy: nil, timeout: 10) @customer_id = customer_id @api_key = api_key @rest_endpoint = rest_endpoint @http = Net::HTTP::Persistent.new(name: 'telesign', proxy: proxy) unless timeout.nil? @http.open_timeout = timeout @http.read_timeout = timeout end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest\n @rest ||= RestClient.new ENDPOINT[type], lgn: login, pwd: password\n end", "def call_api(**rest_options)\n @retry.do do\n res = RestClient::Request.execute(**rest_options)\n json = res && !res.empty? ? ::JSON.parse(res.to_s) : nil\n call_api_response(res) if r...
[ "0.6244816", "0.6234532", "0.60365266", "0.59155256", "0.58677393", "0.58076847", "0.5753729", "0.5723202", "0.56997734", "0.5676537", "0.56553006", "0.564077", "0.5604026", "0.55906004", "0.557717", "0.5524308", "0.5522994", "0.55147743", "0.54602253", "0.5452858", "0.545061...
0.7206188
0
Generic TeleSign REST API POST handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the POST request with, as a hash.
def post(resource, **params) execute(Net::HTTP::Post, 'POST', resource, **params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(resource, params)\n Api.new.post(resource, params)\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n ...
[ "0.75428265", "0.70685315", "0.6853991", "0.68156886", "0.6690143", "0.65098995", "0.6404931", "0.63250756", "0.6283927", "0.6038787", "0.6038787", "0.5970068", "0.59241366", "0.5862658", "0.58508605", "0.5834396", "0.5758661", "0.5705562", "0.56920415", "0.5683019", "0.56573...
0.7740034
0
Generic TeleSign REST API GET handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the GET request with, as a hash.
def get(resource, **params) execute(Net::HTTP::Get, 'GET', resource, **params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_path, params=nil, accept=\"*/*\")\n http_params = {:accept => accept}\n http_params = http_params.merge(params: params) if params\n response = @http_client[resource_path].get(http_params)\n Response.new(response)\n rescue => e\n log.error Howitzer::CommunicationError, e...
[ "0.7063598", "0.69762707", "0.6887614", "0.68423516", "0.66711134", "0.66264284", "0.6617485", "0.6552251", "0.64845777", "0.6483327", "0.6444215", "0.64318323", "0.64318323", "0.6416487", "0.63905346", "0.6364933", "0.63618934", "0.6358219", "0.62922496", "0.6242217", "0.618...
0.7988195
0
Generic TeleSign REST API PUT handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the PUT request with, as a hash.
def put(resource, **params) execute(Net::HTTP::Put, 'PUT', resource, **params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(api_version, resource, payload, query_parameters = nil,\n headers = nil)\n make_rest_call(:put, uri_builder(api_version, resource,\n query_parameters), payload, headers)\n end", "def put(resource, body = \"\", headers = {})\n prepare_r...
[ "0.70956933", "0.70368356", "0.6830302", "0.6829505", "0.6654068", "0.65090257", "0.6508298", "0.63247776", "0.62288934", "0.6223546", "0.62199175", "0.6177819", "0.6177819", "0.61661243", "0.6145439", "0.61161745", "0.6110584", "0.60541165", "0.60461867", "0.60164374", "0.59...
0.80104744
0
Generic TeleSign REST API DELETE handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the DELETE request with, as a hash.
def delete(resource, **params) execute(Net::HTTP::Delete, 'DELETE', resource, **params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete(api_version, resource, query_parameters = nil, headers = nil)\n make_rest_call(:delete, uri_builder(api_version, resource,\n query_parameters), headers)\n e...
[ "0.7877372", "0.7480377", "0.72798955", "0.7059302", "0.68671685", "0.6858565", "0.67931414", "0.6769459", "0.668201", "0.663129", "0.66185176", "0.6605539", "0.6597864", "0.6593301", "0.6585191", "0.65845305", "0.65734565", "0.65626556", "0.65529925", "0.65267724", "0.652036...
0.8279141
0
Generic TeleSign REST API request handler. +method_function+ The net/http request to perform the request. +method_name+ The HTTP method name, as an upper case string. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the HTTP request with, as a hash.
def execute(method_function, method_name, resource, **params) resource_uri = URI.parse("#{@rest_endpoint}#{resource}") encoded_fields = '' if %w[POST PUT].include? method_name request = method_function.new(resource_uri.request_uri) if content_type == "application/x-www-form-urlencoded" unless params.empty? encoded_fields = URI.encode_www_form(params, Encoding::UTF_8) request.set_form_data(params) end else encoded_fields = params.to_json request.body = encoded_fields request.set_content_type("application/json") end else resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8) request = method_function.new(resource_uri.request_uri) end headers = RestClient.generate_telesign_headers(@customer_id, @api_key, method_name, resource, content_type, encoded_fields, user_agent: @@user_agent) headers.each do |k, v| request[k] = v end http_response = @http.request(resource_uri, request) Response.new(http_response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_request(resource_name, method_name, params = {}, response_key = nil)\n end", "def request(resource, method, params = nil) \n resource = Resources.get(resource, method, params)\n params = append_api_credentials(params)\n\n if method == :post\n payload = prepare_params(p...
[ "0.6881146", "0.6747781", "0.6244243", "0.6165793", "0.61495125", "0.60945827", "0.60688543", "0.60095716", "0.6008411", "0.5952333", "0.59438866", "0.5936315", "0.58843195", "0.5881889", "0.584854", "0.58376443", "0.5790852", "0.57417744", "0.57381666", "0.57350147", "0.5729...
0.7453009
0
GET /thresholds GET /thresholds.json
def index @thresholds = Threshold.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @threshold }\n end\n end", "def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend", "def create...
[ "0.59992146", "0.58752257", "0.5848886", "0.5711196", "0.5689826", "0.56108534", "0.5553224", "0.55522025", "0.5538886", "0.5511574", "0.54407936", "0.53804755", "0.53055227", "0.5290292", "0.52837574", "0.524133", "0.5188683", "0.51577353", "0.51183265", "0.51137453", "0.507...
0.7063734
0
GET /thresholds/1 GET /thresholds/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @thresholds = Threshold.all\n end", "def show\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @threshold }\n end\n end", "def get_threshold\n d = self.vspecs.select(:value).where(name: 'thres...
[ "0.69760793", "0.6465288", "0.60399467", "0.59047806", "0.57203627", "0.5694649", "0.56749475", "0.5667187", "0.55897677", "0.55240417", "0.55198246", "0.5513609", "0.540041", "0.5383369", "0.53610665", "0.53088", "0.5257977", "0.5254192", "0.50990325", "0.50986415", "0.50694...
0.0
-1
POST /thresholds POST /thresholds.json
def create @threshold = Threshold.new(threshold_params) respond_to do |format| if @threshold.save format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' } format.json { render :show, status: :created, location: @threshold } else format.html { render :new } format.json { render json: @threshold.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\...
[ "0.6966539", "0.6436343", "0.61232716", "0.60181296", "0.5961568", "0.5955487", "0.56774676", "0.5563616", "0.553094", "0.55199975", "0.5450079", "0.541051", "0.5317877", "0.51938426", "0.5158801", "0.51015145", "0.50843513", "0.50095844", "0.492647", "0.492609", "0.49013627"...
0.71900964
0
PATCH/PUT /thresholds/1 PATCH/PUT /thresholds/1.json
def update respond_to do |format| if @threshold.update(threshold_params) format.html { redirect_to thresholds_path, notice: 'Threshold was successfully updated.' } format.json { render :show, status: :ok, location: @threshold } else format.html { render :edit } format.json { render json: @threshold.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n if @threshold.update_attributes(params[:threshold])\n format.html { redirect_to @threshold, notice: 'Threshold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.6908464", "0.6423047", "0.6135383", "0.5685925", "0.5647299", "0.5636884", "0.5538382", "0.5538382", "0.55133283", "0.54966605", "0.5445029", "0.5441752", "0.5426735", "0.5401405", "0.53695375", "0.53661764", "0.5365714", "0.5361594", "0.53432304", "0.53278357", "0.5318644...
0.7070543
0
DELETE /thresholds/1 DELETE /thresholds/1.json
def destroy @threshold.destroy respond_to do |format| format.html { redirect_to thresholds_url, notice: 'Threshold was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prd_threshold = PrdThreshold.find(params[:id])\n @prd_threshold.destroy...
[ "0.7635639", "0.6575579", "0.64611566", "0.6421593", "0.63860756", "0.62113523", "0.6180906", "0.61196035", "0.61111253", "0.6030906", "0.6022729", "0.5962589", "0.5922817", "0.59216017", "0.5919271", "0.58847916", "0.58829063", "0.58793896", "0.58757776", "0.58661294", "0.58...
0.7300227
1
Use callbacks to share common setup or constraints between actions.
def set_threshold @threshold = Threshold.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 threshold_params params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action) 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
GET /presses/1 GET /presses/1.json
def show @press = Press.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @press } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @presses = Press.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presses }\n end\n end", "def index\n trips = Trip.all\n render json: trips\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n ...
[ "0.5794374", "0.5789249", "0.5733543", "0.5719755", "0.5710735", "0.5710735", "0.5698288", "0.5686241", "0.5593689", "0.5572644", "0.5572264", "0.5557893", "0.5523328", "0.5521964", "0.5507844", "0.54906106", "0.54818", "0.5479228", "0.5461432", "0.5451969", "0.54513747", "...
0.0
-1
GET /presses/new GET /presses/new.json
def new @press = Press.new respond_to do |format| format.html # new.html.erb format.json { render json: @press } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ...
[ "0.67079496", "0.65906537", "0.6575844", "0.6566156", "0.6554919", "0.6508564", "0.6458875", "0.6458875", "0.6458875", "0.6434747", "0.64265895", "0.6426355", "0.64014393", "0.64014393", "0.64014393", "0.64013696", "0.64008164", "0.64008164", "0.6394448", "0.63764095", "0.635...
0.63527894
21
POST /presses POST /presses.json
def create @press = Press.new(params[:press]) respond_to do |format| if @press.save format.html { redirect_to @press, notice: 'Press was successfully created.' } format.json { render json: @press, status: :created, location: @press } else format.html { render action: "new" } format.json { render json: @press.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\...
[ "0.5597015", "0.55289644", "0.550854", "0.5499295", "0.54722303", "0.54300714", "0.54295766", "0.54105777", "0.53515303", "0.5304263", "0.52809054", "0.5245171", "0.5240731", "0.5238953", "0.52295953", "0.5222467", "0.52157325", "0.521449", "0.5212442", "0.5209957", "0.520116...
0.0
-1
PUT /presses/1 PUT /presses/1.json
def update @press = Press.find(params[:id]) respond_to do |format| if @press.update_attributes(params[:press]) format.html { redirect_to @press, notice: 'Press was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @press.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if ...
[ "0.5961851", "0.5745591", "0.5745237", "0.5573423", "0.55692333", "0.552148", "0.54978657", "0.5480543", "0.54075634", "0.53879905", "0.5387464", "0.5350518", "0.5350518", "0.53385293", "0.53379124", "0.5308354", "0.52809674", "0.527993", "0.52536386", "0.5235801", "0.5228929...
0.0
-1
DELETE /presses/1 DELETE /presses/1.json
def destroy @press = Press.find(params[:id]) @press.destroy respond_to do |format| format.html { redirect_to presses_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete endpoint\n...
[ "0.67486066", "0.66400546", "0.66270685", "0.6605846", "0.65531504", "0.6523408", "0.648347", "0.6460676", "0.645834", "0.6412049", "0.63988847", "0.6394766", "0.6391004", "0.6391004", "0.6383594", "0.63824135", "0.6370976", "0.63537407", "0.63390493", "0.6329245", "0.6308978...
0.0
-1
ar = [1,2,3,4,5,5,100] puts sum ar
def max_2_sum arr # YOUR CODE HERE if arr.empty? return 0 end if arr.length == 1 return arr[0] end a = arr.sort a[-2] + a[-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total(arr)\n\tsum = 0\n\tarr.each do |i|\n\t\tsum = sum + i\n\tend\n\treturn sum\nend", "def total(arr)\n\tsum\t= 0\n\tarr.each{|i| sum+= i}\n\treturn sum\nend", "def simpleArraySum(ar)\n count = 0\n ar.each {|x| count += x}\n count\nend", "def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n ...
[ "0.8045934", "0.8034174", "0.7928271", "0.7897545", "0.78941095", "0.78880334", "0.788568", "0.78678155", "0.7865682", "0.7861191", "0.7845133", "0.7841689", "0.78385335", "0.78199553", "0.7819571", "0.7815741", "0.7802759", "0.78018117", "0.77977276", "0.7795607", "0.779311"...
0.0
-1
ar = [12,1,2,3,7,2,6,11] puts max_2_sum ar
def sum_to_n? arr, n # YOUR CODE HERE unless arr.length > 1 return false end h=Hash.new arr.each{|a| if h.key? a return true else h[n-a] = n end} return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_2_sum(ar)\n return 0 if ar.empty?\n return ar[0] if ar.length == 1\n sar = ar.sort {|x,y| y <=> x }\n return sar[0] + sar[1]\nend", "def max_2_sum(array)\n sum array.sort.last(2)\nend", "def max_2_sum(array)\n sum(array.sort.last(2))\nend", "def max_2_sum arr\n sum(arr.sort.last(2))\nend", "...
[ "0.88413167", "0.86858577", "0.868312", "0.8633925", "0.85873747", "0.8563176", "0.8540599", "0.8530031", "0.8479846", "0.8455737", "0.84409845", "0.8435277", "0.8435194", "0.8435194", "0.8398274", "0.83772784", "0.83700895", "0.83585393", "0.8349051", "0.8303656", "0.8262274...
0.0
-1
ar = [1,2,3,4,5,6,7,8] puts sum_to_n? ar , 100 Part 2
def hello(name) # YOUR CODE HERE "Hello, #{name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_to_n? arr, n\n result = false\n sum = 0\n if arr.size>1\n arr.each {|num| result = true if num == n}\n end\n \n return result\nend", "def sum_to_n? arr, n\n return false if arr.empty?#empty to 0\n i=0\n while i < arr.length do#goes throgh all elements\n e = arr.shift#returns the 1st elemen...
[ "0.76581335", "0.76269585", "0.75408334", "0.74987227", "0.74719393", "0.7459591", "0.7456765", "0.74144167", "0.73850226", "0.7337382", "0.73184174", "0.72775155", "0.72710407", "0.7249368", "0.7233714", "0.72080904", "0.7206499", "0.7198432", "0.71878934", "0.7174599", "0.7...
0.0
-1
GET /surgeries GET /surgeries.json
def index # Initialize the surgery @surgery = Surgery.new # adding the pagination for page with page limit 10 record @surgeries = Surgery.where(user_type: "admin").paginate(page: params[:page],per_page: 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @surgeries = Surgery.all\n end", "def index\n @surgeries = Surgery.all\n end", "def surgery_name_list\n\t\tsurgeries = current_user.surgeries\n\t\tif surgeries.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {surgeries: surgeries.collect(&:name).as_js...
[ "0.70388985", "0.70388985", "0.69341296", "0.59730726", "0.59461135", "0.59223783", "0.5865941", "0.5732964", "0.5643951", "0.56194353", "0.5598398", "0.5585932", "0.55832285", "0.5582528", "0.55722", "0.5571055", "0.5565265", "0.555195", "0.5544764", "0.55380434", "0.5532715...
0.0
-1