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
This pattern was mostly borrowed from Rails' style of generating URLs. Here we just concatenate the `id` and a sanitized form of our title.
def to_param "#{id}-#{title.to_s.gsub(/\p{^Alnum}/u, " ").gsub(/\s+/, "-").downcase}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slug_by_title\n \"#{title.gsub(/[^a-zA-Z0-9]/, '-')}-#{id}\"\n end", "def slug_by_title\n \"#{title.gsub(/[^a-zA-Z0-9]/, '-')}-#{id}\"\n end", "def to_param\n if title\n \"#{id}-#{title.parameterize}\"\n else\n \"#{id}\"\n end\n end", "def to_param\n \"#{id}-#{canonical_tit...
[ "0.79633814", "0.79633814", "0.76133287", "0.74743444", "0.7466054", "0.7420295", "0.7420295", "0.7383907", "0.7383907", "0.736635", "0.73506486", "0.73506486", "0.73481745", "0.73453933", "0.73443717", "0.7310359", "0.7310359", "0.7304273", "0.7295721", "0.72705746", "0.7165...
0.7080661
26
`Ohm::Slug` just uses the value of the object's `to_s`.
def to_s title.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slug_string\n self.name\n end", "def slug_base_string\n self.id || sluggify\n end", "def as_slug\n Swift::Transliteration.slugize self\n end", "def slugando\n\t\tself.slug = summary.parameterize.to_s\n\tend", "def compute_slug\n \"#{normalize_slug_base_string}-#{self.id || sluggify}\"...
[ "0.7330686", "0.7318265", "0.7284198", "0.72534746", "0.7250964", "0.7232965", "0.71368796", "0.69758606", "0.69758606", "0.6946584", "0.69367075", "0.6909818", "0.69081855", "0.69035494", "0.69035494", "0.69035494", "0.69035494", "0.6871828", "0.6871828", "0.6871828", "0.687...
0.0
-1
GET /api/venues/:id Get a specific venue
def show @venue = Venue.fetch(params[:id]) render json: @venue end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def venue(id)\n get(\"venues/#{id}\").venue\n end", "def venue(id)\n options = { :venue_id => id }\n get('/venue_info', options)\n end", "def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",...
[ "0.88087016", "0.87964976", "0.8481945", "0.7645665", "0.750519", "0.7464382", "0.73194623", "0.7228529", "0.7223211", "0.7198148", "0.7172391", "0.7157408", "0.7029044", "0.6990767", "0.6959182", "0.6816427", "0.68115366", "0.67954344", "0.67954344", "0.67954344", "0.6795434...
0.77446586
3
add node to adjacent nodes
def add_edge(from, to) from.adjacents << to end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(node); end", "def add_adjacent(node)\n\t\t@adjacent << node unless node == nil\n\tend", "def add_node(n)\n @nodes.push n unless @nodes.include? n\n end", "def add_vertice(node, next_node)\n return node.contains?(next_node)\n node.add_node(next_node)\n end", "def add_next_sibling...
[ "0.7719516", "0.7534212", "0.74344546", "0.7378509", "0.7267463", "0.72057813", "0.71330756", "0.70928305", "0.70699865", "0.7009737", "0.69945514", "0.6992224", "0.6985715", "0.693611", "0.6935762", "0.6831133", "0.6818299", "0.6800331", "0.6799736", "0.6788778", "0.67590433...
0.6874084
15
GET /bands/newacct a band must make a user account first
def newacct @user = User.new @user.user_type="m" return @user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @account = BlackberryAccount.new(params[:blackberry_account])\n current_user.person.blackberry_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { r...
[ "0.6474185", "0.61988866", "0.6180345", "0.6072713", "0.60690564", "0.6055859", "0.60405153", "0.59998626", "0.5959238", "0.5950074", "0.5933926", "0.5911778", "0.5899646", "0.587501", "0.5860568", "0.58499056", "0.5846739", "0.58255875", "0.58225316", "0.5804499", "0.5798383...
0.60215974
7
Functions for handling band_musician HABTM management GET /bands/1/addmusician
def add_musician @band = Band.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_band_albums\n @band_album = BandAlbum.find(params[:id])\n end", "def create\n @band = Band.find(params[:band_id])\n @album = Band.find(params[:band_id]).albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to new_band_album_song_path...
[ "0.61438066", "0.6006179", "0.5877538", "0.57935894", "0.56938714", "0.56598675", "0.5617073", "0.548602", "0.54144955", "0.54003686", "0.5387357", "0.5370931", "0.5330105", "0.5323411", "0.5299777", "0.52876997", "0.522167", "0.52166724", "0.5203303", "0.5203303", "0.5203303...
0.7605662
0
Never trust parameters from the scary internet, only allow the white list through.
def band_params params.require(:band).permit(:name, :genre, :description, :email, :url, :image, :songdemo1, :songdemo1_title, :songdemo2, :songdemo2_title, :zipcode, :radius) 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
Allow you to route based on whether a scope is not authenticated. You can optionally specify which scope. unauthenticated do as :user do root to: 'devise/registrationsnew' end end root to: 'dashboardshow'
def unauthenticated(scope = nil) constraint = lambda do |request| not request.env["warden"].authenticate? scope: scope end constraints(constraint) do yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_unauthenticated(scope=nil, options={}, &routes_block)\n github_constraint(scope, options, routes_block) do |warden, scope|\n not warden.authenticated?(scope: scope)\n end\n end", "def not_authenticated\n redirect_to root_path\n end", "def not_authentic...
[ "0.70543295", "0.69676393", "0.6907679", "0.6869371", "0.6740226", "0.65670973", "0.6303805", "0.62966394", "0.6274277", "0.62515825", "0.6240269", "0.6206316", "0.6174704", "0.6156587", "0.61227757", "0.6106262", "0.61058855", "0.6101658", "0.6096006", "0.6069385", "0.603631...
0.6579713
5
Sets the devise scope to be used in the controller. If you have custom routes, you are required to call this method (also aliased as :as) in order to specify to which controller it is targeted. as :user do get "sign_in", to: "devise/sessionsnew" end Notice you cannot have two scopes mapping to the same URL. And remember, if you try to access a devise controller without specifying a scope, it will raise ActionNotFound error. Also be aware of that 'devise_scope' and 'as' use the singular form of the noun where other devise route commands expect the plural form. This would be a good and working example. devise_scope :user do get "/some/route" => "some_devise_controller" end devise_for :users Notice and be aware of the differences above between :user and :users
def devise_scope(scope) constraint = lambda do |request| request.env["devise.mapping"] = Devise.mappings[scope] true end constraints(constraint) do yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def devise_scope(scope); end", "def scope_path\n opts = {}\n route = :\"new_#{scope}_session_path\"\n alt_route = :\"new_#{scope}_ichain_session_path\"\n opts[:format] = request_format unless skip_format?\n\n config = Rails.application.config\n opts[:script_name] = (config.relative_url_root if...
[ "0.63038975", "0.60145664", "0.56660396", "0.5660806", "0.55076504", "0.5474653", "0.54698837", "0.5284277", "0.52402264", "0.52402264", "0.5200738", "0.5157306", "0.5135411", "0.5102347", "0.5083151", "0.5047014", "0.50278544", "0.50278544", "0.50207245", "0.5019525", "0.498...
0.650471
0
Instance Methods This must be overriden otherwise a stack error will occur
def get_update "Scheduled for disposition in #{fiscal_year(disposition_year)}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def overrides; end", "def custom; end", "def custom; end", "def internal; end", "def private_method\n end", "def initialize\n \n end", "def initialize\n super\n end", "def initialize\n super\n ...
[ "0.81206024", "0.7433605", "0.7433605", "0.7131736", "0.7077887", "0.7077887", "0.7049042", "0.6927309", "0.68313843", "0.6755908", "0.6755908", "0.6755908", "0.67526174", "0.67526174", "0.67130387", "0.66995394", "0.6672705", "0.6659637", "0.66464406", "0.66464406", "0.66464...
0.0
-1
Set resonable defaults for a new schedule disposition update event
def set_defaults super self.disposition_year ||= current_planning_year_year end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults\n super\n self.disposition_type ||= transam_asset.disposition_updates.last.try(:disposition_type)\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end", "def set_defaults\n if self.state.blank?\n self.state ||= :unsubmitted\n end\n if self.priori...
[ "0.6756056", "0.6198075", "0.6195358", "0.6011378", "0.59645414", "0.5936624", "0.5936624", "0.5924654", "0.58832496", "0.587119", "0.5857892", "0.5774789", "0.5774789", "0.5762118", "0.5725462", "0.56899446", "0.5659203", "0.5640756", "0.5635095", "0.5630209", "0.5629499", ...
0.6576574
1
GET /faqs GET /faqs.json
def index if params[:faqs] == 'active' @faqs = Helpdesk::Faq.roots.active render action: 'index' elsif params[:faqs] == 'inactive' @faqs = Helpdesk::Faq.inactive render action: 'inactive' else @faqs = Helpdesk::Faq.roots render action: 'index' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @faqs = Faq.all\n\n render json: @faqs\n end", "def index\n faqs = Faq.all\n json_response(faqs)\n end", "def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end", "def index\...
[ "0.7732165", "0.7640553", "0.70759785", "0.6900822", "0.6800585", "0.6800585", "0.66494685", "0.659629", "0.65596265", "0.64982325", "0.64765036", "0.63238734", "0.63238734", "0.6227685", "0.62221664", "0.6181443", "0.6171267", "0.61466366", "0.60860986", "0.60777515", "0.603...
0.60214424
21
GET /faqs/1 GET /faqs/1.json
def show @faq = Helpdesk::Faq.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @faq } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @faqs = Faq.all\n\n render json: @faqs\n end", "def index\n faqs = Faq.all\n json_response(faqs)\n end", "def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end", "def index\...
[ "0.7446974", "0.72393256", "0.6855255", "0.67025083", "0.6631856", "0.65555865", "0.65555865", "0.63668865", "0.6328317", "0.62225175", "0.6184599", "0.61820745", "0.6108334", "0.6003133", "0.5998208", "0.59977275", "0.5961989", "0.59587103", "0.59587103", "0.5955481", "0.594...
0.65490824
7
GET /faqs/new GET /faqs/new.json
def new @faq = Helpdesk::Faq.active.new if params[:faq] && params[:faq][:parent_id] @faq.parent_id = params[:faq][:parent_id] end respond_to do |format| format.html # new.html.erb format.json { render json: @faq } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end", "def new\n @qa = Qa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qa }\n end\n end", "def new\n...
[ "0.734708", "0.7067098", "0.6970919", "0.6949079", "0.6899515", "0.6851469", "0.6829886", "0.6829886", "0.6829886", "0.6829886", "0.6829886", "0.68217987", "0.6815922", "0.6791641", "0.6754286", "0.6752604", "0.6749751", "0.6735947", "0.6734344", "0.6720491", "0.6714116", "...
0.64218616
62
POST /faqs POST /faqs.json
def create @faq = Helpdesk::Faq.new(faq_params) respond_to do |format| if @faq.save format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully created.' } format.json { render json: @faq, status: :created, location: @faq } else format.html { render action: "new" } format.json { render json: @faq.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n faq = Faq.new(faqs_params)\n faq.created_by_id = @current_user.id\n \n if faq.save\n json_response(faq)\n else\n json_response({ message: faq.errors }, :unprocessable_entity)\n end\n end", "def create\n @faq = Faq.new(faq_params)\n\n if @faq.save\...
[ "0.70005", "0.6883594", "0.6463756", "0.6332136", "0.62378883", "0.622395", "0.6191667", "0.617251", "0.6150773", "0.6024217", "0.6011545", "0.59803087", "0.5953915", "0.59383136", "0.58961576", "0.58607256", "0.5843578", "0.58328074", "0.57954866", "0.57920384", "0.5748579",...
0.6218168
6
PUT /faqs/1 PUT /faqs/1.json
def update @faq = Helpdesk::Faq.find(params[:id]) respond_to do |format| if @faq.update_attributes(faq_params) format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @faq.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @faq.update(faqs_params)\n json_response(@faq)\n end", "def update_faq_using_put_with_http_info(faq, faq_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FAQApi.update_faq_using_put ...'\n end\n # verify the required ...
[ "0.7245404", "0.6496175", "0.633799", "0.627388", "0.60901546", "0.608596", "0.608596", "0.6078146", "0.6078146", "0.60516375", "0.6036375", "0.5939026", "0.59150714", "0.5889679", "0.5871437", "0.58273745", "0.58210176", "0.5818731", "0.5816156", "0.57945573", "0.57505107", ...
0.63020533
3
DELETE /faqs/1 DELETE /faqs/1.json
def destroy @faq = Helpdesk::Faq.find(params[:id]) @faq.destroy respond_to do |format| format.html { redirect_to admin_faqs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @faq = Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_faq.destroy\n respond_to do |format|\n format.html { redirect_to admin_faqs_ur...
[ "0.71004444", "0.68754107", "0.6869112", "0.6863694", "0.68629193", "0.68523794", "0.68523794", "0.67636675", "0.67228574", "0.67146635", "0.66786647", "0.6674779", "0.66706693", "0.6658279", "0.66508406", "0.66394943", "0.6626388", "0.6615939", "0.6615246", "0.65891176", "0....
0.7021236
1
GET /lookup_pettracers/1 GET /lookup_pettracers/1.xml
def show @lookup_pettracer = LookupPettracer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @lookup_pettracer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.617898", "0.6178828", "0.5629938", "0.56234324", "0.5599871", "0.55295986", "0.5497101", "0.5496962", "0.5491627", "0.5441498", "0.5411596", "0.5232296", "0.5232296", "0.51972854", "0.5173034", "0.51612353", "0.51506937", "0.51472586", "0.5144232", "0.5136531", "0.5100024"...
0.70403606
0
GET /lookup_pettracers/new GET /lookup_pettracers/new.xml
def new @lookup_pettracer = LookupPettracer.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @lookup_pettracer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer,...
[ "0.6986458", "0.6785958", "0.6715071", "0.663035", "0.6353197", "0.62890637", "0.6262899", "0.6211364", "0.6172767", "0.6135101", "0.61207235", "0.6089706", "0.60735816", "0.6056022", "0.6056022", "0.60174274", "0.5950391", "0.59489316", "0.59164035", "0.591276", "0.58937114"...
0.77304757
1
POST /lookup_pettracers POST /lookup_pettracers.xml
def create @lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer]) respond_to do |format| if @lookup_pettracer.save format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') } format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer } else format.html { render :action => "new" } format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @lookup_pettracer = LookupPettracer.new(lookup_pettracer_params)#params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :...
[ "0.66099983", "0.6114222", "0.61133844", "0.5912088", "0.5912088", "0.5796141", "0.5335628", "0.5335628", "0.518648", "0.5173311", "0.5116872", "0.4898803", "0.48800823", "0.48636475", "0.4845849", "0.4825261", "0.48101485", "0.48078805", "0.477831", "0.47346777", "0.472848",...
0.6679185
0
PUT /lookup_pettracers/1 PUT /lookup_pettracers/1.xml
def update @lookup_pettracer = LookupPettracer.find(params[:id]) respond_to do |format| if @lookup_pettracer.update_attributes(params[:lookup_pettracer]) format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n if @lookup_pettracer.update(lookup_pettracer_params)#params[:lookup_pettracer], :without_protection => true)\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully...
[ "0.6480511", "0.60778826", "0.5935224", "0.57746637", "0.57746637", "0.5695609", "0.5695609", "0.55353755", "0.55346435", "0.55152076", "0.55112356", "0.5393598", "0.5340134", "0.5339657", "0.53219825", "0.53199166", "0.52830756", "0.52445287", "0.5166773", "0.5159707", "0.51...
0.7107689
0
DELETE /lookup_pettracers/1 DELETE /lookup_pettracers/1.xml
def destroy @lookup_pettracer = LookupPettracer.find(params[:id]) @lookup_pettracer.destroy respond_to do |format| format.html { redirect_to(lookup_pettracers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|...
[ "0.65213794", "0.6422062", "0.63901067", "0.6331035", "0.624117", "0.62286836", "0.6227409", "0.6223926", "0.6162956", "0.6149925", "0.61464643", "0.6143414", "0.61240757", "0.61084324", "0.61003464", "0.6093439", "0.6068151", "0.6063949", "0.60539997", "0.6052828", "0.605142...
0.7397508
0
GET /vehicle_fines GET /vehicle_fines.json
def index @vehicle_fines = VehicleFine.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end", "def index\n @fines = Fine.all\n end", "def venue\n \t@events = Event.where(:venue => params[:venue])\n\n \trespond_to do |format|\n ...
[ "0.70188123", "0.62482", "0.5703264", "0.5691642", "0.56804585", "0.5654685", "0.5621919", "0.5603099", "0.5540101", "0.55395526", "0.54882604", "0.5485835", "0.546986", "0.54606533", "0.5452128", "0.54468244", "0.54337066", "0.5429024", "0.5425933", "0.54215693", "0.5420562"...
0.7248065
0
GET /vehicle_fines/1 GET /vehicle_fines/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @vehicle_fines = VehicleFine.all\n end", "def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end", "def index\n @fines = Fine.all\n end", "def show\n begin\n @vehicle...
[ "0.71918774", "0.65815866", "0.6152531", "0.6055051", "0.6003735", "0.59761447", "0.5952298", "0.5931807", "0.58920354", "0.5856093", "0.5841494", "0.5796567", "0.57765126", "0.57586837", "0.57129014", "0.5696446", "0.56385165", "0.5605099", "0.56039953", "0.55951726", "0.559...
0.0
-1
POST /vehicle_fines POST /vehicle_fines.json
def create @vehicle_fine = VehicleFine.new(vehicle_fine_params) respond_to do |format| if @vehicle_fine.save format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully created.' } format.json { render :show, status: :created, location: @vehicle_fine } else format.html { render :new } format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end", "def vehicle_fine_params\n params.require(:vehicle_fine).permit(:vehicle_id, :fine_id)\n end", "def index\n @vehicle_fines = Veh...
[ "0.66059697", "0.63605464", "0.6159991", "0.5707541", "0.5568644", "0.5464221", "0.54442924", "0.5434772", "0.5395799", "0.5382774", "0.5341945", "0.53278255", "0.53195584", "0.5309192", "0.5276832", "0.52435696", "0.52389073", "0.52357733", "0.52343714", "0.52343714", "0.523...
0.6491171
1
PATCH/PUT /vehicle_fines/1 PATCH/PUT /vehicle_fines/1.json
def update respond_to do |format| if @vehicle_fine.update(vehicle_fine_params) format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' } format.json { render :show, status: :ok, location: @vehicle_fine } else format.html { render :edit } format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n...
[ "0.6476595", "0.63793296", "0.6365856", "0.6321504", "0.63096505", "0.6265638", "0.6265638", "0.6163199", "0.6122666", "0.6122666", "0.6122666", "0.60961986", "0.60857534", "0.6013301", "0.599916", "0.59777886", "0.5956239", "0.59495074", "0.59427565", "0.5925206", "0.5907818...
0.6601508
0
DELETE /vehicle_fines/1 DELETE /vehicle_fines/1.json
def destroy @vehicle_fine.destroy respond_to do |format| format.html { redirect_to vehicle_fines_url, notice: 'Vehicle fine was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |forma...
[ "0.6989613", "0.69515395", "0.69515395", "0.69145066", "0.6827327", "0.6756159", "0.67259556", "0.6725226", "0.67032343", "0.6690313", "0.6686954", "0.6668574", "0.66641843", "0.66581887", "0.6649907", "0.6649907", "0.6628465", "0.66247714", "0.66247714", "0.66244024", "0.662...
0.7003625
0
Use callbacks to share common setup or constraints between actions.
def set_vehicle_fine @vehicle_fine = VehicleFine.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 vehicle_fine_params params.require(:vehicle_fine).permit(:vehicle_id, :fine_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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
GET /developers GET /developers.json
def index p 888888888888888 p params[:keyword] @developers = params[:keyword] ? Developer.where("name ilike ?","%#{params[:keyword]}%") : Developer.all respond_to do |format| format.js format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @developers = Developer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @developers }\n end\n end", "def developers\n self.sitemap\n self.follow('dtime:dashboard:developers')\n self.get\n self\n end", "def index\n...
[ "0.7118702", "0.6830076", "0.6715157", "0.6593458", "0.65402824", "0.65402824", "0.65402824", "0.65402824", "0.65402824", "0.65402824", "0.64019203", "0.63221776", "0.62486964", "0.62369716", "0.61708885", "0.61533433", "0.60906136", "0.6078302", "0.5995099", "0.5963012", "0....
0.0
-1
GET /developers/1 GET /developers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @developers = Developer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @developers }\n end\n end", "def show\n @developer = Developer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso...
[ "0.72456825", "0.6901353", "0.6870294", "0.67929643", "0.67489284", "0.67489284", "0.67489284", "0.67489284", "0.67489284", "0.67489284", "0.6597", "0.6539458", "0.64249945", "0.6401899", "0.6276624", "0.617692", "0.6144533", "0.61065406", "0.6101274", "0.60991246", "0.603267...
0.0
-1
POST /developers POST /developers.json
def create @developer = Developer.new(developer_params) respond_to do |format| if @developer.save format.js format.html { redirect_to root_path, notice: 'Developer was successfully created.' } format.json { render :show, status: :created, location: @developer } else format.html { render :new } format.json { render json: @developer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def developer_params\n params.require(:developer).permit(:name, :email, :url, :tags, :work_place, :code_name, :bio, :approval_status)\n end", "def developer_params\n params.require(:developer).permit(:name, :description, :logo_url, :adress, :avatar)\n end", "def developer_params\n params...
[ "0.64782524", "0.63745874", "0.6285211", "0.6276198", "0.6270781", "0.6187426", "0.6166327", "0.61359495", "0.60987705", "0.6067938", "0.6051768", "0.59969413", "0.5917255", "0.5886722", "0.58434904", "0.58331186", "0.581091", "0.5798161", "0.57804304", "0.577954", "0.5776980...
0.59060115
13
PATCH/PUT /developers/1 PATCH/PUT /developers/1.json
def update respond_to do |format| if @developer.update(developer_params) format.html { redirect_to @developer, notice: 'Developer was successfully updated.' } format.json { render :show, status: :ok, location: @developer } else format.html { render :edit } format.json { render json: @developer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch!\n request! :patch\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def ...
[ "0.6736037", "0.6707327", "0.6572162", "0.647133", "0.64539754", "0.6399965", "0.6283699", "0.6283699", "0.6269025", "0.62065923", "0.62028867", "0.61770177", "0.6161722", "0.6145099", "0.61281556", "0.61122376", "0.61122376", "0.60858244", "0.6064696", "0.60309666", "0.60252...
0.59859806
27
DELETE /developers/1 DELETE /developers/1.json
def destroy @row_id = "developer_#{@developer.id}" @developer.destroy respond_to do |format| format.js format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @developer = Developer.find(params[:id])\n @developer.destroy\n\n respond_to do |format|\n format.html { redirec...
[ "0.74475676", "0.74362314", "0.7360634", "0.72691184", "0.72691184", "0.72691184", "0.72691184", "0.71332335", "0.7109947", "0.7097219", "0.7097219", "0.7094356", "0.7094356", "0.7071335", "0.704793", "0.70362794", "0.7007513", "0.69891113", "0.68970907", "0.6877959", "0.6863...
0.6430789
76
Use callbacks to share common setup or constraints between actions.
def set_developer @developer = Developer.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 developer_params params.require(:developer).permit(:name, :manager) 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
output: string with first char of each word capped
def word_cap(str) str.split.each { |word| word.capitalize! }.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_of_word(a)\n return a.chars.first.join\nend", "def word_cap(str)\n new_words = \n str.downcase.split.map do |word|\n word[0] = (word[0].ord - 32).chr if word[0].ord.between?(97,122)\n word\n end\n new_words.join(\" \")\nend", "def create_index1(word)\n word.chars.sort!.join\n e...
[ "0.71904933", "0.71635", "0.69765633", "0.6968609", "0.6923813", "0.690993", "0.6891819", "0.6889737", "0.68699515", "0.68509454", "0.68150955", "0.68119955", "0.67886543", "0.6784134", "0.67813516", "0.6771816", "0.67648315", "0.6751634", "0.6749942", "0.67211217", "0.671965...
0.0
-1
now try a brute force one (can make it easier by downcasing whole thing first...)
def word_cap(str) words = str.split words.each do |word| word[0] = word[0].upcase word[1..-1] = word[1..-1].downcase end words.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_params(fonts)\n 1.upto(9) do |d|\n 2.times do\n 1.upto(999) do |u|\n 1.upto(999) do |v|\n if fonts.all? {|f| solve_identity(u, v, f + d) }\n table = fonts.map do |f|\n solve_identity(u, v, f + d).reverse\n end.transpose.flatten.map {|c| c.chr }.j...
[ "0.5606247", "0.5482669", "0.5463777", "0.5457702", "0.54504585", "0.54260767", "0.53929895", "0.538886", "0.53611475", "0.53606755", "0.53475887", "0.5345825", "0.53375375", "0.53059566", "0.5289501", "0.5274647", "0.5255167", "0.52535915", "0.5251702", "0.52515894", "0.5250...
0.0
-1
initializes data used in _sso.html.erb
def sso @xdcomm_uri = "#{my_addr}/#{app.name}/xdcomm" @logout_uri = "#{my_addr}/#{app.name}/logout?from_sso=1" @redirect_uri = api_args["redirect_uri"] @use_sso = !app.sso_server.nil? && @use_sso end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_data\n end", "def initialize\n super()\n init_data()\n end", "def initialize_data\n end", "def site_data; end", "def initialize\n @email_fld = {\"selector\" => :id, \"value\"=>\"email\"}\n @password_fld = {\"selector\" => :id, \"value\" => \"password\"}\n @login_btn =...
[ "0.65488935", "0.65121853", "0.63683546", "0.62603974", "0.60916585", "0.6052692", "0.60149044", "0.60111576", "0.597437", "0.592945", "0.592945", "0.592945", "0.592945", "0.592945", "0.592945", "0.592945", "0.592945", "0.59260744", "0.59232444", "0.5922576", "0.5894975", "...
0.0
-1
initializes data used in _backplane.html.erb
def backplane @use_backplane = @@use_backplane && app.backplane_server && app.backplane_bus && app.backplane_version @serverBaseURL = "https://#{app.backplane_server}/#{app.backplane_version}/" @busName = app.backplane_bus end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n super()\n init_data()\n end", "def init_data\n end", "def initialize_data\n end", "def prepare_data\n\t\t\tsuper\n\t\t\t@data[:tuneable_data] = @tuneable_data\n\t\t\t@data[:@lowest_old] = @lowest_old\n\t\tend", "def initialize()\n ...
[ "0.6786237", "0.66795194", "0.65281487", "0.6055044", "0.5886195", "0.5875435", "0.58595026", "0.58595026", "0.58595026", "0.58595026", "0.58595026", "0.58595026", "0.58595026", "0.58595026", "0.5842142", "0.5842142", "0.5839305", "0.5839305", "0.5839292", "0.5839292", "0.583...
0.0
-1
api_args, are args that can be used to construct queries in screen uris
def api_args return @api_args unless @api_args.blank? @api_args = settings.select_keys("client_id", "client_secret") @api_args["response_type"] = "code" uri = URI(my_addr) uri.path = "/#{app.name}/authCallback" @api_args["redirect_uri"] = uri.to_s @api_args["token"] = access_token if signed_in? @api_args["id"] = user_entity["id"].to_s if signed_in? return @api_args end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api(*args); end", "def set_api(*args); end", "def view_api_args\n render :json => api_args\n end", "def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n ...
[ "0.6849017", "0.6849017", "0.6754669", "0.64831704", "0.6350846", "0.6350846", "0.60725975", "0.60503054", "0.6039183", "0.5952092", "0.5833404", "0.5762942", "0.57573867", "0.57251745", "0.57068104", "0.5664376", "0.5655886", "0.56414324", "0.56414324", "0.5618756", "0.56087...
0.5825597
11
constructs a uri for a capture screen with the necesary params and embeds it in an iframe in the page.
def embed_screen(params = {}) @iframe_src = screen_uri(params) render "iframe" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def screen_uri(params = {}, sn = screen_name)\n uri = URI(\"https://\" + app.captureui_addr)\n uri.path = \"/oauth/#{sn}\"\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Butt...
[ "0.68570787", "0.57051253", "0.56397533", "0.54838306", "0.544183", "0.54017854", "0.53970087", "0.5389497", "0.53653485", "0.53134775", "0.53134775", "0.5308929", "0.52701604", "0.52701604", "0.52700263", "0.5243266", "0.52056426", "0.51905924", "0.51839465", "0.5167935", "0...
0.7436474
0
constructs the uri of a capture_screen from params
def screen_uri(params = {}, sn = screen_name) uri = URI("https://" + app.captureui_addr) uri.path = "/oauth/#{sn}" uri.query = URI.encode_www_form(params) uri.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square_uri\n square_params\n uri\n end", "def build_retrieve_url(args)\n url_type = args[type]\n url_device_id = args[device_id]\n url_sensor_type = args[sensot_type]\n url_retrieve_type = args[retrieve_type]\n\n complete_url = \"/data/#{url_type}/#{url_device_id}/#{...
[ "0.5898366", "0.5666568", "0.5663937", "0.55912805", "0.5581854", "0.5522475", "0.5512769", "0.5498587", "0.5417829", "0.53507", "0.5332685", "0.5330718", "0.5330597", "0.5329763", "0.5302307", "0.5286036", "0.52647424", "0.52646154", "0.5259118", "0.5256418", "0.5235528", ...
0.8084606
0
def client_id render :text => api_args["client_id"] end
def view_api_args render :json => api_args end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_id; end", "def client_id=(_arg0); end", "def clientid\n @obj['clientid']\n end", "def client_id\n super\n end", "def clientid\n @data['clientid'].to_i\n end", "def client_id\n @client_id\n end", "def client_id\n @client_id\n end", "def client_id=...
[ "0.75982255", "0.71889406", "0.70441616", "0.6901879", "0.6744241", "0.6731397", "0.6731397", "0.6730047", "0.6730047", "0.6722395", "0.66101027", "0.65980667", "0.65912783", "0.65839916", "0.6557157", "0.64711756", "0.6434851", "0.6426976", "0.6426976", "0.642261", "0.640444...
0.0
-1
these actions are for development
def list_apps render :text => app_configs.keys end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def development\r\n\r\n end", "def developer\n end", "def dev() end", "def actions; end", "def action_hook; end", "def run_actions; end", "def maintenance\n end", "def allow_production; end", "def before_dispatch(env); end", "def request_debug_assets?; end", "def request_debug_assets?; end", ...
[ "0.7686353", "0.6718021", "0.6708541", "0.6623451", "0.6393749", "0.6239733", "0.6166546", "0.6123369", "0.6102154", "0.60734874", "0.60734874", "0.60446393", "0.60446393", "0.60446393", "0.60446393", "0.60446393", "0.6026852", "0.5947523", "0.59231967", "0.5916279", "0.59083...
0.0
-1
not capture screens, but used for this app.
def logout sign_out # render :text => "single sign off" and return unless params["from_sso"].nil? redirect_to "#{my_addr}/#{app.name}/home" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classroom_app_force_unprompted_screen_observation\n return @classroom_app_force_unprompted_screen_observation\n end", "def no_recapture\n @recapture = false\n end", "def classroom_app_block_remote_screen_observation\n return @classroom_app_block_remote_scree...
[ "0.6292149", "0.6030954", "0.6015375", "0.5977784", "0.59771615", "0.59307766", "0.59307766", "0.5921016", "0.5921016", "0.5921016", "0.5919633", "0.59061325", "0.5898946", "0.5886099", "0.58118844", "0.57285357", "0.57271665", "0.57271665", "0.57000214", "0.5698981", "0.5690...
0.0
-1
required as described in documentation
def xdcomm render "xdcomm", :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def required; end", "def required; end", "def required; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def inform...
[ "0.80019647", "0.7208154", "0.7208154", "0.7208154", "0.70820856", "0.70820856", "0.70820856", "0.70820856", "0.69346887", "0.69346887", "0.69346887", "0.69346887", "0.6849503", "0.675782", "0.6680389", "0.66043264", "0.65863585", "0.65863585", "0.6540047", "0.651459", "0.650...
0.0
-1
handles oauth callback stuff from signin
def authCallback begin auth_code = params.fetch("code") rescue KeyError raise "error: no code param provided" end from_sso = params.fetch("from_sso", "0") == "1" origin = params["origin"] if params.key?("origin") redirect_uri_sso = URI(api_args["redirect_uri"]) redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| ["from_sso", "origin"].include? k}) redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args["redirect_uri"] password_reset = sign_in(auth_code, redirect_uri) if from_sso # we got here from sso, redirect to origin(the page where user entered # the site) redirect_to origin elsif password_reset # we got here from email password reset, redirect to change password redirect_to "/#{app.name}/profile_change_password" else # since we are in an iframe, reload the parent, not the current window, # otherwise we will get nesting. render :text => "<script>window.parent.location.reload()</script>" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end", "def signin\n oauth_authorize\n end", "def oauth_authentication; end", "def facebook\n handle_oauth\n end", "def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end", "def...
[ "0.77667075", "0.7513835", "0.7500759", "0.7400751", "0.73507404", "0.7308533", "0.717329", "0.70877194", "0.70413065", "0.7033294", "0.7020424", "0.7020424", "0.69426715", "0.69387007", "0.69151074", "0.6905451", "0.6883488", "0.6865838", "0.68639284", "0.6828978", "0.681921...
0.6782988
21
dispatcher is the action that get called for /:app_name/:screen_name routes. Turns screen into an action, and calls it. If it can't find an action it will remove suffixes until it can, or until it decides to call a generic handler. note that all actions will go through here, so rails will default to rendering /demo/dispatcher, which doesn't exist and will make for bad times. im so meta
def dispatcher screen = screen_name # continuosly remove tokens seperated by '_', starting from the end # until there are no more tokens, or we find one that we respond to begin if self.respond_to?(screen.to_sym) self.method(screen).call return end tokens = screen.split("_") screen = tokens.take(tokens.length - 1).join("_") end while screen != "" # even if we don't have an action for this screen, attempt to embed it. # if anything captureui will just 404 or complain. embed_screen end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatcher(session,context,dispatch_destination = nil)\n @myclass.Dispatcher.dispatch(session,context,dispatch_destination)\n end", "def dispatch_to(dispatcher)\n @jr_method_args.each { |args|\n # copy args so original is preserved\n handler_method, jr_methods =\n extract_...
[ "0.6072325", "0.5977636", "0.5609077", "0.55966645", "0.5523472", "0.5400321", "0.5369532", "0.5354395", "0.5312287", "0.5298134", "0.5272304", "0.524332", "0.5194301", "0.5178822", "0.5178822", "0.51294446", "0.50959474", "0.5073871", "0.5067447", "0.5044979", "0.5040055", ...
0.730287
0
these are shils for capture screens. they embed capture screens within an iframe in the page.
def signin embed_screen api_args.select_keys("redirect_uri", "client_id", "response_type") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_screen(params = {})\n @iframe_src = screen_uri(params)\n render \"iframe\"\n end", "def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Button\", \":Form.captureScreenButton_QPushButton\")\n screenCaptureBtn.click\n snooze 1\n S...
[ "0.68680793", "0.65823877", "0.6148493", "0.61085856", "0.61085856", "0.60696733", "0.5980833", "0.5979643", "0.5967544", "0.59474146", "0.59474146", "0.5915155", "0.5908444", "0.5866771", "0.5846596", "0.5846596", "0.57578295", "0.57227653", "0.56973493", "0.56903225", "0.56...
0.0
-1
Create n sample posts
def create_samples(n) n.times do |i| Post.create(title: "New Post #{i}", body: "Body of post #{i}", created_at: Time.now) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed_posts(count)\n (1..count).map do\n post = Post.create!(title: Faker::Lorem.words(number: rand(2..10)).join(' '),\n content: Faker::Lorem.paragraphs(number: rand(2..8)).join(' '),\n user: User.create!(login: Faker::Name.unique.last_name))\n ...
[ "0.7760789", "0.7468684", "0.71601", "0.6980279", "0.6676278", "0.6434332", "0.6426591", "0.63799375", "0.6373876", "0.6356503", "0.6356503", "0.6323924", "0.6311269", "0.62499684", "0.62360156", "0.62043643", "0.61530966", "0.61039674", "0.60942537", "0.59117395", "0.5889075...
0.8585263
0
Returns the information for all scans. Empty beds are filtered out.
def metadata(params) scanned_beds = params[:robot].reject { |_k, v| v.values.all?(&:blank?) } { "scanned" => scanned_beds } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_scans\n Item.scoped.each {|i|\n puts i.name\n i.scans.each {|x| puts \"\\t#{x}\"}\n puts \"\"\n }\n end", "def list_scans\n Item.scoped.each {|i|\n puts i.name\n i.scans.each {|x| puts \"\\t#{x}\"}\n puts \"\"\n }\n end", "def scan_list\n http_get(:uri=...
[ "0.664807", "0.664807", "0.6523927", "0.63976824", "0.62439317", "0.6159222", "0.5966648", "0.59597987", "0.5921369", "0.5921369", "0.58139735", "0.58065814", "0.57967055", "0.56971145", "0.56424934", "0.56110287", "0.56026167", "0.55651116", "0.5558006", "0.5555861", "0.5507...
0.5418284
23
param : String return : [ [ String, String or nil ], ... ]
def decode_from_percent_encoded_str( str ) str.split( '&', -1 ).map! do |s| if s.empty? [ '', nil ] else pair = s.split( '=', -1 ).map!{ |s| dec_perenc( s ) } # TODO: pair の要素数は 1 以上 2 以下 ('=' がない場合など, 1 個だけの場合もある) [ pair[0], pair[1] ] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_array(str)\n return [] if str.blank?\n return str.split(\",\").each{|t| t.strip!} if str.class == String\n return []\n end", "def string_to_arr(str)\n arr = str.split(\" \")\n arr_f = []\n \n for a in arr\n if a != \"\"\n arr_f.push(a.strip)\n end\n end\n ...
[ "0.65235347", "0.64403963", "0.6437402", "0.6347517", "0.6339965", "0.61768395", "0.61768395", "0.6174168", "0.61679107", "0.61393446", "0.6052927", "0.60481435", "0.603189", "0.60203284", "0.5992489", "0.59824854", "0.59697634", "0.590372", "0.5886214", "0.58853394", "0.5864...
0.0
-1
param : [ [ String, String or nil ], ... ] return : String
def encode_to_percent_encoded_str_pairs( str_pairs ) str_pairs.map do |pair| pair[1].nil? ? enc_perenc( pair[0] ) : enc_perenc( pair[0] ) + '=' + enc_perenc( pair[1] ) end.join( '&' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def musketeer *values\n values.join '' unless values.include? nil\n end", "def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\n end", "def not_so_tricky_method(string_param, array_p...
[ "0.64837927", "0.62587494", "0.62238455", "0.619185", "0.6151578", "0.6118093", "0.61119217", "0.61099756", "0.61044854", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068", "0.6092068"...
0.0
-1
GET /drawables GET /drawables.json
def index @drawables = Drawable.all respond_to do |format| format.html # index.html.erb format.json { render json: @drawables } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end", "def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { ...
[ "0.5707991", "0.56121224", "0.5445468", "0.54172033", "0.5362379", "0.53444016", "0.53135693", "0.52198774", "0.514454", "0.5032679", "0.5013118", "0.50037205", "0.49812412", "0.49798182", "0.49472016", "0.49451435", "0.49378833", "0.4908923", "0.48770866", "0.48752898", "0.4...
0.76883763
0
GET /drawables/1 GET /drawables/1.json
def show @drawable = Drawable.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @drawable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end", "def destroy\n @drawable = Drawable.find(param...
[ "0.7439337", "0.5921452", "0.5917683", "0.57408315", "0.5487863", "0.54113376", "0.526407", "0.5232786", "0.5197832", "0.5087014", "0.50849587", "0.5082376", "0.5079196", "0.50362116", "0.5022915", "0.5018479", "0.49898526", "0.49810594", "0.4975394", "0.49750707", "0.4960267...
0.6102062
1
GET /drawables/new GET /drawables/new.json
def new @drawable = Drawable.new respond_to do |format| format.html # new.html.erb format.json { render json: @drawable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @draw = Draw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draw }\n end\n end", "def new\n @drawing = Drawing.new\n\n render json: @drawing\n end", "def create\n @drawable = Drawable.new(params[:drawable])\n\n respond_to do ...
[ "0.66811454", "0.65393215", "0.6338831", "0.62122405", "0.5990946", "0.58282304", "0.57941514", "0.5732265", "0.57302177", "0.5720544", "0.57129544", "0.56501657", "0.5633856", "0.56319046", "0.5626325", "0.56226295", "0.56220925", "0.5618016", "0.5613935", "0.5610757", "0.56...
0.680307
0
POST /drawables POST /drawables.json
def create @drawable = Drawable.new(params[:drawable]) respond_to do |format| if @drawable.save format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' } format.json { render json: @drawable, status: :created, location: @drawable } else format.html { render action: "new" } format.json { render json: @drawable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end", "def create\n @drawing = Draw...
[ "0.6536369", "0.5879714", "0.57173353", "0.56031364", "0.55733466", "0.55604565", "0.5257709", "0.51588225", "0.5120784", "0.4947977", "0.49430686", "0.48951083", "0.48821902", "0.48548877", "0.48295486", "0.48210588", "0.47879502", "0.4786748", "0.478391", "0.47566026", "0.4...
0.59568775
1
PUT /drawables/1 PUT /drawables/1.json
def update @drawable = Drawable.find(params[:id]) respond_to do |format| if @drawable.update_attributes(params[:drawable]) format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @drawable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def update\n @drawing = Drawing.find(params[:id])\n\n if @drawing.update_attributes(params[:drawing])\n head :no_content\n els...
[ "0.5866623", "0.58017206", "0.5777124", "0.5737231", "0.5647263", "0.55356985", "0.5415297", "0.5352123", "0.5254152", "0.52277166", "0.5183401", "0.5179659", "0.5168513", "0.5163592", "0.5102437", "0.5083342", "0.50663334", "0.5063533", "0.5050877", "0.5048667", "0.50395226"...
0.64346766
0
DELETE /drawables/1 DELETE /drawables/1.json
def destroy @drawable = Drawable.find(params[:id]) @drawable.destroy respond_to do |format| format.html { redirect_to drawables_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @draw.destroy\n respond_to do |format|\n format.html { redirect_to draws_url, notice: '...
[ "0.6709174", "0.6492926", "0.6446323", "0.61876327", "0.60467523", "0.6036098", "0.59882545", "0.59378135", "0.5921157", "0.5892541", "0.58924985", "0.58770925", "0.58700407", "0.5868044", "0.58358884", "0.5828177", "0.5805022", "0.5800439", "0.5795041", "0.57838845", "0.5783...
0.76286787
0
Returns a new instance of ToyRobot and defines the table size
def initialize(table = Table.new([4, 4])) @table = table end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(width, height)\n @table = Table.new(width, height)\n @view = RobotView.new\n @robot = Robot.new(@table)\n end", "def initialize(height = AppConfig.default_height, width = AppConfig.default_width)\n @table = Table.new height, width\n end", "def initialize\n\t\t@table = Table.new\n\t...
[ "0.738519", "0.70830303", "0.6927399", "0.6586158", "0.6248693", "0.6159597", "0.5939875", "0.5938685", "0.5832788", "0.58148104", "0.58096623", "0.5726672", "0.5688979", "0.5686853", "0.568655", "0.55993795", "0.5580344", "0.55662566", "0.5490791", "0.54539376", "0.5451549",...
0.5807809
11
Puts the robot on a exact location and direction
def place(x, y, orientation) position(x, y, @table.size) self.direction = orientation.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @t...
[ "0.7324468", "0.72123486", "0.71226174", "0.70440006", "0.7043758", "0.70307237", "0.6988174", "0.6943922", "0.6907475", "0.6871157", "0.6867791", "0.68670845", "0.6858393", "0.68250793", "0.6812549", "0.6801973", "0.67897856", "0.6781105", "0.67726916", "0.6770284", "0.67311...
0.0
-1
Make the robot moves on the table
def move check_placement new_position = make_move(current_position, direction) position(new_position[0], new_position[1], @table.size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@d...
[ "0.764751", "0.7535064", "0.7361405", "0.73400754", "0.7291339", "0.72098935", "0.71584964", "0.7081699", "0.69641864", "0.69641644", "0.6940378", "0.6928104", "0.6926129", "0.6911971", "0.68632704", "0.6828963", "0.6812738", "0.6811055", "0.67697424", "0.6742795", "0.6724101...
0.73887944
2
Change the robot orientation to left
def left check_placement super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_left\n case @current_orientation\n when NORTH\n @current_orientation = WEST\n when SOUTH\n @current_orientation = EAST\n when EAST\n @current_orientation = NORTH\n when WEST\n @current_orientation = SOUTH\n else\n raise RuntimeError, \"Curre...
[ "0.7841995", "0.7748834", "0.7416586", "0.73719764", "0.73568475", "0.7235052", "0.7234698", "0.7129432", "0.7128901", "0.702351", "0.69879735", "0.6901461", "0.68688893", "0.6852996", "0.68012816", "0.6791054", "0.67578155", "0.67278564", "0.66836727", "0.6664468", "0.665698...
0.0
-1
Change the robot orientation to right
def right check_placement super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right\n case @current_orientation\n when NORTH\n @current_orientation = EAST\n when SOUTH\n @current_orientation = WEST\n when EAST\n @current_orientation = SOUTH\n when WEST\n @current_orientation = NORTH\n else\n raise RuntimeError, \"Curr...
[ "0.7942539", "0.782674", "0.7729831", "0.7446227", "0.7422933", "0.7371262", "0.73317474", "0.73234993", "0.7280098", "0.7143196", "0.6997991", "0.69667715", "0.69617736", "0.69457155", "0.69166434", "0.6860365", "0.6763772", "0.67596114", "0.67492354", "0.6694773", "0.665253...
0.0
-1
Reports the current robot position and direction
def report check_placement "#{x},#{y},#{direction}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\n\t\tputs \"My current location is (#{@x}, #{@y}) facing #{@robot_direction}.\"\n\tend", "def report_robot_details details\r\n\tprint(\"\\nCurrent position details\")\r\n\tprintf(\"\\nFORMAT : (X,Y) - Face Direction => (%d,%d) - %s\", details.x, details.y, DIRECTIONS[details.f])\r\nend", "def report...
[ "0.803053", "0.7412843", "0.73613125", "0.6972874", "0.69268864", "0.6819841", "0.67567635", "0.67005676", "0.65997297", "0.6572118", "0.6572118", "0.64463973", "0.64215946", "0.6386886", "0.62608427", "0.6224459", "0.61988735", "0.61793095", "0.61745423", "0.6173017", "0.615...
0.648183
11
Hash of initial attributes for :new, :create and :update actions. This is optional
def attributes_for(action) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end", "def creation_attributes\n ...
[ "0.72828543", "0.7228471", "0.72082424", "0.71196026", "0.7031325", "0.69217175", "0.69217175", "0.69217175", "0.68784016", "0.68784016", "0.6865404", "0.6861506", "0.68182206", "0.6758456", "0.6758456", "0.6758456", "0.6758456", "0.6758456", "0.6751411", "0.6666538", "0.6651...
0.0
-1
Create a new Quaternion
def initialize(a = 0, b = 0, c = 0, d = 0) @a = a unless a.nil? @b = b unless b.nil? @c = c unless c.nil? @d = d unless d.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_qt\n Qt::Quaternion.new(w, x, y, z)\n end", "def to_s\r\n \"Quaternion: axis: x #{axis.x} y #{axis.y} z #{axis.z} real #{real}\"\r\n end", "def % other\n if other.is_a? Quaternion\n raise \"invalid operation\"\n else\n Quaternion.new @t0%other, @t1%other, @t...
[ "0.6609356", "0.6067942", "0.6010836", "0.5893185", "0.5707647", "0.56866354", "0.5601761", "0.5553814", "0.55081373", "0.54702795", "0.5269312", "0.52210754", "0.52124554", "0.51892394", "0.5124108", "0.5040364", "0.4886151", "0.4883682", "0.4806269", "0.47952566", "0.475007...
0.0
-1
Returns a string representing _obj_.
def to_s return '0' if zero? format_number(@a, false) + sign_as_per(@b) + format_number(@b.abs) + 'i' + sign_as_per(@c) + format_number(@c.abs) + 'j' + sign_as_per(@d) + format_number(@d.abs) + 'k' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{@obj.getName}>\"\n end", "def to_s\n \"#<#{self.class.name}:#{object_id}...
[ "0.7897086", "0.7849092", "0.7577642", "0.7528425", "0.75139254", "0.73215187", "0.73002166", "0.73002166", "0.7273724", "0.7173728", "0.7171099", "0.71517575", "0.70949596", "0.70807034", "0.70685", "0.7067048", "0.70640725", "0.7045982", "0.6963688", "0.6837255", "0.6809143...
0.0
-1
Returns a string containing a humanreadable representation of _obj_.
def inspect "(#{self})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{@obj.getName}>\"\n end", "def format_object(obj)\n if obj.kind_of? Exception\n return \"Caught #{obj.class}: #{obj.message}\\n\\...
[ "0.7423372", "0.7420134", "0.7367416", "0.7285436", "0.7209587", "0.711324", "0.7067031", "0.70242876", "0.69852823", "0.69777095", "0.69775784", "0.69267505", "0.6894947", "0.6886218", "0.6886218", "0.68712807", "0.6715116", "0.6715116", "0.6715116", "0.6715116", "0.66884786...
0.0
-1
Returns the conjugate of _obj_ q which is the quaternion q = a b_i_ c_j_ d_k_.
def conjugate Quaternion.new(@a, -1 * @b, -1 * @c, -1 * @d) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conjugate\r\n quaternion.conjugate!\r\n end", "def conjugate\n\t\t\tself.class.new( -@elem[0], -@elem[1], -@elem[2], @elem[3] )\n\t\tend", "def conjugate\n Complex(@real, -@image)\n end", "def conjugate\n self\n end", "def conjugate!\r\n set(@axis.mirror,@real)\r\n end", "def ...
[ "0.71933794", "0.5804909", "0.5800573", "0.5717437", "0.5548184", "0.55300075", "0.5492936", "0.5445048", "0.54141617", "0.5387543", "0.53554666", "0.53186464", "0.52169544", "0.519719", "0.519719", "0.5138542", "0.5034089", "0.48333374", "0.4812672", "0.47285125", "0.4718216...
0.713598
1
Returns the norm of this Quaternion.
def norm Math.sqrt((@a**2) + (@b**2) + (@c**2) + (@d**2)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm\r\n (@real * @real) + @axis.modulus\r\n end", "def norm\n m = mag\n @x /= m\n @y /= m\n self\n end", "def norm\n Math::sqrt(data.values.inject(0) { |m,v| m+v**2})\n end", "def normalize\n self / self.norm\n end", "def normalize\n f = 1.0 / length\n ...
[ "0.7424701", "0.69205356", "0.6828851", "0.66731066", "0.6608091", "0.63745207", "0.6243272", "0.6227756", "0.6162305", "0.6065019", "0.5958431", "0.5948012", "0.58266836", "0.57888806", "0.57573503", "0.57524544", "0.5740608", "0.57361263", "0.5725177", "0.5651427", "0.56322...
0.70567596
1
Returns the versor of this Quaternion
def versor self / norm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rotation\n return @rotation\n end", "def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end", "def v4_3\n return @v4_3\n end", "def v4_0_3\n return @v4_0_3\n end", "def newton_version\...
[ "0.5861304", "0.58144236", "0.57364124", "0.56396675", "0.56191534", "0.5575057", "0.5555586", "0.5527554", "0.55040705", "0.5497734", "0.54316986", "0.5414937", "0.53658736", "0.5351508", "0.5323392", "0.5296935", "0.52861214", "0.5277911", "0.5277911", "0.52749354", "0.5260...
0.7034304
0
Check equality between this +Quaternion+ and _other_.
def ==(other) eql?(other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n @prev_out == other.prev_out &&\n @prev_out_index == other.prev_out_index &&\n @script_sig == other.script_sig &&\n @sequence == other.sequence\n end", "def ==(other)\n return false unless other.is_a?(Signature)\n r == other.r && s == other.s\n e...
[ "0.6957159", "0.6933347", "0.690714", "0.68919915", "0.68746436", "0.68746436", "0.67618036", "0.6752472", "0.6709065", "0.6693967", "0.6691978", "0.6659211", "0.6652678", "0.6637433", "0.6634698", "0.66251314", "0.66251314", "0.66087955", "0.66035426", "0.6589601", "0.657674...
0.0
-1
Add a new node to the start of the list
def prepend( value ) new_node = Node.new value # Whatever node was at the start of the list, it # is now the 'next' node for our newly created node new_node.next = @head # The new head of the list is set to be the new # node that we just created @head = new_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end", "def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign...
[ "0.73379487", "0.7329455", "0.73108834", "0.73108834", "0.73108834", "0.7293695", "0.7276967", "0.7273252", "0.72594947", "0.7253602", "0.7242728", "0.72347844", "0.7224525", "0.72144526", "0.7166542", "0.7166542", "0.71650815", "0.7162736", "0.7160902", "0.7158707", "0.71455...
0.7728383
1
prepend Add a new node to the end of the list
def append( value ) # Find the last node in this list # i.e. keep looking at the next node # until the next node is 'nil' node = @head while node.next node = node.next # kind of like incrementing the loop counter end # puts "End of loop:" # p node node.next = Node.new value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end", "def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n ne...
[ "0.82489604", "0.82410103", "0.82410103", "0.81375027", "0.8067547", "0.80228585", "0.8011651", "0.7995636", "0.7977105", "0.79767853", "0.7965512", "0.794785", "0.7929981", "0.7927346", "0.7926634", "0.79168195", "0.78590506", "0.78385437", "0.7833854", "0.78299326", "0.7806...
0.0
-1
append Return the last node in this list
def last node = @head while node.next node = node.next end node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end", "def add_last(data)\n @head.nil? ? @head = Node.new(data, @head) : add_last_helper(data, @head)\n end", "def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n e...
[ "0.76333445", "0.72190785", "0.7195643", "0.7189808", "0.71814615", "0.71620053", "0.71572375", "0.71486217", "0.71486217", "0.71486217", "0.7133261", "0.7070799", "0.7046044", "0.7032208", "0.6990088", "0.69867617", "0.6971533", "0.69511676", "0.6915157", "0.6881915", "0.685...
0.63768387
65
last Ruby will look for the 'to_s' method on any object you try to print using 'puts', and will run the method to get a printable string. In this way you can provide a clear output for your custom objects with weird internal structures.
def to_s output = '' node = @head while node.next output += node.value + ', ' node = node.next end output += node.value # last entry without dangling comma output # return the final string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print\n puts to_s\n end", "def to_s\n Printer.instance.print(self)\n end", "def to_s\r\n self.each do |r|\r\n puts r.each { |p| p }.join(\" \")\r\n end\r\n end", "def print\n Kernel.print(self)\n end", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def to_s\n ...
[ "0.78535944", "0.726828", "0.7250138", "0.7164556", "0.7060365", "0.70278555", "0.6999086", "0.69877875", "0.69877875", "0.69877875", "0.69877875", "0.69877875", "0.69158405", "0.689715", "0.68448645", "0.6844409", "0.6755981", "0.6731686", "0.67243606", "0.6713582", "0.66981...
0.0
-1
HOMEWORK! Implement the following methods:
def insert_after( node, value ) # Find the specified node, and add a new node # with the given value between that found node # and the next node = find node node_after = node.next node_inserted = Node.new value node.next = node_inserted node_inserted.next = node_after node_inserted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def schubert; end", "def probers; end", "def suivre; end", "def who_we_are\r\n end", "def zuruecksetzen()\n end", "def operations; end", "def operations; end", "def specie; end", "def specie; end", "def specie; end"...
[ "0.7975987", "0.76630944", "0.76630944", "0.74354887", "0.7211074", "0.7130097", "0.7059601", "0.69221073", "0.6912169", "0.6912169", "0.68951285", "0.68951285", "0.68951285", "0.68951285", "0.68256587", "0.6823467", "0.67611814", "0.67586416", "0.6726162", "0.6726162", "0.67...
0.0
-1
Preview this email at
def password_reset user = User.first user.reset_token = User.new_token UserMailer.password_reset(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
EZ_GLOBAL_VARIABLES = '/usr/local/ngseq/opt/EZ_GLOBAL_VARIABLES_DEMO.txt' compatible method to R vector, c(x,x,x)
def c(*list) list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_variables() end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_...
[ "0.57787293", "0.5437727", "0.53847665", "0.53415114", "0.52824944", "0.5281301", "0.5277103", "0.5256173", "0.524109", "0.5216734", "0.5202382", "0.51952016", "0.5193567", "0.519213", "0.51885235", "0.51804507", "0.5118744", "0.510987", "0.51084673", "0.5104509", "0.5092805"...
0.0
-1
Helper to set date values. Converts dates, in Date or String format, to a RDF::Literal.
def date_setter(name, d) case d.class.name when 'RDF::Literal::Date', 'NilClass' value = d when 'String' begin if d.empty? value = nil else value = ::RDF::Literal.new(Date.parse(d)) end rescue raise ArgumentError, "#{name} could not be converted to a date." end when 'Date', 'DateTime', 'Time' value = ::RDF::Literal.new(Date.parse(d.to_s)) else raise ArgumentError, "#{name} cannot be a #{d.class}." end set_value(name, value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_datetime\n ))\n end", "def set_date(*fields)\n fields.each do |field|\n next unless self.respond_to?(field) && self[field].is_a?(String)\n ...
[ "0.61408395", "0.6054538", "0.6045261", "0.6020434", "0.5935131", "0.5876302", "0.5873125", "0.5766013", "0.57497317", "0.5747136", "0.5747136", "0.5747136", "0.5747136", "0.5747136", "0.5747136", "0.5747136", "0.5725321", "0.57109386", "0.57109386", "0.57109386", "0.57109386...
0.7216855
0
override to add prefork captured coverage when someone asks for the results
def result original = super return original unless @capture_coverage CoverageCapture.merge_coverage(original, @capture_coverage) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coverage; end", "def coverage; end", "def start_coverage\n return unless sporkless? # Something funny about numbers right now under spork\n require 'simplecov'\nend", "def perform_coverage(options)\n unless @test_suite.nil?\n if options.illuminator.task.coverage #TODO: only if there are no cras...
[ "0.7429355", "0.7429355", "0.7261151", "0.65028083", "0.63773966", "0.6352008", "0.6264562", "0.60111326", "0.59743744", "0.593595", "0.5933165", "0.59013397", "0.585767", "0.5673992", "0.56510586", "0.5650351", "0.5645502", "0.5624903", "0.5613734", "0.56104046", "0.5599582"...
0.64188975
4
assuming b has same or more keys since it comes from a fork [nil,1,0] + [nil,nil,2] > [nil,1,2]
def merge_lines_coverage(a, b) b.each_with_index.map do |b_count, i| a_count = a[i] (a_count.nil? && b_count.nil?) ? nil : a_count.to_i + b_count.to_i end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing_nums(a,b)\n ahash = {}\n bhash = {}\n while i < a.size do\n if ahash.has_key?(a[i]) then\n ahash[a[i]] += 1\n else\n ahash[a[i]] = 1\n end\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n...
[ "0.6267201", "0.6113411", "0.5837487", "0.5693437", "0.5684041", "0.56149745", "0.5596037", "0.55826306", "0.5524331", "0.55197954", "0.55040365", "0.5498897", "0.5498897", "0.5475461", "0.5471344", "0.54435736", "0.54267", "0.54155016", "0.54134613", "0.54130995", "0.5410589...
0.0
-1
log runtime via dumping or curling it into the runtime log location
def record_test_runtime(mode, results, log) data = results.map { |test, time| "#{test}:#{time.round(2)}" }.join("\n") << "\n" case mode when 'simple' File.write(log, data) when 'amend' if id = ENV["BUILDKITE_JOB_ID"] slug = ENV.fetch("BUILDKITE_ORG_SLUG") + "-" + ENV.fetch("BUILDKITE_PIPELINE_SLUG") else slug = ENV.fetch("TRAVIS_REPO_SLUG").sub("/", "-") id = ENV.fetch("TRAVIS_BUILD_NUMBER") end url = "https://amend.herokuapp.com/amend/#{slug}-#{id}" require 'tempfile' Tempfile.open("runtime.log") do |f| f.write(data) f.close result = `curl -X POST --data-binary @#{f.path} #{url}` puts "amended runtime log\ncurl #{url} | sort > #{log}\nStatus: #{$?.success?}\nResponse: #{result}" end else raise "Unsupported record-runtime flag: #{mode}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end", "def debug_log(msg)\n Chef::Log.info(\"easybib_deploy_manager: #{msg}\")\nend", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end"...
[ "0.66599214", "0.62891406", "0.62763715", "0.62763715", "0.62763715", "0.62763715", "0.62763715", "0.62763715", "0.62763715", "0.62763715", "0.6120447", "0.6100217", "0.60659903", "0.59829795", "0.59028375", "0.58917505", "0.58807623", "0.5876165", "0.5876165", "0.5829135", "...
0.63583314
1
This forces Rails to load all fixtures, then prevents it from "deleting and reinserting all fixtures" when a new connection is used (forked).
def preload_fixtures return if @options.fetch(:no_fixtures) fixtures = (ActiveSupport::VERSION::MAJOR == 3 ? ActiveRecord::Fixtures : ActiveRecord::FixtureSet) # reuse our pre-loaded fixtures even if we have a different connection fixtures_eigenclass = class << fixtures; self; end fixtures_eigenclass.send(:define_method, :cache_for_connection) do |_connection| fixtures.class_variable_get(:@@all_cached_fixtures)[:unique] end ActiveSupport::TestCase.fixtures :all fixtures.create_fixtures( ActiveSupport::TestCase.fixture_path, ActiveSupport::TestCase.fixture_table_names, ActiveSupport::TestCase.fixture_class_names ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_fixtures\n # fixtures = ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(File.dirname(__FILE__), 'test', 'fixtures', '*.{yml,csv}')) \n fixtures = [ 'active_sources', 'semantic_relations', 'semantic_properties' 'data_records']\n fixtures.reverse.each { |f| ActiveReco...
[ "0.7689433", "0.7288067", "0.721409", "0.7108288", "0.69748354", "0.6583475", "0.6563983", "0.6537219", "0.6426591", "0.6383931", "0.62575036", "0.6167778", "0.6166913", "0.6128", "0.6100864", "0.59841317", "0.59573853", "0.5943862", "0.5943862", "0.5937712", "0.58950555", ...
0.7744954
0
don't let minitest setup another exit hook
def disable_test_autorun toggle_test_autorun false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_skipping_test()\n Process.exit 99\nend", "def set_exit_exception; end", "def assert_clean_exit\n assert(0 == exit_status)\n end", "def assert_no_clean_exit\n assert(0 != exit_status)\n end", "def coolest_exit\n Kernel.exit! 99\n end", "def exit_hook\n # Avoid hook...
[ "0.74580383", "0.71610457", "0.7152282", "0.71249247", "0.70512414", "0.7000419", "0.69370043", "0.6891331", "0.68888855", "0.6787687", "0.677607", "0.6635127", "0.66083074", "0.6604842", "0.6604842", "0.65952295", "0.6541772", "0.65209746", "0.65112644", "0.64879537", "0.648...
0.0
-1
we remove the args we understand and leave the rest alone so minitest / rspec can read their own options (seed / v ...) keep our options clear / unambiguous to avoid overriding read all serial nonflag arguments as tests and leave only unknown options behind use .fetch everywhere to make sure nothing is misspelled GOOD: test ours theirs OK: ours test theirs BAD: theirs test ours
def parse_options(argv) arguments = [ [:rspec, "--rspec", "RSpec mode"], [:helper, "--helper", "Helper file to load before tests start", String], [:quiet, "--quiet", "Quiet"], [:no_fixtures, "--no-fixtures", "Do not load fixtures"], [:no_ar, "--no-ar", "Disable ActiveRecord logic"], [:merge_coverage, "--merge-coverage", "Merge base code coverage into indvidual files coverage, great for SingleCov"], [ :record_runtime, "--record-runtime=MODE", "\n Record test runtime:\n" << " simple = write to disk at --runtime-log)\n" << " amend = write from multiple remote workers via http://github.com/grosser/amend, needs TRAVIS_REPO_SLUG & TRAVIS_BUILD_NUMBER", String ], [:runtime_log, "--runtime-log=FILE", "File to store runtime log in or runtime.log", String], [:group, "--group=NUM", "What group this is (use with --groups / starts at 1)", Integer], [:groups, "--groups=NUM", "How many groups there are in total (use with --group)", Integer], [:version, "--version", "Show version"], [:help, "--help", "Show help"] ] options = arguments.each_with_object({}) do |(setting, flag, _, type), all| all[setting] = delete_argv(flag.split('=', 2)[0], argv, type: type) end # show version if options.fetch(:version) puts VERSION exit 0 end # # show help if options[:help] parser = OptionParser.new("forking-test-runner folder [options]", 32, '') do |opts| arguments.each do |_, flag, desc, type| opts.on(flag, desc, type) end end puts parser exit 0 end # check if we can use merge_coverage if options.fetch(:merge_coverage) require 'coverage' abort "merge_coverage does not work on Ruby prior to 2.3 due to the lack of the Coverage.peek_result method" unless Coverage.method_defined?(:peek_result) klass = (class << Coverage; self; end) klass.prepend CoverageCapture end # all remaining non-flag options until the next flag must be tests next_flag = argv.index { |arg| arg.start_with?("-") } || argv.size tests = argv.slice!(0, next_flag) abort "No tests or folders found in arguments" if tests.empty? tests.each { |t| abort "Unable to find #{t}" unless File.exist?(t) } [options, tests] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the s...
[ "0.6082498", "0.5994887", "0.5934016", "0.59327596", "0.5926534", "0.5926534", "0.59179205", "0.59142536", "0.5908598", "0.5906967", "0.58827066", "0.5803615", "0.57876045", "0.57618517", "0.57618517", "0.57618517", "0.57618517", "0.57618517", "0.57618517", "0.5746898", "0.57...
0.54406285
71
this user aswell we create by hand because of the custom sign up method for the polimorphic association. the rest of the data such as email, password, etc for the user is handled by devise controllers
def create build_resource(sign_up_params) @student = Student.new # students params @student.first_name = params[:first_name] @student.last_name = params[:last_name] @student.last_m_name = params[:last_m_name] @student.udg_code = params[:udg_code] @student.born_date = params[:born_date] @student.academic_level = params[:academic_level] @student.terms_of_service = params[:terms_of_service] #assigning the enum data if params[:genre] == "masculino" @student.genre = 0 else @student.genre = 1 end if params[:civil_status] == "soltero" @student.civil_status = 0 elsif params[:civil_status] == "casado" @student.civil_status = 1 elsif params[:civil_status ] == "viudo" @student.civil_status = 2 else @student.civil_status =3 end if @student.save resource.roleable = @student resource.save yield resource if block_given? if resource.persisted? if resource.active_for_authentication? set_flash_message! :notice, :signed_up sign_up(resource_name, resource) respond_with resource, location: after_sign_up_path_for(resource) else set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}" expire_data_after_sign_in! respond_with resource, location: after_inactive_sign_up_path_for(resource) end else clean_up_passwords resource set_minimum_password_length respond_with resource end else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new(params[:user])\n if current_user \n @user.update_attributes(:organisation_id => current_user.organisation_id)\n end\n #if @user.save\n #if session[:omniauth]\n\t#@user.authentications.create!(:provider => session[:omniauth]['provider'], :uid => session[:omniauth]...
[ "0.7395851", "0.7247467", "0.71626556", "0.7139672", "0.7113497", "0.70984936", "0.70888823", "0.70888823", "0.7039201", "0.70281327", "0.70087355", "0.69871736", "0.69728005", "0.6933284", "0.6915741", "0.6902796", "0.689676", "0.68957406", "0.68957406", "0.68770015", "0.686...
0.0
-1
Given a range of numbers, print every number between them except put fizz if it is divisible by 3, buzz if it's divisible by 5 and fizzbuzz if divisible by both Input 2 numbers Output Printout of strings and integers Rules Print out "Fizz" if divisible by 3 Print out "Buzz" if divisible by 5 Print out "FizzBuzz" if divisible by 15 Print out integer otherwise Example fizzbuzz(1, 15) > 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz
def fizzbuzz(num1,num2) for i in num1..num2 do if i%15 == 0 puts "FizzBuzz" elsif i%3 == 0 puts "Fizz" elsif i%5 == 0 puts "Buzz" else puts i end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz(num_1, num_2, range)\n # starts a counter from 1 to range value\n # for each in that range, print the specified output on\n # these next conditions:\n (1..range).each do |i|\n\n # if the next number in the counter is divisible\n # by both num1 and num2 (with 0 remainder)\n if i % num_1 ==...
[ "0.82603306", "0.82559174", "0.8235474", "0.82354546", "0.82118964", "0.8210945", "0.8187753", "0.8174899", "0.81746626", "0.81545216", "0.8144926", "0.8142883", "0.8117165", "0.8104457", "0.8094259", "0.8066383", "0.80643237", "0.8062092", "0.8054983", "0.805326", "0.8025470...
0.82012075
6
GET /discussions GET /discussions.json
def frontpage @users = User.order(karma: :desc).limit(5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end", "def index\n @discussions = Discussion.all\n end", "def index\n @discussions = Discussion.all\n end", "def index\n @discussions = @issue.discussions.all\n end", "def index\n ...
[ "0.8178684", "0.7578467", "0.7578467", "0.7574891", "0.7510708", "0.7504164", "0.7442654", "0.7403548", "0.7198004", "0.717403", "0.70452297", "0.70417637", "0.702059", "0.69400394", "0.69400394", "0.69400394", "0.6928606", "0.68670267", "0.6846973", "0.6844735", "0.67892504"...
0.0
-1
GET /discussions/1 GET /discussions/1.json
def show @discussion = Discussion.find_by(id: params[:id]) @comment = Comment.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end", "def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end", "...
[ "0.78855824", "0.764879", "0.7442033", "0.741649", "0.741649", "0.741649", "0.73295057", "0.73295057", "0.73012006", "0.72252136", "0.7183044", "0.71306515", "0.71094894", "0.7100332", "0.709193", "0.7090734", "0.70024735", "0.6940598", "0.6940598", "0.69377434", "0.6900812",...
0.69655836
17
GET /discussions/1/edit POST /discussions POST /discussions.json
def create @discussion = current_user.discussions.build(discussion_params) # assigns user_id to first comment when creating discussion for comment in @discussion.comments comment.user_id = current_user.id end if @discussion.save redirect_to category_path(@discussion.category_id) flash[:success] = "Discussion was successfully created." else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { head :ok }\n else\n format.html {...
[ "0.74226654", "0.73993945", "0.73835903", "0.72817284", "0.72817284", "0.72817284", "0.7136127", "0.7121069", "0.7017703", "0.7002519", "0.696721", "0.6902926", "0.6845264", "0.6845264", "0.68330467", "0.68316424", "0.6826424", "0.6790943", "0.67702574", "0.6750189", "0.67501...
0.0
-1
PATCH/PUT /discussions/1 PATCH/PUT /discussions/1.json DELETE /discussions/1 DELETE /discussions/1.json
def destroy @discussion.destroy flash[:success] = "Discussion was successfully deleted." redirect_to discussions_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_t...
[ "0.71458375", "0.7107177", "0.7017333", "0.6907177", "0.6907177", "0.6907177", "0.6907177", "0.6887747", "0.6833005", "0.6791768", "0.6733276", "0.6733173", "0.67007315", "0.6672481", "0.6672481", "0.6672481", "0.6581577", "0.65767634", "0.6569762", "0.6559188", "0.65583247",...
0.6385715
26
Use callbacks to share common setup or constraints between actions.
def set_discussion @discussion = Discussion.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 discussion_params params.require(:discussion).permit(:id, :user_id, :category_id, comments_attributes: [:body, :discussion_id, :user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
Replace this with your real tests.
def test_truth assert true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7444841", "0.6954491", "0.6913394", "0.6913394", "0.6863823", "0.6863823", "0.66389537", "0.66389537", "0.66238844", "0.6545616", "0.6523148", "0.64830077", "0.64830077", "0.64830077", "0.6406177", "0.6389718", "0.6389718", "0.6389718", "0.6389718", "0.6389718", "0.6389718...
0.0
-1
GET /voxels GET /voxels.json
def index @voxels = Voxel.find(:all, :order => 'created_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def index\n @venues = Venue.all\n\n respond_...
[ "0.6757858", "0.65102774", "0.6476249", "0.6476249", "0.64666194", "0.64484835", "0.6426593", "0.6396732", "0.6396434", "0.63778955", "0.6373501", "0.63711417", "0.636001", "0.6314642", "0.6304709", "0.62653047", "0.6247005", "0.6240893", "0.62278944", "0.6224991", "0.6214654...
0.62513626
16
GET /voxels/1 GET /voxels/1.json
def show @auto_rotate = true @method = 'show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end", "def show\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { re...
[ "0.6820424", "0.6738501", "0.671494", "0.66128075", "0.6539147", "0.65020144", "0.6498369", "0.6437586", "0.6426292", "0.6378908", "0.6376608", "0.6372474", "0.63563097", "0.6349099", "0.63385314", "0.63286555", "0.63024735", "0.63024735", "0.62728345", "0.6269416", "0.626653...
0.0
-1
POST /voxels POST /voxels.json
def create @method = 'create' @voxel = Voxel.new(voxel_params) respond_to do |format| if @voxel.save flash[:notice] = '作成されました!' format.html { redirect_to action: 'index' } format.json { render action: 'show', status: :created, location: @voxel } else format.html { render action: 'new' } format.json { render json: @voxel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @voxel = Voxel.new(params[:voxel])\n \n respond_to do |format|\n if @voxel.save\n format.html { redirect_to @voxel, notice: 'Voxel was successfully created.' }\n format.json { render json: @voxel, status: :created, location: @voxel }\n else\n format....
[ "0.5641265", "0.56377167", "0.5620466", "0.5576917", "0.5454755", "0.54493076", "0.54357016", "0.5418508", "0.5385171", "0.5365114", "0.5326564", "0.53097767", "0.53066945", "0.53062725", "0.52811444", "0.526124", "0.52591765", "0.5254248", "0.52470416", "0.5246799", "0.52428...
0.5674255
0