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
Outdent just indents a negative number of spaces. CREDIT: Noah Gibbs
def outdent(n) indent(-n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def outdent( str )\n\t\t\tstr.gsub( /^(\\t|[ ]{1,#{TabWidth}})/, '')\n\t\tend", "def outdent(text)\n lines = text.split(\"\\n\")\n indented_with = /^ +/.match(lines.first)[0]\n lines.map { |line| lin...
[ "0.7580794", "0.7580794", "0.7580794", "0.7580794", "0.7580794", "0.74903524", "0.74517727", "0.74358475", "0.7384244", "0.73489225", "0.73329127", "0.7289794", "0.7266201", "0.7264544", "0.72586995", "0.7255473", "0.7255473", "0.7138836", "0.71144277", "0.70178425", "0.69558...
0.81327397
1
Returns the shortest length of leading whitespace for all nonblank lines n = %Q( a = 3 b = 4 ).level_of_indent => 2 CREDIT: Kyle Yetter
def level_of_indent self.scan(/^ *(?=\S)/).map { |space| space.length }.min || 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_minimum_indent\n self.lines.map { |s| s.index(/[^\\s]/) unless s.empty? }.compact.min\n end", "def minimum_leading_whitespace\n whitespace = split(\"\\n\", -1).inject(0) do |indent, line|\n if line.strip.empty?\n indent # Ignore completely blank lines.\n elsif line =~ /^(\\s+)/\n...
[ "0.74780935", "0.7442416", "0.72889143", "0.7068567", "0.6767091", "0.66523623", "0.66405654", "0.66405344", "0.6549506", "0.65437335", "0.6375742", "0.63555884", "0.6333959", "0.6306292", "0.6245016", "0.6244218", "0.6241559", "0.61366063", "0.6126559", "0.6094262", "0.60942...
0.79616946
1
Need to add amin authenticate?
def new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capable_login_auth?; end", "def authenticate\n end", "def active_for_authentication?; end", "def active_for_authentication?; end", "def auth\n end", "def auth\n end", "def authenticateA\n # if is_admin?\n # true\n # else\n authenticate_or_request_with_http_basic do |name, pas...
[ "0.7042675", "0.69671696", "0.6808769", "0.6808769", "0.6767335", "0.6767335", "0.6749536", "0.67111087", "0.66900283", "0.6658098", "0.6655828", "0.6625847", "0.65987146", "0.6525876", "0.6525876", "0.65134937", "0.65021807", "0.6474636", "0.6466037", "0.6457145", "0.6454786...
0.0
-1
end of valid_move? helper methods
def move_piece(position, origin, destination) # verbose way ro, co = origin piece = position[ro][co] position[ro][co] = EMPTY_SQUARE rd, cd = destination position[rd][cd] = piece # original way # piece = square_at(origin) # square_at(origin) = '_' # square_at(destination) = piece...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(new_x, new_y)\n true\n end", "def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end...
[ "0.81292874", "0.8051748", "0.79580164", "0.7957261", "0.7943796", "0.7927553", "0.7889717", "0.78767973", "0.7863138", "0.7849579", "0.7836784", "0.78313833", "0.78210205", "0.78099394", "0.7785216", "0.7768848", "0.7760268", "0.77575916", "0.77533317", "0.77465016", "0.7741...
0.0
-1
CRUD GET /publications GET /publications.xml
def index @publications = Publication.all @publications_by_year = @publications.group_by(&:year).sort.reverse @people = Person.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @publications } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def...
[ "0.7509093", "0.74663025", "0.74663025", "0.74663025", "0.74663025", "0.7287071", "0.72331434", "0.7127555", "0.705368", "0.7032353", "0.6961863", "0.6961863", "0.68406", "0.6833808", "0.6810536", "0.67538106", "0.6700692", "0.66824245", "0.6666154", "0.66631824", "0.6653827"...
0.68212074
14
GET /publications/1 GET /publications/1.xml
def show @publication = Publication.find(params[:id]) @people = Person.find(:all) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @publication } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end", "def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.e...
[ "0.75776505", "0.7097476", "0.7097476", "0.7089773", "0.69612336", "0.6798793", "0.6797898", "0.6797898", "0.6797898", "0.6797898", "0.6761041", "0.67446434", "0.67288697", "0.6724868", "0.66720855", "0.6650073", "0.65796924", "0.65638375", "0.65608615", "0.65201485", "0.6470...
0.70093715
4
GET /publications/new GET /publications/new.xml
def new @publication = Publication.new(:kind => "Full Paper") respond_to do |format| format.html # new.html.erb format.xml { render :xml => @publication } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def new\n @publication = Publication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :...
[ "0.78457", "0.7843138", "0.76088804", "0.7511445", "0.74132615", "0.7407113", "0.72819763", "0.72743595", "0.70832306", "0.703002", "0.69157666", "0.6902536", "0.69020337", "0.6839659", "0.6826005", "0.68243253", "0.68171304", "0.67765045", "0.67621595", "0.67621595", "0.6762...
0.7654183
2
POST /publications POST /publications.xml
def create @publication = Publication.new(params[:publication]) respond_to do |format| if @publication.save flash[:notice] = 'Publication was successfully created.' format.html { redirect_to(@publication) } format.xml { render :xml => @publication, :status => :created, :location ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to([:admin, @publication]) }\n format.xml { render :xml => @publication, :status =...
[ "0.68611294", "0.67688096", "0.6753121", "0.6753121", "0.67010725", "0.6653412", "0.6570811", "0.6548563", "0.65242827", "0.6522444", "0.6501274", "0.6480929", "0.6390201", "0.63879097", "0.63609976", "0.6344977", "0.6323771", "0.6304588", "0.62720144", "0.6244312", "0.619247...
0.69639194
0
PUT /publications/1 PUT /publications/1.xml
def update @publication = Publication.find(params[:id]) respond_to do |format| if @publication.update_attributes(params[:publication]) flash[:notice] = 'Publication was successfully updated.' format.html { redirect_to(@publication) } format.xml { head :ok } else for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @publication.update(publication_params)\n render json: @publication, status: :ok\n else\n render json: @publication.errors, status: :unprocessable_entity\n end\n end", "def update\n @publication = Publication.find(params[:id])\n #expire_action :action => :index\n resp...
[ "0.6557939", "0.6459204", "0.6369439", "0.621068", "0.621068", "0.621068", "0.61835724", "0.6160963", "0.6158146", "0.6156734", "0.6116166", "0.6094925", "0.60927254", "0.6077991", "0.60596114", "0.6050914", "0.60390353", "0.60103434", "0.5997976", "0.597876", "0.59746325", ...
0.648601
1
DELETE /publications/1 DELETE /publications/1.xml
def destroy @publication = Publication.find(params[:id]) @publication.destroy respond_to do |format| format.html { redirect_to(publications_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @primary_publication = PrimaryPublication.find(params[:id])\n @primary_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @publication = Publication.find(params[:id]...
[ "0.7520577", "0.74822325", "0.7343033", "0.73337376", "0.7133383", "0.7086301", "0.7086301", "0.70299464", "0.70158035", "0.7007015", "0.69977736", "0.6990287", "0.6984269", "0.6956068", "0.6949394", "0.6942173", "0.688183", "0.68575996", "0.6835827", "0.6830836", "0.6830836"...
0.75374734
0
to make sure that your mailer uses the devise viewsend
def confirmation_instructions(record, token, opts={}) if record.is_student? opts[:to] = record.cid + "@imperial.ac.uk" record.send_created end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email\n true\n end", "def devise_mail(record, action, opts = T.unsafe(nil), &block); end", "def send_devise_notification(notification, *args)\n if Rails.env.development?\n devise_mailer.send(notification, self, *args).deliver_later\n else\n super\n end\n end", "def show_t...
[ "0.66826737", "0.6531535", "0.64451253", "0.6394326", "0.6389744", "0.63628364", "0.6355999", "0.6337123", "0.62737876", "0.6236599", "0.6211698", "0.62016666", "0.6192043", "0.6160711", "0.61541677", "0.6153697", "0.6147815", "0.6122064", "0.61120087", "0.61093014", "0.60993...
0.0
-1
action d'affichage d'un user existant
def show @user = User.find(params[:id]) @microposts = @user.microposts.paginate(page: params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requires_user_existence!\n if not e.user_exists?\n error \"You have to setup your user before you can perform this action.\"\n exit\n end\n end", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n ...
[ "0.7170434", "0.70026034", "0.6744559", "0.67359686", "0.67325854", "0.6664765", "0.6620415", "0.66080207", "0.66068417", "0.6533948", "0.6524703", "0.650976", "0.6466059", "0.6466059", "0.6453", "0.6451426", "0.6448586", "0.64321285", "0.642774", "0.64091474", "0.6403324", ...
0.0
-1
action d'affichage de la liste de tout les users
def index @users = User.paginate(page: params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_list_users\n\n end", "def list\n flash[:notice] = \"Het volg-systeem is neergestort als een mir. Iedereen volgt gewoon iedereen. Wel zo communistisch en makkelijk\";\n @user = User.find(:all)\n end", "def list_all_users\n\n end", "def users_index\n\t\t@view.users_list($users)\n\t\t@view.seco...
[ "0.7708326", "0.7670727", "0.74115753", "0.73080677", "0.7261754", "0.7258003", "0.72348666", "0.71564084", "0.71342176", "0.7084502", "0.7066023", "0.70487046", "0.70428413", "0.70235527", "0.701124", "0.6964923", "0.6964071", "0.69457686", "0.69396394", "0.6930786", "0.6926...
0.0
-1
action de validation / modification en base d'un user existant
def update if @user.update_attributes(params[:user]) flash[:success] = "Profil mis à jour" sign_in @user redirect_to @user else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_user_required\n unless @current_user == User.find(params[:id])\n flash[:error] = \"Non puoi modificare un utente diverso dal tuo\"\n redirect_to timetables_url\n end\n end", "def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"...
[ "0.69611365", "0.6770306", "0.6756908", "0.6753057", "0.66834563", "0.667699", "0.6642618", "0.6606788", "0.6579179", "0.65139085", "0.6504406", "0.6440934", "0.6430533", "0.6403475", "0.6385131", "0.6376318", "0.63403475", "0.6336565", "0.6336565", "0.6307002", "0.6302542", ...
0.0
-1
action de suppression de user
def destroy User.find(params[:id]).destroy flash[:success] = "Utilisateur supprimé." redirect_to users_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end", "def ...
[ "0.6774508", "0.6645706", "0.6457265", "0.6388986", "0.63796055", "0.63624865", "0.63286066", "0.6319055", "0.6278878", "0.62702006", "0.6242016", "0.6242016", "0.62410825", "0.6230924", "0.61922646", "0.61851734", "0.61779076", "0.6176904", "0.6167911", "0.61559784", "0.6128...
0.0
-1
The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11). TopDown: min_path_at(bottom) = min_path_at(bottom 1) + min(bottom) min_path_at(bottom 1) = min_path_at(bottom 2) + min(bottom 1) ... min_path_at(x) = min_path_at(x 1) + min(x) ... min_path_at(top + 1) = min_path_at(top) + min(top + 1) min_path_at...
def min_path(triangle) min_path_helper(triangle, level = triangle.size - 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_path_sum matrix\n rows, cols = matrix.size, matrix.first.size\n\n # Stores minimum path sum from row i, column j to bottom right of matrix\n table = (0...rows).map { (0...cols).map { 0 } }\n\n # Base case: Along bottom row, we can only go right (so min path is always to\n # the right)\n table[rows-1]...
[ "0.7284701", "0.7063666", "0.7035126", "0.7031865", "0.68650585", "0.68380755", "0.6834655", "0.64450943", "0.6441168", "0.6337252", "0.63325197", "0.6212159", "0.6157112", "0.6140991", "0.61077255", "0.5923265", "0.58980364", "0.5879608", "0.5856792", "0.58224756", "0.579549...
0.7488787
0
Helper method to generate author ship
def author_ship_gen(author_hash, max_dist, probe_list) text = "// Author ship for #{author_hash[:author]} var #{author_hash[:author].downcase.gsub(" ", "_")} = new Ship({ name: \"#{author_hash[:author].downcase.gsub(" ", "_")}\", material: new THREE.SpriteMaterial({map: author_texture, color: #{author_hash...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorship_string\n string = protonym.authorship_string\n if string && recombination?\n string = '(' + string + ')'\n end\n string\n end", "def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end", "def author; end", "def author\n \"#{user.firstname} #{user.l...
[ "0.71346617", "0.63335323", "0.63032866", "0.62016046", "0.61892396", "0.6186706", "0.6149504", "0.6097318", "0.60430384", "0.59250355", "0.58850044", "0.58583945", "0.5792639", "0.5787432", "0.5774436", "0.5755709", "0.5751579", "0.57359433", "0.57305354", "0.5725633", "0.57...
0.71606475
0
Helper method to generate probes
def probe_ship_gen(probe_count, probe_array) text = "" probe_count.times.with_index do |v| temp = ("a".."zz").to_a[v] text += "var author_probe_#{temp} = new Ship({ material: new THREE.SpriteMaterial({map: probe_texture, color: 0xffffff, fog: true}), dis_at_end: true, name: \"author_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing( method, *args, &block )\n if @probes_collection.respond_to?(method)\n @probes_collection.send( method, *args, &block )\n else\n @probe.send( method, *args, &block )\n end \n end", "def probe_create\n org_endpoint \"/network/#{net...
[ "0.6292964", "0.5812821", "0.5774996", "0.57596546", "0.57061213", "0.5659702", "0.56422085", "0.5578842", "0.538561", "0.5337505", "0.53266907", "0.52996534", "0.5263085", "0.524717", "0.5220067", "0.51508147", "0.514383", "0.51420987", "0.505187", "0.50376236", "0.5025179",...
0.5233694
14
Read xattrs from file (requires "getfattr" to be in the path)
def getxattrs # # file: Scissor_Sisters_-_Invisible_Light.flv # user.m.options="-c" cmd = %w[getfattr -d -m - -e base64] + [realpath.to_s] attrs = {} IO.popen(cmd, "rb", :err=>[:child, :out]) do |io| io.each_line do |line| if line =~ /^([^=]+)=0s(.+)/ key = $1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingest_attributes attr_file\n attr_files_array = attr_file.force_array\n attrs = {}\n attr_files_array.each do |f|\n if f.include? \":\"\n file = f.split(\":\")\n filename = file[0]\n block_name = file[1]\n else\n filename = f\n block_name = false\n end\n validate_file_i...
[ "0.5977739", "0.5892331", "0.57962173", "0.5772171", "0.5772171", "0.57375383", "0.56861466", "0.5577721", "0.5480866", "0.5429698", "0.5426336", "0.53887284", "0.53807145", "0.535704", "0.5353315", "0.5353116", "0.53285587", "0.53096616", "0.5303835", "0.5300185", "0.5246477...
0.73411804
0
Encrypts the password with the user salt
def encrypt(password) self.class.encrypt(password, salt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n ...
[ "0.8456656", "0.83809954", "0.837295", "0.83666867", "0.8361271", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83539045", "0.8353123", "0.83147633", "0.8314556", "0.83011955", "0.82853645", "0.8279242", "0.8253498", "0.82321554", "0.8...
0.0
-1
These create and unset the fields required for remembering users between browser closes
def remember_me self.remember_token_expires_at = 2.weeks.from_now.utc self.remember_token = encrypt("#{email}--#{remember_token_expires_at}") save(false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forgets\n update_attribute(:remember_digest, nil)\n end", "def after_save\n cookies['global_properties_for_user'] = nil\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:...
[ "0.655833", "0.64576274", "0.6433039", "0.6433039", "0.63186485", "0.6318346", "0.62982345", "0.62982345", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", ...
0.0
-1
Added Add_item funcation to remove item and campare the values for both quantity & Guide Price before & After add from any PLP screen
def add_item_verify wait_for_animate value1= query("* marked:'quantityText'", :text)[0] guide_price1 = query("* marked:'basket_action_bar_up'", :text)[0] puts "Quantity Before Add Item : : #{value1}" touch("* id:'add_btn'") wait_for_animate sleep 4 #wait_for_elements_exist( ["button marked:'Open baske...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item_verify\n\n\t\twait_for_animate\n\t\tvalue3= query(\"* marked:'quantityText'\", :text)[0]\n\t\tguide_price3 = query(\"* marked:'basket_action_bar_up'\", :text)[0]\n\t\tputs \"Quantity Before remove Item : : #{value3}\"\n\t\ttouch(\"* id:'remove_btn'\")\n\t\twait_for_animate\n\t\tsleep 4\n\t\t#wait...
[ "0.71856433", "0.6858823", "0.6651558", "0.6648791", "0.6607437", "0.65963775", "0.65642387", "0.6546954", "0.654024", "0.65021074", "0.649573", "0.6486366", "0.6466927", "0.6466375", "0.64630705", "0.6457096", "0.6454732", "0.64488995", "0.6442573", "0.64414686", "0.6438267"...
0.70049405
1
Funcation to campare two values
def campare_values(a, b) if a == b #puts"#{a} and #{b}" puts "Item count is same as before" elsif a > b puts "Item is removed from the basket" else puts "Item is added into basket" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def *(other)\n @a=other.a*@a\n @b=other.b*@b\n self.to_s #devuelve el resultado como cadena. la operacion modifica el valor del objeto.\n\n end", "def pega_soma (valor1, valor2)\n valor1 + valor2\nend", "def pega_soma(v1,v2)\r\n v1 + v2\r\nend", "def initialize( x, y )\n @x, @y = x.to_f, ...
[ "0.59333676", "0.57842046", "0.57190937", "0.5669236", "0.55440474", "0.5510343", "0.5504149", "0.54627454", "0.54465365", "0.54465365", "0.54465365", "0.54465365", "0.54465365", "0.54465365", "0.54465365", "0.54465365", "0.54434824", "0.54395044", "0.5433525", "0.54317695", ...
0.52730685
32
def add_another_item by default this will only add the first item in the array of items in the list. we can get more sophisicated to decide which item we want to choose, but I think this works as a proof of concept for now wait_for_animate touch("button marked:'add_btn'") wait_for_animation end Added Remove funcation t...
def remove_item_verify wait_for_animate value3= query("* marked:'quantityText'", :text)[0] guide_price3 = query("* marked:'basket_action_bar_up'", :text)[0] puts "Quantity Before remove Item : : #{value3}" touch("* id:'remove_btn'") wait_for_animate sleep 4 #wait_for_elements_exist( ["button marked:'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item_verify\n\t\twait_for_animate\n\t\tvalue1= query(\"* marked:'quantityText'\", :text)[0]\n\t\tguide_price1 = query(\"* marked:'basket_action_bar_up'\", :text)[0]\n\t\tputs \"Quantity Before Add Item : : #{value1}\"\n\t\ttouch(\"* id:'add_btn'\")\n\t\twait_for_animate\n\t\tsleep 4\n\t\t#wait_for_elemen...
[ "0.72496736", "0.6868546", "0.6838464", "0.67742735", "0.6750291", "0.6724352", "0.6715745", "0.6702474", "0.6700111", "0.66902816", "0.66856533", "0.66817915", "0.6677951", "0.6663126", "0.6661014", "0.66510355", "0.6650196", "0.66279507", "0.6627639", "0.6627639", "0.662763...
0.68217814
3
item add and remove
def item_count query("* marked:'quantityText'", :text)[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item\n\n end", "def add item\n self[index item] = item if check item\n# check item ? super : free key # delete key\n end", "def add_item(itemToAdd)\r\n itemToAdd.set_owner(self)\r\n itemToAdd.deactivate\r\n self.items.push(itemToAdd)\r\n end", "def remove!\n ...
[ "0.76002026", "0.6879147", "0.67500335", "0.6711917", "0.6682403", "0.6578955", "0.6560382", "0.6485937", "0.6481222", "0.646837", "0.646837", "0.646837", "0.646837", "0.644812", "0.6442859", "0.6438638", "0.6435442", "0.64256394", "0.64123356", "0.64016384", "0.6383642", "...
0.0
-1
GET /admin/messages GET /admin/messages.json
def index @admin_messages = Admin::Message.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages\n get_json('messages.json')\n end", "def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end", "def index\n messages = Messa...
[ "0.82243216", "0.7567452", "0.7286672", "0.7273846", "0.720779", "0.71946615", "0.71946615", "0.718178", "0.71696675", "0.70842534", "0.7072393", "0.70173544", "0.69966894", "0.6995583", "0.69878453", "0.69665706", "0.6946824", "0.69319737", "0.69157046", "0.69080293", "0.687...
0.7187165
7
GET /admin/messages/1 GET /admin/messages/1.json
def show render layout: false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages\n get_json('messages.json')\n end", "def show\n @admin_message = AdminMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_message }\n end\n end", "def show\n @v1_message = V1::Message.find(params[:id]...
[ "0.7665005", "0.7464625", "0.720917", "0.71032053", "0.70685333", "0.70093566", "0.6997538", "0.6993825", "0.6993825", "0.6976966", "0.69663674", "0.69618297", "0.69573015", "0.6947765", "0.6924477", "0.6884206", "0.68728906", "0.6868306", "0.6858979", "0.68408", "0.6825752",...
0.0
-1
POST /admin/messages POST /admin/messages.json
def create @admin_message = Admin::Message.new(admin_message_params) respond_to do |format| if @admin_message.save format.html { redirect_to @admin_message, notice: 'Message was successfully created.' } format.json { render :show, status: :created, location: @admin_message } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @admin_message = AdminMessage.new(params[:admin_message])\n\n respond_to do |format|\n if @admin_message.save\n format.html { redirect_to @admin_message, notice: 'Admin message was successfully created.' }\n format.json { render json: @admin_message, status: :created, location...
[ "0.7169151", "0.7161568", "0.70958084", "0.69879574", "0.6949255", "0.6868583", "0.6868583", "0.6838316", "0.67667675", "0.67427164", "0.6733923", "0.6719758", "0.6624947", "0.656136", "0.65362144", "0.6528607", "0.65250224", "0.6524086", "0.6484145", "0.6480948", "0.64748925...
0.72629344
0
PATCH/PUT /admin/messages/1 PATCH/PUT /admin/messages/1.json
def update respond_to do |format| if @admin_message.update(admin_message_params) MessageMailer.message_reply(@admin_message).deliver # if you use delayed_job for email deliver # MessageMailer.message_reply(@admin_message).send_later(:deliver) format.html { redirect_to admin_mes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to admin_message_path(@message), notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n for...
[ "0.7124417", "0.70473844", "0.68448395", "0.6816783", "0.6809775", "0.67945015", "0.67491966", "0.67483073", "0.67465806", "0.67465806", "0.6724717", "0.67167944", "0.6706941", "0.6687704", "0.6683965", "0.6680729", "0.6680399", "0.6654741", "0.6654652", "0.66458213", "0.6628...
0.6780389
6
DELETE /admin/messages/1 DELETE /admin/messages/1.json
def destroy @admin_message.destroy respond_to do |format| format.html { redirect_to admin_messages_url, notice: "#{ t 'activerecord.successful.messages.message_deleted' }" } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def delete\n ...
[ "0.7863948", "0.7845226", "0.77960026", "0.7779255", "0.77680314", "0.7734307", "0.7651324", "0.7612186", "0.7609573", "0.7582608", "0.75567836", "0.75495493", "0.7547044", "0.75041413", "0.7496441", "0.7495047", "0.7495047", "0.7477896", "0.74652314", "0.74434274", "0.744342...
0.786719
0
Use callbacks to share common setup or constraints between actions.
def set_admin_message @admin_message = Admin::Message.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 admin_message_params params.require(:admin_message).permit(:author, :email, :content, :is_permit, :reply) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
GET /comments GET /comments.json
def index @comments = Comment.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n render json: @post.comments\n end", "def list\n comments = Comment.where(post: @p...
[ "0.8573962", "0.7837408", "0.7837408", "0.7555969", "0.75293446", "0.75213426", "0.74966145", "0.739651", "0.7300984", "0.729431", "0.7285037", "0.72734404", "0.72714454", "0.7247879", "0.724236", "0.7208452", "0.72043866", "0.71849746", "0.7177853", "0.71577495", "0.715637",...
0.0
-1
GET /comments/1 GET /comments/1.json
def show @comments= Comment.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_...
[ "0.82817644", "0.7442182", "0.7442182", "0.74355227", "0.7405664", "0.7305381", "0.72841007", "0.72580236", "0.72554684", "0.72480613", "0.72426623", "0.72193956", "0.72187996", "0.72187996", "0.71744055", "0.715919", "0.7158581", "0.7119482", "0.7115376", "0.7101109", "0.710...
0.0
-1
POST /comments POST /comments.json
def create @course = Course.find(params[:course_id]) @comment = @course.comments.build(comment_params) @comment.user_id = current_user.id respond_to do |format| if @comment.save format.html { redirect_to @course } format.js {} # renders create.js.erb else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end", "def comment options={}\n client.post(\"/#{id}/comments\", options)\n end", ...
[ "0.75120175", "0.74212646", "0.7374645", "0.72364116", "0.7205224", "0.7086658", "0.7069151", "0.70549524", "0.7049054", "0.6989455", "0.69825", "0.69657713", "0.69578165", "0.6910411", "0.6909373", "0.68731725", "0.6871654", "0.6822542", "0.6810818", "0.6787486", "0.6785412"...
0.0
-1
PATCH/PUT /comments/1 PATCH/PUT /comments/1.json
def update respond_to do |format| if @comment.update(comment_params) format.html { redirect_to @course, notice: 'modification valide.' } format.js else format.html { render :edit } format.json { render json: @comment.errors, status: :unprocessable_entity } end e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end", "def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end", "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.com...
[ "0.72258955", "0.70661867", "0.70645124", "0.702627", "0.6884049", "0.67773885", "0.67360747", "0.6731645", "0.67238104", "0.67238104", "0.66939694", "0.6669364", "0.66608423", "0.66390574", "0.66342026", "0.6628103", "0.6604785", "0.6598973", "0.65973663", "0.65973663", "0.6...
0.0
-1
DELETE /comments/1 DELETE /comments/1.json
def destroy @comment.destroy respond_to do |format| format.html { redirect_to courses_url, notice: 'Commentaire supprimé.' } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end", "def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |f...
[ "0.7563111", "0.74376714", "0.7375191", "0.7369342", "0.7360642", "0.7356597", "0.7295853", "0.7295853", "0.72800404", "0.726927", "0.72620535", "0.72620535", "0.72620535", "0.7257083", "0.7257083", "0.7257083", "0.72429276", "0.72420895", "0.7241516", "0.7241516", "0.7241516...
0.0
-1
=> find course_id reference
def set_course @course = Course.find(params[:course_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_course( course_unit_id )\n course_unit = CourseUnit.find course_unit_id\n course_unit.course\n end", "def find_course(id)\n @course ||= Course.find_by_id(id)\n end", "def find_course\n @course = Course.find(params[:id])\n end", "def course\n @course ||= Course.find(params[:id...
[ "0.76031303", "0.7543209", "0.7531035", "0.7070267", "0.6912821", "0.6793062", "0.66941434", "0.6636958", "0.66196066", "0.65554017", "0.6543263", "0.6525808", "0.65062696", "0.6497168", "0.6497168", "0.6484552", "0.64643973", "0.6452911", "0.6427086", "0.6427086", "0.6399643...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_comment @comment = Comment.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 comment_params params.require(:comment).permit(:content, :course_id, :user_id) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Calculated the dot product between the two document vectors. The dot product is an algebraic operation that takes two equallength sequences of numbers (usually coordinate vectors) and returns a single number.
def dotProduct(doc1, doc2) common_tokens(doc1.keys, doc2.keys).inject(0.0) do |dot_product, token| dot_product + doc2[token] * doc1[token] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotProduct(doc1, doc2)\n _common_tokens = findCommonTokens(doc1.keys, doc2.keys)\n _dot_product = 0.0\n\n _common_tokens.each do |token|\n _dot_product += doc2[token] * doc1[token]\n end\n return _dot_product\n end", "def dot( otherVector )\n\t\t\traise ArgumentError,\n\t\t\t\t\"Cannot c...
[ "0.8282214", "0.75856096", "0.7538062", "0.70999485", "0.7062362", "0.7030834", "0.697268", "0.69102484", "0.68628", "0.6858873", "0.6815264", "0.6708391", "0.6636967", "0.66185665", "0.65308607", "0.6475507", "0.6445035", "0.6398171", "0.6383551", "0.63625705", "0.63372064",...
0.818539
1
Calculates the magnitude of a vector document
def d(doc) doc.keys.inject(0.0) do |d, term| d + doc[term]**2.0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(vector)\n\n Math::sqrt((vector.x**2) + (vector.y**2) + (vector.z**2))\n end", "def magnitude()\n _nrm2()\n end", "def magnitude\n Math.sqrt self.dot self\n end", "def magnitude; Math.sqrt x*x + y*y + z*z; end", "def magnitude\n\t\tt = 0.0\n\t\tsize.times do |k|\n\t\t\t...
[ "0.7431693", "0.73172045", "0.7293373", "0.7290743", "0.7072121", "0.67194784", "0.6521048", "0.64603734", "0.63906026", "0.636122", "0.62744415", "0.62457734", "0.6126279", "0.6031404", "0.59944934", "0.59944934", "0.5956333", "0.5916045", "0.5910961", "0.5885567", "0.582024...
0.0
-1
returns the set of common tokens between two document vectors
def common_tokens(doc1_tokens, doc2_tokens) common_tokens = Set.new doc1_tokens common_tokens.intersection(Set.new doc2_tokens) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findCommonTokens(doc1_tokens, doc2_tokens)\n common_tokens = Set.new doc1_tokens\n return common_tokens.intersection(Set.new doc2_tokens)\n end", "def shared_words(other_text, min_word_length, distance: 0)\n if (distance > 0) then\n @word_array.each do |word|\n other_text.word_array.eac...
[ "0.8606288", "0.6476365", "0.633807", "0.61009884", "0.60810125", "0.5992939", "0.59903497", "0.59461623", "0.59298974", "0.59115744", "0.59063596", "0.5903452", "0.5882036", "0.5879101", "0.58568335", "0.5853883", "0.5844817", "0.58221257", "0.5789339", "0.57877225", "0.5737...
0.854384
1
GET /test_contact_basics GET /test_contact_basics.json
def index @test_contact_basics = TestContactBasic.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def create\n @test_contact_basic = TestContactBasic.new(test_contact_basic_params)\n\n respond_to do |format|\n if @test_contact_basic.save\n format.html { redirect_to @test_contact_basic...
[ "0.6761999", "0.6761999", "0.6418817", "0.6359233", "0.63451976", "0.63451976", "0.62648785", "0.625962", "0.6255711", "0.6239113", "0.62272304", "0.6094534", "0.6086907", "0.60779977", "0.60174304", "0.5981418", "0.5974453", "0.5974453", "0.5974453", "0.59739715", "0.5966352...
0.72843534
0
GET /test_contact_basics/1 GET /test_contact_basics/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @test_contact_basics = TestContactBasic.all\n end", "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def show\n render json: @contact\n end", "def show\n render json: @contact\n end", "def index\n @contacts = Contact.all...
[ "0.68940336", "0.6532601", "0.6532601", "0.64854133", "0.64854133", "0.64487576", "0.6447247", "0.64247847", "0.6377475", "0.63695097", "0.63227844", "0.6279892", "0.6276008", "0.62646013", "0.62646013", "0.62646013", "0.6247497", "0.62184465", "0.6112802", "0.6102046", "0.60...
0.0
-1
POST /test_contact_basics POST /test_contact_basics.json
def create @test_contact_basic = TestContactBasic.new(test_contact_basic_params) respond_to do |format| if @test_contact_basic.save format.html { redirect_to @test_contact_basic, notice: 'Test contact basic was successfully created.' } format.json { render :show, status: :created, locatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @test_contact_detail = TestContactDetail.new(test_contact_detail_params)\n\n respond_to do |format|\n if @test_contact_detail.save\n format.html { redirect_to @test_contact_detail, notice: 'Test contact detail was successfully created.' }\n format.json { render :show, status: ...
[ "0.67362255", "0.6581297", "0.65653837", "0.6493638", "0.6399214", "0.6380972", "0.6253909", "0.61934406", "0.61769235", "0.60954237", "0.6054128", "0.60289335", "0.6028881", "0.6025148", "0.5972945", "0.59528637", "0.5937356", "0.59121984", "0.58799094", "0.5878189", "0.5818...
0.73869723
0
PATCH/PUT /test_contact_basics/1 PATCH/PUT /test_contact_basics/1.json
def update respond_to do |format| if @test_contact_basic.update(test_contact_basic_params) format.html { redirect_to @test_contact_basic, notice: 'Test contact basic was successfully updated.' } format.json { render :show, status: :ok, location: @test_contact_basic } else format....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @test_contact_detail.update(test_contact_detail_params)\n format.html { redirect_to @test_contact_detail, notice: 'Test contact detail was successfully updated.' }\n format.json { render :show, status: :ok, l...
[ "0.65184575", "0.64153963", "0.6366644", "0.635069", "0.6348566", "0.6297022", "0.6291329", "0.62911224", "0.6253723", "0.62375325", "0.6153705", "0.6123014", "0.6104074", "0.60865426", "0.6057294", "0.6057294", "0.6041184", "0.60362077", "0.60049695", "0.6002365", "0.5993352...
0.67008394
0
DELETE /test_contact_basics/1 DELETE /test_contact_basics/1.json
def destroy @test_contact_basic.destroy respond_to do |format| format.html { redirect_to test_contact_basics_url, notice: 'Test contact basic was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(contactname)\n\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @test_contact_detail.destroy\n respond_to do |format|\n format.html { redirect_to test_contact_details_url, notice: 'Test contact detail was successfully destroyed.' }\n format.json { head ...
[ "0.71172655", "0.70366323", "0.6996021", "0.6943147", "0.692179", "0.69148916", "0.68199205", "0.6784733", "0.6775229", "0.6765523", "0.6739837", "0.6739837", "0.6739837", "0.6739837", "0.66733646", "0.66429436", "0.66338396", "0.66263056", "0.66242564", "0.6620513", "0.66153...
0.72155464
0
Use callbacks to share common setup or constraints between actions.
def set_test_contact_basic @test_contact_basic = TestContactBasic.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 test_contact_basic_params params.require(:test_contact_basic).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
Translate from boolean attribute to string equivalent
def to_enable(value) value == :true ? 'Yes' : 'No' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordify_boolean(bool)\n# bool ? t(:\"shared.boolean.yes\") : t(:\"shared.boolean.no\")\n bool ? \"Ja\" : \"Nein\"\n end", "def boolean_to_string(b)\n return b.to_s\nend", "def quote_boolean(value)\n value.to_s.upcase\n end", "def bool_to_string(value)\n return 'yes' if value == true\n ...
[ "0.738058", "0.7372864", "0.72937304", "0.7246668", "0.72419554", "0.7240239", "0.7202298", "0.7200814", "0.7183298", "0.7160297", "0.7057972", "0.7019454", "0.7016637", "0.70069677", "0.70069677", "0.70016295", "0.6944213", "0.6889121", "0.6889121", "0.6866214", "0.6847573",...
0.71937174
8
Check whether a resource exists
def exists? @property_hash[:ensure] == :present end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist?\n @resource.exist?\n end", "def exists?\n File.exists?(@resource[:name])\n end", "def exists?\n begin\n url_for(:resources_resource, credentials, id).head\n true\n rescue RestClient::Forbidden\n true\n rescue RestClient::ResourceNotFound\n f...
[ "0.8365488", "0.82498884", "0.8136532", "0.8108513", "0.7976558", "0.7820463", "0.7764061", "0.77305424", "0.76817715", "0.7664899", "0.7587882", "0.7529607", "0.75185937", "0.74498206", "0.74137366", "0.74137366", "0.74137366", "0.73962706", "0.73924845", "0.73869413", "0.73...
0.0
-1
Create a new resource. Sets a flag in property_flush to say that this resource needs to be created in flush
def create @property_hash[:ensure] = :present @property_flush[:ensure] = :present end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n clone_max: @resource[:clone_max],\n clone_node_max: @resource[:clone_node_max],\n notify_clones: @resource[:notify_clon...
[ "0.75893426", "0.732253", "0.7078186", "0.6981254", "0.69694924", "0.69560575", "0.6907065", "0.6876129", "0.68420553", "0.6813454", "0.6721458", "0.65660834", "0.65253943", "0.65025765", "0.6467358", "0.64488757", "0.64385515", "0.6336533", "0.63311136", "0.63161117", "0.627...
0.71859473
2
Destroy a resource. Sets a flag in property_flush to say that this resource needs to be destroyed in flush
def destroy @property_flush[:ensure] = :absent end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n debug \"Call: destroy on cs_resource '#{@resource[:name]}'\"\n pcs 'resource', 'disable', @resource[:name]\n pcs 'resource', 'cleanup', @resource[:name]\n pcs 'resource', 'delete', @resource[:name]\n end", "def clear_resource\n if self.delete_resource && (self.delete_resource == '1'...
[ "0.73332137", "0.7276434", "0.72326595", "0.7111784", "0.70392007", "0.70036674", "0.6986571", "0.69277066", "0.6891081", "0.6832478", "0.68075335", "0.6777253", "0.6764608", "0.67460513", "0.6694253", "0.6690591", "0.6660377", "0.6638358", "0.6630516", "0.6596504", "0.659619...
0.76285607
0
Flushes changes to hponcfg
def flush if @property_flush[:ensure] == :present config = <<-EOF <RIBCL VERSION="2.1"> <LOGIN USER_LOGIN="Administrator" PASSWORD="password"> <USER_INFO MODE="write"> <ADD_USER USER_NAME = "#{resource[:ilo_name]}" USER_LOGIN = "#{resource[:name]}" PASSWORD = "#{resource[:p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush\n return if @cmds.nil? || @cmds.empty?\n str = (@cmds << 'commit' << 'exit').join(\"\\n\")\n @cmds = []\n @property_hash.clear\n\n command = \"#{command(:cfg)} -z #{@resource[:name]} -f -\"\n r = exec_cmd(cmd: command, input: str)\n raise ArgumentError, _('Failed to apply configurati...
[ "0.64723045", "0.6464532", "0.62526155", "0.6210242", "0.6210242", "0.61569697", "0.61535853", "0.6121477", "0.61077213", "0.6048499", "0.6039009", "0.6039009", "0.6039009", "0.6034505", "0.5964054", "0.5946772", "0.591501", "0.591501", "0.591501", "0.591501", "0.591501", "...
0.0
-1
List of citations associated with chapter
def citations Footnote.where(noted_id: id).where(slug: '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def citations\n CounterCitation.citations(stash_identifier: self)\n end", "def citations\n CounterCitation.citations(stash_identifier: self)\n end", "def index\n @references_citations = References::Citation.all\n end", "def index\n @civil_citations = CivilCitation.all\n end", "def c...
[ "0.71716505", "0.71716505", "0.71274847", "0.6747682", "0.673911", "0.64995456", "0.64924467", "0.6472405", "0.6459782", "0.6347816", "0.6301734", "0.62996227", "0.617431", "0.6169333", "0.616483", "0.61617684", "0.6141711", "0.61372256", "0.6095142", "0.5963093", "0.59165406...
0.6776555
3
client.unspents(addresses: ...) => method_missing(:unspents, addresses: ... )
def method_missing(method, *args, &block) endpoint_defined?(method) ? navigate_to_path(method, args[0]) : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unspents(wallet_id: default_wallet_id)\n call :get, '/wallet/' + wallet_id + '/unspents'\n end", "def unspent(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/utxo?noCache=1\")\n end", "def list_unspent(addresses)\n raise NotImplementedError\n end", "def uninvite_no_progress(...
[ "0.6682865", "0.612047", "0.6064088", "0.54726225", "0.54473084", "0.5312224", "0.5181685", "0.50398487", "0.49927652", "0.49844423", "0.49590498", "0.4954784", "0.4910354", "0.49094254", "0.49032104", "0.4890498", "0.48795226", "0.48507437", "0.48457894", "0.48452073", "0.48...
0.0
-1
Home page You can completely override this action: def home do something differently end
def home # do nothing end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home\n\t\t# Home Page\n\tend", "def home \n\tend", "def home\r\n \r\n end", "def home\n\tend", "def home\n\t\t\n\tend", "def home\n\t\t\n\tend", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end...
[ "0.894325", "0.86987686", "0.8681684", "0.8649782", "0.8622541", "0.8622541", "0.8606292", "0.8606292", "0.8606292", "0.8606292", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "0.8495714", "...
0.8520049
10
Resourceful action to list paginated records. You can override this method in subclasses in the following ways: To perform action before `index` is run def index do something beforehand super end To perform action after `index`, but before rendering. The reason is that we use responder at the end of the action def inde...
def index authorize! :index, current_model_class yield if block_given? # after_index respond_with collection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\n end", "def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n if prm.present?\n # Perform search here.\n ...
[ "0.7198302", "0.7183029", "0.703233", "0.69947845", "0.6948338", "0.69343054", "0.6915502", "0.6915117", "0.69099027", "0.6868115", "0.68468356", "0.6817825", "0.68174064", "0.68077385", "0.6779767", "0.67755765", "0.67398787", "0.673515", "0.670401", "0.67023265", "0.6670079...
0.6981244
4
Resourceful new action to show a form for creating a record. You can override this method in subclasses in the following ways: To perform action before `new` is run def new do something beforehand super end To perform action after `new`, but before rendering. The reason is that we use responder at the end of the action...
def new authorize! :new, resource yield if block_given? # after_new respond_with resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n # render(:new) => this whole action could also be implicit\n end", "def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end", "def new\n\t\t# no code needed here; all handled in the view\n\tend", "def new\n...
[ "0.77027816", "0.73604083", "0.73374164", "0.732912", "0.732912", "0.732912", "0.732912", "0.72930497", "0.7250631", "0.7223275", "0.7183772", "0.71783155", "0.71386945", "0.71386945", "0.7100966", "0.70774645", "0.7063029", "0.7061922", "0.7055055", "0.70440906", "0.7036564"...
0.7231871
9
Resourceful create action to create a record. You can override this method in subclasses in the following ways: To perform action before `new` is run def create do something beforehand super end To perform action after `create`, but before rendering. The reason is that we use responder at the end of the action def crea...
def create authorize! :create, resource current_model_service.create resource, params yield if block_given? # after_create respond_with resource, location: helpers.show_path(resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @record = model.new(record_params)\n # call before actions created in the DSL\n if resource.before_actions[:create]\n resource.before_actions[:create].call(@record)\n end\n if @record.save\n redirect_to polymorphic_path([app_kit, @record])\n else\n pu...
[ "0.7787758", "0.7591158", "0.7471336", "0.7298428", "0.7246447", "0.71595776", "0.70445955", "0.7044304", "0.7020189", "0.7017634", "0.69840467", "0.69720614", "0.6967218", "0.6967218", "0.6967218", "0.6967218", "0.69477046", "0.6926534", "0.6924933", "0.686543", "0.686543", ...
0.7538105
2
Resourceful show action to display values for a record. You can override this method in subclasses in the following ways: To perform action before `show` is run def show do something beforehand super end To perform action after `show`, but before rendering. The reason is that we use responder at the end of the action d...
def show authorize! :show, resource yield if block_given? # after_show respond_with resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n instance_exec(&resource.before_actions[:show]) if resource.before_actions[:show]\n end", "def show\n # For future use\n end", "def show(&block)\n respond_with(entry, &block)\n end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def ...
[ "0.75482357", "0.7041094", "0.7037692", "0.70150256", "0.7014898", "0.7014898", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", "0.7013686", ...
0.0
-1
Resourceful edit action to show a form for editing a record. You can override this method in subclasses in the following ways: To perform action before `edit` is run def edit do something beforehand super end To perform action after `edit`, but before rendering. The reason is that we use responder at the end of the act...
def edit authorize! :edit, resource yield if block_given? # after_edit respond_with resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end", "def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end", "def edit\r\n render :edit\r\n end", "def edit\n # Renders the edit for...
[ "0.8055901", "0.7850417", "0.7753116", "0.77452016", "0.7687542", "0.7687542", "0.7603332", "0.75708866", "0.75191844", "0.7494109", "0.747857", "0.7438215", "0.7438215", "0.7438215", "0.7438215", "0.7438215", "0.7438215", "0.7438215", "0.7438215", "0.7438215", "0.7438215", ...
0.7468147
11
Resourceful update action to update a record. You can override this method in subclasses in the following ways: To perform action before `update` is run def update do something beforehand super end To perform action after `update`, but before rendering. The reason is that we use responder at the end of the action def u...
def update authorize! :update, resource current_model_service.update resource, params yield if block_given? # after_update respond_with resource, location: helpers.show_path(resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n flash[:success] = \"Record updated successfully.\"\n # call before actions created in the DSL\n if resource.before_actions[:update]\n resource.before_actions[:update].call(@record)\n end\n if @record.update(record_params)\n redirect_to polymorphic_path([app_kit, ...
[ "0.7692603", "0.7118525", "0.7107012", "0.71021277", "0.7094881", "0.7073104", "0.7072492", "0.7065457", "0.7040223", "0.6989414", "0.69865364", "0.69865364", "0.6977226", "0.69434047", "0.69420695", "0.69379103", "0.68979186", "0.6892645", "0.68801993", "0.6832471", "0.68135...
0.7449132
1
Resourceful destroy action to delete a record. You can override this method in subclasses in the following ways: To perform action before `destroy` is run def destroy do something beforehand super end To perform action after `destroy`, but before rendering. The reason is that we use responder at the end of the action d...
def destroy authorize! :destroy, resource current_model_service.destroy resource, params yield if block_given? # after_destroy respond_with resource, location: helpers.index_path(current_model_class) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n resource.destroy\n respond_to do |format|\n format.html { redirect_to self.send(\"#{resource_class_name.pluralize.underscore}_url\"), notice: \"#{resource_class_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n after_destr...
[ "0.74950266", "0.7481194", "0.7470153", "0.73163944", "0.7273081", "0.72693187", "0.72693187", "0.72546655", "0.724401", "0.724401", "0.724401", "0.724401", "0.72421277", "0.72411364", "0.71957576", "0.71660006", "0.7155891", "0.7155891", "0.714037", "0.714037", "0.714037", ...
0.7383018
3
Model servicer associated to current modal class. This model servicer will take care of all the CRUD operations For how to override model service, see (Wallaby::ModelServicer)
def current_model_service @current_model_service ||= begin model_class = current_model_class Map.servicer_map(model_class).new model_class, authorizer end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_model\n @model = ClientService.find(params[:id])\n end", "def model\n self.class.model\n end", "def model\n self.class.model\n end", "def model\n end", "def model\n self\n end", "def model\n self::Model\n end", "def model\n retur...
[ "0.63112026", "0.6102231", "0.6102231", "0.60964566", "0.6047657", "0.6007424", "0.59987175", "0.5992136", "0.5992136", "0.5992136", "0.5992136", "0.596821", "0.5953232", "0.5953232", "0.5932104", "0.5913124", "0.5913124", "0.5913124", "0.5833696", "0.58145183", "0.5786863", ...
0.61893356
1
To whitelist the params for CRUD actions
def resource_params @resource_params ||= current_model_service.permit params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n [:role, :title]\n end", "def safe_params\n resurce_name = self.cla...
[ "0.7299525", "0.72398764", "0.7216672", "0.71491283", "0.706786", "0.68346214", "0.68321043", "0.6776893", "0.67739594", "0.6739736", "0.6702918", "0.6683323", "0.6683086", "0.66535646", "0.6627053", "0.66230536", "0.66080284", "0.66004056", "0.65962297", "0.65950984", "0.659...
0.6247362
49
Override origin ActionView::ViewPaths::ClassMethods_prefixes to add more paths so that it could look up partials in the following order: mounted_path/resources_name/action_name (e.g. `admin/products/index) mounted_path/resources_name (e.g. `admin/products) full_path_of_custom_resources_controller/action_name (e.g. `man...
def _prefixes @_prefixes ||= PrefixesBuilder.new( super, controller_path, current_resources_name, params ).build end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prefixes #:nodoc:\n @_prefixes ||= if self.class.scoped_views? && request && devise_mapping\n [\"#{devise_mapping.scoped_path}/#{controller_name}\"] + super\n else\n super\n end\n end", "def partial_path_without_prefix\n old_value = ActionView::Base.prefix_partial_path_with_controll...
[ "0.6338648", "0.6223998", "0.6103791", "0.6103791", "0.60784996", "0.6074098", "0.60672086", "0.60502857", "0.59853566", "0.58621657", "0.58621657", "0.5762238", "0.5762238", "0.5762238", "0.5762238", "0.5753722", "0.5735193", "0.5735193", "0.5735193", "0.56993383", "0.569748...
0.55514705
25
A wrapped lookup content Its aim is to render string partial when given partial is not found
def lookup_context @_lookup_context ||= LookupContextWrapper.new super # rubocop:disable Naming/MemoizedInstanceVariableName, Metrics/LineLength end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_partial(context, options, &block); end", "def render_partial(*ignore_args); end", "def partial; end", "def partial; end", "def partial; end", "def partial; end", "def find_partial(content)\n return content if content.is_a? String\n begin\n File.open(Dir[\"views/#{content}\\.*\"][...
[ "0.6558276", "0.6557188", "0.6523232", "0.6523232", "0.6523232", "0.6523232", "0.6466327", "0.636845", "0.62848955", "0.6172499", "0.6149851", "0.61439955", "0.60841554", "0.60838246", "0.6076932", "0.6055503", "0.60317034", "0.599523", "0.59912926", "0.5988889", "0.59869385"...
0.0
-1
To paginate the collection but only when either `page` or `per` param is given, or requesting HTML response
def paginate(query) paginatable = params[:page] || params[:per] || request.format.symbol == :html paginatable ? current_model_service.paginate(query, params) : query end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginated(collection, options = {})\n respond_with_object_and_type collection, options, :paginated, false\n end", "def paginate_collection!\n set_collection get_collection.page(params[:page]).per(self.class.per_page)\n end", "def page_collection!\n return unless paginate\n\n page = pa...
[ "0.7653906", "0.7626297", "0.7454962", "0.7372583", "0.7372176", "0.7356476", "0.7269862", "0.7262341", "0.7185179", "0.7174828", "0.71712285", "0.7129295", "0.7077602", "0.70717794", "0.7044445", "0.7001339", "0.6991625", "0.693468", "0.6930902", "0.6887957", "0.6875859", ...
0.6717646
30
Creates an MOTD by parsing the provided config file, and processing each component.
def initialize(config_path = nil, process = true) @config = Config.new(config_path) @components = @config.components_enabled.map { |ce| ce.new(self) } @components.each(&:process) if process end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(config_file='../config_parser/example_config.conf', comments=%w{# ;})\n @config_file = config_file\n @params = {}\n @splitRegex = '\\s*=\\s*'\n @comments = comments\n\n # validate the file and extract the content\n self.validate_file\n self.import_config_content_fr...
[ "0.5494292", "0.54584086", "0.5345603", "0.5322335", "0.53087294", "0.5305105", "0.5266013", "0.5241835", "0.51642776", "0.5088057", "0.50805175", "0.5063265", "0.50626063", "0.50624716", "0.5049244", "0.5048432", "0.50477874", "0.5047706", "0.50424004", "0.50183207", "0.4994...
0.54814065
1
Takes each component on the MOTD and joins them together in a printable format. It inserts two newlines in between each component, ensuring that there is one empty line between each. If a component has any errors, the error will be printed in a clean way.
def to_s @components.map do |c| if c.errors.any? c.errors.map(&:to_s).join("\n") else c.to_s end end.join("\n\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_cr\n self.compact.reject { |element| element.to_s.empty? || element.to_s.strip == \"\\n\" }.join(\"\\n\")\n end", "def to_s\n [\n self.line_01,\n self.line_02,\n self.line_03,\n ].join(\"\\n\")\n end", "def to_s\n\t\tstr = \"\"\n\t\t\n\t\t@sequence.each { |path_step|\n\t\t\ts...
[ "0.592743", "0.5906287", "0.57644963", "0.5740147", "0.5690373", "0.5648598", "0.5645454", "0.56112826", "0.5578862", "0.5491013", "0.5475599", "0.54475343", "0.5441067", "0.54279125", "0.5404422", "0.540217", "0.53905976", "0.53895843", "0.53753746", "0.5374701", "0.537263",...
0.6502261
0
NOTE: resource_name must be defined inside a controller
def find_obj @obj = eval(resource_name).find_by(id: params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_name\n @resource_name\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def ...
[ "0.80523896", "0.7671639", "0.7671639", "0.7671639", "0.7651403", "0.76505053", "0.764794", "0.763178", "0.763178", "0.7582317", "0.7582317", "0.75647444", "0.75647444", "0.75639117", "0.7548163", "0.751696", "0.7414335", "0.7401391", "0.7398605", "0.7398605", "0.7398605", ...
0.0
-1
Funkcija, kas veiks teksta ievadi text fieldos ka ari aizver klaviaturu
def enter_text(element, text) @driver.find_element(element[:type], element[:value]).send_keys text @driver.hide_keyboard end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_field; end", "def startEdit\n super\n create_text_field unless @text_field\n\n set_text nil\n set_graphic @text_field\n @text_field.select_all\n end", "def textfields\n find_2_eles_attr :textfield, :secure, :text\n end", "def custom_field_text(field, text)\n frm.text_field(:na...
[ "0.70769143", "0.674519", "0.6641948", "0.65832204", "0.6418945", "0.6345485", "0.6258119", "0.62333226", "0.62333226", "0.6160044", "0.6160044", "0.6147772", "0.60633856", "0.60584754", "0.6043653", "0.6042639", "0.6028083", "0.5976439", "0.5966441", "0.59550333", "0.5952508...
0.0
-1
Returns the footer y coordinate. Should be called from within a Prawn canvas block so it will return the correct position rather than one based on its parent bounding_box. It takes the absolute bottom of the page and adds the bottom margin to position the footer correctly.
def footer_top_position bounds.bottom + layout.margin.bottom end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def margin_bottom\n cur_page.margin_bottom\n end", "def bottom_cell_y_at(y); (y + HEIGHT - 1) / HEIGHT; end", "def bottom\n `#{clientRect}.bottom` + Window.scrollY\n end", "def Footer()\n\t\tif (@print_footer)\n\t\t\t\n\t\t\tif (@original_l_margin.nil?)\n\t\t\t\t@original_l_margin = @l_margin...
[ "0.64847916", "0.63965666", "0.6232922", "0.6231279", "0.6153665", "0.6029872", "0.6021109", "0.5982036", "0.5976986", "0.59590864", "0.59573084", "0.5827599", "0.58044696", "0.5790716", "0.57705593", "0.5740608", "0.5718204", "0.5718204", "0.5718204", "0.5697172", "0.567623"...
0.7141976
0
Returns the x position for a content box. Should be called from within a Prawn canvas block so it will return the correct position based on the absolute left rather than the left of its parent bounding_box.
def left_position if page_number.even? bounds.left + layout.margin.outer else bounds.left + layout.margin.inner end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor_x\n # x is \"0\" if cursor position at 0\n return -self.src_rect.x + 4 if !self.cursor_can_move_left?\n # find cursor position from text left from it\n display_text = get_display_text.scan(/./m)[0, @cursor_position].join\n cx = self.bitmap.text_size(display_text).width - self.src_rect.x\n...
[ "0.67312425", "0.67090607", "0.67090607", "0.65771407", "0.65749764", "0.65749764", "0.6309193", "0.62823945", "0.6089543", "0.6041718", "0.60141474", "0.59900105", "0.59631073", "0.59182215", "0.5907461", "0.59032667", "0.5874886", "0.58266085", "0.58254564", "0.5811696", "0...
0.61196375
8
make a method that formats the created_at being returned
def created_at object.created_at.strftime("%B %d, %Y") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at\n formatted_time(object.created_at)\n end", "def created_at\n formatted_time(object.created_at)\n end", "def created_at\n formatted_time(object.created_at)\n end", "def created_at\n formatted_time(object.created_at)\n end", "def formatted_created_at\n self.created_at.to_date...
[ "0.85336226", "0.85336226", "0.85336226", "0.85336226", "0.85320216", "0.8322495", "0.82812834", "0.82767206", "0.8253503", "0.82510966", "0.8221854", "0.8188201", "0.81389046", "0.80946183", "0.80631673", "0.8018845", "0.79176617", "0.79062927", "0.7902615", "0.78953546", "0...
0.8103344
13
Write one or more full 128bit (16byte) blocks, encrypted and MAC'd.
def write_encrypted(data) @writer.print(@encrypter.encrypt(data)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_blocks(nonce, start_block, block_count, data)\n # TODO: transactional integrity\n \n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_update_path start_block + i\n load_data[:ops] <<\n { :op => :update, :path => load_data[:path], :nonce => nonce,\n ...
[ "0.6458036", "0.53372365", "0.525439", "0.5194992", "0.51114166", "0.5091549", "0.5048273", "0.50439847", "0.5034523", "0.50245327", "0.4995039", "0.49366203", "0.49269098", "0.4862832", "0.481707", "0.48079565", "0.48017782", "0.47787538", "0.4745417", "0.47452587", "0.47363...
0.0
-1
get the currently logged in user from the db based on id stored in session
def current_user # set instance variable to either nil (if session[:user_id] is nil) # or to the user with that id @current_user ||= session[:user_id] && User.find_by_id(session[:user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user(id = session[:user_id])\n User.get_one id\n end", "def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end", "def user_from_session\n if session[:user] && session[:user][:id]\n User.find_by_id(session[:use...
[ "0.87355727", "0.84786755", "0.8460682", "0.8434553", "0.8310839", "0.8297439", "0.82851344", "0.8245029", "0.8237716", "0.8235049", "0.8224543", "0.82087266", "0.8203497", "0.8199233", "0.8194346", "0.81864583", "0.8180787", "0.81712854", "0.81707126", "0.8146058", "0.814605...
0.0
-1
Finds the author with the ID stored in the session with the key :current_user_id
def get_author @current_author ||= session[:current_user_id] && Author.find(session[:current_user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n @current_author ||= Author.find_by(id: session[:author_id])\n end", "def current_author\n Author.find(current_user.id) unless current_user.nil?\n end", "def author; User.get(self.author_id); end", "def author\n User.find_by_id(@user_id)\n end", "def author\n User.find_by_i...
[ "0.7809056", "0.7687823", "0.764944", "0.7494498", "0.73757726", "0.7371289", "0.72766143", "0.72730285", "0.71326894", "0.7075736", "0.6912546", "0.68382454", "0.6765388", "0.6763939", "0.6705555", "0.6703723", "0.6688449", "0.6664083", "0.66475266", "0.6567684", "0.65578485...
0.82768464
0
outputs: columns to be displayed
def print_entries(entries, outputs, format = "csv") columns = outputs.select{|o| ClosedAuction::Entry::all_valid_columns.include? o} columns = ClosedAuction::Entry::all_valid_columns if columns.empty? rows = entries.map do |e| columns.map{|c| e.send(c.to_sym)} end # print to console in specified format ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displayframecolumnvalues\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t\tnew_row='|'+row.join('|')+'|'\r\n\t\t\t\t@output.puts(new_row)\r\n\t\t\tend\r\n\t\tend", "def display_columns(input)\n output = \"\"\n input.each_with_index do ...
[ "0.7862548", "0.7622022", "0.7525488", "0.7406344", "0.73121935", "0.7224902", "0.72210085", "0.71443385", "0.70697254", "0.7001578", "0.69805753", "0.6963453", "0.69265574", "0.6921507", "0.68830186", "0.68830186", "0.68830186", "0.68830186", "0.6878737", "0.686178", "0.6821...
0.0
-1
Get card account for a user on a marketplace.
def find(id) response = JSON.parse(@client.get("card_accounts/#{id}").body) Promisepay::CardAccount.new(@client, response['card_accounts']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_marketplace_bank_account\n Balanced::BankAccount.find(\"/v1/bank_accounts/BAj6sNNBdMp5WmY6PJ7sAu3\")\n end", "def card_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/card_accounts\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n rescue Promis...
[ "0.6984317", "0.6853766", "0.63499445", "0.6302592", "0.6252587", "0.606689", "0.6034837", "0.59980404", "0.59494144", "0.59472644", "0.594268", "0.59419256", "0.5941332", "0.59325624", "0.59325624", "0.59325624", "0.59325624", "0.59325624", "0.59325624", "0.59325624", "0.593...
0.5800744
32
Create a card account for a user on a marketplace.
def create(attributes) response = JSON.parse(@client.post('card_accounts', attributes).body) Promisepay::CardAccount.new(@client, response['card_accounts']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end", "def create_buyer email_a...
[ "0.7338271", "0.7338271", "0.7283342", "0.70521915", "0.7025848", "0.6785142", "0.6764714", "0.668449", "0.66742784", "0.66125196", "0.6558059", "0.6497932", "0.6462553", "0.64279014", "0.6425974", "0.6380054", "0.63437176", "0.6323746", "0.6321136", "0.63041604", "0.6301173"...
0.63380754
17
It accepts the following types of provider: methodname as symbol the specified method should return the relevant items and has to be available in the view (a helper method) object that responds to :items enumerable object that represents the items See SimpleNavigation::ItemAdapter for the requirements that need to be f...
def initialize(provider) @provider = provider end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items\n if provider.is_a?(Symbol)\n SimpleNavigation.context_for_eval.send(provider)\n elsif provider.respond_to?(:items)\n provider.items\n elsif provider.respond_to?(:each)\n provider\n else\n fail('items_provider either must be a symbol specifying the ' ...
[ "0.7641031", "0.573533", "0.5617465", "0.55956", "0.55828834", "0.5412781", "0.5398078", "0.5381077", "0.5371486", "0.5320449", "0.5274618", "0.5268091", "0.5251499", "0.5226022", "0.52250695", "0.51857144", "0.51839715", "0.51826376", "0.51781857", "0.5172751", "0.51636547",...
0.0
-1
Returns the navigation items
def items if provider.is_a?(Symbol) SimpleNavigation.context_for_eval.send(provider) elsif provider.respond_to?(:items) provider.items elsif provider.respond_to?(:each) provider else fail('items_provider either must be a symbol specifying the ' \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @navigation_items = NavigationItem.all\n end", "def nav_items\n [\n {\n url: root_path,\n title: \"Home\"\n },\n {\n url: about_me_path,\n title: \"About Me\"\n },\n {\n url: contact_path,\n title: \"Contact\"\n },\n ...
[ "0.7621677", "0.7096835", "0.7044875", "0.70417273", "0.7013416", "0.6864084", "0.6794634", "0.6688742", "0.66465354", "0.6626555", "0.6613879", "0.65847254", "0.65441275", "0.65441275", "0.6525138", "0.65213484", "0.64665216", "0.64500433", "0.6443602", "0.6377212", "0.63647...
0.0
-1
GET /works GET /works.json
def index @works = Work.includes(:avalon_items).all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n...
[ "0.7963417", "0.7963417", "0.7592916", "0.7276264", "0.72696793", "0.7181406", "0.7109182", "0.7109182", "0.70479816", "0.7040871", "0.70310766", "0.70310766", "0.6985947", "0.6954218", "0.68944174", "0.6786475", "0.6781445", "0.67543817", "0.67355305", "0.6715832", "0.668567...
0.6506665
26
GET /works/1 GET /works/1.json
def show render 'works/show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n...
[ "0.77681607", "0.77681607", "0.7337539", "0.7337539", "0.7274655", "0.7250202", "0.70975107", "0.70936084", "0.70882404", "0.7059149", "0.69210666", "0.6906746", "0.68945616", "0.6868209", "0.6868209", "0.67656106", "0.6708405", "0.6655762", "0.6639254", "0.662724", "0.662439...
0.62219137
57
POST /works POST /works.json
def create @work = Work.new(work_params) process_work_contributors respond_to do |format| if @work.save format.html { redirect_to @work, notice: 'Work was successfully created.' } format.json { render text: "success"} else format.html { render :new } format.json {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully created.' }}\n format.json { render json: @work, status: :created, location: @work }\n else\n format....
[ "0.708761", "0.70516276", "0.70516276", "0.70188236", "0.6999388", "0.6957046", "0.6957046", "0.6947207", "0.686405", "0.6839066", "0.682445", "0.67952967", "0.67952967", "0.67653304", "0.6612987", "0.655409", "0.6534056", "0.64667", "0.6440446", "0.6437012", "0.6386774", "...
0.6778861
13
PATCH/PUT /works/1 PATCH/PUT /works/1.json
def update respond_to do |format| if @work.update(work_params) process_work_contributors format.html { redirect_to @work, notice: 'Work was successfully updated.' } format.json { render :show, status: :ok, location: @work } else format.html { render :edit } format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.6731105", "0.6726822", "0.6666729", "0.66356814", "0.6496148", "0.6496148", "0.6496148", "0.6496148", "0.64026994", "0.6394418", "0.63560146", "0.6339367", "0.63167864", "0.63131815", "0.6312206", "0.6304752", "0.62879384", "0.627947", "0.6279258", "0.62507415", "0.6240582...
0.6287096
17
DELETE /works/1 DELETE /works/1.json
def destroy if @work.avalon_items.size > 0 respond_to do |format| format.html { redirect_to works_url, notice: "The Work <i>#{@work.title}</i> cannot be destroyed because it is currently associated with Avalon Items".html_safe } end else @work.destroy respond_to do |format| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.h...
[ "0.73931", "0.73931", "0.73931", "0.73931", "0.7373433", "0.714431", "0.71261984", "0.7107901", "0.7107901", "0.70960915", "0.7062018", "0.7062018", "0.7062018", "0.7062018", "0.70499235", "0.7034367", "0.70037955", "0.6999732", "0.69838285", "0.69475096", "0.6944108", "0.6...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_work @work = Work.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 work_params params.require(:work).permit( :title, :alternative_titles, :publication_date_edtf, :authority_source, :authority_source_url, :traditional, :contemporary_work_in_copyright, :restored_copyright, :copyright_renewed, :copyright_end_date_edtf, :access_determination, :notes...
{ "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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Builtin stats callback: librato
def librato_send(stats) if @librato_api_key.nil? || @librato_api_key.empty? || @librato_email.nil? || @librato_email.empty? puts "No librato api key and email" return end begin Librato::Metrics.authenticate(@librato_email, @librato_api_key) metrics = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats\n ## TODO:\n end", "def stats\n end", "def stats\n end", "def stats; end", "def stats; end", "def stats\n \n end", "def goaltending_stats(stats)\n\nend", "def quick_stats\n\tend", "def global_statistics\n super\n end", "def statistics; end", "def stats(&blk)\n i...
[ "0.7026585", "0.69027096", "0.69027096", "0.68195134", "0.68195134", "0.6771899", "0.65079606", "0.6405632", "0.6402354", "0.63938344", "0.63415927", "0.63074017", "0.6276781", "0.62426555", "0.623176", "0.623176", "0.623176", "0.623176", "0.623176", "0.623176", "0.623176", ...
0.5888995
33
We don't have access to blank? and it would be dumb to include activesupport for only one method
def default_value_if_blank(value, default) # Stolen from: http://api.rubyonrails.org/classes/Object.html#method-i-blank-3F empty = value.respond_to?(:empty?) ? !!value.empty? : !value if empty return default else return value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compact_blank; end", "def simple_present; end", "def compact_blank!; end", "def isolated?; end", "def isolated?; end", "def isolated; end", "def isolated; end", "def skip_include_blank?; end", "def missing; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end"...
[ "0.6287324", "0.62396044", "0.62029094", "0.6094884", "0.6094884", "0.59446096", "0.59446096", "0.59141827", "0.5704057", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931", "0.5682931"...
0.0
-1
Initialize adapter object with nokogiri xml structure
def initialize(ng_or_string_or_io) @ng_xml = ng_or_string_or_io.is_a?(Nokogiri::XML::Document) ? ng_or_string_or_io : Nokogiri::XML(ng_or_string_or_io) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_xml(xml)\n\t\tend", "def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end", "def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end", "def initialize(xml)\n #puts \"________________________________________\"\n #puts xml\n #pu...
[ "0.6946053", "0.6939388", "0.6939388", "0.68979234", "0.6860766", "0.6790575", "0.6790575", "0.6790575", "0.67199165", "0.66667604", "0.662498", "0.65954125", "0.6562989", "0.6405884", "0.63613373", "0.63469476", "0.63333946", "0.6281743", "0.6281558", "0.62646025", "0.622423...
0.5954089
43
It's your duty create the lasts two tests
def test_ignoring_accent end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_created(test)\n\n end", "def tests; end", "def tests; end", "def generate_alltest\n\n end", "def testing\n # ...\n end", "def test_should_create_test_result\n test_target_instance = get_new_test_target_instance(\"example1\", \"2012112801\")\n batch_edit_test_results(test_ta...
[ "0.717982", "0.7111336", "0.7111336", "0.6925307", "0.6812443", "0.6748784", "0.6748068", "0.6730499", "0.6730099", "0.66824293", "0.66562474", "0.66562474", "0.66562474", "0.66485804", "0.663655", "0.66223675", "0.6589322", "0.65762246", "0.654712", "0.65329075", "0.65279084...
0.0
-1
Deliberately calling this end_of_list to avoid using a keyword as a function name (ie: calling it 'end')
def end_of_list temp = @head while !temp.next.nil? temp = temp.next end temp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saw_end_list(list); end", "def end_special_list\n end", "def closed_end_list(list); end", "def end_special_list_item\n end", "def accept_list_end(list)\n @list.pop\n if tag = @in_list_entry.pop\n @res << tag\n end\n @res << html_list_name(list.type, false) << \"\\n\"\n end", "...
[ "0.8076358", "0.77887195", "0.76102024", "0.72153544", "0.6839532", "0.6803045", "0.66644824", "0.66548944", "0.6545781", "0.65084994", "0.648477", "0.6462193", "0.6462193", "0.6462193", "0.64449257", "0.64449257", "0.643805", "0.6404285", "0.63649607", "0.6356598", "0.634967...
0.645051
14
Just a simple delete based on value
def delete(value:) if @head.value == value if @head.next.nil? @head.value = nil return value else @head = @head.next return value end else prev = @head temp = @head.next while !temp.nil? if temp.value == value prev.next = tem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(value)\n end", "def delete(value)\n end", "def delete(value)\n @data.delete value\n value\n end", "def delete!\n values.delete!\n end", "def delete(value)\n delete_node(find(value))\n end", "def delete(value)\n #get hashed value\n hash_value = hash_function...
[ "0.7884888", "0.7884888", "0.7641194", "0.74536157", "0.7340252", "0.73029256", "0.72384787", "0.710383", "0.7082027", "0.7082027", "0.7082027", "0.7082027", "0.7082027", "0.70776063", "0.7054805", "0.7030585", "0.70077795", "0.69498336", "0.69246554", "0.6906715", "0.6871165...
0.0
-1
code.index returns the index of the first object for which the block returns true returns nil if no match is found
def delete_from_secret(code, n) code.delete_at(code.index(n)) if code.index(n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_index list, &block #were taking a list, and a block we want to find, find_index = func name\n list.index(&block) #look in list using .index(&block) to find the index of the block \nend", "def find_index(a, target) # this is where returning directly from withing block is ok!\n a.each_with_index do |e, ...
[ "0.67784846", "0.65281355", "0.6413899", "0.6376496", "0.628027", "0.62407255", "0.6232813", "0.6232152", "0.61305", "0.6122309", "0.61066425", "0.61030716", "0.6056695", "0.6027439", "0.6009167", "0.5990148", "0.5987622", "0.5956319", "0.58758664", "0.585709", "0.5835079", ...
0.0
-1
inject(0) > initialize 'count' with 0 run through 'index', return new 'count' assign 'count' as the start of the next iteration
def exact_match_count (0..3).inject(0) do |count, index| count + (exact_match?(index) ? 1 : 0) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @orig...
[ "0.651731", "0.6286114", "0.6281915", "0.6260245", "0.6253486", "0.60835385", "0.60714096", "0.6017701", "0.60049784", "0.5996404", "0.5984871", "0.5963638", "0.59387887", "0.59370905", "0.5920315", "0.591127", "0.58732", "0.58402944", "0.5835711", "0.5832871", "0.58129007", ...
0.0
-1