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
Only allow a list of trusted parameters through.
def formula_herb_action_params params.require(:formula_herb_action).permit(:formula_herb_id, :formula_named_action_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /subscriptions GET /subscriptions.json
def index @subscriptions = Subscription.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions...
[ "0.8179333", "0.80743414", "0.7945015", "0.7691383", "0.7650296", "0.758197", "0.7512477", "0.74939454", "0.7430707", "0.74138576", "0.7406093", "0.7406093", "0.7406041", "0.7387691", "0.7374919", "0.7374919", "0.7365163", "0.7320913", "0.7300906", "0.7266754", "0.72661877", ...
0.7114169
25
GET /subscriptions/1 GET /subscriptions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7861968", "0.75837445", "0.75837445", "0.75720704", "0.75669205", "0.74484855", "0.73489445", "0.7335316", "0.7335316", "0.7256615", "0.7242413", "0.7242413", "0.7242413", "0.7242413", "0.7234326", "0.7231307", "0.7203007", "0.7198185", "0.7190798", "0.71879846", "0.718450...
0.0
-1
POST /subscriptions POST /subscriptions.json 127.0.0.1:3000/subscriptions/update
def toggle # put user_id business_id in params user = User.where(:unique_id => params[:device_id]) if user.empty? user = User.new(:unique_id => params[:device_id]) user.save else user = user.first #WHERE RETURNS AN ARRAY end user_id = user.id @subscription = Subscription.where(:business_id => params[:business_id], :user_id => user_id) if @subscription.empty? @subscription = Subscription.new(:business_id => params[:business_id], :user_id => user_id) @subscription.save render :json => "subscribed" else @subscription.first.destroy render :json => "unsubscribed" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @subscription = Subscription.find(params[:id])\n\n if @subscription.update(subscription_params)\n head :no_content\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end", "def update\n @subscription = Subscription.get(params[:id])\n @subsc...
[ "0.75670075", "0.74948996", "0.74905753", "0.74732214", "0.7418818", "0.74143976", "0.7390735", "0.7390735", "0.7390735", "0.7354441", "0.7330095", "0.73239106", "0.7310953", "0.7310953", "0.7290768", "0.72902995", "0.728721", "0.72593945", "0.7243102", "0.72309256", "0.72289...
0.0
-1
DELETE /subscriptions/1 DELETE /subscriptions/1.json
def destroy @subscription.destroy respond_to do |format| format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end", "def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end", "def delete_subscriptions\n end", ...
[ "0.8083839", "0.7971518", "0.7749676", "0.77227986", "0.76973474", "0.76788694", "0.76788694", "0.76788694", "0.76788694", "0.766344", "0.75745755", "0.75494754", "0.75242066", "0.7512467", "0.74898785", "0.7430863", "0.7402852", "0.7389791", "0.7389791", "0.7389791", "0.7348...
0.74766344
19
it would be nice to use flagged_as_spam? directly but GuideTaxon is a weird case of something that is spam only because of association its not directly flagged
def known_spam? if is_a?( GuideTaxon ) # guide taxa can have many sections, each of which could be spam, # so when one is spam consider the entire GuideTaxon as spam if guide_sections.any?( &:flagged_as_spam? ) return true end return false end if respond_to?( :flagged_as_spam? ) && flagged_as_spam? return true end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_spam!\n update_attribute(:approved, false)\n Akismetor.submit_spam(akismet_attributes)\n end", "def check_for_spam\n if self.spam?\n self.update_column(:approved, false)\n elsif !approved\n self.update_column(:approved, true)\n end\n end", "def mark_as_spam!\n update_a...
[ "0.69001424", "0.6811213", "0.6809065", "0.6678388", "0.6649906", "0.6620109", "0.6425489", "0.6271691", "0.62688047", "0.62554777", "0.6250683", "0.6248758", "0.6159642", "0.61051667", "0.6083339", "0.6060099", "0.60578305", "0.60532117", "0.60508287", "0.5966958", "0.596609...
0.7278442
0
Objective: This method takes in an array of stock prices, where position 0 is day 1, position 1 is day 2, etc. The method identifies the highest stock value, purchases the lowest stock value that occurs before the stock hits that highest value, and then sells at the highest for a profit.
def stock_picker(stock_prices) lowest, highest = 9999999999, 0 index_of_highest, index_of_lowest = 0 stock_prices.each_with_index do |price, index| if price > highest highest, index_of_highest = price, index end end index = 0 while index < index_of_highest if stock_prices[index] < lowest lowest, index_of_lowest = stock_prices[index], index end index += 1 end puts "You bought stock on Day #{index_of_lowest + 1}, for $#{lowest}, and sold it on Day #{index_of_highest + 1} for $#{highest}. Your profit is $#{highest - lowest}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_picker(array)\n best_buy = 0\n best_sell = 0\n max_profit = 0\n\n #first iterate through the array to find a buy day\n (0..(array.length-2)).each do |buy_date|\n\n #for each possible buy day, iterate through each sell day\n ((buy_date + 1)..array.length - 1).each do |sell_date|\n\n #check t...
[ "0.81271076", "0.795692", "0.7864436", "0.7828624", "0.7785256", "0.77725315", "0.77601504", "0.77523786", "0.7751751", "0.77350444", "0.77242064", "0.77165604", "0.77150345", "0.77058905", "0.7683098", "0.7680521", "0.766874", "0.7650591", "0.76504564", "0.7630014", "0.76280...
0.7285116
62
Pass by reference vs value 8 January 2014 sort array, immutable way
def foo arr arr.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def my_array_sorting_method(array)\n\t@array=array\n\t@array.sort\n\treturn @array\nend", "def using_sort(array)\n sorted_array=array.sort\nend", "def bar arr\n arr.sort!\nend", "def sort arr\r\n\trec_sort arr, []\r\ne...
[ "0.7191132", "0.7191132", "0.71701574", "0.7117478", "0.71114975", "0.71004623", "0.7098862", "0.7098862", "0.7098862", "0.70960903", "0.70762867", "0.7046668", "0.70443517", "0.70016634", "0.69939274", "0.69921017", "0.6954474", "0.69530416", "0.68441963", "0.6828034", "0.68...
0.70188576
13
sort array, non immutable way
def bar arr arr.sort! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort arr \n\trec_sort arr, []\nend", "def sort arr\r\n\trec_sort arr, []\r\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def sort1(array)\n\nend", "def sort arr\n rec_sort arr, []\nend", "def using_sort(array)\n sorted_array=array.sort\nend", "def ...
[ "0.7905387", "0.78058445", "0.7604979", "0.7604979", "0.75994635", "0.7559644", "0.74847424", "0.74668956", "0.7457611", "0.7444893", "0.7334978", "0.7334978", "0.7334978", "0.7321632", "0.73134655", "0.72790354", "0.7277577", "0.7243714", "0.7241533", "0.721947", "0.71927184...
0.7166119
29
Check if user is authorized by minimum role Using the power value to determine if user has sufficent privileges
def is_authorized(min_role) @roles = Role.all.group(:name) authorized = false if @roles[self[:name]] >= @roles[min_role] authorized = true end return authorized end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin? ; user.instance_of? User and user.role >= 2 ; end", "def level! min\n level = @connection.users[@msg.nick].level\n\n return true if level >= min\n\n raise 'Insufficient access level.'\n end", "def admin_authorized?\n\t\tif @user\n\t\t\t@user.level >= ADMIN_USER_LEVEL \n\t\telse\n\t...
[ "0.6755913", "0.6736553", "0.67134863", "0.6619026", "0.6614342", "0.6607437", "0.65995127", "0.6598425", "0.6540702", "0.6496781", "0.6478794", "0.6419712", "0.6412473", "0.63778853", "0.63186556", "0.63133794", "0.63118696", "0.6297386", "0.6295865", "0.6261967", "0.6251437...
0.7311992
0
:tie, :dealer, :player, :dealer_busted, :player_busted
def detect_result(dealer_total, player_total) # player_total = total(player_cards) # dealer_total = total(dealer_cards) if player_total > 21 :player_busted elsif dealer_total > 21 :dealer_busted elsif dealer_total < player_total :player elsif dealer_total > player_total :dealer else :tie end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affichage_player\n\n\n end", "def human_and_human_player(size)\n\t@player1 = \"player\"\n @player2 = \"player\"\nend", "def detect_result\n case\n when player.busted? then :player_busted\n when dealer.busted? then :dealer_busted\n when player.total > dealer.total then :player_higher\n wh...
[ "0.67239624", "0.66771483", "0.6507257", "0.64697087", "0.6375969", "0.632774", "0.632774", "0.632774", "0.632774", "0.632774", "0.632774", "0.632774", "0.62016624", "0.61749953", "0.616538", "0.6162165", "0.61455154", "0.6081245", "0.60663533", "0.60663533", "0.60663533", ...
0.0
-1
Initializes the rating with its various attributes
def initialize(user_id,movie_id,rating,timestamp) @user_id = user_id @movie_id = movie_id @rating = rating @timestamp = timestamp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_rating\n create_rating if self.sf_id =~ /\\D/ and rating.nil?\n end", "def initialize\n @rating_list = {}\n end", "def initialize(id,rating)\n @id = id\n @rating = rating\n end", "def initialize(rating)\n move_id = rating.movie_id\n @rating_list = {movie_id: rating}\n @...
[ "0.7673313", "0.7470649", "0.73743445", "0.7259347", "0.71213055", "0.68973154", "0.68631005", "0.67338026", "0.67326015", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.6702151", "0.66445476", "0.662064...
0.64645636
25
Method checks the current_user is the Team Lead. Only Team Leads are allow to modify teams
def check_if_user_is_team_leader? render json: ["Only the Team Lead can edit this team"], status: 422 unless current_user.id == this_team.user_id; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_edit_team?(team)\n can_manage_teams? || team_leader?(team.friendly_id)\n end", "def check_access(team)\n if !team.is_in?(user)\n flash[:error] = \"Vous ne faites pas partie de cette équipe\"\n redirect_referrer\n end\n end", "def check_use_team\r\n if !params[:team_id].nil?\r\n ...
[ "0.7071976", "0.7069822", "0.7068741", "0.7049596", "0.7046182", "0.67955595", "0.678053", "0.6642092", "0.6583335", "0.6553016", "0.6542398", "0.6522999", "0.6384407", "0.6342866", "0.63334334", "0.63294965", "0.63172734", "0.63161284", "0.6280954", "0.62598145", "0.62499374...
0.75258464
0
Specify input file options
def options(hash) @options.merge! hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_std_file_opt(inkey)\n @oparse.on(\"-f\", \"--file FILENAME\", \"Input from FILENAME\") do |f|\n @opts[inkey] = do_file_read(f)\n end\n return @oparse\n end", "def file_options; end", "def file_read_opts; end", "def file_read_opts(context); end", "def file_read_opts=(_arg0);...
[ "0.74768263", "0.73147166", "0.68818724", "0.6788118", "0.66807646", "0.64102745", "0.63863736", "0.6381875", "0.6369093", "0.627762", "0.6258423", "0.62216496", "0.6189287", "0.6173023", "0.6159322", "0.6159322", "0.613186", "0.6120181", "0.6097292", "0.6081564", "0.60713184...
0.0
-1
sending the Mail for Staff after creating and after enable process
def send_p pwreset_key_success = false until pwreset_key_success self.password_reset_key = self.class.make_key self.save pwreset_key_success = self.errors.on(:password_reset_key).nil? ? true : false end send_pwd end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_activation\n @user = Student.first\n @user.create_email_activation\n @email = 'yan_fuhai@hotmail.com'\n @option = 'student'\n UserMailer.email_activation @user, @email, @option\n end", "def new_user_waiting_for_approval(faculty)\n @faculty = faculty\n\n mail(to: 'rorteammaker@gmai...
[ "0.7046527", "0.6858299", "0.680331", "0.6701324", "0.66089714", "0.65614575", "0.6526693", "0.6479002", "0.64678794", "0.646258", "0.6459198", "0.64535713", "0.6446289", "0.6419522", "0.64179647", "0.6412921", "0.6410535", "0.6403179", "0.63811415", "0.6365386", "0.63629687"...
0.0
-1
Notifying the Staff about their Account Details
def changed_details mail_deliver(:notify_staff_details, :subject => "Your details have changed for " + self.school.school_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_employee\n \t\temployees.each do |employee|\n \t\t\tputs \"Notification sent to #{employee.name} at #{employee.email}\"\n \t\t\tputs \"\"\n \t\tend\t\n end", "def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if...
[ "0.65631616", "0.64840055", "0.63763887", "0.63678", "0.6290983", "0.6285072", "0.6276045", "0.62560976", "0.6252183", "0.6229516", "0.6212217", "0.6208451", "0.61434716", "0.6129879", "0.6098518", "0.6094862", "0.6091503", "0.6085698", "0.60644627", "0.6031124", "0.6016786",...
0.595952
26
Changing the password reset key after the user clicks
def resetting pwreset_key_success = false until pwreset_key_success self.password_reset_key = self.class.make_key self.save pwreset_key_success = self.errors.on(:password_reset_key).nil? ? true : false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_password_reset\n self.make_password_reset_code\n end", "def password_reset\n player = Player.first\n player.reset_token = Player.new_token\n PlayerMailer.password_reset(player)\n end", "def password_reset\n\t\tshepherd = Shepherd.first\n\t\tshepherd.reset_token = Shepherd.new_token\n S...
[ "0.7393369", "0.72879815", "0.7261722", "0.7204202", "0.7203254", "0.71970606", "0.71729875", "0.71285856", "0.71285856", "0.70927495", "0.708605", "0.7058666", "0.70582527", "0.7039743", "0.7038798", "0.7038798", "0.7038798", "0.7038798", "0.7038798", "0.7038798", "0.7038798...
0.6692635
60
this is a setter
def set_cohort(group) @cohort = group end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set; end", "def set; end", "def __setter__\n \"#{self}=\"\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def setter\r\n @setter ...
[ "0.81791145", "0.81791145", "0.79880553", "0.7590008", "0.7529154", "0.7389435", "0.7363279", "0.73087966", "0.7284757", "0.7281158", "0.7223879", "0.72025865", "0.71291995", "0.7022676", "0.70107377", "0.6997533", "0.6915362", "0.68675435", "0.67795324", "0.6757638", "0.6750...
0.0
-1
O(n) finding the bucket is O(1) and pushing onto ruby's dynamic array is O(1) but iterating through the array using inlcude? is O(n)
def insert(num) self[num].push(num) unless include?(num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket_sort\n buckets = {}\n #Ideal for known and uniformly distributed range. Sort age of employees for eg.:\n @array.each do |age|\n bucket = age/10\n buckets[bucket] ||= []\n buckets[bucket] << age\n end\n\n result = []\n for i in 0..20\n arr = buckets[i]\n puts \"...
[ "0.6758928", "0.67467326", "0.6646215", "0.6583308", "0.654688", "0.6154582", "0.6138802", "0.60570073", "0.5965968", "0.5960513", "0.59391284", "0.5934266", "0.5876404", "0.58067745", "0.5777012", "0.57595503", "0.571151", "0.5674974", "0.5659087", "0.56243217", "0.5559785",...
0.0
-1
O(n) same here, that darn include? method
def remove(num) self[num].delete(num) if include?(num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend", "def include?(position); end", "def el_include(el)\n @cache.each_with_index do |el2, idx|\n return idx if el == el2\n end\n nil\n end", "def include?(ary, value)\n !!ary.index(va...
[ "0.6068663", "0.59994394", "0.58974713", "0.5889515", "0.58879215", "0.5887838", "0.5887838", "0.5887838", "0.5887838", "0.5887838", "0.5861198", "0.5856517", "0.58524776", "0.5730106", "0.57045865", "0.57045865", "0.5688149", "0.5680672", "0.56793", "0.5677134", "0.5677134",...
0.0
-1
O(n) the source of our problems
def include?(num) self[num].include?(num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce(...
[ "0.62264663", "0.60937554", "0.602436", "0.59051985", "0.5887899", "0.58437115", "0.5826624", "0.5764585", "0.5724603", "0.57212794", "0.570705", "0.56688595", "0.56575215", "0.5616169", "0.5598454", "0.5585784", "0.5585481", "0.55834836", "0.5579299", "0.5578773", "0.556171"...
0.0
-1
Usage: create_metric type: :researched do Siemens 2015: 4, 2014: 3 Apple 2105: 7 end
def create_metric opts={}, &block Card::Auth.as_bot do if opts[:name] && opts[:name].to_name.parts.size == 1 opts[:name] = "#{Card::Auth.current.name}+#{opts[:name]}" end opts[:name] ||= "TestDesigner+TestMetric" Card::Metric.create opts, &block end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_metric name, description: nil, filter: nil\n ensure_connection!\n resp = connection.create_metric name, description, filter\n if resp.success?\n Metric.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "de...
[ "0.59261656", "0.58557934", "0.55596787", "0.55426264", "0.5375842", "0.53575224", "0.5240023", "0.52255964", "0.52010566", "0.51951087", "0.513933", "0.51354957", "0.50977165", "0.5075539", "0.5066253", "0.5062732", "0.5054314", "0.5042691", "0.5036032", "0.5024833", "0.5004...
0.4843848
38
Test that the Hiredis thread is scheduled after some time while waiting for the descriptor to be readable.
def test_read_against_timeout_with_other_thread thread = Thread.new do sleep 0.1 while true end listen do |_| hiredis.connect("localhost", DEFAULT_PORT) hiredis.timeout = 10_000 assert_raises Errno::EAGAIN do hiredis.read end end ensure thread.kill end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_readable_or_timeout; end", "def wait_writable_or_timeout; end", "def wait_until_not_full; end", "def wait_for_reader\n @reader.wait if @reader\n end", "def wait_until( desc, freq = 1.0 )\n $stdout.write( \"Waiting for \" + desc )\n until (ret = yield) do\n $stdout.write '.'\n ...
[ "0.6639793", "0.6246055", "0.5915321", "0.58758545", "0.5872144", "0.5829963", "0.57832235", "0.57832235", "0.57832235", "0.5755491", "0.5747877", "0.57255566", "0.5689719", "0.5689719", "0.5663947", "0.5648442", "0.5645678", "0.56427556", "0.5619988", "0.56191844", "0.561592...
0.7100216
0
This does not have consistent outcome for different operating systems... def test_eagain_on_write listen do |server| hiredis.connect("localhost", 6380) hiredis.timeout = 100_000 Find out buffer sizes sndbuf = sockopt(hiredis.sock, Socket::SO_SNDBUF) rcvbuf = sockopt(hiredis.sock, Socket::SO_RCVBUF) Make request that fills both the remote receive buffer and the local send buffer. This assumes that the size of the receive buffer on the remote end is equal to our local receive buffer size. assert_raises Errno::EAGAIN do hiredis.write(["x" rcvbuf 2]) hiredis.write(["x" sndbuf 2]) hiredis.flush end end end
def test_eagain_on_write_followed_by_remote_drain skip "`#flush` doesn't work on hi-redis 1.0. See https://github.com/redis/hiredis/issues/975" listen do |server| hiredis.connect("localhost", 6380) hiredis.timeout = 100_000 # Find out buffer sizes sndbuf = sockopt(hiredis.sock, Socket::SO_SNDBUF) rcvbuf = sockopt(hiredis.sock, Socket::SO_RCVBUF) # This thread starts reading the server buffer after 50ms. This will # cause the local write to first return EAGAIN, wait for the socket to # become writable with select(2) and retry. begin thread = Thread.new do sleep(0.050) loop do server.read(1024) end end # Make request that fills both the remote receive buffer and the local # send buffer. This assumes that the size of the receive buffer on the # remote end is equal to our local receive buffer size. hiredis.write(["x" * rcvbuf]) hiredis.write(["x" * sndbuf]) hiredis.flush hiredis.disconnect ensure thread.kill end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_server_survives_half_message\n puts \"test_server_survives_half_message\"\n\n expects = []\n 10.times do\n expects << random_string\n pr = push(expects[-1])\n assert_equal(0, pr, \"expected 0, got #{pr}\")\n end\n\n s = random_string(15)\n header = s.length\n client = t...
[ "0.637658", "0.6212006", "0.60668343", "0.5868407", "0.57329184", "0.57095397", "0.5570915", "0.55589736", "0.5449376", "0.54032564", "0.5403216", "0.53791744", "0.5369392", "0.5338041", "0.52995646", "0.52987987", "0.5276667", "0.5227054", "0.51494396", "0.514907", "0.513831...
0.8699605
0
form view for adding new courses
def new @course = Course.new @user = Teacher.find_by_email(session[:email]) @teachers = Teacher.where(department: @user.department) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @course = Course.new\n render 'new'\n end", "def new\n @course=Course.new\n end", "def new\n @course=Course.new\n end", "def create\n @course = Course.new(course_params) # crea un curso con todos los parametros que le envia el formulario\n @course.save\n @courses =...
[ "0.77628183", "0.76429343", "0.76429343", "0.759494", "0.759298", "0.7485415", "0.7464564", "0.74486226", "0.7442729", "0.74423623", "0.74423623", "0.74423623", "0.7377019", "0.7348429", "0.7309669", "0.73026997", "0.7286684", "0.7274841", "0.72677267", "0.7252113", "0.723057...
0.0
-1
This should get all the courses that match the search query
def search query = "%" + params[:search] + "%" @course = Course.where("name LIKE ?", query) # if params[:search] # @course = Course.where(params:[:search]).order("created_at DESC") # else # @course = Course.all.order("created_at DESC") #This was causing an error with the search #@courses = Course.all; #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\r\n @search_term = params[:search]\r\n # Do search using scoped_search. If search term is empty then all records are returned.\r\n @courses = Course.available.full_search(@search_term).order(:title).page(params[:page])\r\n\r\n # Load category.\r\n @category = nil\r\n if params[:category...
[ "0.7679417", "0.7669443", "0.759345", "0.745616", "0.715831", "0.71459097", "0.6973851", "0.69128966", "0.68473893", "0.6808028", "0.67894065", "0.6744216", "0.67375946", "0.67330676", "0.67150223", "0.6703322", "0.6679047", "0.66788036", "0.6674686", "0.66684306", "0.6656228...
0.7100484
6
save changes to database
def create # find if there are any courses with both the same name and section number duplicate_courses = Course.where(name: course_params[:name], section: course_params[:section]) # SQL Equivalent (in SQLite): # SELECT "courses".* FROM "courses" WHERE "courses"."name" = ? AND "courses"."section" = ? # where ? == name of course and section of course if duplicate_courses.blank? # else make a new course based on parameters passed from form @course = Course.new(course_params) # check validity and successful save if @course.valid? && @course.save # @course.save SQL Equivalent: # INSERT INTO "courses" # ("teacher_id", "deptName", "name", "section", "created_at", "updated_at") # VALUES (?, ?, ?, ?, ?, ?); # redirect redirect_to '/admin/index' return else # otherwise check the error if @course.invalid? flash[:fail] = "Unable to create course: #{@course.errors.full_messages}" else flash[:fail] = "Unable to create course for unknown reason. Try again!" end redirect_back(fallback_location: '/admin/index') return end else # sent an error flash[:fail] = "There is already a course with that name and section!" redirect_back(fallback_location: '/admin/index') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n end", "def save\n end", "def save\n end", "def save\n SAVE\n end", "def save\n end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save\n\t\tend", "def s...
[ "0.7938795", "0.7938795", "0.7902631", "0.7891448", "0.7865254", "0.78510165", "0.78510165", "0.78510165", "0.78510165", "0.78510165", "0.78510165", "0.78510165", "0.78510165", "0.7776529", "0.77655566", "0.7734467", "0.7734467", "0.77161795", "0.7664324", "0.7421853", "0.741...
0.0
-1
helper function for validating parameters passed by course form
def course_params params.require(:course).permit(:teacher_id, :course_number, :name, :deptName, :section, :submitted) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_params?; end", "def validate_question params\n\n end", "def validate_params(params)\n # This will be implemented by Validators which take parameters\n end", "def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end...
[ "0.73239416", "0.7180958", "0.70730954", "0.7015546", "0.6887508", "0.6859432", "0.67120916", "0.67049825", "0.6690377", "0.66890925", "0.6595403", "0.6590227", "0.6569277", "0.65507567", "0.6520472", "0.65196097", "0.6513065", "0.6449599", "0.6449599", "0.6449599", "0.644959...
0.6056935
88
has_audited_state_through :hmd_states, [:announced, :devkit, :released]
def has_audited_state_through(table, states, options={}) class_attribute :audited_state_table self.audited_state_table = table has_many table # has_many :hmd_states class_attribute :audited_states self.audited_states = states send :include, AuditedClassInstanceMethods attr_accessor :audited_state # custom validations validate :validates_audited_state_with_exception # life-cycle hooks after_save :create_audited_state_record end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_audited_state_for(model, options = {})\n\n belongs_to model, touch: true\n\n # validations & double checks\n # make sure that these attributes are present\n validates :hmd_id, presence: true\n validates :state, presence: true\n end", "def skill_state_on(id)\n if Skill_State_...
[ "0.66121393", "0.6417146", "0.60232216", "0.60232216", "0.60232216", "0.5957101", "0.5942494", "0.59208184", "0.58217937", "0.57956517", "0.5779245", "0.577735", "0.5775334", "0.5746464", "0.5727154", "0.5725348", "0.5663618", "0.5663028", "0.5662798", "0.56339014", "0.562705...
0.71087116
0
should always return a symbol
def state=(input) self.audited_state = input.try(:to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol\n @symbol\n end", "def symbol\n \n end", "def to_sym() end", "def to_sym() end", "def to_sym() end", "def symbol\n :R\n end", "def sym\n @sym\n ...
[ "0.8439484", "0.8439484", "0.8439484", "0.8439484", "0.8439484", "0.8439484", "0.8221429", "0.81886065", "0.7841624", "0.7841624", "0.7841624", "0.7761048", "0.76911813", "0.76012975", "0.7558928", "0.7551381", "0.7421179", "0.73289627", "0.7321705", "0.73111606", "0.72689587...
0.0
-1
should be noisy if it fails
def create_audited_state_record # e.g. @hmd.hmd_states.create!(state: self.state) self.send(self.class.audited_state_table).create!(state: self.audited_state) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend", "def failures; end", "def failures; end", "def failures; end", "def big_bad; end", "def missed?; end", "def miss_reason; end", "def do_failure; end", "def run_failed; end", "def fail\n ...
[ "0.70121485", "0.68163675", "0.68163675", "0.68163675", "0.6485798", "0.6475313", "0.64390904", "0.6392389", "0.6389032", "0.6387016", "0.62987447", "0.62987447", "0.62987447", "0.62987447", "0.62987447", "0.62987447", "0.62987447", "0.62720925", "0.6262136", "0.6259702", "0....
0.0
-1
Post.set!(:hits => 0, :available => 100)
def set!(args) collection_modifier_update('$set', args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_values\n self.eligibility_counter = 0\n self.posts_count = 0\n end", "def set_hits(results, weights)\n results.each {|item| item.hits = weights[item.name] }\n end", "def add_hit\n @hits += 1\n :hit\n end", "def show\n @article = Article.find(params[:id])\n @article.hits +...
[ "0.6082596", "0.6017526", "0.60152984", "0.5795298", "0.5789049", "0.57890236", "0.57734025", "0.5722759", "0.5702382", "0.5686063", "0.5666594", "0.56349427", "0.56349427", "0.56129366", "0.55959666", "0.55959666", "0.55668634", "0.55668634", "0.55668634", "0.55580014", "0.5...
0.0
-1
Post.push_all!(:tags => ['xxx', 'yyy', 'zzz'])
def push_all!(args) collection_modifier_update('$pushAll', args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_all(*args)\n if args.length == 1 && args.first.is_a?(Hash)\n query.update_all(\"$push\" => collect_each_operations(args.first))\n else\n query.update_all(\"$push\" => { database_field_name(args[0]) => { \"$each\" => Array.wrap(args[1]) } })\n end\n end", "def push\n if @tags.empty...
[ "0.7164476", "0.7131387", "0.6976583", "0.6836607", "0.6750737", "0.6703292", "0.65711147", "0.65628296", "0.6419335", "0.6386689", "0.63777876", "0.6334515", "0.63339686", "0.6307532", "0.62725884", "0.62404835", "0.6234765", "0.62315315", "0.62022996", "0.6172553", "0.61412...
0.73060334
0
Post.pull_all!(:tags => ['xxx', 'yyy', 'zzz'])
def pull_all!(args) collection_modifier_update('$pullAll', args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_all(pulls)\n prepare_atomic_operation do |ops|\n process_atomic_operations(pulls) do |field, value|\n existing = send(field) || []\n value.each{ |val| existing.delete(val) }\n ops[atomic_attribute_name(field)] = value\n end\n { \"$pullAll\...
[ "0.70059043", "0.66936535", "0.6583242", "0.65817666", "0.65602046", "0.6553358", "0.6096642", "0.60800093", "0.6051959", "0.5974984", "0.5874631", "0.5872539", "0.5818738", "0.58043724", "0.5778912", "0.5686603", "0.56759363", "0.56659436", "0.5612834", "0.56012523", "0.5558...
0.69739914
1
requires mongodb 1.7.2 Post.rename!(:tags => :tag_collection)
def rename!(args) collection_modifier_update('$rename', args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_collection(db, coll_name, new_name)\n collections = db.collection_names\n\n if new_name.include?('__')\n raise 'double underscores are resereved for internal usage'\n end\n\n if not collections.include? coll_name\n raise \"collection does not exist\"...
[ "0.6940573", "0.5937969", "0.5903214", "0.5880829", "0.56793594", "0.5625939", "0.5573838", "0.5446834", "0.5446834", "0.542975", "0.5377901", "0.5377136", "0.533312", "0.5324209", "0.53133667", "0.52966696", "0.5280025", "0.52213675", "0.5215603", "0.5215603", "0.5215603", ...
0.5879938
4
Return an array representation of this server version.
def to_a to_array(@version) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_a\n @_to_a = self::VERSION.split('.')\n end", "def versions\n versions = Backlogjp.base._command \"getVersions\", self.id\n versions.map {|hash| Version.new(hash)}\n end", "def to_a\n [MAJOR, MINOR, PATCH]\n end", "def to_a\n @to_a ||= [major, minor, patch, pre]\n ...
[ "0.6914009", "0.6495592", "0.6490487", "0.63712704", "0.63600886", "0.6288458", "0.6220673", "0.60777134", "0.6066185", "0.6053287", "0.6012424", "0.6006785", "0.600157", "0.59971744", "0.59907997", "0.5983766", "0.598161", "0.595839", "0.59453535", "0.5934606", "0.5929137", ...
0.77772266
1
Return a string representation of this server version.
def to_s @version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n self.version.to_s\n end", "def to_s\n @version\n end", "def to_s\n \"<Version #{number}>\"\n end", "def to_s\n version = get_version_string\n version << \"-#{get_pre_string}\" unless @pre == nil\n version << \"+#{get_build_string}\" unless @build == nil\n ...
[ "0.8146219", "0.8031185", "0.784821", "0.75688654", "0.7506059", "0.7424028", "0.73196304", "0.724541", "0.7165139", "0.7165139", "0.7165139", "0.7165139", "0.7165139", "0.7062053", "0.70005435", "0.70005435", "0.69932", "0.69932", "0.6988285", "0.6888626", "0.6888626", "0....
0.8252398
1
Returns true if any elements include mod symbols (, +)
def elements_include_mods?(*elements) elements.any? { |n| n =~ /[\-\+]/ } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SimpleSymbols(str)\n things = str.split(\"\")\n\n things.each_with_index do |unit, idx|\n if unit =~ /[a-z]/\n return false if things[idx - 1] != \"+\" || things[idx + 1] != \"+\"\n end\n end\n\n true\nend", "def SimpleSymbols(str)\n alphabet = ('a'..'z').to_a\n str_array = str.split(//)\n ...
[ "0.6363892", "0.6182549", "0.6128964", "0.6115055", "0.60915154", "0.6007713", "0.5977526", "0.5951359", "0.59122527", "0.5882929", "0.57054305", "0.5633246", "0.5627606", "0.55858517", "0.55675143", "0.55118847", "0.5475426", "0.5460246", "0.54600555", "0.54427755", "0.54251...
0.80756885
1
Converts argument to an array of integers, appending any mods as the final element.
def to_array(version) array = version.split(".").map {|n| (n =~ /^\d+$/) ? n.to_i : n } if array.last =~ /(\d+)([\-\+])/ array[array.length-1] = $1.to_i array << $2 end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_int_array(input)\n input.chars.to_a.collect { |x| x.to_i }\n end", "def array_to_integer_array_method\n @card_integer_array = []\n @card_array.each do |integer|\n new_integer = integer.to_i\n @card_integer_array << new_integer\n end\n return @card_integer_array\n end", "de...
[ "0.67339206", "0.6533739", "0.64756244", "0.6439487", "0.64330786", "0.6400515", "0.63602626", "0.6280674", "0.6242669", "0.62163883", "0.6194731", "0.61423916", "0.61012995", "0.60715914", "0.60610086", "0.6035379", "0.6028871", "0.60274017", "0.60091686", "0.5998907", "0.59...
0.5410432
88
not sure what should be passed here
def initialize(params = {}) @params = params @bunny_options = RabbitMQOptions.new(params) @rabbit = RabbitMQClient.new(@bunny_options.to_hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def schubert; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def param; end", "def param; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", ...
[ "0.76063484", "0.6932786", "0.6925768", "0.67931837", "0.67931837", "0.67931837", "0.67931837", "0.65811515", "0.65811515", "0.6571968", "0.6571968", "0.6571968", "0.6571968", "0.6571968", "0.6571968", "0.6571968", "0.6571968", "0.6540821", "0.6519084", "0.6519084", "0.649436...
0.0
-1
must have this method basically overwrite the original one no callback currently
def call(env) logger(env) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback &block\n super\n end", "def callback &block\n super\n end", "def callback_phase\n super\n end", "def original; end", "def callback\n end", "def callbacks; end", "def callbacks; end", "def callback\n\n end", "def original_method; end", "def method_missi...
[ "0.6974545", "0.6974545", "0.67480576", "0.6483268", "0.6414559", "0.6340521", "0.6340521", "0.6282671", "0.62333894", "0.61819166", "0.61254835", "0.61146003", "0.611095", "0.6098755", "0.60951644", "0.5990475", "0.59362775", "0.59290004", "0.59221196", "0.59192735", "0.5868...
0.0
-1
GET /lendables/1 GET /lendables/1.xml
def show @lendable = Lendable.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @lendable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_listings_xml(url)\n @client.get_content(url)\n end", "def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end", "def index\n @leks = Lek.all\n\n respond_to do |format|\n format....
[ "0.59151435", "0.58259964", "0.5727452", "0.5639547", "0.55827403", "0.5566066", "0.5522777", "0.5484479", "0.54842544", "0.5460977", "0.54559046", "0.545203", "0.54515165", "0.5446914", "0.54190123", "0.5409285", "0.54069895", "0.54030013", "0.5399312", "0.5382163", "0.53723...
0.6550243
0
GET /lendables/new GET /lendables/new.xml
def new @lendable = Lendable.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @lendable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @lb202556 = Lb202556.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb202556 }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lo...
[ "0.6501095", "0.644611", "0.64217705", "0.6407091", "0.6406053", "0.6398388", "0.637133", "0.6356885", "0.63413095", "0.6338049", "0.6263476", "0.62181586", "0.6214869", "0.62112314", "0.6208151", "0.62009174", "0.6196796", "0.6182455", "0.6174943", "0.6174943", "0.6174943", ...
0.72537094
0
POST /lendables POST /lendables.xml
def create @lendable = Lendable.new(params[:lendable]) respond_to do |format| if @lendable.save format.html { redirect_to(@lendable, :notice => 'Lendable was successfully created.') } format.xml { render :xml => @lendable, :status => :created, :location => @lendable } else format.html { render :action => "new" } format.xml { render :xml => @lendable.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postEntityYext_list( entity_id, yext_list_id, description, name, type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['yext_list_id'] = yext_list_id\n params['description'] = description\n params['name'] = name\n params['type'] = type\n return doCurl(\"post\",\"/entity/yext...
[ "0.5138751", "0.5026368", "0.49665746", "0.4898042", "0.4693962", "0.46792135", "0.45998502", "0.45138013", "0.44840452", "0.44724372", "0.44701415", "0.44653237", "0.44638425", "0.44493517", "0.44401067", "0.4423871", "0.44238675", "0.43927434", "0.43759087", "0.43745932", "...
0.56408757
0
PUT /lendables/1 PUT /lendables/1.xml
def update @lendable = Lendable.find(params[:id]) respond_to do |format| if @lendable.update_attributes(params[:lendable]) format.html { redirect_to(@lendable, :notice => 'Lendable was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @lendable.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start...
[ "0.5409736", "0.5356203", "0.52444696", "0.520978", "0.51950705", "0.51767594", "0.5104458", "0.5079469", "0.506452", "0.5062782", "0.50571084", "0.50479376", "0.5008665", "0.4931264", "0.49015042", "0.4892242", "0.48538858", "0.48454016", "0.48239005", "0.48239005", "0.48208...
0.58159214
0
DELETE /lendables/1 DELETE /lendables/1.xml
def destroy @lendable = Lendable.find(params[:id]) @lendable.destroy respond_to do |format| format.html { redirect_to(lendables_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete_all(xpath); end", "def unlink \n @lnode.unlink unless @lnode.nil?\n end", "def delete_node(l)\n node = Node.find_by(layer: l).destro...
[ "0.64729553", "0.6457131", "0.6360469", "0.6329929", "0.59976476", "0.589152", "0.5880542", "0.58798677", "0.5838007", "0.5838007", "0.582222", "0.5818429", "0.5811634", "0.5777692", "0.57700217", "0.57662344", "0.5757047", "0.5741342", "0.57393384", "0.57297313", "0.5726183"...
0.68560266
0
denoted by `n!`, is the product of all positive integers less than or equal to `n`. Solution Write a function called factorial() that takes a number and multiplies up all numbers from 1 through that number. Example: factorial(5) should equal 1 2 3 4 5.
def factorial(num) result = 1; for i in 1..num result *= i end puts result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(n)\n product = 1\n for i in (1..n)\n product *= i\n end\n product\nend", "def factorial(n)\n if n == 0 || n == 1 \n \treturn 1\n else\n numbers = []\n n.downto(1) { |x| numbers << x }\n numbers.inject(1) { |x,y| x * y }\n end\nend", "def factorial(n)\n result = 1\n\n whi...
[ "0.8794431", "0.87536556", "0.8735388", "0.8666659", "0.8665695", "0.8648504", "0.8642203", "0.864168", "0.8617912", "0.86042565", "0.85957146", "0.85886884", "0.85623807", "0.85420895", "0.85265267", "0.8525576", "0.852055", "0.85158575", "0.8515507", "0.8515507", "0.8515507...
0.0
-1
Return the maximum number of vdevs without which the pool is still guaranteed to be available. For simple examples: stripe: 0 mirror: 1 raidz1: 1 raidz2: 2 raidz3: 3
def redundancy_level # Note that the slog devices show up in @root_vdev.children, but l2arc # and spare devices don't. That's exactly what we want. top_level_parities = @root_vdev.children.map do |top_level_vdev| case top_level_vdev.type when "mirror" top_level_vdev.children.count - 1 when "raidz" top_level_vdev.nparity else 0 end end top_level_parities.min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_free_gigabytes\n if plan_id == 'pro'\n 100\n elsif plan_id == 'basic'\n 10\n else\n 1\n end\n end", "def largest_length\n @executor.getLargestPoolSize\n end", "def get_max_haplotype_size\n max_haplotype = 0\n @blocks.values.each do |block|\n if b...
[ "0.61479676", "0.61266536", "0.60445374", "0.60064226", "0.5991015", "0.5935252", "0.5917585", "0.5894255", "0.5893222", "0.5885927", "0.58676416", "0.5825332", "0.58093035", "0.580604", "0.58006436", "0.57750165", "0.57748914", "0.5773723", "0.5765105", "0.57554466", "0.5755...
0.0
-1
Refresh the pool properties and child lists.
def refresh self.class.base_properties.each_with_index do |prop, prop_id| @properties[prop] = get_property(prop_id) end refresh_features refresh_status refresh_config self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_pool_nodes\n @mutex.synchronize do\n reload_pool_nodes_unsync\n end\n end", "def reload!\n LOG.debug \"Attempting to reload #{self}.\"\n @lock.synchronize do\n expected = @pool_initializer.call \n actual = @pool\n # remove old destinations\n (a...
[ "0.7100571", "0.6721935", "0.6373797", "0.6280679", "0.6131214", "0.6063424", "0.5996053", "0.5947397", "0.58811545", "0.58314586", "0.5796762", "0.5795837", "0.5770083", "0.576221", "0.5739193", "0.5739193", "0.57170373", "0.57170373", "0.5684405", "0.5661635", "0.56103134",...
0.65775394
2
Look up an attribute of the node by the name it has in the OpenAPI document.
def [](value) node_data[value.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attribute(node, attr_name)\n node.attribute(attr_name)\n end", "def get_attribute(node, attr_name)\n #There has been a method shift between 0.5 and 0.7\n if defined?(node.property) == nil\n return node.attributes[attr_name]\n else\n if defined?(node[attr...
[ "0.7586056", "0.74624944", "0.741198", "0.7194562", "0.7194562", "0.7175515", "0.7147677", "0.7043587", "0.7038855", "0.7035356", "0.70238584", "0.7018633", "0.7001013", "0.69599706", "0.6941388", "0.69199353", "0.6915854", "0.6894896", "0.6868919", "0.6850737", "0.6843978", ...
0.0
-1
Look up an extension provided for this map, doesn't need a prefix of "x"
def extension(value) node_data["x-#{value}"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension(key)\n @extensions[key.to_s]\n end", "def extension(key)\r\n return nil unless @extensions.has_key?(key)\r\n return @extensions[key]\r\n end", "def extension(value)\n self[\"x-#{value}\"]\n end", "def by_extension(ext); end", "def [](key)\n @extension...
[ "0.7432741", "0.7142958", "0.6967343", "0.69126326", "0.676964", "0.6508039", "0.64826035", "0.6421745", "0.62816036", "0.62020713", "0.6185295", "0.6155714", "0.6079679", "0.5983031", "0.59774756", "0.5930489", "0.58469635", "0.5842816", "0.5836051", "0.5821867", "0.5821867"...
0.63881344
8
Used to access a node relative to this node
def node_at(pointer_like) current_pointer = node_context.document_location.pointer node_context.document.node_at(pointer_like, current_pointer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node\n @node\n end", "def node\n @node\n end", "def node\n return @node\n end", "def node\n @context.node\n end", "def node\n attributes['node']\n end", "def node\n attributes['node']\n end", "def get\n if @position.access\n data = @node.send(@pos...
[ "0.7731943", "0.7731943", "0.7568608", "0.7457841", "0.74190134", "0.74190134", "0.741819", "0.7388837", "0.73212653", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0.71706474", "0....
0.6687805
44
Creates a new load balancer policy that contains the necessary attributes depending on the policy type. Policies are settings that are saved for your load balancer and that can be applied to the frontend listener, or the backend application server, depending on your policy type. == Applying Policies To apply a policy to a frontend listener: each listener may only have a single policy load_balancer.listener[80].policy = listener_policy To apply a policy to backend instance port back end servers can have multiple policies per instance port load_balancer.backend_server_policies.add(80, back_end_policy)
def create name, type, attributes = {} attribute_list = [] attributes.each do |attr_name,values| [values].flatten.each do |value| attribute_list << { :attribute_name => attr_name, :attribute_value => value.to_s } end end client.create_load_balancer_policy( :load_balancer_name => load_balancer.name, :policy_name => name.to_s, :policy_type_name => type.to_s, :policy_attributes => attribute_list) LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []= instance_port, policy\n\n client.set_load_balancer_policies_for_backend_server(\n :load_balancer_name => load_balancer.name,\n :instance_port => instance_port.to_i,\n :policy_names => [policy_name(policy)].compact)\n\n nil\n\n end", "def create_load_balancer_...
[ "0.6613577", "0.6293767", "0.6085485", "0.593681", "0.56331176", "0.54778725", "0.54384965", "0.52465326", "0.520651", "0.5175385", "0.51662636", "0.514898", "0.5141088", "0.51317406", "0.51284635", "0.51284635", "0.5116953", "0.5097152", "0.505784", "0.5038275", "0.500837", ...
0.668007
0
Helper method for showing brief view composers who have composed works based on this superwork are requierd to be shown
def works_evidenced_composers all_composers = [] works.map{|w| all_composers << w.composers} all_composers.flatten! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @other_tools = @tool.others_from_this_owner\n @collaborators = @tool.collaborators\n end", "def displayed?; end", "def draw_tactic_overview\n end", "def show_full\n @show_full=true\n end", "def show_works_widget\n @show_works_widget = true\n end", "def display\n # If the D...
[ "0.5758615", "0.56742543", "0.56047547", "0.55751497", "0.5482914", "0.5413041", "0.53686714", "0.5345104", "0.534279", "0.53310424", "0.5324569", "0.53068936", "0.5306546", "0.53005964", "0.525008", "0.52456075", "0.52089113", "0.5192857", "0.51906866", "0.5184041", "0.51715...
0.0
-1
should remove the current single role (set = nil) only if it is contained in the list of roles to be removed
def remove_roles *role_names role_names = role_names.flat_uniq set_empty_roles and return if roles_diff(role_names).empty? roles_to_remove = select_valid_roles(role_names) set_roles roles_diff(role_names) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_role(role)\n role_obj = Role.find_by_name(role)\n roles.delete(role_obj) unless role_obj.nil?\n roles\n end", "def remove_role (role_in)\n Rails.logger.debug (\"#{self.class}.remove_role(#{role_in.to_s}) - #{self.username.to_s} \")\n cur_roles = to_array_if_not(self.roles)\n role_at...
[ "0.7705658", "0.7692161", "0.7629407", "0.7629407", "0.7472426", "0.7464963", "0.742721", "0.74058014", "0.73950243", "0.7291196", "0.72170496", "0.7170516", "0.7122717", "0.709785", "0.709785", "0.6998709", "0.69846267", "0.6929257", "0.6921377", "0.691297", "0.68795323", ...
0.7080716
15
Defines the path, file or content of the csv file. Also allows you to overwrite the configuration at runtime. Example: .new(file: my_csv_file) .new(path: "subscribers.csv", model: newsletter.subscribers)
def initialize(*args, &block) @csv = CSVReader.new(*args) @config = self.class.config.dup @config.attributes = args.last @report = Report.new Configurator.new(@config).instance_exec(&block) if block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_csv_file\n \t@csv_file = CsvFile.find(params[:id])\n end", "def csv_filename\n raise NotImplementedError\n end", "def initialize(csv_file_path)\n # take recipe from csv file\n @csv_file_path = csv_file_path\n @recipes = []\n parse\n end", "def initialize(csv, importer)\n @source...
[ "0.63111824", "0.63063574", "0.6291434", "0.61375433", "0.6103567", "0.61031485", "0.61011624", "0.6090713", "0.60613924", "0.6050992", "0.6019264", "0.58894736", "0.5876875", "0.5874358", "0.5872753", "0.5869697", "0.584772", "0.58409953", "0.58012336", "0.58008945", "0.5777...
0.5856602
16
Initialize and return the `Header` for the current CSV file
def header @header ||= Header.new( column_definitions: config.column_definitions, column_names: csv.header ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header\n @header ||= csv_rows.first\n end", "def header\n @header ||= csv_rows.first\n end", "def csv_header\n #empty by default\n []\n end", "def csv_header\n #empty by default\n []\n end", "def header\n @header ||= create_header\n end", "def header_fields\n ...
[ "0.81811714", "0.81811714", "0.7482727", "0.7482727", "0.7353371", "0.70078933", "0.70057446", "0.6968203", "0.69610083", "0.6796678", "0.6750354", "0.65901566", "0.6551267", "0.65221846", "0.65061986", "0.6496908", "0.6492711", "0.6470569", "0.6459076", "0.6450369", "0.64484...
0.8598381
0
Initialize and return the `Row`s for the current CSV file
def rows csv.rows.map { |row_array| Row.new(header: header, row_array: row_array).to_a } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rows\n @rows ||= csv_rows[1..-1]\n end", "def rows\n @rows ||= csv_rows[1..-1]\n end", "def rows\n @rows ||= [].tap do |rows|\n CSV.foreach(csv_file, headers: @has_header_row) do |row|\n rows << columns.map { |column, index| normalize(column, row[index].try(:strip).pres...
[ "0.73947436", "0.73947436", "0.7231613", "0.7112304", "0.70487416", "0.70487416", "0.68859357", "0.681869", "0.66462904", "0.66247207", "0.6590753", "0.6569246", "0.6490851", "0.64713776", "0.6465624", "0.6465203", "0.6464063", "0.64581937", "0.6452828", "0.64308774", "0.6425...
0.74670786
0
Run the import. Return a Report.
def run! if valid_header? @report = Runner.call(header: header, rows: rows, config: config) else @report end rescue CSV::MalformedCSVError => e @report = Report.new(status: :invalid_csv_file, parser_error: e.message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n @report = Report.new\n @report.plugin = self\n build_report\n rescue Exception => e\n @report.error e\n ensure\n return @report\n end", "def import\n ret = @uri.import\n render plain: ret[:message], status: ret[:status]\n end", "def import\n R...
[ "0.6796825", "0.6345392", "0.6336648", "0.6246904", "0.6195034", "0.6164449", "0.6162187", "0.60573727", "0.6048603", "0.60405004", "0.60405004", "0.60405004", "0.60405004", "0.59835815", "0.59653956", "0.59631217", "0.5943379", "0.5909817", "0.5909817", "0.5909817", "0.59098...
0.62847245
3
GET /allocation_tests or /allocation_tests.json
def index @allocation_tests = AllocationTest.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @allocations = Allocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @allocations }\n end\n end", "def show\n @allocation = Allocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n fo...
[ "0.6131166", "0.6069248", "0.6000204", "0.5999134", "0.5969513", "0.59063035", "0.59063035", "0.5813263", "0.579941", "0.5640044", "0.5614283", "0.56085396", "0.5586211", "0.5583955", "0.5577205", "0.5563409", "0.55596966", "0.55421823", "0.5538621", "0.55183303", "0.55061877...
0.7029506
0
GET /allocation_tests/1 or /allocation_tests/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @allocation_tests = AllocationTest.all\n end", "def show\n @allocation = Allocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allocation }\n end\n end", "def allocation(id)\n connection.get do |req|\n ...
[ "0.69436985", "0.6305407", "0.6286053", "0.624435", "0.60783", "0.6051012", "0.57828885", "0.5768882", "0.5744177", "0.5704603", "0.56784326", "0.56774116", "0.56721216", "0.5670114", "0.56609786", "0.56437653", "0.5635185", "0.5634303", "0.5612641", "0.5600295", "0.5596388",...
0.0
-1
POST /allocation_tests or /allocation_tests.json
def create @allocation_test = AllocationTest.new(allocation_test_params) redirect_path = nil if not current_user.allocation_tests.any? redirect_path = new_gamble_path else redirect_path = survey_path end respond_to do |format| if @allocation_test.save format.html { redirect_to redirect_path} format.json { render :show, status: :created, location: @allocation_test } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @allocation_test.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allocation_test_params\n params.require(:allocation_test).permit(:test_id, :user_id,\n allocation_items_attributes: [:name, :points, :allocation_test_id])\n end", "def create\n @allocation = Allocation.new(allocation_params)\n\n respond_to do |format|...
[ "0.66239893", "0.63554347", "0.6350287", "0.6298568", "0.6263548", "0.624127", "0.61448866", "0.6057474", "0.60164624", "0.5960756", "0.5751927", "0.5751536", "0.5728472", "0.5684383", "0.56291664", "0.5620527", "0.56042695", "0.5595294", "0.5548781", "0.5495598", "0.5493918"...
0.6723118
0
PATCH/PUT /allocation_tests/1 or /allocation_tests/1.json
def update respond_to do |format| if @allocation_test.update(allocation_test_params) format.html { redirect_to @allocation_test, notice: "Allocation test was successfully updated." } format.json { render :show, status: :ok, location: @allocation_test } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @allocation_test.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_allocation_test\n @allocation_test = AllocationTest.find(params[:id])\n end", "def update\n\n respond_to do |format|\n if @allocation.update(allocation_params)\n format.html { redirect_to @allocation, notice: t(:allocation_updated) }\n format.json { render :show, status: :ok...
[ "0.6691268", "0.65710807", "0.6443952", "0.6376934", "0.6359231", "0.6197849", "0.6166732", "0.6073905", "0.59780383", "0.5933964", "0.5912709", "0.58222693", "0.5817471", "0.5729198", "0.5619015", "0.5586988", "0.55792004", "0.55767983", "0.5576299", "0.5570958", "0.55604804...
0.75359327
0
DELETE /allocation_tests/1 or /allocation_tests/1.json
def destroy @allocation_test.destroy respond_to do |format| format.html { redirect_to allocation_tests_url, notice: "Allocation test was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @allocation.destroy\n respond_to do |format|\n format.html { redirect_to allocations_url, notice: t(:allocation_deleted) }\n format.json { head :no_content }\n end\n end", "def destroy\n @allocation = Allocation.find(params[:id])\n @allocation.destroy\n\n respond_to do ...
[ "0.6911397", "0.6892234", "0.6850457", "0.67834747", "0.67834747", "0.6739281", "0.67143124", "0.6706566", "0.66820115", "0.6669262", "0.6650305", "0.6618751", "0.6611394", "0.6605287", "0.66007185", "0.65891427", "0.65774184", "0.65707254", "0.65693647", "0.6555484", "0.6554...
0.7617036
0
Use callbacks to share common setup or constraints between actions.
def set_allocation_test @allocation_test = AllocationTest.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def allocation_test_params params.require(:allocation_test).permit(:test_id, :user_id, allocation_items_attributes: [:name, :points, :allocation_test_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.6950644", "0.68134046", "0.68034387", "0.6796522", "0.674668", "0.6742105", "0.6527854", "0.65214247", "0.6491907", "0.64294493", "0.64294493", "0.64294493", "0.64004904", "0.6356768", "0.63556653", "0.6348119", "0.6344521", "0.63386923", "0.632588", "0.632588", "0.632588"...
0.0
-1
Return or set the fetch limit. If passed an argument, return a new query with the specified limit value. Otherwise, return the current value.
def limit(value = EMPTY) if value == EMPTY @limit else clone(limit: value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit(limit)\n self.query.limit = limit\n self\n end", "def apply_limit\n @query = @query.limit(@options[:limit])\n end", "def limit(limit)\n @last_query_context.limit = limit\n self\n end", "def limit(value)\n update_query(:limit => value)\n end", "def limit(v...
[ "0.72889", "0.7169501", "0.7139718", "0.7067749", "0.70223385", "0.7004306", "0.69932073", "0.6865179", "0.6802621", "0.677243", "0.6695933", "0.6680929", "0.66650116", "0.66567755", "0.66511065", "0.6649006", "0.66412556", "0.6609347", "0.6583515", "0.6561679", "0.65508574",...
0.6559211
20
Return or set the fetch offset. If passed an argument, return a new query with the specified offset value. Otherwise, return the current value.
def offset(value = EMPTY) if value == EMPTY @offset else clone(offset: value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset(offset)\n self.query.offset = offset\n self\n end", "def offset(offset)\n @last_query_context.offset = offset\n self\n end", "def offset(count)\n Fetcher.new(self).offset(count)\n end", "def offset(count=nil)\n if count\n count = 1 if count < 1\n ...
[ "0.71616685", "0.7020441", "0.6692578", "0.65077627", "0.63418084", "0.6278891", "0.62192494", "0.6185706", "0.61695546", "0.6160593", "0.6132295", "0.60971963", "0.60947216", "0.60680705", "0.6029035", "0.59772104", "0.59589416", "0.5885133", "0.58766437", "0.584784", "0.581...
0.6199856
7
Combine this query with others in an intersection ("and") relationship. Can be used to begin a new query as well, especially when called in its where variant. The query passed in can be a wide variety of types: Symbol: This is by far the most common, and it is also a special case the return value when passing a symbol is a CDQPartialPredicate, rather than CDQQuery. Methods on CDQPartialPredicate are then comparison operators against the attribute indicated by the symbol itself, which take a value operand. For example: query.where(:name).equal("Chuck").and(:title).not_equal("Manager")
def and(query = nil, *args) merge_query(query, :and, *args) do |left, right| NSCompoundPredicate.andPredicateWithSubpredicates([left, right]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_scope_with_and(query, &block)\n if Query === query && Query::Conditions::AbstractOperation === query.conditions\n query = query.dup\n scope_stack = self.scope_stack\n scope_stack << query\n\n begin\n yield\n ensure\n scope_stack.pop...
[ "0.6269062", "0.61989015", "0.6102245", "0.60790914", "0.6026933", "0.59913754", "0.59749824", "0.59085655", "0.5833891", "0.5806791", "0.5798313", "0.5752054", "0.5740845", "0.57124114", "0.5711134", "0.5710215", "0.5708985", "0.5690314", "0.5680164", "0.5673887", "0.5619271...
0.7037875
0
Combine this query with others in a union ("or") relationship. Accepts all the same argument types as and.
def or(query = nil, *args) merge_query(query, :or, *args) do |left, right| NSCompoundPredicate.orPredicateWithSubpredicates([left, right]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def or(*others)\n self.class.or(self, *others)\n end", "def combine_or(left, right)\n OrQuery.new(left, right)\n end", "def all_or(*args)\n Term.get OrTerm, *args\n end", "def or(*exps)\n joined_exps = exps.join(' and ')\n @query[:filters] += \" or #{joined_exps}\"\n ...
[ "0.75229627", "0.7424549", "0.66974527", "0.6671067", "0.65888315", "0.65782046", "0.63999754", "0.62737834", "0.62258154", "0.6222271", "0.617718", "0.61576843", "0.6147056", "0.61453295", "0.61273444", "0.6122767", "0.6120874", "0.60838884", "0.6072722", "0.6014629", "0.598...
0.6931823
2
Add a new sort key. Multiple invocations add additional sort keys rather than replacing old ones.
def sort_by(key, options = {}) # backwards compat: if options is not a hash, it is a sort ordering. unless options.is_a?Hash sort_order = options options = { order: sort_order, case_insensitive: false, } end options = { order: :ascending, }.merge(options) order = options[:order].to_s if order[0,4].downcase == 'desc' ascending = false else ascending = true end if options[:case_insensitive] descriptor = NSSortDescriptor.sortDescriptorWithKey(key, ascending: ascending, selector: "localizedCaseInsensitiveCompare:") else descriptor = NSSortDescriptor.sortDescriptorWithKey(key, ascending: ascending) end clone(sort_descriptors: @sort_descriptors + [descriptor]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_sort_key\n @item.sort_key = @sortable[@parent.sort_index]\n @item.reversed = @parent.reversed? ? -1 : 1\n end", "def sort_key(value)\n @sort = value\n end", "def add_key(key)\n keys.add(key)\n end", "def add_sort(field)\n @order_by.push(field)\n end", "def ad...
[ "0.65199274", "0.6416684", "0.6356432", "0.6125981", "0.60693586", "0.60305905", "0.59715337", "0.5865316", "0.58565366", "0.5788275", "0.5765549", "0.57413036", "0.5739954", "0.56203586", "0.5556833", "0.55378854", "0.5529041", "0.55149317", "0.5500996", "0.5489865", "0.5457...
0.0
-1
Return an NSFetchRequest that will implement this query
def fetch_request NSFetchRequest.new.tap do |req| req.predicate = predicate req.fetchLimit = limit if limit req.fetchOffset = offset if offset req.sortDescriptors = sort_descriptors unless sort_descriptors.empty? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchRequest\n # Start with a predicate which selects those entities that belong to the owner.\n predicate = Predicate::Builder.new(inverseRelationshipName) == @owner\n # Then apply the scope's predicate.\n predicate = predicate.and(@predicate) if @predicate\n\n request = NSF...
[ "0.7018905", "0.5848367", "0.5704148", "0.55644894", "0.55564356", "0.5513734", "0.550383", "0.550383", "0.5446275", "0.54153264", "0.54153264", "0.54153264", "0.5390705", "0.5383686", "0.53689975", "0.5361893", "0.53583664", "0.53410643", "0.53379124", "0.53075457", "0.53075...
0.7097449
0
Create a new query with the same values as this one, optionally overriding any of them in the options
def clone(opts = {}) self.class.new(locals.merge(opts)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options={})\n self.query = Query.new\n self.query.table = options.delete(:table)\n self.query.limit = options.delete(:limit)\n self.query.offset = options.delete(:offset)\n self.query.select = options.delete(:select)\n self.query.condit...
[ "0.7084909", "0.6825532", "0.65663075", "0.6455315", "0.63708556", "0.6317489", "0.626224", "0.6247702", "0.623057", "0.6217517", "0.6193991", "0.6176988", "0.6176988", "0.61534125", "0.61451143", "0.6132", "0.611564", "0.61147106", "0.6100363", "0.60006297", "0.59986967", ...
0.0
-1
Returns whether this uritemplate is absolute. This is detected by checking for "://".
def absolute? return @absolute unless @absolute.nil? read_chars = "" tokens.each do |token| if token.expression? read_chars << "x" elsif token.literal? read_chars << token.string end if read_chars =~ /^[a-z]+:\/\//i return @absolute = true elsif read_chars =~ /(^|[^:\/])\/(?!\/)/ return @absolute = false end end return @absolute = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute?\n @uri.absolute?\n end", "def absolute_url?\n (self.include?('://') || self.start_with?('/')) ? true : false\n end", "def absolute?\n if @scheme\n true\n else\n false\n end\n end", "def absolute_url?(string); end", "def absolute?\n #%r{\\A/} =~...
[ "0.8419571", "0.8111299", "0.79552335", "0.78528345", "0.7761613", "0.7753431", "0.7614763", "0.74972963", "0.74972963", "0.74638903", "0.7335414", "0.7262466", "0.72552073", "0.72454077", "0.7211512", "0.7210166", "0.715751", "0.71414983", "0.7112463", "0.707958", "0.7067324...
0.7195111
16
For now this follows v5.4 syntax... We have not yet finalised an OML syntax inside OEDL for v6 TODO: v6 currently does not support OML filters. Formerly in v5.x, these filters were defined in an optional block.
def measure(mp, opts, &block) collect_point = opts.delete(:collect) collect_point ||= OmfEc.experiment.oml_uri if collect_point.nil? warn "No OML URI configured for measurement collection! "+ "(see option 'oml_uri'). Disabling OML Collection for '#{mp}'." return end stream = { :mp => mp , :filters => [] }.merge(opts) index = @oml_collections.find_index { |c| c[:url] == collect_point } @oml_collections << {:url => collect_point, :streams => [stream] } if index.nil? @oml_collections[index][:streams] << stream unless index.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def or_filters\n read_attribute('or_filters') || {}\n end", "def filters; end", "def filters; end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def visit_filter(node)\n # For unknown reasons, haml doesn't escape interpolations in filters.\n # So we can rely on \\n t...
[ "0.63526523", "0.6338202", "0.6338202", "0.62142307", "0.62142307", "0.61139333", "0.6054174", "0.6032129", "0.6017577", "0.5977019", "0.5916134", "0.5874067", "0.5858878", "0.58500105", "0.5849297", "0.580708", "0.57710034", "0.5747855", "0.5738424", "0.5717974", "0.57064384...
0.0
-1
All from examples here:
def test_floats zero = "3 000 0.0000000000000000" assert_equal zero, SimpleRecord::Translations.pad_and_offset(0.0) puts 'induced = ' + "3.25e5".to_f.to_s assert_equal "5 005 3.2500000000000000", SimpleRecord::Translations.pad_and_offset("3.25e5".to_f) assert_equal "4 994 8.4000000000000000", SimpleRecord::Translations.pad_and_offset("8.4e-5".to_f) assert_equal "4 992 8.4000000000000000", SimpleRecord::Translations.pad_and_offset("8.4e-7".to_f) assert_equal "3 000 0.0000000000000000", SimpleRecord::Translations.pad_and_offset("0.0e0".to_f) assert_equal "2 004 5.7500000000000000", SimpleRecord::Translations.pad_and_offset("-4.25e-4".to_f) assert_equal "2 004 3.6500000000000000", SimpleRecord::Translations.pad_and_offset("-6.35e-4".to_f) assert_equal "2 003 3.6500000000000000", SimpleRecord::Translations.pad_and_offset("-6.35e-3".to_f) assert_equal "1 895 6.0000000000000000", SimpleRecord::Translations.pad_and_offset("-4.0e105".to_f) assert_equal "1 894 6.0000000000000000", SimpleRecord::Translations.pad_and_offset("-4.0e105".to_f) assert_equal "1 894 4.0000000000000000", SimpleRecord::Translations.pad_and_offset("-6.0e105".to_f) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def who_we_are\r\n end", "def custom; end", "def custom; end", "def spec; end", "def spec; end", "def weber; end", "def how_it_works\r\n end", "def extra; end", "def imp...
[ "0.7633319", "0.6828286", "0.6828286", "0.6828286", "0.6828286", "0.6721718", "0.6468544", "0.64381826", "0.64381826", "0.6405142", "0.6405142", "0.63828343", "0.6381497", "0.6371727", "0.6345411", "0.6345411", "0.6329541", "0.6329541", "0.6296775", "0.6296775", "0.6279973", ...
0.0
-1
Compute number of integers divisible by k in range [a..b]. full description:
def solution(a, b, k) first_dividend = a remainder = first_dividend%k while remainder != 0 && first_dividend <= b do first_dividend += 1 remainder = first_dividend%k end remainder == 0 ? (b - first_dividend) / k + 1 : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divisible_by(a, b, k)\n a = k if a < k\n\n x = ((b-a)/k)\n x += 1 if a % k == 0\n\n #n = 0\n #(a..b).each do |i|\n # n += 1 if i % k == 0\n #end\n return x\nend", "def intChooseInts (n, k)\n pTop = (n-k+1..n).inject(1, &:*)\n pBottom = (2..k).inject(1,&:*)\n pTop/pBottom\nend", ...
[ "0.8443348", "0.7185717", "0.71461934", "0.6996867", "0.6847606", "0.68330914", "0.6804294", "0.67908627", "0.675941", "0.6745905", "0.666709", "0.662192", "0.6617464", "0.65719575", "0.646598", "0.6459474", "0.64392614", "0.64329696", "0.64152926", "0.638801", "0.6383595", ...
0.7913576
1
diffs +path+ with another revision. if no revision is specified, the previous revision is used.
def diff( path, options={} ) raise Svn::Error, "cannot diff directory #{path}@#{to_s}" if dir? path other = options[:with] if options[:with].is_a? Root other = repo.revision(options[:with]) if options[:with].is_a? Numeric other ||= repo.revision(to_i - 1) return other.diff( path, :with => self ) if other < self content = "" begin content = file_content_stream( path ).to_counted_string rescue Svn::Error => err raise if options[:raise_errors] end other_content = "" begin other_content= other.file_content_stream( path ).to_counted_string rescue Svn::Error => err raise if options[:raise_errors] end Diff.string_diff( content, other_content ).unified( :original_header => "#{path}@#{to_s}", :modified_header => "#{path}@#{other}" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_path_history(old_path, revision)\n unless (history = history_for_revision(revision))\n create_path_history(old_path, revision)\n end\n end", "def apply(revision)\n owner.with_revision(revision) do\n owner.force_path_changes_with_history(old_value, new_value)\n ...
[ "0.65200967", "0.6305841", "0.6121806", "0.61095357", "0.5987845", "0.5865554", "0.57444376", "0.57370746", "0.5523071", "0.5497513", "0.5457696", "0.5422875", "0.5416916", "0.53977805", "0.53865194", "0.53601223", "0.53591263", "0.53428656", "0.5292478", "0.52867603", "0.528...
0.6063937
4
PLGrid with certificate (standard)
def login_openid_plgrid_url url_for :action => 'login_openid_plgrid', :only_path => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def certificate; end", "def certificate; end", "def cert; end", "def cert; end", "def cert; end", "def cert_content; end", "def register_with_pkyp\n send_to_pkyp(@cert.to_s)\n end", "def cert_pem; end", "def cert_store; end", "def cert_store; end", "def handle_auth data\n CERTIFICATE...
[ "0.6399502", "0.6399502", "0.62356037", "0.62356037", "0.62356037", "0.59352547", "0.5841509", "0.5835554", "0.5814392", "0.5814392", "0.5788206", "0.5733798", "0.57122207", "0.57085127", "0.56525683", "0.56441766", "0.5605067", "0.56027365", "0.55675745", "0.5552299", "0.548...
0.0
-1
TODO: SCAL936 enable/disable PLGrid
def plgrid_enabled? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid; @parameters['GRiD']; end", "def grid_modified!\n end", "def toggle_grid\n if @show_grid\n self.show_grid = false\n else\n self.show_grid = true\n end\n end", "def build_voyage_port_grid(data_set,can_edit,can_delete)\n column_configs = Array.new\n\n if can_ed...
[ "0.6275129", "0.62216455", "0.6181977", "0.61113", "0.607926", "0.60341907", "0.6025261", "0.6024623", "0.60153353", "0.60153353", "0.5923404", "0.59128314", "0.57938933", "0.5710799", "0.5709018", "0.5677611", "0.5651054", "0.5646655", "0.5627494", "0.56239116", "0.5586932",...
0.8503345
0
TODO: SCAL936 enable/disable PLGrid
def basicauth_enabled? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plgrid_enabled?\n true\n end", "def grid; @parameters['GRiD']; end", "def grid_modified!\n end", "def toggle_grid\n if @show_grid\n self.show_grid = false\n else\n self.show_grid = true\n end\n end", "def build_voyage_port_grid(data_set,can_edit,can_delete)\n col...
[ "0.8502784", "0.62757754", "0.62229645", "0.6183486", "0.611126", "0.60810155", "0.6035749", "0.6026787", "0.6025474", "0.6016687", "0.6016687", "0.59253377", "0.5913974", "0.5795546", "0.57123667", "0.5711879", "0.56795454", "0.565231", "0.5647841", "0.5630417", "0.5624477",...
0.0
-1
returns first id of record with a field equal to value
def id field, value # can't bind field name, oh well @db.get_first_value "select id from #{@name} where #{field} = ?", value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(value)\n key = \\\n if value.to_s =~ /^[0-9\\.]*$/\n default_search_param + \"id\"\n else\n default_search_param\n end\n\n where(key => value).first\n end", "def get_id(*value)\n return nil if value.blank?\n return nil unless attribute_na...
[ "0.69565594", "0.6676421", "0.6634789", "0.6634789", "0.66263705", "0.6493472", "0.64218557", "0.63811576", "0.6373809", "0.6348592", "0.63105625", "0.6292532", "0.6277508", "0.6275408", "0.61603403", "0.61383283", "0.60730416", "0.6067499", "0.6064629", "0.6058045", "0.60514...
0.8031731
0
Update/add specific metadata key (works with GET)
def run(request, data) node = Razor::Data::Node[:name => data['node']] operation = { 'update' => { data['key'] => data['value'] } } operation['no_replace'] = data['no_replace'] begin node.modify_metadata(operation) rescue Razor::Data::NoReplaceMetadataError request.error 409, :error => _('no_replace supplied and key is present') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_metadata(key, **metadata); end", "def update_metadata(key, **metadata)\n end", "def set(key, value)\n @metadata[key] = value\n end", "def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end", "def set_metadata(key, valu...
[ "0.81631094", "0.7936334", "0.69122374", "0.689169", "0.6829413", "0.6807875", "0.6783698", "0.6702113", "0.67008746", "0.66036904", "0.65782917", "0.65782917", "0.65527576", "0.6550364", "0.65428597", "0.6534862", "0.64902127", "0.63708603", "0.63569903", "0.63527167", "0.63...
0.5924304
97
Use callbacks to share common setup or constraints between actions.
def set_newsletter @newsletter = Newsletter.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.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516"...
0.0
-1
Only allow a trusted parameter "white list" through.
def newsletter_params params.require(:newsletter).permit(:released_at, :title, :description, :asset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
checks whether supplier user owns a clan or is a member of a clan
def can_create_or_join_clan(user) raise "must supply a block" unless block_given? unless user.clans.blank? && user.member_of_clan.blank? render :partial => 'clans/cannot_create_or_join', :layout => true else yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner?(user_asking)\n user_asking.in? company.owners\n end", "def owned_by?(u)\n self.user == u\n end", "def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ? true : false\n ...
[ "0.6850293", "0.6849805", "0.6837078", "0.68338585", "0.6779485", "0.6776255", "0.6721402", "0.66866213", "0.6574234", "0.6566158", "0.655444", "0.6538602", "0.6532752", "0.65129113", "0.6433698", "0.6376648", "0.6370196", "0.6361917", "0.6344178", "0.6314224", "0.6314224", ...
0.61404294
31
This method is autogenerated. Do not change directly.
def to_sdd_xml(meta, xml) xml.send(meta[:xml_name]) do self.class.xml_fields.each do |field| if self[field[:db_field_name]] if self[field[:db_field_name]].is_a? Array logger.debug 'Translating to XML and the object is an Array' self[field[:db_field_name]].each_with_index do |instance, index| xml.send(:"#{field[:xml_field_name]}", instance, 'index' => index) end else xml.send(:"#{field[:xml_field_name]}", self[field[:db_field_name]]) end end end # go through children if they have something to add, call their methods kids = self.class.children_models unless kids.nil? || kids.empty? kids.each do |k| models = send(k[:model_name].pluralize) models.each do |m| m.to_sdd_xml(k, xml) end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def custom; end", "def custom; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def implementation; end", "def implementation; end", "def probers; end", "def attribute; end", "def attribut...
[ "0.7373633", "0.65087914", "0.65087914", "0.645239", "0.6378533", "0.6378533", "0.6378533", "0.6378533", "0.6254785", "0.62208474", "0.62208474", "0.6191855", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.6120204", "0.611...
0.0
-1
This method is autogenerated. Do not change directly.
def create_children_from_sdd_json(meta, h) # Go through the children self_model = meta[:model_name].camelcase(:upper).constantize kids = self_model.children_models unless kids.nil? || kids.empty? kids.each do |k| # check if the kids have a json object at this level if h[k[:xml_name]] logger.debug "XML child is #{k[:xml_name]}" logger.debug "Model name is #{k[:model_name]}" if h[k[:xml_name]].is_a? Array logger.debug "#{k[:xml_name]} is an array, will add all the objects" h[k[:xml_name]].each do |h_instance| klass = k[:model_name].camelcase(:upper).constantize if klass.respond_to? :from_sdd_json model = klass.from_sdd_json(k, h_instance) # Assign the foreign key on the object model["#{meta[:model_name]}_id"] = id model.save! else logger.warn "Class #{klass} does not have instance method 'from_sdd_json'" end end elsif h[k[:xml_name]].is_a? Hash logger.debug "#{k[:xml_name]} is a single object, will add only one" klass = k[:model_name].camelcase(:upper).constantize if klass.respond_to? :from_sdd_json model = klass.from_sdd_json(k, h[k[:xml_name]]) # Assign the foreign key on the object model["#{meta[:model_name]}_id"] = id model.save! else logger.warn "Class #{klass} does not have instance method 'from_sdd_json'" end end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def custom; end", "def custom; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def implementation; end", "def implementation; end", "def probers; end", "def attribute; end", "def attribut...
[ "0.73732734", "0.6505777", "0.6505777", "0.6450235", "0.6377401", "0.6377401", "0.6377401", "0.6377401", "0.6253046", "0.6218102", "0.6218102", "0.6190521", "0.6126704", "0.6126704", "0.6126704", "0.6126704", "0.6126704", "0.6126704", "0.6126704", "0.61183673", "0.6115741", ...
0.0
-1
strip leading and trailing spaces from names, login and email
def strip_spaces # these are conditionalized because it is called before the validation # so the validation will make sure they are setup correctly if self.first_name? then self.first_name.strip! end if self.last_name? then self.last_name.strip! end if self.login? then self.login.strip! end if self.email? then self.email.strip! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_login\n self.login.to_s.strip!\n end", "def remove_whitespace\n self.first_name = self.first_name.strip\n self.last_name = self.last_name.strip\n self.biography = self.biography.strip\n end", "def remove_whitespace\n self.name = self.name.strip\n self.phone = self.phone.strip\n e...
[ "0.7560539", "0.7235534", "0.70129585", "0.69557816", "0.68847084", "0.6797453", "0.6666385", "0.666385", "0.66604817", "0.660489", "0.660489", "0.660489", "0.660489", "0.6599209", "0.6575654", "0.6553751", "0.6549051", "0.65147996", "0.6501655", "0.64907503", "0.64902186", ...
0.7366326
1
is this user the anonymous user?
def anonymous? id == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anonymous?\n user.nil?\n end", "def anonymous?\n user.nil? || as_anonymous?\n end", "def is_anonymous\n @user_id == Gss::Provider::IDENTITY_ANONYMOUS\n end", "def anonymous_user?\n\t\t\tunless logged_in?\n\t\t\t\tredirect_to root_path\n\t\t\tend\n\t\tend", "def is_anonymous_user...
[ "0.88499546", "0.8657433", "0.8383578", "0.8324707", "0.82785976", "0.8135039", "0.7969194", "0.78817886", "0.78217703", "0.7734905", "0.76812845", "0.7604624", "0.7599052", "0.7525505", "0.75085247", "0.75039715", "0.7489127", "0.74887115", "0.7482023", "0.74815583", "0.7422...
0.0
-1
Encrypts the password with the user salt
def salted_sha_encrypt(password) self.class.local_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
Encrypts just using MD5 hash
def md5_encrypt(password) self.class.remote_encrypt(password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_md5(pass)\r\n return Digest::MD5.hexdigest(pass)\r\nend", "def encrypt(password) #, salt)\n Digest::MD5.hexdigest(password)\n end", "def to_md5(pass)\n return Digest::MD5.hexdigest(pass)\nend", "def to_md5(salt = \"\")\n hashsum(:md5, salt)\n end", "def md5(string)\n\tDigest::MD5.hexdi...
[ "0.75340575", "0.74995816", "0.7496476", "0.741504", "0.70201004", "0.70020866", "0.6996137", "0.6984172", "0.6983229", "0.69254977", "0.687628", "0.687628", "0.6864773", "0.6862848", "0.6856227", "0.683133", "0.6800406", "0.6787133", "0.6769178", "0.6755509", "0.6744237", ...
0.7686864
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.82061076
100
These create and unset the fields required for remembering users between browser closes
def remember_me remember_me_for 2.weeks 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
:name, :title, :salary, :boss,
def initialize(name,title,salary,boss) super #(name,title,salary,boss) # @name = name # @title = title # @salary = salary # @boss = boss @employees = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boss_params\n params.require(:boss).permit(:name, :weakness, :resistance, :immunity, :parryable, :optional)\n end", "def name\n name_business\n end", "def name; nutrdesc; end", "def hire_employee(employee_name, employee_salary)\n Employee.new(employee_name, employee_salary, self.name)\nend...
[ "0.63197845", "0.5958281", "0.59469897", "0.5849107", "0.58132035", "0.5800984", "0.5753704", "0.5748102", "0.5724427", "0.5712752", "0.57117563", "0.5686457", "0.56847274", "0.5670774", "0.56623596", "0.5651402", "0.56296873", "0.56107277", "0.5609868", "0.560186", "0.559191...
0.64796734
0
Get the database provided in the URI.
def database @database ||= match[9] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database\n @database ||= opts.fetch(:database, parsed_uri.path[1..-1])\n end", "def db_name\n @uri.path.split('/').last\n end", "def get_db(dbname)\n Database.new(dbname, @socket, self)\n end", "def find_db\n db = nil\n if !database.nil?\n db = rds.db_...
[ "0.8474478", "0.7361203", "0.72507834", "0.7188314", "0.71707356", "0.7165774", "0.7125147", "0.711822", "0.7115814", "0.7093209", "0.70868504", "0.70248395", "0.692902", "0.68376786", "0.68043804", "0.67975646", "0.6763022", "0.67322564", "0.6731406", "0.67264473", "0.671744...
0.6784345
16
Get the hosts provided in the URI.
def hosts @hosts ||= match[5].split(",") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uri_hosts(tweet)\n list = []\n #tweet.uris.each { |uri| list << uri.expanded_uri.host.downcase } if tweet.uris?\n\n # Remove subdomains (e.g.: www.example.org => example.org)\n regex = '[[:word:]]{1,}\\.[[:word:]]{1,}\\z'\n tweet.uris.each do |uri|\n m = /#{regex}/.match(uri.expanded_ur...
[ "0.7350574", "0.73418415", "0.7292541", "0.7212927", "0.7190429", "0.7047398", "0.6989781", "0.68751174", "0.6825206", "0.67855984", "0.67705446", "0.67204815", "0.6502923", "0.6502923", "0.6502923", "0.6431278", "0.635271", "0.63357264", "0.6286228", "0.6284372", "0.6215691"...
0.7346816
1
Create the new uri from the provided string.
def initialize(string) @match = string.match(URI) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri(string)\n return if string.blank?\n\n string = URI(string) unless string.is_a?(URI)\n\n # Rewrite host if necessary\n return string unless MetalArchives.config.endpoint\n\n endpoint = URI(MetalArchives.config.endpoint)\n\n string\n .tap { |u| u.host = endp...
[ "0.7402693", "0.70300627", "0.65971994", "0.6473146", "0.64545035", "0.6445503", "0.6440364", "0.63728964", "0.6298496", "0.6262053", "0.62530804", "0.6208939", "0.6127222", "0.6126438", "0.61233413", "0.6106487", "0.60913354", "0.6088699", "0.60630333", "0.604967", "0.604700...
0.5929767
33
Get the password provided in the URI.
def password @password ||= match[4] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_password\n password = @uri.password\n password ? Wgit::Url.new(password) : nil\n end", "def get_password(password)\n password\n end", "def password\n connect\n password = self.class.query('CMD_API_VERIFY_PASSWORD',\n :user => resource[:username],\n :passwd => r...
[ "0.7688032", "0.7278035", "0.71954423", "0.6933452", "0.6813961", "0.67981833", "0.67922705", "0.6749623", "0.6726572", "0.66764104", "0.66354936", "0.6610255", "0.65721804", "0.65259826", "0.6508754", "0.6508754", "0.65066034", "0.64915466", "0.648858", "0.64885455", "0.6460...
0.6514339
14
Get the uri as a Mongoid friendly configuration hash.
def to_hash config = { database: database, hosts: hosts } if username && password config.merge!(username: username, password: password) end config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri\n if @config.include?('uri')\n @config['uri']\n elsif credentials?\n \"mongodb://#{credentials}@#{@config['host']}:#{@config['port']}/#{@config['database']}\"\n else\n \"mongodb://#{@config['host']}:#{@config['port']}/#{@config['database']}\"\n end\n end", "def...
[ "0.7023173", "0.6625796", "0.6445636", "0.64266497", "0.6417377", "0.6405865", "0.6373918", "0.63606936", "0.63118374", "0.63118374", "0.6306402", "0.6302526", "0.6259779", "0.6248994", "0.6248994", "0.6232", "0.6230305", "0.6230159", "0.6207951", "0.61928755", "0.6176924", ...
0.0
-1