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
Check if the board is active.
def closed? closed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active?\n game.winner.nil?\n end", "def active?\n @active != false\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def active?\n end", "def active?\n end", "def active?\n !!@active\n end", "def active?\n active\n end", "def active?\r...
[ "0.72255385", "0.6966318", "0.6955483", "0.6909574", "0.6909574", "0.6906565", "0.69046885", "0.69014794", "0.68916625", "0.68749785", "0.6858607", "0.6838285", "0.6836151", "0.6819111", "0.67949307", "0.67949307", "0.67942", "0.6782677", "0.67717516", "0.67455405", "0.673831...
0.0
-1
Return a timeline of actions related to this board.
def actions return @actions if @actions @actions = Client.get("/boards/#{id}/actions").json_into(Action) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n return @activities if @activities != nil && @activities.length > 0\n \n @activities = []\n self.board.cards.each do |card|\n card.actions.each do |action|\n member = Trello::Member.find(action.member_creator_id)\n action_record = {action: action, member...
[ "0.67371905", "0.64903355", "0.647004", "0.6455652", "0.64302546", "0.64049757", "0.6376932", "0.6250689", "0.6232675", "0.6224151", "0.61936295", "0.61691153", "0.61060584", "0.60315526", "0.6023984", "0.5902284", "0.5901821", "0.5875048", "0.5862841", "0.5842338", "0.581233...
0.7405257
0
Return all the cards on this board. The options hash may have a filter key which can have its value set as any of the following values: :filter => [ :none, :open, :closed, :all ] default :open
def cards(options = { :filter => :open }) return @cards if @cards @cards = Client.get("/boards/#{id}/cards").json_into(Card) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n pagination = pagination_params\n filter = filter_params\n\n @cards = Card.filter_query(filter).page(pagination[:page]).per(pagination[:quantity]).ordered\n end", "def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: '...
[ "0.6034083", "0.588842", "0.58768225", "0.584634", "0.57683104", "0.5723003", "0.5689829", "0.5616721", "0.548925", "0.5477554", "0.5456947", "0.54422325", "0.5389554", "0.538205", "0.53687763", "0.53497905", "0.53481454", "0.53429586", "0.5337706", "0.5328086", "0.5281229", ...
0.7840381
0
Returns all the lists on this board. The options hash may have a filter key which can have its value set as any of the following values: :filter => [ :none, :open, :closed, :all ] default :open
def lists(options = { :filter => :open }) return @lists if @lists @lists = Client.get("/boards/#{id}/lists", options).json_into(List) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(filter)\n List.new(options.merge(filter: filter)).run\n end", "def list(filter)\n List.new(options.merge(filter: filter)).run\n end", "def list(options={})\n if options['minimal']\n minimal_list\n else\n detailed_list(options)\n end\n end", ...
[ "0.65999115", "0.65999115", "0.6525082", "0.6159027", "0.6072747", "0.60206145", "0.59669834", "0.5933132", "0.58936805", "0.58399665", "0.58094454", "0.5776571", "0.5702198", "0.56813216", "0.56681395", "0.56539756", "0.56479675", "0.5632726", "0.5629341", "0.55781543", "0.5...
0.70494926
0
Returns an array of members who are associated with this board. The options hash may have a filter key which can have its value set as any of the following values: :filter => [ :none, :normal, :owners, :all ] default :all
def members(options = { :filter => :all }) return @members if @members @members = Client.get("/boards/#{id}/members", options).json_into(Member) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(arg, members)\n begin\n rescue\n members = []\n end\n\n return members\n end", "def member_list(which_ones = :all)\n case which_ones\n when :manual\n ::User.with_role(:member, self).includes(user_profile: [:country]).sort_by { |u| u.full_name....
[ "0.6173816", "0.61728716", "0.5975429", "0.5952184", "0.58167785", "0.5794426", "0.57853174", "0.57815635", "0.57480836", "0.5738862", "0.5738298", "0.5731879", "0.56814504", "0.56580925", "0.56430995", "0.5626707", "0.5612667", "0.5597425", "0.55871916", "0.55749285", "0.557...
0.68274254
0
Returns a reference to the organization this board belongs to.
def organization return @organization if @organization @organization = Organization.find(organization_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization\n self[:O]\n end", "def organization\n if documentable.respond_to? :organization\n documentable.organization\n else\n creator.organization\n end\n end", "def org\n client.org(org_id)\n end", "def org\n client.org(org_id)\n end", "def organization...
[ "0.77385926", "0.72353333", "0.71153164", "0.71153164", "0.71124864", "0.69948316", "0.69533277", "0.68588", "0.6817078", "0.672692", "0.672576", "0.6674985", "0.6659625", "0.65687406", "0.65275806", "0.64485246", "0.64417744", "0.6440629", "0.6439464", "0.6430019", "0.642391...
0.73314035
1
this lines cancel cancan authorization on devise controller the following method is used for redirecting after a devise sign in or sign up the method overrides the devise default method which redirects to root url
def after_sign_in_path_for(resource) #resource refers to user being signed in if resource.role == "company" then #if the user is company user #if it is first time after sign up go to new page of company else go to show page if resource.company.nil? then new_user_company_path(resource) else ([resource,resource.company]) end elsif resource.role== "applicant" then # if user is applicant user #if it is first time after sign up go to new page of company else go to show page if resource.applicant.nil? then new_user_applicant_path(resource) else ([resource,resource.applicant]) end else#if admin go to admin show path user_admin_path(resource,resource.admin) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize\n redirect_to '/login' unless current_user\n end", "def redirect_unauthorized!\n redirect_to not_authorized_path\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def authorize\n redirect_to new_sessions_path if current_user.nil?\nend", "def authorize\n...
[ "0.7331466", "0.7276669", "0.7271069", "0.72166383", "0.7179402", "0.717813", "0.7164306", "0.71570516", "0.7135147", "0.7135147", "0.7135147", "0.7120936", "0.711324", "0.711324", "0.711324", "0.711324", "0.711324", "0.711324", "0.711324", "0.711324", "0.71111274", "0.7108...
0.0
-1
this is layout chooser helper method for actions associated with multiple users it chooses current layout according to current user
def layout_chooser(current_user) unless current_user.nil? if current_user.role=="applicant" then @applicant=current_user.applicant layout="applicants" elsif current_user.role=="company" then @company=current_user.company layout="companies" else layout="admin" end else layout="welcome" end layout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_layout\r\n return nil if action_name=='show'\r\n return 'usercenter' if action_name=='index' || action_name=='new'\r\n return 'public'\r\n end", "def custom_layout\n case action_name\n when \"edit\"\n \"profile\"\n when \"dashboard\"\n \"profile\"\n ...
[ "0.7543387", "0.6900417", "0.6732375", "0.6732053", "0.66744787", "0.66368294", "0.6604511", "0.6551679", "0.6525565", "0.6512689", "0.64824975", "0.64329356", "0.6409577", "0.6400393", "0.64003015", "0.6368447", "0.63629174", "0.6350181", "0.63303137", "0.6307976", "0.627495...
0.7907816
0
this method specifically create a guest user if there is no user it is applied to job post and company controllers' show pages using an append_before_filter
def check_for_guest if(params[:user_id]) then @user=User.find(params[:user_id]) else @user=nil end @user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if (params[:user][:email] == \"guest@example.com\")\n prep_guest\n end\n super\n end", "def create_user\n @user = User.find(session[:user_id])\n redirect_to(root_url) unless current_user?(@user) || current_user.admin?\n end", "def admin_create_work_user_...
[ "0.6730167", "0.6324074", "0.6241084", "0.6165088", "0.6155476", "0.61092424", "0.60877013", "0.60450846", "0.60407984", "0.59920365", "0.5970798", "0.5957232", "0.59430504", "0.5916035", "0.59023196", "0.5848989", "0.5838833", "0.5835897", "0.58234626", "0.58013", "0.5787566...
0.57504606
24
GET /planets/exoplanets/1 GET /planets/exoplanets/1.json
def show @planets_exoplanet = Planets::Exoplanet.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @planets_exoplanet } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @planets_exoplanet = Planets::Exoplanet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planets_exoplanet }\n end\n end", "def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n ...
[ "0.66094404", "0.62891334", "0.62724143", "0.61960447", "0.6172324", "0.6172324", "0.6172324", "0.61516273", "0.61026025", "0.6098107", "0.607099", "0.6025091", "0.60019046", "0.59780914", "0.5942235", "0.5907151", "0.59033376", "0.5895756", "0.5868944", "0.5868944", "0.58424...
0.7465328
0
GET /planets/exoplanets/new GET /planets/exoplanets/new.json
def new @planets_exoplanet = Planets::Exoplanet.new respond_to do |format| format.html # new.html.erb format.json { render :json => @planets_exoplanet } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @planets_exoplanet = Planets::Exoplanet.new(params[:planets_exoplanet])\n\n respond_to do |format|\n if @planets_exoplanet.save\n format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully created.' }\n format.json { render :json => @planets_exoplanet...
[ "0.7438295", "0.6969885", "0.6866875", "0.683856", "0.67798555", "0.6749272", "0.6677058", "0.66483027", "0.66196585", "0.65612596", "0.6532148", "0.65176815", "0.6475955", "0.64712024", "0.64698285", "0.6454886", "0.6447167", "0.6444216", "0.64395136", "0.6438629", "0.643003...
0.78973085
0
POST /planets/exoplanets POST /planets/exoplanets.json
def create @planets_exoplanet = Planets::Exoplanet.new(params[:planets_exoplanet]) respond_to do |format| if @planets_exoplanet.save format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully created.' } format.json { render :json => @planets_exoplanet, :status => :created, :location => @planets_exoplanet } else format.html { render :action => "new" } format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @planets_exoplanet = Planets::Exoplanet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planets_exoplanet }\n end\n end", "def destroy\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n @planets_exoplanet.destroy\n\n r...
[ "0.6356627", "0.59141165", "0.57223207", "0.5597912", "0.554691", "0.55455786", "0.55296516", "0.5505713", "0.54652905", "0.5396261", "0.5393298", "0.5378965", "0.5339681", "0.53359824", "0.53220665", "0.53220665", "0.5302504", "0.5268097", "0.5251579", "0.5235915", "0.523060...
0.7014784
0
PUT /planets/exoplanets/1 PUT /planets/exoplanets/1.json
def update @planets_exoplanet = Planets::Exoplanet.find(params[:id]) respond_to do |format| if @planets_exoplanet.update_attributes(params[:planets_exoplanet]) format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n @planets_exoplanet.destroy\n\n respond_to do |format|\n format.html { redirect_to planets_exoplanets_url }\n format.json { head :no_content }\n end\n end", "def update\n curr_planet = Planet.find(params[:id])\n ...
[ "0.6010414", "0.5926599", "0.5887137", "0.57801425", "0.577238", "0.5738635", "0.57173973", "0.5691856", "0.5682854", "0.56821406", "0.560406", "0.5596819", "0.5596819", "0.55673885", "0.5546897", "0.553295", "0.5473633", "0.5471466", "0.5463692", "0.54596853", "0.54584795", ...
0.71278805
0
DELETE /planets/exoplanets/1 DELETE /planets/exoplanets/1.json
def destroy @planets_exoplanet = Planets::Exoplanet.find(params[:id]) @planets_exoplanet.destroy respond_to do |format| format.html { redirect_to planets_exoplanets_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n Planet.delete(params[:id])\n redirect_to \"/planets\"\n end", "def destroy\n @backend_planet = Backend::Planet.find(params[:id])\n @backend_planet.destroy\n\n respond_to do |for...
[ "0.69855887", "0.69509727", "0.6894552", "0.6745221", "0.67182815", "0.669422", "0.668759", "0.665336", "0.663873", "0.6630759", "0.66040075", "0.66018283", "0.6586566", "0.6586566", "0.6536496", "0.65157765", "0.65036786", "0.64986724", "0.6488343", "0.64832836", "0.6478534"...
0.76955533
0
Email address of the author (optional).
def author @node.at_xpath("author").try(:content) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_email\n \"#{self.author} <#{self.email}>\"\n end", "def author_email\n commenter.try(:email)\n end", "def author\n @author ||=\n convert_content(item_attributes!.author) ||\n convert_content(item_attributes!.creator) ||\n \"\"\n end", "def author_name_and_email\n...
[ "0.8259439", "0.8171124", "0.77516556", "0.7689124", "0.76663435", "0.75917184", "0.75159883", "0.75021154", "0.7467721", "0.7431995", "0.7420305", "0.7387217", "0.7355769", "0.7334097", "0.7316417", "0.7294293", "0.7288146", "0.72758377", "0.7269425", "0.7260772", "0.7245484...
0.66203713
98
Array of categories (optional).
def categories if nodes = @node.xpath("category") nodes.map { |node| RSSCategory.new(node) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n []\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def getCategories()\n\t\tcat = ...
[ "0.7808225", "0.78069943", "0.7557289", "0.75259405", "0.7412948", "0.7349738", "0.7332413", "0.7332012", "0.72663844", "0.72108454", "0.7199028", "0.7178491", "0.71761423", "0.7150811", "0.7142924", "0.7142924", "0.7142924", "0.7105368", "0.7105368", "0.7105368", "0.70737886...
0.6993127
29
Array of URLs to comments (optional).
def comments if nodes = @node.xpath("comments") nodes.map { |node| node.content }.compact end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n results = []\n return results unless @comments\n\n comment = ''\n @comments.split(\"\\n\").each do |line|\n if line =~ /^\\S/\n results << comment unless comment.empty?\n comment = line\n else\n comment += \"\\n\" + line\n end\n end\n\n results <...
[ "0.7028294", "0.6779267", "0.65361285", "0.6511437", "0.6482451", "0.6482451", "0.64617723", "0.6437521", "0.6437521", "0.6410286", "0.6409736", "0.63873476", "0.63690555", "0.63671744", "0.6279321", "0.62631565", "0.621163", "0.6200982", "0.61900663", "0.6174481", "0.6173482...
0.6383598
12
GET /rate_registers GET /rate_registers.json
def index @rate_registers = RateRegister.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rate_register\n @rate_register = RateRegister.find(params[:id])\n end", "def get_rate(id:)\n @client.http_get(\"/#{@resource}/#{id}/rate\")\n end", "def rate_limit_status\n get('/account/rate_limit_status.json')\n end", "def get_rates(options={})\n post 'rates/full'...
[ "0.6079114", "0.5913549", "0.59036636", "0.5889425", "0.58611745", "0.57453424", "0.57453424", "0.57409436", "0.5721455", "0.561782", "0.5607936", "0.5602513", "0.55790436", "0.5551368", "0.5545205", "0.55449605", "0.5534712", "0.5515998", "0.5515998", "0.5515998", "0.5515998...
0.71612746
0
GET /rate_registers/1 GET /rate_registers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @rate_registers = RateRegister.all\n end", "def set_rate_register\n @rate_register = RateRegister.find(params[:id])\n end", "def show\n @rate_watcher = RateWatcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ra...
[ "0.6998958", "0.6307403", "0.61090523", "0.6022344", "0.5930128", "0.59232336", "0.584905", "0.58334905", "0.5768206", "0.57445896", "0.565274", "0.5647409", "0.56422734", "0.56229025", "0.56194526", "0.5609146", "0.5600623", "0.5589774", "0.55791664", "0.553006", "0.5509701"...
0.0
-1
POST /rate_registers POST /rate_registers.json
def create @rate_register = RateRegister.new(rate_register_params) respond_to do |format| if @rate_register.save format.html { redirect_to DevelopmentRate.find(@rate_register.development_rate_id), notice: 'Rate register was successfully created.' } else format.html { render :new } format.json { render json: @rate_register.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate_register_params\n params.require(:rate_register).permit(:rate_value, :date_registered,:country_id,:development_rate_id)\n end", "def set_rate_register\n @rate_register = RateRegister.find(params[:id])\n end", "def index\n @rate_registers = RateRegister.all\n end", "def update\n ...
[ "0.64433", "0.61306244", "0.60119444", "0.58407956", "0.56713754", "0.56713754", "0.56713754", "0.56579256", "0.56246686", "0.56151617", "0.5604948", "0.55853665", "0.5584166", "0.5568553", "0.5503004", "0.5487805", "0.54568696", "0.54504406", "0.5394667", "0.53917336", "0.53...
0.6530318
0
PATCH/PUT /rate_registers/1 PATCH/PUT /rate_registers/1.json
def update respond_to do |format| if @rate_register.update(rate_register_params) format.html { redirect_to @rate_register, notice: 'Rate register was successfully updated.' } format.json { render :show, status: :ok, location: @rate_register } else format.html { render :edit } format.json { render json: @rate_register.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to @rate, notice: 'Rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rate.errors, stat...
[ "0.6421251", "0.6372113", "0.63718086", "0.63718086", "0.63665795", "0.6319415", "0.6256315", "0.62064654", "0.61677265", "0.61290324", "0.61177224", "0.6017373", "0.5925531", "0.59065884", "0.5896722", "0.58882284", "0.5883248", "0.5852123", "0.58398443", "0.58243567", "0.58...
0.70425975
0
DELETE /rate_registers/1 DELETE /rate_registers/1.json
def destroy @development_rate=@rate_register.development_rate_id @rate_register.destroy respond_to do |format| format.html { redirect_to '/development_rates/'+@development_rate.to_s+'/edit', notice: 'Rate register was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_rates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rate_watcher = RateWatcher.find(params[:id])\n @rate_watcher.destroy\n\n ...
[ "0.67275524", "0.6690139", "0.6621716", "0.65430444", "0.65430444", "0.65430444", "0.6533137", "0.64993685", "0.64944834", "0.6469112", "0.6436515", "0.6400018", "0.6384946", "0.63846564", "0.6370642", "0.6361175", "0.63602674", "0.63510877", "0.634902", "0.6343456", "0.63377...
0.6737894
0
Use callbacks to share common setup or constraints between actions.
def set_rate_register @rate_register = RateRegister.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def rate_register_params params.require(:rate_register).permit(:rate_value, :date_registered,:country_id,:development_rate_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Returns a String that indicates the amount of required arguments.
def argument_text(method, given) min = method.amount(:arg) opt = method.amount(:optarg) return opt > 0 ? "#{min}..#{min + opt}" : min.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_args\n @required_args || 0\n end", "def sizeOf _args\n \"sizeOf _args;\" \n end", "def length; @args.length end", "def length\n @args.length\n end", "def required_arguments(args, n)\n n = (n..n) if Fixnum === n\n unless n.include? args.size\n STDERR.put...
[ "0.741767", "0.70701486", "0.66494113", "0.655792", "0.65137565", "0.648602", "0.6447344", "0.6434085", "0.64226204", "0.6409974", "0.63446444", "0.6327032", "0.6298592", "0.62435514", "0.6223118", "0.6173767", "0.6107167", "0.6087301", "0.60333294", "0.59912753", "0.5961103"...
0.5376433
82
Returns the minimum and maximum amount of arguments for a method call.
def argument_range(method) min = method.amount(:arg) if method.amount(:restarg) > 0 max = Float::INFINITY else max = min + method.amount(:optarg) + method.amount(:restarg) end return min, max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acceptable_argument_count\n parameters = @object.method(@method).parameters\n min_args = parameters.select{ |arg| arg[0] == :req }.count\n if parameters.any? { |arg| arg[0] == :rest }\n max_args = Float::INFINITY\n else\n max_args = parameters.count\n end\n ...
[ "0.7954306", "0.6642183", "0.65222526", "0.6510936", "0.63968897", "0.6392022", "0.6377676", "0.63766927", "0.63694423", "0.63536376", "0.63116866", "0.63029116", "0.629299", "0.62649894", "0.62595373", "0.6215791", "0.6158474", "0.61422664", "0.608806", "0.60749716", "0.6064...
0.7720659
1
Validates the config and returns it. Has sideeffect of
def conf return @validated_config if defined? @validated_config if !config[:playbook] raise 'No playbook defined. Please specify one in .kitchen.yml' end if !File.exist?(config[:playbook]) raise "playbook '%s' could not be found. Please check path" % config[:playbook] end if config[:vault_password_file] and !File.exist?(config[:vault_password_file]) raise "Vault password '%s' could not be found. Please check path" % config[:vault_password_file] end # Validate that extra_vars is either a hash, or a path to an existing file if config[:extra_vars] extra_vars_is_valid = config[:extra_vars].kind_of?(Hash) || config[:extra_vars].kind_of?(String) if config[:extra_vars].kind_of?(String) # Accept the usage of '@' (e.g. '@vars.yml' and 'vars.yml' are both supported) match_data = /^@?(.+)$/.match(config[:extra_vars]) extra_vars_path = match_data[1].to_s expanded_path = Pathname.new(extra_vars_path).expand_path(Dir.pwd) extra_vars_is_valid = expanded_path.exist? if extra_vars_is_valid @extra_vars = '@' + extra_vars_path end end if !extra_vars_is_valid raise "ansible extra_vars is in valid type: %s value: %s" % [config[:extra_vars].class.to_s, config[:extra_vars].to_s] end end info("Ansible push config validated") @validated_config = config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_config!\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end", "def validate\n config = clone\n\n check_plugins(config)\n check_include_exclude(config)\n\n config\n end", "def load_config\n @log.debug \"loading validator-specific ...
[ "0.7006162", "0.69469297", "0.694018", "0.6664716", "0.66612107", "0.660304", "0.649402", "0.6431398", "0.6374473", "0.6373463", "0.62486273", "0.6220413", "0.62055206", "0.61852103", "0.61675555", "0.61524576", "0.61184853", "0.6109659", "0.6101108", "0.608081", "0.6062132",...
0.6323326
10
available column refresh_token, name Credential < ActiveRecord enrcypt_column :refresh_token end available method decrypt_refresh_token_encrypted refresh_token_chipertext? refresh_token refresh_token=(string) refresh_token_encrypted refresh_token_encrypted token_encrypted
def define_decrypt_method_name(decrypt_method_name) define_singleton_method decrypt_method_name do |encrypted, **_opts| Rahasia.encryptor.decrypt( key: Rahasia.rahasia_key, value: encrypted ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_token\n return nil unless (temp_refresh_token = read_attribute(:refresh_token))\n # logger.debug2 \"temp_refresh_token = #{temp_refresh_token}\"\n encrypt_remove_pre_and_postfix(temp_refresh_token, 'refresh_token', 45)\n end", "def refresh_token\n return nil unless (temp_refresh_token =...
[ "0.7103973", "0.7103973", "0.68847513", "0.61939013", "0.6120722", "0.60736346", "0.6002098", "0.5906571", "0.58934873", "0.58477956", "0.5826083", "0.57855016", "0.5736644", "0.5701264", "0.56874704", "0.5656953", "0.5644627", "0.5620553", "0.56172395", "0.5615025", "0.55976...
0.0
-1
respond_to :html, :except => :running respond_to :json, :only => [:running, :show, :new, :index, :create, :update, :end, :destroy]
def index @date=@local_tzone_time.to_date if current_user.admin? @rooms = OnlineMeetingRoom.all(:conditions=>"(scheduled_on >= '#{@date.strftime("%Y-%m-%d 00:00:00")}' and scheduled_on <= '#{@date.strftime("%Y-%m-%d 23:59:59")}' )",:order=>"id DESC") else @rooms = OnlineMeetingRoom.rooms_for_user(current_user,@date) end @current_user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def interface\n ...
[ "0.7179914", "0.7167162", "0.71653855", "0.69957083", "0.696439", "0.694399", "0.6926398", "0.6913246", "0.6878505", "0.68782", "0.6791344", "0.6748802", "0.67346746", "0.67076594", "0.66850287", "0.6652708", "0.66402155", "0.6637897", "0.6625115", "0.65985906", "0.6568029", ...
0.0
-1
Used by logged users to join public rooms.
def join @room = OnlineMeetingRoom.find_by_id(params[:id]) role = @room.user_role(current_user) unless role == :denied join_internal(current_user.full_name, role, :join) else flash[:notice] = "#{t('access_denied')}" redirect_to :index and return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join\n @room = Room.find(params.require(:room_id))\n if @room&.add_user(current_user)\n success\n else\n not_found\n end\n end", "def join\n payload = { \"id\" => id }.to_json\n data = client.post \"#{api_prefix}/user/#{client.user.id}/rooms\", payload\n\...
[ "0.773721", "0.75216216", "0.71170044", "0.68892056", "0.6875336", "0.6836095", "0.6771018", "0.6664467", "0.64970833", "0.648658", "0.64627826", "0.6347988", "0.6342486", "0.6312066", "0.62884665", "0.62368757", "0.61450493", "0.61159116", "0.6104629", "0.60921735", "0.60914...
0.76633143
1
If delivery_method attribute was specified when object was built/created, deliver using that delivery method
def deliver_after_create_commit return if delivery_method.nil? deliver(delivery_method, delivery_options || {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver\r\n raise NotImplementedError.new(\"#{self.class.name}#deliver is not implemented.\")\r\n end", "def delivery_method\n if @delivery_method.nil?\n dm = Mail::Configuration.instance.lookup_delivery_method(method_name)\n @delivery_method = dm.new(settings)\n end\n @d...
[ "0.71574855", "0.70364994", "0.70011115", "0.69870013", "0.695244", "0.6952262", "0.6883569", "0.6688401", "0.65585536", "0.65392774", "0.65236986", "0.64548635", "0.6445575", "0.64311063", "0.6404226", "0.64019865", "0.6347012", "0.634472", "0.6343421", "0.6308687", "0.62912...
0.67168933
7
GET /messages GET /messages.json
def index @message = Message.new @messages = Message.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages\n get_json('messages.json')\n end", "def index\n messages = Message.all\n render json: messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @mess...
[ "0.8392115", "0.755332", "0.7461291", "0.7461291", "0.74388546", "0.74314713", "0.74295616", "0.74287003", "0.7412067", "0.73680776", "0.7355837", "0.7349781", "0.72963905", "0.72897035", "0.72890514", "0.7267814", "0.71833634", "0.7156361", "0.71530104", "0.71393275", "0.710...
0.0
-1
POST /messages POST /messages.json
def create @message = Message.new(message_params) if @message.save redirect_to messages_url, notice: "Message was successfully created." else redirect_to messages_url, alert: "Message was unsuccessfully created." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end", "def create\n @messag...
[ "0.7465386", "0.71694404", "0.7112854", "0.7095524", "0.70685273", "0.70200527", "0.69382447", "0.6844289", "0.683413", "0.683015", "0.68281627", "0.68281627", "0.6783851", "0.6763146", "0.67002374", "0.6698929", "0.66701055", "0.66322166", "0.66246116", "0.6623654", "0.66130...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def message_params params.require(:message).permit(:title, :body, :signature) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
It can be treated like a variable, which can be assigned to another variable, passed as an argument to a method. Remembers the value of variables no longer in scope. It remembers the values of all the variables that were in scope when the function was defined. It is then able to access those variables when it is called even if they are in a different scope.
def block_message_printer message = "Welcome to Block Message Printer" if block_given? yield end puts "But in this function/method message is :: #{message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mess_with_vars(one, two, three)\n one = two # one now points to \"two\" within the method\n two = three # two now points to \"three\" within the method\n three = one # three now points to \"one\" within the method\n # Thi...
[ "0.81631464", "0.7466545", "0.7009998", "0.69853485", "0.6955157", "0.69201404", "0.69152004", "0.6909581", "0.6854019", "0.6840671", "0.6836567", "0.6804345", "0.6761889", "0.67116845", "0.66349363", "0.6584624", "0.658415", "0.6517734", "0.65160567", "0.65160567", "0.651605...
0.0
-1
Is a number a palindrome? i.e. 55, 5 > 5 == 5 < 5
def palindromic(num) if num.to_s.split("") == num.to_s.split("").reverse true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Palindrome? (number)\r\n nstr = number.to_s()\r\n nstr == nstr.reverse\r\n end", "def palindromic_number?(num)\n palindrome?(num.to_s)\nend", "def palindromic_number?(number)\n palindrome?(number.to_s)\nend", "def palindrome?(num)\n num.to_s == num.to_s.reverse\nend", "def palindrome?( num )\...
[ "0.8378741", "0.8376165", "0.8354378", "0.8338549", "0.8305698", "0.8277938", "0.82777846", "0.8251787", "0.82496685", "0.82496685", "0.81918645", "0.8188534", "0.8188534", "0.8175997", "0.8157307", "0.8149886", "0.8140178", "0.81398565", "0.81009847", "0.80876976", "0.808702...
0.7749637
68
Remove val from the string at idx
def eliminate (val, idx) # Note that delete! does in-place deletion, and # returns nil if the character isn't found if @array[idx].delete!(val) new_length = @array[idx].length if new_length == 0 return false elsif new_length == 1 val2 = @array[idx] result = true $peers[idx].each do |idx2| result = result && eliminate(val2, idx2) end if !result return false end end # Check if deleting this value means that there's only # one of this value left in the current row/column/box result = true [$rows[idx], $columns[idx], $boxes[idx]].each do |unit| places = unit.select { |idx| @array[idx].count(val) > 0 } if places.length == 0 return false elsif places.length == 1 # val must go at that location result = result && assign(val, places[0]) end end if !result return false end end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(word, idx)\n word[0...idx] + word[idx+1..-1]\n end", "def strip_index(input); end", "def unprefix_index(index)\n index.sub(/^\\d{14}_/, '')\n end", "def remove_node(index)\n @strat.remove_node(index)\n @ize -= 1\n end", "def delete_at(idx)\n idx = Maglev::Type.coe...
[ "0.7155627", "0.66252166", "0.6412874", "0.6177011", "0.6164583", "0.6092276", "0.59655726", "0.59321475", "0.5899646", "0.5893241", "0.5841199", "0.5834068", "0.5834068", "0.5790758", "0.5783646", "0.5783646", "0.5758063", "0.573363", "0.57302356", "0.5720951", "0.56738055",...
0.54186374
38
GET /contests/1 GET /contests/1.json
def show @contest = Contest.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @contest } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format...
[ "0.8039824", "0.79434526", "0.79434526", "0.7894636", "0.78603256", "0.74444187", "0.73176265", "0.73176265", "0.73176265", "0.73176265", "0.7205758", "0.7156151", "0.7156151", "0.71495616", "0.7118187", "0.7028238", "0.6884724", "0.6837134", "0.6814197", "0.6814197", "0.6757...
0.80027866
1
GET /contests/new GET /contests/new.json
def new @contest = Contest.new respond_to do |format| format.html # new.html.erb format.json { render json: @contest } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { r...
[ "0.8337581", "0.81820256", "0.8151595", "0.7914554", "0.76854205", "0.7533876", "0.7533876", "0.7533876", "0.75304234", "0.7507851", "0.7507851", "0.7381418", "0.7381418", "0.7381418", "0.7335629", "0.72180265", "0.72180265", "0.72180265", "0.7210044", "0.7195519", "0.7053474...
0.84166914
1
POST /contests POST /contests.json
def create @contest = Contest.new(params[:contest]) respond_to do |format| if @contest.save format.html { redirect_to @contest, notice: 'Contest was successfully created.' } format.json { render json: @contest, status: :created, location: @contest } else format.html { render action: "new" } format.json { render json: @contest.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contest = @event.contests.build(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n ...
[ "0.7152174", "0.7103855", "0.70241404", "0.70208913", "0.69897294", "0.695391", "0.68805426", "0.68404317", "0.68307537", "0.68174773", "0.6759615", "0.6731611", "0.67187345", "0.67118084", "0.6692199", "0.6692199", "0.66318876", "0.66176033", "0.6520299", "0.6520299", "0.652...
0.74872786
1
PUT /contests/1 PUT /contests/1.json
def update @contest = Contest.find(params[:id]) respond_to do |format| if @contest.update_attributes(params[:contest]) format.html { redirect_to @contest, notice: 'Contest was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @contest.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @contest = Contest.find_by(path: params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to contest_path(@contest.path)+'/upload' }\n #format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.7452851", "0.7452833", "0.7441542", "0.7191935", "0.71750563", "0.7164745", "0.7117877", "0.705355", "0.70395637", "0.7026145", "0.69851846", "0.6976812", "0.69482785", "0.6924179", "0.69112897", "0.67661893", "0.67661893", "0.6714746", "0.6714746", "0.6714746", "0.6714746...
0.74279934
3
DELETE /contests/1 DELETE /contests/1.json
def destroy @contest = Contest.find(params[:id]) @contest.destroy respond_to do |format| format.html { redirect_to contests_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url ...
[ "0.80987906", "0.80896854", "0.7983932", "0.79219407", "0.7868613", "0.7868047", "0.78431594", "0.7790738", "0.77683955", "0.77683955", "0.77683955", "0.77602553", "0.76734424", "0.76611394", "0.75796723", "0.7568219", "0.74781656", "0.7476672", "0.73513526", "0.7268441", "0....
0.8085642
5
ensure should remains an array
def should @should end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invariant\n\t\t\tassert(@filesWatched.kind_of? Array)\n\t\tend", "def array?\n false\n end", "def array?\n false\n end", "def can_deconvert?\n array.is_a?(Array)\n end", "def returns_array?\n false\n end", "def returns_array?\n false\n end",...
[ "0.6605333", "0.64925665", "0.64804965", "0.63421243", "0.62954116", "0.62954116", "0.6197726", "0.6121671", "0.60856885", "0.60547894", "0.6024384", "0.59986347", "0.5961366", "0.59526676", "0.5946659", "0.5938891", "0.59381163", "0.5908284", "0.58942974", "0.58885854", "0.5...
0.0
-1
GET /headcounts/1 GET /headcounts/1.json
def show #TODO: this needs to be locked down self.not_implemented end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_headcount\n @headcount = Headcount.find(params[:id])\n end", "def count\n resource = @client.send(:head, self.next, **@options)\n resource.get_response.total_records\n end", "def counts\n @counts = UserCounts.new(@company, params)\n respond_to do |format|\n format.json {...
[ "0.6758427", "0.6606031", "0.658177", "0.6340657", "0.6253364", "0.62132484", "0.6203871", "0.6170963", "0.605158", "0.6042578", "0.60238814", "0.600332", "0.59930384", "0.5991357", "0.595194", "0.5927296", "0.59207386", "0.5899384", "0.58819866", "0.585761", "0.58531183", ...
0.0
-1
POST /headcounts POST /headcounts.json
def create room = Room.find_by_id(headcount_params[:room_id]) return self.bad_request_json "Invalid room" if room.nil? # find site that the room belongs to p = Permissions.new({ user: current_user, site: room.site }) return self.unauthorized_json unless user_signed_in? and p.can_add_site_counts? # augment the parameters with expected values default_params = { recorded_at: Time.now, recorded_by: current_user, capacity: room.capacity, } @headcount = Headcount.new(headcount_params.merge default_params) if @headcount.save render json: @headcount, status: 201 else render json: @headcount.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_headcount\n @headcount = Headcount.find(params[:id])\n end", "def headcount_params\n params.require(:headcount).permit(\n :room_id,\n :occupancy\n )\n end", "def counts\n @counts = UserCounts.new(@company, params)\n respond_to do |format|\n format.json { re...
[ "0.6796428", "0.654818", "0.622602", "0.6112921", "0.5893761", "0.57116014", "0.5663056", "0.5641685", "0.5480049", "0.54782856", "0.546549", "0.5426013", "0.53945655", "0.53865796", "0.5341104", "0.5313465", "0.531017", "0.52920187", "0.5275558", "0.52645457", "0.52645457", ...
0.69554317
0
PATCH/PUT /headcounts/1 PATCH/PUT /headcounts/1.json
def update edit_window = Rails.application.config.headcount_edit_window_minutes # find site that the room belongs to p = Permissions.new({ user: current_user, site: @headcount.room.site }) return self.unauthorized_json unless user_signed_in? and p.can_add_site_counts? # ensure headcount isn't too old if @headcount.recorded_at < Time.now - edit_window.minutes return self.bad_request_json("Headcount cannot be updated after #{edit_window} minutes") end if @headcount.update(headcount_params) render json: @headcount, status: 200 else render json: @headcount.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_headcount\n @headcount = Headcount.find(params[:id])\n end", "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @status_code = args[:status_code] if args.key?(:status_code)\n end", "def update!(**args)\n @count = args[:count] if args.key?(:coun...
[ "0.65793335", "0.6080353", "0.6080353", "0.6080353", "0.59173214", "0.58068055", "0.57757044", "0.576368", "0.57397395", "0.5714854", "0.5702639", "0.56934464", "0.568728", "0.5673615", "0.5658815", "0.5653211", "0.56425446", "0.56253016", "0.56253016", "0.5616629", "0.560612...
0.6756748
0
Use callbacks to share common setup or constraints between actions.
def set_headcount @headcount = Headcount.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def headcount_params params.require(:headcount).permit( :room_id, :occupancy ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Build a GStreamer pipeline out of the given elements. If an element is specified by name only, we simply create that element and move on. If the element is specified as an an array, however, it's treated differently. The first entry must always be a typename string, and additional entries can specify
def build_pipeline(elements) pipeline = Gst::Pipeline.new('raspi-stream') vars = {} prev = nil elements.each do |el| element = if el.kind_of?(String) Gst::ElementFactory.make(el) else opts = el.select { |s| s.kind_of?(Hash) }[0] sym = el.select { |s| s.kind_of?(Symbol) }[0] o = Gst::ElementFactory.make(el[0]) opts.each_pair { |k, v| o.set_property(k.to_s, v) } if not opts.nil? vars[sym] = o if not sym.nil? o end pipeline.add(element) prev >> element if not prev.nil? prev = element end [pipeline, vars] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_element(type,*args)\n # Case statement sorts elements by type\n # in order to align it to it's correct\n # class then add it to @elements array\n case type\n when ELEMENT\n # Element Argument Structure:\n # (type, x, y, width, height, colour, z, name)\n @elements << Element.new(*args)\n when...
[ "0.5631175", "0.53784704", "0.53035647", "0.5201956", "0.5200438", "0.51621425", "0.5156829", "0.5105961", "0.50834394", "0.5072651", "0.5031317", "0.49805814", "0.48569882", "0.4855959", "0.4854404", "0.479705", "0.47945777", "0.47942778", "0.47845525", "0.47636935", "0.4724...
0.7430818
0
def all_strategies result = Array.new for i in 0..2
def all_strategies races = stints.map do |stint| race = Race.new(track: track) race.add(stint) race end # why do we return race? and cloned_race. without them it doesnt recognise finished? loop do if races.all?(&:unfinished?) races = races.flat_map do |race| stints.map do |stint| cloned_race = race.dup cloned_race.add(stint) cloned_race end end else break races end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairs\n @pieces.combination(2).to_a\n end", "def pairs\n @pieces.combination(2).to_a\n end", "def all_possible_answers\n [1,2,3,4,5,6].repeated_permutation(4).to_a\n end", "def build_strategies\n @dial_strategies = Array.new\n @config[\"dial_strategies\"].each do |strategy|\n instr...
[ "0.6082316", "0.6082316", "0.59154886", "0.5900677", "0.589362", "0.5823252", "0.5798494", "0.57799435", "0.570098", "0.5696746", "0.5672325", "0.56624854", "0.56393015", "0.56186587", "0.55943054", "0.55943054", "0.55943054", "0.55943054", "0.55943054", "0.55833393", "0.5581...
0.64497745
0
Parse documentation from controller's comment
def parse_action_comment(folder) resource_name = @resource_group[:file_path].match(/([a-zA-Z_-]+)_spec\.rb/)[1].singularize file_path = folder.is_a?(Proc) ? folder.call(resource_name) : File.join(folder, resource_name.pluralize + '_controller.rb') in_comment = false comment_lines = [] resource_action = "#{action} #{resource}" File.open(file_path, 'r').each do |line| if in_comment if line =~ /\s*# ?(.*)$/ comment_lines << $1 else comment_lines << '' break end elsif line =~ Regexp.new("\s*#\s*" + Regexp.escape(resource_action) + "\s*$") in_comment = true end end puts "Cannot find docs for action #{resource_action}" if comment_lines.size == 0 comment_lines.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc\n if @spec.key?('doc')\n Comment.new(\"@param #{@spec['name']} #{@spec['doc']}\")\n else\n Comment.new\n end\n end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def document\n comment_code\n super\n end", "d...
[ "0.6550967", "0.64859974", "0.64859974", "0.63901705", "0.63584834", "0.63057333", "0.6269548", "0.62304395", "0.6222108", "0.62018436", "0.6065298", "0.6065298", "0.6065298", "0.6065298", "0.6065298", "0.6053797", "0.6050455", "0.60243326", "0.6009047", "0.6009047", "0.59968...
0.62322235
7
This method will create a session Handles : POST /sessions Redirects : productsindex > if the signin info is valid Renders : sessions_new > if the signin info is invalid
def create user = User.find_by_email(params[:session][:email].downcase) if user administrator = Administrator.find_by_user_id(user.id) end if user && user.authenticate(params[:session][:password]) && administrator if administrator.status sign_in user if administrator.admin redirect_to :controller => 'users', :action => 'index' else redirect_to :controller => 'products', :action => 'index' end else flash[:notice] = "Inactive user" render 'new' end else flash[:notice] = "Invalid Email/Password combination" render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def create\n return if Settings.readon...
[ "0.69648707", "0.6827196", "0.6748931", "0.67271096", "0.669886", "0.6678992", "0.6637938", "0.6606742", "0.6569253", "0.6538962", "0.65211993", "0.651269", "0.65070015", "0.64951515", "0.64805955", "0.6480062", "0.64635354", "0.64058053", "0.640505", "0.6392072", "0.63836586...
0.5944306
71
This method will sign out Handles : DELETE /sessions/1 Redirects : root_url(home)
def destroy sign_out redirect_to root_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n\tsign_out\n\tredirect_to root_path\n end", "def signout \n\t if current_user\n\t session[:identity] = nil\n\t session[:authentication_id] = nil\n\t session.delete :identity\n\t session.delete :authentication_id\n\t flash[:notice] = 'You have been signed out!'\n\t end...
[ "0.8274047", "0.8242702", "0.8240513", "0.82164955", "0.81651276", "0.8160631", "0.8146642", "0.8141222", "0.81356984", "0.8135215", "0.81282216", "0.81199414", "0.81197053", "0.81074655", "0.8098998", "0.808223", "0.80703515", "0.80703515", "0.80703515", "0.80703515", "0.807...
0.81750596
4
Parses JSON response body into ruby +Hash+
def response_body JSON.parse(response.body, symbolize_names: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toHash\n raise ResponseError, \"Response body doesnot exist\" if @_responseBody.nil? || @_responseBody.empty?\n JSON.parse(@_responseBody) \n end", "def to_hash\n fail_on_non_200_family_if_specified\n\n if @response['content-type'].nil? || @response['content-type'].include?('js...
[ "0.77171564", "0.7675921", "0.7646305", "0.7488846", "0.7487674", "0.74701023", "0.7438537", "0.737611", "0.7369797", "0.7367081", "0.7360659", "0.7360659", "0.7359517", "0.73383296", "0.72941315", "0.7288628", "0.7260729", "0.7254442", "0.7240592", "0.7222808", "0.7219769", ...
0.70317894
43
Parses JSON body page request into ruby +Hash+
def page_body JSON.parse(page.body, symbolize_names: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_request_body(request)\n JSON.parse(request.body.read).symbolize_keys\n end", "def parse_request\n unless request.body.read.empty?\n @json = JSON.parse(request.body.read.html_safe)\n end\n end", "def parse_body\n JSON.load(body)\n end", "def parse_body(body)\n if...
[ "0.74962825", "0.7483641", "0.7403551", "0.73852134", "0.7331105", "0.7221939", "0.7217827", "0.712856", "0.7046855", "0.6983776", "0.69733477", "0.69695973", "0.68898207", "0.68862844", "0.6880898", "0.6864806", "0.68418837", "0.68312794", "0.6795127", "0.6780157", "0.677335...
0.6979707
10
sends an authentication request to defined +user_session_url+ for the given +email+ and +password+ combination. sets a global variable with response headers with the generated token if authentication was successful.
def api_user_login(email, password) url = user_session_url params = { email: email, password: password } page.driver.submit :post, url, params @api_user_headers = page.response_headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n\t\t@user = User.where(:email => params[:email]).first\n\t\t@response = Hash.new\n\n\t\tif @user\n\t\t\tif @user.valid_password?(params[:password])\n\t\t\t\t@response[:auth_token] = @user.authentication_token\n\t\t\telse\n\t\t\t\t@response[:error] = \"incorrect_password\"\n\t\t\tend\n\t\telse\n\t\t\t@r...
[ "0.6978584", "0.6853472", "0.6813044", "0.68050814", "0.6770416", "0.67243326", "0.669188", "0.6641018", "0.65770096", "0.6552213", "0.652185", "0.65069836", "0.64773244", "0.6429541", "0.6398384", "0.6383236", "0.63760644", "0.63331026", "0.6324832", "0.6309728", "0.6286636"...
0.68362015
2
Generates session from created user and attaches request headers
def api_user_headers user = create(:user) headers = api_user_login(user.email, user.password) request.headers['access-token'] = headers['access-token'] request.headers['client'] = headers['client'] request.headers['uid'] = headers['uid'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_session(user)\n AuthController.clear_user_info(session, nil)\n session[:original_user] = @original_user\n session[:impersonate] = true\n session[:user] = user\n end", "def push_to_headers\n unless @session.nil?\n response.headers['sid'] = @session.id\n response.headers['uto...
[ "0.7603864", "0.70592844", "0.6954857", "0.6949582", "0.67129016", "0.66373193", "0.65760714", "0.655444", "0.6503431", "0.64246863", "0.6402696", "0.6402436", "0.6402436", "0.6402436", "0.6381906", "0.6349552", "0.63485104", "0.6342568", "0.6314866", "0.6305673", "0.6262678"...
0.63821256
14
escape the command string so that it can be executed safily in the shell
def escape cmd # not woking under windows, but I don't think I will support windows :) Shellwords.escape cmd end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape_shell_string(str)\n str = str.gsub(/\\\\/, \"\\\\\\\\\\\\\")\n str = str.gsub(/\"/, \"\\\\\\\"\")\n str = str.gsub(/`/, \"\\\\`\")\n str = str.gsub(/;/, \"\\\\;\")\n str = str.gsub(/&/, \"\\\\&\")\n str = str.gsub(/\\|/, \"\\\\|\")\n str = str.gsub(/\\$/,...
[ "0.7606828", "0.74306816", "0.7345491", "0.72995347", "0.71911234", "0.70388347", "0.700027", "0.682643", "0.67511046", "0.6746734", "0.67285883", "0.6728352", "0.672209", "0.6708982", "0.6687166", "0.66678417", "0.65987223", "0.65884876", "0.6551885", "0.653255", "0.6480994"...
0.79246044
0
A hash representation of this Message
def to_h extensions = { "code" => code, "fieldName" => field_name, "conflicts" => conflicts } super.merge({ "extensions" => extensions }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(message)\n return Digest::SHA1.hexdigest(message)\n end", "def hash\n to_s.hash\n end", "def hash\n bytes.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n return to_s.hash\n end", "def hash\n [id, sender, receiver, text, status, con...
[ "0.7490682", "0.74396694", "0.7406479", "0.7369256", "0.73615134", "0.7297777", "0.7281703", "0.7241214", "0.72286654", "0.7158623", "0.69904107", "0.6972131", "0.6951924", "0.6930224", "0.69290173", "0.68979913", "0.68979913", "0.68979913", "0.6891554", "0.6830518", "0.68305...
0.0
-1
Log nick change in all channels the user is in
def nick(m) channel_users do |users| unless users.has_key?(m.user.last_nick) fail "user '#{m.user.last_nick}' not found" end users[m.user.nick] = users[m.user.last_nick] users.delete(m.user.last_nick) users[m.user.nick].each do |chan| @loggers[chan].each { |l| l.log(:nick, m) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nick(msg)\n if msg.user.last_nick == @settings['identity']['nick']\n bot.nick = @settings['identity']['nick']\n return\n end\n str = sprintf('*** %s is now known as %s',msg.user.last_nick,msg.user.nick)\n # gotta log to every channel this user is in\n (msg.user.channels & msg.bot.c...
[ "0.7564629", "0.6958028", "0.6775302", "0.6619831", "0.6509698", "0.6455759", "0.62146425", "0.61176044", "0.60649335", "0.60551655", "0.6043401", "0.6028885", "0.6007194", "0.59623015", "0.5940634", "0.59327936", "0.59301585", "0.5918561", "0.5898888", "0.5882976", "0.582540...
0.72244036
1
Returns a new ChangeNotify object and places a monitor on +path+. The +path+ argument may be a file or a directory. If +recursive is true and +path+ is a directory, then the monitor applies to all subdirectories of +path+. The +filter+ tells the monitor what to watch for, such as file changes, attribute changes, etc. If the +event+ option is specified, it must be a Win32::Event object. It is then set as the event that will be set to the signaled state when a notification has been completed. Yields itself if a block is provided, and automatically closes itself when the block terminates.
def initialize(path, recursive, filter, event=nil) @path = path @recursive = recursive @filter = filter @overlap = 0.chr * 20 # OVERLAPPED struct # Because Win32API doesn't do type checking, we do it expicitly here. raise TypeError unless path.is_a?(String) raise TypeError unless [true, false].include?(recursive) raise TypeError unless filter.is_a?(Fixnum) if event raise TypeError unless event.respond_to?(:handle) @handle = event.handle else event = Win32::Event.new @handle = event.handle end @event = event @overlap[16,4] = [@handle].pack('L') # hEvent member super(@handle) if block_given? begin yield self ensure close end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(&block)\n watch_recursive @project_dir\n\n while true\n if IO.select([@notifier.to_io], [], [], @frequency)\n @notifier.process\n elsif @events.size > 0\n if block_given?\n yield @events\n else\n check @events\n end\n @events = []\n ...
[ "0.5044757", "0.4807635", "0.47473073", "0.4724187", "0.46325305", "0.46030313", "0.45693177", "0.4525198", "0.4499759", "0.4492174", "0.44850728", "0.44737154", "0.44728535", "0.44230953", "0.44142556", "0.44063988", "0.43663436", "0.43537223", "0.43165684", "0.4312553", "0....
0.54693514
0
Returns whether or not the ChangeNotify object is monitoring subdirectories of the path being monitored.
def recursive? @recursive end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subfolders?\n !self.subfolders.nil?\n end", "def folder?\n children.any?\n end", "def hierarchical?\n if @path\n true\n else\n false\n end\n end", "def object_has_hierarchy?\n filepaths.any?(/\\/+/)\n end", "def glob_me\n was_changed = fals...
[ "0.63438576", "0.62692416", "0.62255615", "0.61172014", "0.6003739", "0.5937641", "0.59241354", "0.5859265", "0.5840983", "0.58359426", "0.5689714", "0.56610936", "0.56596744", "0.56363237", "0.5595792", "0.55705327", "0.5533487", "0.55213255", "0.5510598", "0.5493472", "0.54...
0.49762243
98
Waits up to 'seconds' for a notification to occur, or infinitely if no value is specified. Yields an array of ChangeNotifyStruct's that contains two members: file_name and action.
def wait(seconds = INFINITE) seconds *= 1000 unless seconds == INFINITE fni = 0.chr * 65536 # FILE_NOTIFY_INFORMATION struct buffer rbytes = [0].pack('L') qbytes = [0].pack('L') subtree = @recursive ? 1 : 0 dir_handle = get_dir_handle(@path) comp_key = [12345].pack('L') begin comp_port = CreateIoCompletionPort(dir_handle, 0, comp_key, 0) if comp_port == 0 raise Error, get_last_error end bool = ReadDirectoryChangesW( dir_handle, fni, fni.size, subtree, @filter, rbytes, @overlap, 0 ) unless bool raise Error, get_last_error end while true bool = GetQueuedCompletionStatus( comp_port, qbytes, comp_key, @overlap, seconds ) unless bool raise Error, get_last_error end @signaled = true @event.signaled = true break if comp_key.unpack('L').first == 0 yield get_file_action(fni) if block_given? bool = ReadDirectoryChangesW( dir_handle, fni, fni.size, subtree, @filter, rbytes, @overlap, 0 ) unless bool raise Error, get_last_error end end ensure CloseHandle(dir_handle) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor_changes(file, resolution=1)\n puts \"Monitoring #{file}...\"\n last_change = Time.now\n every_n_seconds(resolution) do\n check = File.stat(file).ctime\n if check > last_change\n yield file\n last_change = check\n elsif Time.now - last_change > 60\n puts \"Nothing's happened f...
[ "0.57444406", "0.5645621", "0.5489788", "0.5011549", "0.5000409", "0.4992333", "0.49648407", "0.49008203", "0.48937106", "0.48901314", "0.48765433", "0.48584193", "0.4851336", "0.4844185", "0.48208678", "0.4810973", "0.47789672", "0.4768305", "0.47445107", "0.47279555", "0.47...
0.592727
0
Returns an array of ChangeNotify structs, each containing a file name and an action.
def get_file_action(fni2) fni = fni2.dup array = [] while true int_action = fni[4,4].unpack('L')[0] str_action = 'unknown' case int_action when FILE_ACTION_ADDED str_action = 'added' when FILE_ACTION_REMOVED str_action = 'removed' when FILE_ACTION_MODIFIED str_action = 'modified' when FILE_ACTION_RENAMED_OLD_NAME str_action = 'renamed old name' when FILE_ACTION_RENAMED_NEW_NAME str_action = 'renamed new name' end len = fni[8,4].unpack('L').first # FileNameLength struct member file = fni[12,len] + "\0\0" # FileName struct member + null buf = 0.chr * 260 WideCharToMultiByte(CP_ACP, 0, file, -1, buf, 260, 0, 0) file = File.join(@path, buf.unpack('A*')[0]) struct = ChangeNotifyStruct.new(str_action, file) array.push(struct) break if fni[0,4].unpack('L')[0] == 0 fni = fni[fni[0,4].unpack('L').first .. -1] # Next offset break if fni.nil? end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arrayOfChanges\n #we could also use Ruby/Git here, but that feels like an overkill right #now.\n gitChanges = `git diff #{@args[:taskpaper_file]} | grep '^\\+' | grep -i '\\@done'`\n return gitChanges.split(\"\\n\").collect{ |line| Task.new(line.gsub(/^\\+\\ ?/, \"\"))}\n end", "def changed_files\n...
[ "0.6008018", "0.57545584", "0.57450247", "0.57450247", "0.55981255", "0.5592533", "0.5581009", "0.5558055", "0.5501579", "0.5482988", "0.5329793", "0.5329793", "0.53209895", "0.5272098", "0.5221821", "0.51644516", "0.5140139", "0.5137358", "0.5122203", "0.51075745", "0.510453...
0.64608014
0
Returns a HANDLE to the directory +path+ created via CreateFile().
def get_dir_handle(path) handle = CreateFile( path, FILE_LIST_DIRECTORY, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0 ) if handle == INVALID_HANDLE_VALUE raise Error, get_last_error end handle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end", "def create_directory(path)\n clean_path = File.expand_path(path.gsub(/ /, '_'))\n Dir.mkdir(clean_path)\n clean_path\n end", "def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n...
[ "0.64952713", "0.6001071", "0.5783564", "0.575929", "0.57583535", "0.5746483", "0.5742945", "0.5742221", "0.5723379", "0.5667824", "0.5647695", "0.562329", "0.5621653", "0.56155515", "0.5598167", "0.55790836", "0.55531955", "0.5547269", "0.5493785", "0.5432875", "0.54263234",...
0.82394
0
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def event_params params.require(:event).permit(:date, :description, :name, :address1, :address2, :city, :state, :zip, :organization_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.6290564...
0.0
-1
This provider supports whyrun mode.
def whyrun_supported? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend", "def whyrun_supported?\n true\nend"...
[ "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686", "0.77423686"...
0.75637203
83
Name of nib containing document window
def windowNibName 'MyDocument' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def windowNibName\n 'ChillDocument'\n end", "def current_name_window_builder\n return UI::Window.window_builder(current_name_windowskin)\n end", "def window\r\n return $window\r\n end", "def document_window(name)\n Window.new {\n title \"Document: \" + name\n\t\t\n text = TextArea.new ...
[ "0.8387948", "0.66311735", "0.6305378", "0.62701106", "0.6242978", "0.62148565", "0.62039155", "0.6158767", "0.6112912", "0.6069856", "0.6060565", "0.59783363", "0.59160703", "0.59079355", "0.5872375", "0.58712214", "0.5868874", "0.5868874", "0.5822668", "0.5817585", "0.58111...
0.8478669
0
Document data representation for saving (return NSData)
def dataOfType(type, error:outError) outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4, userInfo:nil)) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n @raw_data\n end", "def to_data\n to_s\n end", "def to_blob\n @blob\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def base64\n self[:data]\n end", "def docum...
[ "0.6665685", "0.6553893", "0.6482804", "0.6404357", "0.6404357", "0.6404357", "0.6404357", "0.6404357", "0.6404357", "0.6374992", "0.63565695", "0.6301067", "0.628701", "0.6241542", "0.6194796", "0.61496043", "0.6147677", "0.6135176", "0.6117229", "0.6102818", "0.60741943", ...
0.0
-1
Read document from data (return nonnil on success)
def readFromData(data, ofType:type, error:outError) outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4, userInfo:nil)) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(document=section)\n @downloader.read(\n document: document,\n origin: origin_for(document)\n )\n end", "def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end", "def read document_file_name\n path_to_document = File.join(item...
[ "0.6667793", "0.6460025", "0.61755407", "0.61325914", "0.61291635", "0.61170334", "0.60951036", "0.6078486", "0.6062921", "0.60515213", "0.6047166", "0.6016368", "0.6011556", "0.59876966", "0.5978336", "0.5978336", "0.5918063", "0.59027493", "0.5865768", "0.58471924", "0.5835...
0.53665215
80
Return lowercase 'untitled', to comply with HIG
def displayName fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n name.gsub(/_/, ' ')\n end", "def wikified_name\n self.name.slice(0,1).capitalize + self.name.slice(1..-1).gsub(/ /, '_')\n end", "def wikiname(title)\n title.gsub(\" \",\"_\").downcase\nend", "def quick_title(song)\n File.basename(song, File.extname(song)).gsub(/^[^A-Za-z]+\\s+(\\w)/...
[ "0.7231389", "0.7142952", "0.7133862", "0.7060653", "0.70403767", "0.7037739", "0.6999924", "0.6961202", "0.6958249", "0.6884209", "0.6880593", "0.6877515", "0.68573695", "0.68573695", "0.6833635", "0.6829837", "0.6824174", "0.6819142", "0.67633533", "0.67549527", "0.6732342"...
0.0
-1
GET /positions GET /positions.json
def index @positions = Position.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def positions(id)\n get(\"/accounts/#{id}/positions\")['positions']\n end", "def index\n @user_positions = UserPosition.paginat...
[ "0.778692", "0.72966564", "0.7098048", "0.7051117", "0.6970844", "0.69439834", "0.69187045", "0.6905706", "0.6859098", "0.6839868", "0.6839868", "0.6839868", "0.6839868", "0.6824333", "0.68223953", "0.6743859", "0.6639118", "0.65764093", "0.6565626", "0.6484883", "0.6435992",...
0.7069381
3
Use callbacks to share common setup or constraints between actions.
def set_position @position = Position.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
GET /institution_ads/1 GET /institution_ads/1.json
def show @institution_ad = InstitutionAd.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @institution_ad } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def institution(institution, options={})\n self.class.get(\"/Institution/#{institution}.json\", options)\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "d...
[ "0.76730835", "0.729509", "0.729509", "0.6955955", "0.68970346", "0.68837225", "0.6868542", "0.68474203", "0.6784142", "0.67081994", "0.665566", "0.66103953", "0.6554832", "0.6545069", "0.65259486", "0.6476499", "0.64731705", "0.6434685", "0.6433249", "0.63807684", "0.6353695...
0.7846734
0
GET /institution_ads/new GET /institution_ads/new.json
def new @institution_ad = InstitutionAd.new respond_to do |format| format.html # new.html.erb format.json { render json: @institution_ad } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution }\n end\n end", "def create\n @institution_ad = InstitutionAd.new(params[:institution_ad])\n\n respond_to do |format|\n if @institution_ad.save...
[ "0.8046617", "0.76647604", "0.7561584", "0.7561584", "0.7480298", "0.7451679", "0.74488676", "0.7405367", "0.73738337", "0.73510116", "0.7334744", "0.7288871", "0.7281324", "0.7249385", "0.6968274", "0.69541186", "0.69126654", "0.6880818", "0.687772", "0.68770343", "0.6824505...
0.8229032
0
POST /institution_ads POST /institution_ads.json
def create @institution_ad = InstitutionAd.new(params[:institution_ad]) respond_to do |format| if @institution_ad.save format.html { redirect_to ([:administrator, @institution_ad]), notice: 'Institution ad was successfully created.' } format.json { render json: @institution_ad, status: :created, location: @institution_ad } else format.html { render action: "new" } format.json { render json: @institution_ad.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @institution = current_user.institutions.new(institution_params)\n\n if @institution.save\n render :show, status: :created\n else\n render json: @institution.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @institution = Institution.new(param...
[ "0.70202315", "0.6763568", "0.6763568", "0.6732582", "0.6704686", "0.66471446", "0.65469676", "0.64808124", "0.64150363", "0.63381505", "0.6286381", "0.6207896", "0.6176013", "0.61009187", "0.6081325", "0.606184", "0.60338444", "0.60222626", "0.6011597", "0.5990483", "0.59874...
0.7529048
0
PUT /institution_ads/1 PUT /institution_ads/1.json
def update @institution_ad = InstitutionAd.find(params[:id]) respond_to do |format| if @institution_ad.update_attributes(params[:institution_ad]) format.html { redirect_to ([:administrator, @institution_ad]), notice: 'Institution ad was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @institution_ad.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @institution.update(institution_params)\n render :show, status: :ok, location: @institution\n else\n render json: @institution.errors, status: :unprocessable_entity\n end\n end", "def set_institution\n @institution = Institution.find(params[:id])\n end", "def set_institu...
[ "0.7240295", "0.70504576", "0.70139", "0.7009776", "0.6947989", "0.69319123", "0.69319123", "0.69319123", "0.69319123", "0.686174", "0.683668", "0.68180233", "0.68180233", "0.67908674", "0.67707694", "0.6767324", "0.67390245", "0.6737389", "0.6728703", "0.65373856", "0.651314...
0.7403388
0
DELETE /institution_ads/1 DELETE /institution_ads/1.json
def destroy @institution_ad = InstitutionAd.find(params[:id]) @institution_ad.destroy respond_to do |format| format.html { redirect_to administrator_institution_ads_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @one_reg_institution = OneRegInstitution.find(params[:id])\n @one_reg_institution.destroy\n\n respond_to do |format|\n format.html { redirect_to one_reg_institutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institution.destroy\n respond_to ...
[ "0.7574022", "0.75542706", "0.7434145", "0.736017", "0.72736466", "0.7260414", "0.7256634", "0.72297335", "0.72164", "0.71205086", "0.7043163", "0.7000711", "0.69882995", "0.68336046", "0.68160915", "0.67975414", "0.67546064", "0.6743895", "0.67414767", "0.67224795", "0.66572...
0.8000204
0
(separated by spaces) capitalized.
def capitalize_each_word(phrase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalize() end", "def wordcap\n self.split(\" \").each{|word| word.capitalize!}.join(\" \")\n end", "def capitalize!() end", "def title_case\n\t\tself.split.collect{ |s| s.capitalize_first }.join(\" \")\n\tend", "def capitalize(input); end", "def capitalize\n\t\tcollect(&:capitalize)\n\tend...
[ "0.8691848", "0.8341359", "0.83251894", "0.81890136", "0.81576073", "0.8154197", "0.81382203", "0.8122856", "0.8056589", "0.8050964", "0.79773206", "0.7956179", "0.7950664", "0.7950664", "0.78909713", "0.7843024", "0.7842663", "0.7841264", "0.78269213", "0.7825759", "0.780563...
0.74776584
58
Copied from geokitrails/lib/geokitrails/acts_as_mappable.rb Extract distance_sql building to method `build_distance_sql`.
def build_distance_sql(options) origin = extract_origin_from_options(options) units = extract_units_from_options(options) formula = extract_formula_from_options(options) distance_sql(origin, units, formula) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_query(lat, long)\n <<-SQL.squish\n base_facilities.*,\n ST_Distance(base_facilities.location,\n ST_MakePoint(#{long},#{lat})) / #{METERS_PER_MILE} AS distance\n SQL\n end", "def intersecting_radius_of_wkt_sql(wkt, distance)\n \"ST_DWithin((#{GeographicItem::GEO...
[ "0.64007723", "0.5817731", "0.57766694", "0.5551427", "0.54333425", "0.53781706", "0.53757596", "0.53117657", "0.53079486", "0.5279111", "0.522313", "0.5160537", "0.51565176", "0.5152986", "0.5149123", "0.5131858", "0.51153207", "0.50883204", "0.50437206", "0.5031477", "0.501...
0.7546984
0
GET /relationships GET /relationships.json
def index @relationships = Relationship.all respond_to do |format| format.html # index.html.erb format.json { render json: @relationships } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @relationships = @relationships.includes(:follower, :followed) }\n format.json {}\n end\n end", "def list_relationships\n end", "def get_relationship_by_i...
[ "0.75787055", "0.7568152", "0.7451009", "0.7267501", "0.71036917", "0.70426375", "0.7041152", "0.701358", "0.6906209", "0.6906209", "0.6860838", "0.6854994", "0.6824355", "0.67031306", "0.6658709", "0.6551664", "0.6498407", "0.64868015", "0.6467257", "0.645903", "0.6446793", ...
0.71861583
4
GET /relationships/1 GET /relationships/1.json
def show @relationship = Relationship.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @relationship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end", "def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @rela...
[ "0.7755634", "0.73264873", "0.7216092", "0.71267563", "0.71030635", "0.70867723", "0.6972944", "0.6853865", "0.68350726", "0.68350726", "0.6743167", "0.67163384", "0.6663593", "0.65900904", "0.6554586", "0.6529403", "0.64761597", "0.6456846", "0.6449501", "0.643889", "0.64173...
0.7000371
6
GET /relationships/new GET /relationships/new.json
def new @available_assemblies = @plan.assemblies.available respond_to do |format| format.html # new.html.erb format.json { render json: @relationship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @dependent_relationship = DependentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dependent_relationship }\n end\n end", "def new\n @relationship = @character.relationships.new\n\n respond_to do |format|\n format.htm...
[ "0.74371874", "0.7262222", "0.7240815", "0.7150617", "0.7094372", "0.70149887", "0.6946886", "0.693737", "0.6810422", "0.6792018", "0.6693162", "0.66386384", "0.66344297", "0.66343176", "0.6601319", "0.65658045", "0.6531819", "0.6496914", "0.64239717", "0.63841444", "0.637162...
0.0
-1
POST /relationships POST /relationships.json
def create child = Assembly.find(params[:child_id]) @relationship = @assembly.relationships.build(child: child) child = @relationship.child child.used = true child.save respond_to do |format| if @relationship.save format.html { redirect_to [@plan, @assembly], notice: 'Relationship was successfully created.' } format.json { render json: @relationship, status: :created, location: @relationship } else format.html { render action: "new" } format.json { render json: @relationship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @relationships = Relationship.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @relationship = Relationship.create(params[:relationship])\n end", "def get_or_create_relationship(conn, node_start, node_end, type)\n data = <<\"EOS\"\n{\n \"to\" : \"#{node_end}\",\n...
[ "0.7072599", "0.67014796", "0.6696139", "0.6636808", "0.6434081", "0.643312", "0.643312", "0.643312", "0.64099956", "0.6396629", "0.6318684", "0.6227721", "0.62182003", "0.62056184", "0.6191377", "0.61736906", "0.6168153", "0.61657244", "0.6157943", "0.60911244", "0.6076791",...
0.58346915
34
PUT /relationships/1 PUT /relationships/1.json
def update @relationship = Relationship.find(params[:id]) respond_to do |format| if @relationship.update_attributes(params[:relationship]) format.html { redirect_to @relationship, notice: 'Relationship was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @relationship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update\n @relationship = Relationship.find(params[:id]...
[ "0.7212586", "0.70425797", "0.65478414", "0.64974725", "0.649698", "0.6481877", "0.6327748", "0.62817204", "0.62817204", "0.62817204", "0.62817204", "0.62817204", "0.62817204", "0.62817204", "0.62817204", "0.62817204", "0.62315273", "0.62071633", "0.6195346", "0.61710835", "0...
0.65155333
3
DELETE /relationships/1 DELETE /relationships/1.json
def destroy @relationship = @assembly.relationships.find(params[:id]) child = @relationship.child child.used = false child.save @relationship.destroy respond_to do |format| format.html { redirect_to [@plan, @assembly], notice: 'Relationship was deleted.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def delete_relationship(id)\n return @client.raw(\"delete\", \"/config/relationships/#{id}\")\n end", "def destroy\n @relationship = Relationship.find(params[:id])\n @relationship.d...
[ "0.798043", "0.7477337", "0.74023247", "0.73197246", "0.72950953", "0.7238506", "0.7238506", "0.72159064", "0.70580107", "0.7053185", "0.70027834", "0.7002065", "0.69677216", "0.69549584", "0.69122267", "0.6908632", "0.6886", "0.6815911", "0.67935276", "0.6789613", "0.6784812...
0.7069854
8
Examples lastof([3,2,1,4]) => [4] Returns the last Value.
def lastof(arr) return arr[arr.length - 1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(list)\n list[-1]\nend", "def using_last(array)\n array.last\n# returns last item in array \nend", "def last(numbers, int)\n numbers.last(int)\nend", "def last\n all[all.size - 1]\n end", "def last_of(arr)\n output = arr[-1]\n return output\nend", "def using_last(array)\n last_el...
[ "0.78494924", "0.7689185", "0.7685252", "0.76785", "0.76104873", "0.75944", "0.7585674", "0.75761986", "0.75173026", "0.75173026", "0.7484074", "0.7468226", "0.743711", "0.7422171", "0.74074084", "0.74074084", "0.739037", "0.7284037", "0.7274148", "0.7236874", "0.71858776", ...
0.7462847
12
An alternative implementation of GoogleDrive::Spreadsheetsave without the expensive XML parsing.
def update_worksheet(worksheet, updates) raise Errors::ProxyError, "File #{worksheet.id} is not a Google Sheets worksheet" unless worksheet.is_a? GoogleDrive::Worksheet cells_feed_url = CGI.escapeHTML worksheet.cells_feed_url.to_s cells_feed_url_base = cells_feed_url.gsub(/\/private\/full\Z/, '') xml = <<-EOS <feed xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gs="http://schemas.google.com/spreadsheets/2006"> <id>#{cells_feed_url}</id> EOS updates.each do |coordinates, value| row, col = coordinates safe_value = value ? CGI.escapeHTML(value).gsub("\n", '&#x0a;') : nil xml << <<-EOS <entry> <batch:id>#{row},#{col}</batch:id> <batch:operation type="update"/> <id>#{cells_feed_url_base}/R#{row}C#{col}</id> <link rel="edit" type="application/atom+xml" href="#{cells_feed_url}/R#{row}C#{col}"/> <gs:cell row="#{row}" col="#{col}" inputValue="#{safe_value}"/> </entry> EOS end xml << <<-EOS </feed> EOS batch_url = "#{cells_feed_url}/batch" begin result = @session.execute!( http_method: :post, uri: batch_url, body: xml, headers: { 'Content-Type' => 'application/atom+xml;charset=utf-8', 'If-Match' => '*' } ) log_response result raise Errors::ProxyError, "update_worksheet failed at URL #{batch_url}. Error: #{result.data['error']}" if result.error? raise Errors::ProxyError, "update_worksheet failed at URL #{batch_url}. Error: interrupted" if result.body.include? 'batch:interrupted' result.body rescue Google::APIClient::TransmissionError => e log_transmission_error(e, "update_worksheet failed failed at URL #{batch_url}") raise e end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save!\n path = File.join(basedir, computed_filename)\n Rails.logger.info \"Saved GPX file as #{path}\"\n file = File.new(path, 'wb')\n file.write contents\n file.close\n file\n end", "def save_as_spreadsheet\n session = GoogleDrive::Session.from_config(\"../../config.json\...
[ "0.62136906", "0.6013091", "0.58843416", "0.5839747", "0.5800876", "0.5742777", "0.5708533", "0.5675723", "0.5635354", "0.56254554", "0.5527766", "0.5517757", "0.5514783", "0.54728943", "0.53800625", "0.5378177", "0.53511333", "0.52754605", "0.52739745", "0.52471423", "0.5225...
0.0
-1
Adds a source list
def source_list(label, *list) _logger.warn "Duplicate source_list '#{label}'" if @result.source_lists.has_key?(label) @result.source_lists[label] += list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end", "def add_source(source)\n all << source unless all.any? { |s| s.url == source || s.name == source.name }\n end", "def add_source(*source_paths)\n...
[ "0.7633334", "0.7320475", "0.7141239", "0.6547541", "0.6351254", "0.6269665", "0.62661344", "0.6221226", "0.6211851", "0.6208193", "0.6054284", "0.6019024", "0.6019024", "0.6019024", "0.5973978", "0.59372014", "0.5934253", "0.5891507", "0.58903515", "0.5886933", "0.58815753",...
0.8361807
0
Have to use the method _logger here, cos logger is defined as a builder elsewhere.
def _logger @logger ||= Log4r::Logger.new(self.class.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "...
[ "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8352363", "0.8258509", "0.81622267", ...
0.7497507
57
funcion que devuelve el precio.
def precio @precio end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prec(*) end", "def getPrecioVenta\n precio = (cantidadCasasHoteles) *(@precioCompra +@precioEdificar) *@factorRevalorizacion \n return precio\n end", "def prec_i() end", "def prec_f() end", "def prec\r\n has_prec? ? parms[1].to_i : 0\r\n end", "def precio_mercado\n @serie.va...
[ "0.7629094", "0.7503461", "0.7303105", "0.7279135", "0.6916624", "0.68725854", "0.6498396", "0.6373705", "0.6198738", "0.6183766", "0.61574", "0.6150528", "0.6135839", "0.6124068", "0.6123842", "0.61127466", "0.61104864", "0.60840017", "0.60699755", "0.6068092", "0.6062614", ...
0.7982646
0
check if the user has to authorize using password
def authorize? @root.attributes["ath"].to_i == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize(username, password)\np username\np password\n username == settings.username && password == settings.password\n end", "def authorized?\n session[:password] == SETTINGS[\"password\"]\n end", "def passwordy?\n # puts \"*****************----------------> Handling user as PASSWORDY.\"\n...
[ "0.8098871", "0.7940844", "0.74612653", "0.7448215", "0.73638606", "0.7263565", "0.72524685", "0.7246693", "0.72189933", "0.7198469", "0.71916246", "0.7163661", "0.7138894", "0.71179044", "0.71061856", "0.7080464", "0.7080327", "0.7072251", "0.707056", "0.7029408", "0.6999489...
0.0
-1
calculate the uptime value
def last_uptime @root.attributes["n"].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uptime\n Time.now - @start_time\n end", "def uptime\n return 0 if started_at.nil?\n ((Time.now.to_f - started_at.to_f) * 1000.0).to_i\n end", "def uptime\n begin\n return Time.now.to_i.to_f - booted_at.to_f\n rescue Exception\n return 0.0\n end\n end",...
[ "0.82396597", "0.8203439", "0.8197685", "0.8150869", "0.8149055", "0.81056297", "0.8101421", "0.80966425", "0.8007932", "0.7919383", "0.7831798", "0.7805715", "0.7804846", "0.7772616", "0.7747241", "0.76484597", "0.76096076", "0.7400749", "0.7277494", "0.72146344", "0.7160234...
0.6128009
34
calculate the current uptime value
def uptime @root.attributes["c"].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uptime\n Time.now - @start_time\n end", "def uptime\n Time.now - live_since\n end", "def uptime\n @uptime ||= down? ? nil : Time.now - started_at\n end", "def uptime\n begin\n return Time.now.to_i.to_f - booted_at.to_f\n rescue Exception\n return 0.0\n ...
[ "0.8465758", "0.8398441", "0.8389986", "0.8389979", "0.8378326", "0.83714026", "0.83548415", "0.8339369", "0.8310032", "0.80609596", "0.8050151", "0.80310214", "0.79601705", "0.7848832", "0.7806286", "0.7726854", "0.7390174", "0.73640984", "0.72302306", "0.7221402", "0.701413...
0.7691845
16
parse the platform of the remote system
def platform @root.attributes["pl"].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) ...
[ "0.7604708", "0.7559172", "0.73745745", "0.72714067", "0.72311217", "0.71745604", "0.716874", "0.7158245", "0.7093216", "0.7093216", "0.7056836", "0.70502925", "0.7009144", "0.70076394", "0.6982891", "0.6972677", "0.6953625", "0.69396025", "0.69396025", "0.69396025", "0.68991...
0.672139
33
Public: Add a repository (or array of repositories). repos a 'username/repository' String or Array of such strings. Returns the updated array of repositories.
def add(repos) @repositories.add(repos) repositories end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(repos)\n @list.push(repos).flatten!\n self\n end", "def add_repository(name, user_name)\n\tabort \"Cannot add repository, user not found!\" unless users(:return => :array).include?(user_name)\n\t@repositories << {:name => name, :user_name => user_name}\n end", "def add_repositories_for_...
[ "0.7124974", "0.6638667", "0.6494411", "0.6412358", "0.6326794", "0.6284215", "0.58795655", "0.58310515", "0.58131367", "0.58034384", "0.57617706", "0.57507414", "0.56919813", "0.56783557", "0.5646922", "0.56441957", "0.56114763", "0.5580396", "0.5564825", "0.54503345", "0.54...
0.78202665
0
Public: Return a user's OSS contributions as a hash. If the hash hasn't already been determined, the contributions are all looked
def contributions_as_hash load_contributions unless @contributions @contributions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [author_email, author_name, author_time, branch, commit_time, committer_email, committer_name, default_branch, message, repository_url, sha, tag].hash\n end", "def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n...
[ "0.5939252", "0.58422995", "0.56694233", "0.5554241", "0.55504555", "0.55158126", "0.5509051", "0.55055594", "0.5479539", "0.5461728", "0.54424083", "0.5339214", "0.5302152", "0.5287696", "0.52471113", "0.5180209", "0.5176064", "0.51621217", "0.5156628", "0.51554525", "0.5155...
0.6682132
0
Public: Determine a user's contributions and load the
def load_contributions @contributions = Hash.new repositories.each do |f| conts = get_contributions(f) @contributions[f] = conts unless conts.empty? end @contributions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end", "def set_user_contribution\n @user_contribution = UserContribution.f...
[ "0.6896388", "0.6517491", "0.6303564", "0.6190211", "0.60571986", "0.5787727", "0.57448256", "0.56568545", "0.55981827", "0.557381", "0.54976463", "0.5436717", "0.5410942", "0.5394207", "0.53469825", "0.5320798", "0.5294943", "0.528777", "0.52717", "0.5254218", "0.5214334", ...
0.6271109
3
Public: Replace the user's forked repositories with the specified repositories. repos a 'username/repository_name' string, or an array of such strings. Returns the updated array of repositories.
def only(repos) @repositories.only repos repositories end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repos\n @repos ||= (user_repos + org_repos).flatten\n end", "def repos\n @repos ||= get(\"/repos/show/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end", "def setup_repositories(opts)\n @repositories = RepositoryList.new(GithubAPI.forks(@username))\n update(opts)\n...
[ "0.6731011", "0.65362006", "0.6252087", "0.6203835", "0.61942744", "0.6188979", "0.61441845", "0.61374277", "0.6073286", "0.60710984", "0.6062793", "0.60467184", "0.6001011", "0.59852064", "0.5976919", "0.5976787", "0.59584904", "0.5932793", "0.58883125", "0.58743095", "0.584...
0.5243899
72