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
List all followers for given relation and klass Example:
def all_followers(relation = "follow", klass = nil) all = followers.by_relation(relation) all = all.by_follower(klass) if klass all.collect do |f| f.follower end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_followees(relation = \"follow\", klass = nil)\n all = followees.by_relation(relation)\n all = all.by_followee(klass) if klass\n\n all.collect do |f|\n f.followee\n end\n end", "def followers\n rels = Relationship.where(followed_id: self.id)\n followers = []\n rels.e...
[ "0.7883443", "0.78079844", "0.75051934", "0.74827176", "0.7481335", "0.7407933", "0.74035126", "0.7331386", "0.73299897", "0.72979987", "0.7272985", "0.71962166", "0.7163347", "0.7163107", "0.713366", "0.71185285", "0.7101758", "0.7097817", "0.70723075", "0.70720774", "0.7057...
0.8177211
0
unfollow by each follower
def reset_followers Follow.where(:follower_id => self.id, follower_type: self.class.name).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfollow! followee\n return if !following? followee\n following_ids.delete(followee.id)\n save\n followee.followers_ids.delete(id)\n followee.save\n end", "def unfollow(user)\n user.followers.delete(self)\n end", "def unfollow! followee\n following_ids.delete(followee.id)\n save\n...
[ "0.827699", "0.8247813", "0.8224253", "0.81958354", "0.81908697", "0.81908697", "0.8024915", "0.7970082", "0.7963606", "0.7941239", "0.78567624", "0.7855578", "0.7822904", "0.7822904", "0.7822904", "0.7822904", "0.7822904", "0.7790724", "0.7789298", "0.7770606", "0.7764208", ...
0.73705983
47
GET /career_stats GET /career_stats.json
def index @career_stats = CareerStat.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @careers = Career.all\n json_response(@careers)\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n Client.current.get(\"#{resource_url}/stats\")\n end", "def stats\n @stats = {\n total_distance:...
[ "0.6976194", "0.6885773", "0.6885773", "0.6863416", "0.6439294", "0.64146954", "0.6401988", "0.63837963", "0.63720113", "0.6369628", "0.63495064", "0.62762195", "0.6269819", "0.61878586", "0.6187181", "0.61848164", "0.6172739", "0.61130387", "0.6098936", "0.6098936", "0.60937...
0.7566693
0
GET /career_stats/1 GET /career_stats/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @career_stats = CareerStat.all\n end", "def index\n @careers = Career.all\n json_response(@careers)\n end", "def stats\n Client.current.get(\"#{resource_url}/stats\")\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n request :get, \"_stats\"\n ...
[ "0.74190724", "0.69373804", "0.66394687", "0.6631773", "0.6631773", "0.6441854", "0.6409762", "0.63964355", "0.63964355", "0.6299451", "0.62745184", "0.6243656", "0.61612636", "0.61497194", "0.61032367", "0.6081625", "0.60584855", "0.6027402", "0.6025741", "0.6022297", "0.601...
0.0
-1
POST /career_stats POST /career_stats.json
def create @career_stat = CareerStat.new(career_stat_params) respond_to do |format| if @career_stat.save format.html { redirect_to @career_stat, notice: 'Career stat was successfully created.' } format.json { render :show, status: :created, location: @career_stat } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @career_stats = CareerStat.all\n end", "def create\n @careers = Career.create!(career_params)\n json_response(@careers, :created)\n end", "def index\n @careers = Career.all\n json_response(@careers)\n end", "def view_stats\n @company = Company.find(params[:id])\n data = {\...
[ "0.65400195", "0.6383909", "0.6072345", "0.581524", "0.5766812", "0.5717711", "0.568553", "0.5577239", "0.5530806", "0.5527323", "0.5497104", "0.5497104", "0.5470477", "0.5465942", "0.5458442", "0.54370207", "0.54284817", "0.5409412", "0.5402594", "0.5394647", "0.5386956", ...
0.66670704
0
PATCH/PUT /career_stats/1 PATCH/PUT /career_stats/1.json
def update respond_to do |format| if @career_stat.update(career_stat_params) format.html { redirect_to @career_stat, notice: 'Career stat was successfully updated.' } format.json { render :show, status: :ok, location: @career_stat } else format.html { render :edit } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @career.update(career_params)\n head :no_content\n end", "def update\n @stat = Stat.find(params[:id])\n\n if @stat.update(stat_params)\n head :no_content\n else\n render json: @stat.errors, status: :unprocessable_entity\n end\n end", "def update\n @supermarket = Su...
[ "0.6691345", "0.6245142", "0.61354935", "0.6045831", "0.6044622", "0.60299426", "0.6019691", "0.60181135", "0.60110414", "0.59514", "0.59486955", "0.593965", "0.59179044", "0.591122", "0.59109545", "0.59075785", "0.59073323", "0.5906655", "0.5895336", "0.5892987", "0.58909947...
0.69564015
0
DELETE /career_stats/1 DELETE /career_stats/1.json
def destroy @career_stat.destroy respond_to do |format| format.html { redirect_to career_stats_url, notice: 'Career stat was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n...
[ "0.70248127", "0.70227915", "0.7003158", "0.6995332", "0.69613284", "0.6957096", "0.69364315", "0.6935587", "0.6916065", "0.6901785", "0.689394", "0.6881072", "0.6881072", "0.6881072", "0.6881072", "0.6881072", "0.68528044", "0.681881", "0.6811564", "0.67976993", "0.6792328",...
0.76511693
0
Use callbacks to share common setup or constraints between actions.
def set_career_stat @career_stat = CareerStat.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 career_stat_params params.require(:career_stat).permit(:team_id, :reg_wins, :reg_losses, :pts_for, :pts_against, :moves, :playoff_appearances, :playoffs_wins, :playoffs_losses, :integer, :championship_appearances, :championship_wins, :championship_losses) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
GET /product_types GET /product_types.json
def index if params[:category_id].nil? @product_types = ProductType.all.order(:name) else @product_types = Category.find(params[:category_id]).product_type.order(:name) @category_id = params[:category_id] end @categories = Category.all.order(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end", "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.j...
[ "0.77233833", "0.7699279", "0.76065946", "0.75507283", "0.7538409", "0.71487176", "0.7083431", "0.69384736", "0.68566054", "0.6840068", "0.6787345", "0.67583835", "0.67381525", "0.67021465", "0.6652509", "0.663758", "0.66269875", "0.65170306", "0.64956784", "0.64936906", "0.6...
0.5940678
69
GET /product_types/1 GET /product_types/1.json
def show @category_id = params[:category_id] @categories_associated = @product_type.category end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end", "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.j...
[ "0.76372427", "0.7617357", "0.74568474", "0.7440766", "0.73846847", "0.73604286", "0.7301483", "0.7072415", "0.705117", "0.7023963", "0.6955693", "0.68639433", "0.6745634", "0.6605813", "0.65856606", "0.65725195", "0.6514445", "0.65130043", "0.6504068", "0.64963543", "0.64720...
0.0
-1
POST /product_types POST /product_types.json
def create @product_type = ProductType.new(product_type_params) respond_to do |format| if @product_type.save if !@categories = params[:product_types].nil? @categories = params[:product_types][:categories] save_relation_with_categories(@categories, nil) end @ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if ! canedit\n redirect_to :action => 'list'\n end\n @product_type = ProductType.new(params[:product_type])\n product = Product.find(params[:product_type][:product_id])\n @product_type.product = product\n product.save\n\n respond_to do |format|\n if @product_type.save\n ...
[ "0.7164354", "0.7007592", "0.69240916", "0.68908906", "0.6832485", "0.6818725", "0.6738141", "0.6625846", "0.6607881", "0.6548828", "0.65436435", "0.646686", "0.6427174", "0.64024943", "0.634868", "0.63476217", "0.6211464", "0.61950874", "0.61807305", "0.6168835", "0.6160017"...
0.6816006
6
PATCH/PUT /product_types/1 PATCH/PUT /product_types/1.json
def update respond_to do |format| if @product_type.update(product_type_params) if params[:product_types].nil? destroy_relations_with_categories @product_type.id else @categories_saved = CategoryProductType.get_relations @product_type.id p @categories_sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @product_type.update(product_type_params)\n format.html { redirect_to @product_type, notice: 'Product type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json {...
[ "0.7181658", "0.7157095", "0.71432626", "0.7055656", "0.704366", "0.70212775", "0.6949405", "0.6948898", "0.6763843", "0.6478165", "0.6295271", "0.6292913", "0.6272565", "0.6271166", "0.6255363", "0.62358034", "0.62358034", "0.619792", "0.61977744", "0.6197254", "0.61788225",...
0.6434951
10
DELETE /product_types/1 DELETE /product_types/1.json
def destroy destroy_relations_with_categories @product_type.id @product_type.destroy @category_id = session[:category_id] session[:category_id] = nil redirect_to product_types_path(:category_id => @category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @producttype = Producttype.find(params[:id])\n @producttype.destroy\n\n respond_to do |format|\n format.html { redirect_to producttypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @products_type.destroy\n respond_to do |format|\n format.ht...
[ "0.77534527", "0.7544088", "0.74977875", "0.73753077", "0.7330673", "0.7117884", "0.71030974", "0.70923364", "0.708528", "0.70670265", "0.70428026", "0.69700503", "0.6932586", "0.69159067", "0.6895105", "0.6890019", "0.6871836", "0.68713593", "0.68383384", "0.68292564", "0.68...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_product_type @product_type = ProductType.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 product_type_params params.require(:product_type).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /stops/new GET /stops/new.xml
def new @stop = Stop.new() if params[:date] @stop.date = params[:date].to_date @stop.location_id = params[:loc] @stop.window_id = params[:win] if @stop.save flash[:notice] = 'Stop was successfully created.' redirect_to('/admin/schedule') end else respond_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @stop = Stop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stop }\n end\n end", "def new\n @stoppage = Stoppage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stoppage }\n e...
[ "0.7189926", "0.6847059", "0.6728251", "0.66952896", "0.6682151", "0.66460174", "0.66460174", "0.6645371", "0.6645371", "0.6642912", "0.66223884", "0.6606153", "0.6606153", "0.6606153", "0.6573957", "0.6569111", "0.6567935", "0.65630114", "0.6530079", "0.65230775", "0.6516368...
0.0
-1
POST /stops POST /stops.xml
def create @stop = Stop.new(params[:stop]) respond_to do |format| if @stop.save flash[:notice] = 'Stop was successfully created.' format.html { redirect_to('/admin/schedule') } format.xml { render :xml => @stop, :status => :created, :location => @stop } else for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stops\n get '/gtfs/stops'\n end", "def create\n @stop = @trip.stops.new(stop_params)\n\n respond_to do |format|\n if @stop.save\n format.html { redirect_to trip_path(@trip), notice: 'Stop was successfully created.' }\n format.json { render :show, status: :created, location: @...
[ "0.66273254", "0.6462691", "0.6293397", "0.6293397", "0.6212631", "0.616559", "0.60894954", "0.6087659", "0.58480984", "0.58157337", "0.57390714", "0.5712861", "0.56713325", "0.5661678", "0.5650368", "0.56486374", "0.5645389", "0.56212974", "0.56120366", "0.55732214", "0.5522...
0.6237231
4
PUT /stops/1 PUT /stops/1.xml
def update @stop = Stop.find(params[:id]) # truck = Truck.find(params[:assignment][:truck]) # driver = Driver.find(params[:assignment][:driver]) respond_to do |format| if @stop.update_attributes(params[:stop]) # if params['stop_assignment'] == 'on' # Assi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @stop.update_attributes(params[:stop])\n render 'api/v1/stops/show'\n else\n render 'api/v1/stops/show', status: :unprocessable_entity\n end\n end", "def update\n @stop = Stop.find(params[:id])\n\n respond_to do |format|\n if @stop.update_attributes(params[:stop])\n...
[ "0.6427789", "0.63684076", "0.6367981", "0.63396776", "0.61248034", "0.60541475", "0.6008969", "0.60000867", "0.5870035", "0.58521205", "0.5736997", "0.56691635", "0.5663527", "0.55944055", "0.5550184", "0.54832023", "0.54571795", "0.54446137", "0.54323846", "0.5431591", "0.5...
0.56376296
13
DELETE /stops/1 DELETE /stops/1.xml
def destroy @stop = Stop.find(params[:id]) @stop.destroy respond_to do |format| format.html { format.html { redirect_to('/admin/schedule') } } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stop = Stop.where(:short_name => params[:id]).first\n @stop.destroy\n\n respond_to do |format|\n format.html { redirect_to(stops_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stop = Stop.find(params[:id])\n @stop.destroy\n\n respond_to do |format|\...
[ "0.6955086", "0.68462557", "0.66244125", "0.65377975", "0.6537512", "0.64747506", "0.64545304", "0.6435788", "0.6421219", "0.63518167", "0.63447976", "0.63440883", "0.62924474", "0.6270862", "0.62658983", "0.62436306", "0.6227919", "0.6184781", "0.6178363", "0.61711913", "0.6...
0.6446886
7
needed in the sessions controller 'create' action to redirect after successful signin
def redirect_back_or(default) redirect_to(session[:return_to] || default) clear_return_to end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create #session for login user\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n @log_msg = \"User Login through TFP Login page\" \n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_in_path_...
[ "0.7707307", "0.7547076", "0.7475161", "0.7471593", "0.74419105", "0.73667127", "0.7318086", "0.7262037", "0.7260331", "0.72510463", "0.72490764", "0.72365505", "0.7222925", "0.7222751", "0.7220904", "0.7213413", "0.7212746", "0.7207398", "0.719769", "0.71969473", "0.71960044...
0.0
-1
POST /motions/:motion_id/motion_comments POST /motions/:motion_id/motion_comments.xml
def create respond_to do |format| if motion_comment.save format.html { redirect_to( motion_comment.motion, flash: { success: 'Motion comment created.' } ) } format.xml { render xml: motion_comment, status: :created, location: motion_comment } else format.html { render action: "n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n motion_comment.assign_attributes motion_comment_attributes\n respond_to do |format|\n if motion_comment.save\n format.html { redirect_to motion_comment.motion, flash: { success: 'Motion comment updated.' } }\n format.xml { head :ok }\n else\n format.html { render ...
[ "0.6471911", "0.5995591", "0.5965611", "0.59224063", "0.5645208", "0.5609259", "0.54327947", "0.53749627", "0.5329645", "0.5310976", "0.52571195", "0.52499086", "0.5241574", "0.5198844", "0.5175442", "0.5175442", "0.5175442", "0.51254535", "0.5122156", "0.5118211", "0.5082629...
0.74302554
0
PUT /motion_comments/1 PUT /motion_comments/1.xml
def update motion_comment.assign_attributes motion_comment_attributes respond_to do |format| if motion_comment.save format.html { redirect_to motion_comment.motion, flash: { success: 'Motion comment updated.' } } format.xml { head :ok } else format.html { render action: "edi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity ...
[ "0.62743294", "0.5963074", "0.5846002", "0.5817308", "0.57961345", "0.5795455", "0.57663435", "0.57254153", "0.5712982", "0.5709012", "0.5706051", "0.57006687", "0.5697301", "0.5680319", "0.5671558", "0.5660295", "0.56590927", "0.56450784", "0.56259865", "0.56259865", "0.5624...
0.7070278
0
DELETE /motion_comments/1 DELETE /motion_comments/1.xml
def destroy motion_comment.destroy respond_to do |format| format.html { redirect_to( motion_url( motion_comment.motion ), flash: { success: "Motion comment destroyed." } ) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comments\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n ...
[ "0.6751097", "0.6532073", "0.6532073", "0.65240186", "0.6460378", "0.64299434", "0.6419422", "0.6348528", "0.6344826", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0.63424635", "0....
0.70813733
0
for namespacing in scss files
def body_classes [controller.controller_name, controller.action_name].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace_by_filename\n rename_body\n indent_sass\n namespace_sass\n\n # remove the @char style css directives (can't be indented)\n move_css_directives\n puts sass\n end", "def syntax\n\t\t\t\t:sass\n\t\t\tend", "def syntax\n\t\t\t\t:scss\n\t\t\tend", "def ...
[ "0.76740426", "0.61868364", "0.6119706", "0.60664195", "0.60604286", "0.59555453", "0.58398116", "0.5805586", "0.5768065", "0.57667404", "0.5746048", "0.57381773", "0.57381773", "0.5713124", "0.5633624", "0.5633456", "0.5611567", "0.560305", "0.560305", "0.560305", "0.560305"...
0.0
-1
find_or_create_by does not work in this version
def find_or_create(uid) is_new = false @user = User.where("uid =?",uid).first is_new = true if @user.nil? @user = User.new() if @user.nil? @user.uid = uid @user.is_new = is_new @user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_or_create_by\n end", "def find_or_create!()\n end", "def find_or_create( id )\n begin\n get( id )\n rescue\n create!( :id => id )\n end \n end", "def find_or_create(*args, &block)\n find_or_initialize_and_do :save, *args, &b...
[ "0.87440157", "0.8452878", "0.7763338", "0.7758803", "0.77352357", "0.77337766", "0.76993144", "0.75463486", "0.74738324", "0.7381685", "0.7357472", "0.7254623", "0.7252943", "0.7231424", "0.72088486", "0.71800053", "0.71126693", "0.7050195", "0.70273584", "0.6788085", "0.676...
0.62288177
43
find_or_create_by does not work in this version
def find_user_by_id(id) User.find(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_or_create_by\n end", "def find_or_create!()\n end", "def find_or_create( id )\n begin\n get( id )\n rescue\n create!( :id => id )\n end \n end", "def find_or_create(*args, &block)\n find_or_initialize_and_do :save, *args, &b...
[ "0.87440157", "0.8452878", "0.7763338", "0.7758803", "0.77352357", "0.77337766", "0.76993144", "0.75463486", "0.74738324", "0.7381685", "0.7357472", "0.7254623", "0.7252943", "0.7231424", "0.72088486", "0.71800053", "0.71126693", "0.7050195", "0.70273584", "0.6788085", "0.676...
0.0
-1
GET /promotions GET /promotions.json
def index @promotions = Promotion.order("created_at desc").where('playerid=?' , current_player.playerid) @bulbs = Notification.where('playerid = ?' , current_player.playerid).sum('bulb') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end", "def api_promotions_get(params, opts = {})\n data, _status_code, _headers = api_promotions_get_with_http_info...
[ "0.7526315", "0.7378621", "0.7359634", "0.72931325", "0.72931325", "0.72931325", "0.7152811", "0.6741252", "0.67093587", "0.64522964", "0.640619", "0.6332135", "0.62668365", "0.6240661", "0.6093199", "0.6066163", "0.60601115", "0.60323346", "0.6001653", "0.5979596", "0.590259...
0.50718355
81
GET /promotions/1 GET /promotions/1.json
def show @promotion = Promotion.where('id=? and playerid=?', params[:id], current_player.playerid)[0] @promotion.read = 1 @promotion.save @notification = Notification.where('notificationid=? and notification=?', @promotion.id, 'promotions') unless @notifcation.nil? @notification[0].read = 1 @notification...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end", "def index\n @title = t('admin.promotions.index.title')\n @promotions = ( @product ? @product.promotions : P...
[ "0.7495655", "0.71599615", "0.7131096", "0.7131096", "0.7131096", "0.7082962", "0.700258", "0.6544531", "0.63461715", "0.62281185", "0.61489755", "0.61034447", "0.6028518", "0.5992029", "0.5971138", "0.5966614", "0.58784336", "0.583163", "0.5791261", "0.5756269", "0.57467437"...
0.52463895
60
POST /promotions POST /promotions.json
def create @promotion = Promotion.new(promotion_params) respond_to do |format| if @promotion.save @promotion.update_notification #@promotion.push format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' } format.json ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_promotions\n @new_promotions ||= []\n end", "def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end", "def create\n @promotion = Promotion.new(params[:pro...
[ "0.61129576", "0.6003724", "0.5930134", "0.5900632", "0.5900632", "0.5900632", "0.5800277", "0.5748506", "0.573991", "0.5670667", "0.56652546", "0.558862", "0.555045", "0.55195886", "0.5505017", "0.550316", "0.54850113", "0.5484974", "0.54847103", "0.5421864", "0.5421864", ...
0.5849472
6
PATCH/PUT /promotions/1 PATCH/PUT /promotions/1.json
def update respond_to do |format| if @promotion.update(promotion_params) format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @promotion...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @promoter.update(promoter_params)\n format.html { redirect_to root_url, notice: 'Promoter was successfully updated.' }\n format.json { render :show, status: :ok, location: @promoter }\n else\n format.html { render :e...
[ "0.6425367", "0.5895799", "0.5888049", "0.58657086", "0.5845975", "0.5716523", "0.571033", "0.5702195", "0.56935906", "0.56898993", "0.5674689", "0.5650366", "0.5645524", "0.56381476", "0.5599362", "0.5589391", "0.5546728", "0.5546728", "0.5515277", "0.5504142", "0.54722214",...
0.5600792
14
DELETE /promotions/1 DELETE /promotions/1.json
def destroy #@promotion = Promotion.find(params[:id]) @promotion.destroy respond_to do |format| format.html { redirect_to promotions_url, notice: 'Promotion was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @promotion = Promotion.find(params[:id])\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to promotions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @promotion = Promotion.find(params[:id])\n @promotion.destroy\n\n respond_to ...
[ "0.6879028", "0.68678474", "0.68394583", "0.67702013", "0.6688265", "0.6603827", "0.660365", "0.6586388", "0.65862375", "0.65211374", "0.65166795", "0.65166795", "0.65166795", "0.64893615", "0.6456399", "0.6427913", "0.6420008", "0.6420008", "0.64042103", "0.6393247", "0.6389...
0.6614795
5
Use callbacks to share common setup or constraints between actions.
def set_promotion @promotion = Promotion.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def promotion_params params.require(:promotion).permit(:code, :description, :drawingtime, :enddate, :num_of_entries, :playerid, :read, :startdate) 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
Goes through the list once storing data encountered in a hash table. If data is repeated, then that node is replaced with the following node. This algorithm is O(n), specially since we assume linked list is not sorted.
def remove_duplicates(linked_list) if !linked_list.is_a?(LinkedList) || linked_list.head == nil return nil end hash_table = {} node = linked_list.head while node.next != nil if hash_table[node.data] node.data = node.next.data node.next = node.next.next else hash_table[node.dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(linked_list)\n duplicate_hash = Hash.new(0)\n test_node = linked_list.head.next\n until test_node.next.value == nil\n next_node = test_node.next\n if duplicate_hash[test_node.value] > 0\n linked_list.remove(test_node)\n end\n duplicate_hash[test_node.value] += 1\n test_...
[ "0.656354", "0.6542628", "0.6542151", "0.64773226", "0.64069575", "0.63600135", "0.63452435", "0.6334141", "0.63062406", "0.6274766", "0.6230547", "0.6154746", "0.6117125", "0.6059073", "0.6051247", "0.6031701", "0.5986258", "0.59143674", "0.5816511", "0.58049977", "0.5800201...
0.7138396
0
replace a code with an array of new codes. This is what happens in passes all the time
def replace code , new_codes index = @codes.index code raise "Code not found #{code} in #{self}" unless index @codes.delete_at(index) if( new_codes.is_a? Array) new_codes.reverse.each {|c| @codes.insert(index , c)} else @codes.insert(index , new_codes) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code(*codes); end", "def code(*codes); end", "def process_code(data)\n @codemap.each do |id, spec|\n formatted = spec[:output] ||\n begin\n code = spec[:code]\n lang = spec[:lang]\n\n if code.lines.all? { |line| line =~ /\\A\\r?\\n\\Z/ || li...
[ "0.6695643", "0.6695643", "0.62840635", "0.62646437", "0.61374253", "0.6047849", "0.6043465", "0.60397667", "0.6012535", "0.59551054", "0.59472865", "0.5882332", "0.5868555", "0.58554256", "0.58223534", "0.58126026", "0.57898015", "0.5784912", "0.57619286", "0.5689093", "0.56...
0.7805287
0
returns if this is a block that ends in a call (and thus needs local variable handling)
def call_block? raise "called" return false unless codes.last.is_a?(CallInstruction) return false unless codes.last.opcode == :call codes.dup.reverse.find{ |c| c.is_a? StackInstruction } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_finished?\n @block.call\n end", "def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend", "def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend", "def captured_by_block?; end", "def b...
[ "0.6967941", "0.6907176", "0.68331456", "0.68084645", "0.67836344", "0.67827106", "0.6629497", "0.6550672", "0.6436251", "0.6366634", "0.63550293", "0.63368464", "0.627693", "0.6204078", "0.6188115", "0.6179837", "0.61743", "0.616382", "0.6160574", "0.6158669", "0.6158669", ...
0.702978
0
position is what another block uses to jump to. this is determined by the assembler the assembler allso assembles and assumes a linear instruction sequence Note: this will have to change for plocks and maybe anyway.
def set_position at @position = at @codes.each do |code| begin code.set_position( at) rescue => e puts "BLOCK #{self.to_s[0..5000]}" raise e end raise code.inspect unless code.byte_length at += code.byte_length end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_jump_for(position)\n at = position.at\n code = position.object\n return unless code.next_code #dont jump beyond and\n jump = Branch.new(\"BinaryCode #{at.to_s(16)}\" , code.next_code)\n translator = @platform.translator\n cpu_jump = translator.translate(jump)\n pos = at +...
[ "0.69871104", "0.6461492", "0.6423892", "0.6351408", "0.6351408", "0.62661916", "0.62260664", "0.6193292", "0.61736417", "0.61073315", "0.60897803", "0.6052145", "0.6052145", "0.6052145", "0.6052145", "0.6052145", "0.6052145", "0.6052145", "0.6052145", "0.60285735", "0.602196...
0.5748766
33
helper for determining reachable blocks
def add_next ret return if @next.nil? return if ret.include? @next ret << @next @next.reachable ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_want_blocks\n return if (@want_blocks.length >= MIN_REQUESTS) || @peer_virgin || @peer_choking || !@interested\n\n rej_count = 0\n acc_count = 0\n @controller.claim_blocks do |b|\n break if @want_blocks.length >= MAX_REQUESTS\n if @peer_pieces[b.pindex] && !@want_blocks.member?(b)\n ...
[ "0.6789595", "0.63523734", "0.6138694", "0.60196054", "0.5993808", "0.5977988", "0.5947772", "0.59334034", "0.58910364", "0.5883558", "0.58422154", "0.583915", "0.5740589", "0.57331216", "0.5703695", "0.568592", "0.5676991", "0.5662776", "0.56459504", "0.5636119", "0.56269765...
0.0
-1
helper for determining reachable blocks
def add_branch ret return if @branch.nil? return if ret.include? @branch ret << @branch @branch.reachable ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_want_blocks\n return if (@want_blocks.length >= MIN_REQUESTS) || @peer_virgin || @peer_choking || !@interested\n\n rej_count = 0\n acc_count = 0\n @controller.claim_blocks do |b|\n break if @want_blocks.length >= MAX_REQUESTS\n if @peer_pieces[b.pindex] && !@want_blocks.member?(b)\n ...
[ "0.6789595", "0.63523734", "0.6138694", "0.60196054", "0.5993808", "0.5977988", "0.5947772", "0.59334034", "0.58910364", "0.5883558", "0.58422154", "0.583915", "0.5740589", "0.57331216", "0.5703695", "0.568592", "0.5676991", "0.5662776", "0.56459504", "0.5636119", "0.56269765...
0.0
-1
decrypt the twitter oauth token and secret and return them
def decrypt_with(password) token = Justbot::Crypto.decrypt( self.crypted_twitter_token, password, self.iv_twitter_token ) secret = Justbot::Crypto.decrypt( self.crypted_twitter_secret, password, self.iv_twitter_secret ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secret\n decrypt_secret\n end", "def secret\n decrypt_secret\n end", "def get_OAuthTokenSecret()\n \t return @outputs[\"OAuthTokenSecret\"]\n \tend", "def decrypt_api_secret\n @api_secret_d = @client_api_detail.decrypted_api_secret\n success\n end", "def get_toke...
[ "0.708607", "0.708607", "0.70498836", "0.70204216", "0.69849175", "0.6958828", "0.67728657", "0.67728657", "0.67728657", "0.6724751", "0.67044616", "0.66627127", "0.65739006", "0.64736295", "0.6472688", "0.64312655", "0.64247835", "0.6413827", "0.6409574", "0.63776726", "0.63...
0.7823934
0
Below methods are not intended to be called directly. They were made public so they can be directly targeted by tests.
def alert_classes(flash_type) "alert alert-#{flash_type} alert-dismissible fade show" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def __dummy_test__\n end", "def private_method\n end", "def testing\n # ...\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def setup; e...
[ "0.75335705", "0.69379103", "0.69379103", "0.65431213", "0.65431213", "0.6536134", "0.6522528", "0.6447145", "0.6427914", "0.6427914", "0.6427914", "0.6427914", "0.64007777", "0.64007777", "0.64007777", "0.64007777", "0.64007777", "0.64007777", "0.64007777", "0.64007777", "0....
0.0
-1
Exercise 5, taken from solution
def color_valid(color) color == "blue" || color = "green" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def exercise_1113 (matrix)\n end", "def alg; end", "def exercise_119 (number)\n end", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i ...
[ "0.6682268", "0.6297984", "0.59682995", "0.59142363", "0.58330125", "0.5762339", "0.5743273", "0.57376397", "0.5737509", "0.5714836", "0.5714592", "0.57123363", "0.57097304", "0.56887263", "0.56735694", "0.56170803", "0.5616739", "0.5583061", "0.55721325", "0.55654705", "0.55...
0.0
-1
We will rebuild the syntax info from the beginning of the file to the end of the current line TODO This will be extremely slow find a better way
def rebuild_syntax @syntax = [] line = [] current = '' text = buffer.data CodeRay.scan_stream(text, filetype) do |k, a| if a==:space || a==:plain || a==:content || a==:comment then k.each_char do |c| if c=="\n" then unless current.empty? then current.symbol_type = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_line(line, index)\n\n # there should be a check for interpolation here, and just run a simple replace for each line\n\n if !indented?(line)\n $context = $root\n add_selector_or_property(line, index)\n # check here for @import, @font-face, and @keyframes\n else\n\n set_default_indent(line...
[ "0.62422764", "0.6073101", "0.6073101", "0.6073101", "0.6056954", "0.6016967", "0.5945852", "0.5944851", "0.5944851", "0.5944851", "0.59363264", "0.59363264", "0.5898507", "0.58979", "0.584238", "0.581424", "0.5750783", "0.57461846", "0.5737963", "0.5732111", "0.5657724", "...
0.7885102
0
We define permission to first_name, last_nae; description and skills for the sign_up form in order to add users into our database
def configure_permitted_parameters added_attrs = [:first_name, :last_name, :description, :skills, :email, :password, :password_confirmation, :remember_me] devise_parameter_sanitizer.permit :sign_up, keys: added_attrs devise_parameter_sanitizer.permit :account_update, keys: added_attrs devise_parameter_sanitizer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end", "def user_attributes\n params.permit(:first_name,\n :last_name, :description)\n end", "def configure_permi...
[ "0.67320037", "0.6444714", "0.64245844", "0.63431567", "0.63253146", "0.6275826", "0.62638676", "0.62525445", "0.6246248", "0.6233602", "0.622621", "0.622621", "0.62260544", "0.62257576", "0.6222339", "0.62025297", "0.62004936", "0.619513", "0.6188096", "0.6186364", "0.616932...
0.595302
62
Method to publish an article, must change the stage of the article and then, redirect to the article
def publish @article.publish! redirect_to @article end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish\n @article = Article.find(params[:id])\n @article.change_publish_status(1)\n flash[:notice] = \"Article status changed to published.\"\n redirect_to :back\n rescue Exception => e\n log_exception(e)\n flash[:warning] = \"Error!\"\n redirect_to :back\n end", "def create\n @art...
[ "0.7737822", "0.74554384", "0.72490364", "0.71499515", "0.7109683", "0.70462453", "0.704477", "0.70352566", "0.6987649", "0.69870913", "0.69630504", "0.69357884", "0.692699", "0.6909706", "0.6909706", "0.6909706", "0.68880814", "0.68870527", "0.68762374", "0.68413466", "0.683...
0.87423855
0
'lb' load balancing layers 'railsapp' 'custom'
def fetch_instance(shortname = :all, options = {}) return instances if instances && !options[:force] fetch_stack unless instance_list self.instance_list = self.instances = aws_client.describe_instances(stack_id: stack[:stack_id])[:instances] end if shortna...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def load_balancer # rubocop:disable AbcSize...
[ "0.64717185", "0.64717185", "0.6065076", "0.60645914", "0.6055592", "0.59892786", "0.59295523", "0.58835083", "0.58549446", "0.5840675", "0.56556135", "0.5636225", "0.5622528", "0.56014174", "0.55267465", "0.5496484", "0.54876256", "0.5479023", "0.54414785", "0.5413021", "0.5...
0.0
-1
solution using these two methods won't run as for some reason the fibonacci implementation is slow. Additiona explanation added on 03/02/2021. the reason this version of fibonacci is slow is becuase it is using recursion. For faster processing use iteration. see new solutions added below for finding fibonacci sequence....
def find_fibonacci_index_by_length(num) fib = [1, 1] until fib.last.digits.size == num fib << fib[-1] + fib[-2] end fib.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_fibonacci_index_by_length(num_digits)\n fib = [1, 1]\n until fib[-1].to_s.size == num_digits do #read: se dodeka...\n fib << (fib[-1] + fib[-2])\n end\n fib.index(fib[-1])+1\nend", "def find_fibonacci_index_by_length(num)\n count = 0\n idx = 2\n\n loop do\n break if count.to_s.size == num\...
[ "0.87969714", "0.87354785", "0.8700831", "0.869631", "0.86919755", "0.865813", "0.8654351", "0.8654351", "0.86352515", "0.8635078", "0.8619846", "0.86094", "0.8602426", "0.8599986", "0.8594892", "0.85891545", "0.85719377", "0.85402787", "0.85324407", "0.8522073", "0.8521333",...
0.87071615
2
p find_fibonacci_index_by_length(2) == 7 1 1 2 3 5 8 13 p find_fibonacci_index_by_length(3) == 12 1 1 2 3 5 8 13 21 34 55 89 144 p find_fibonacci_index_by_length(10) == 45 p find_fibonacci_index_by_length(100) == 476 p find_fibonacci_index_by_length(1000) == 4782 p find_fibonacci_index_by_length(10000) == 47847 def cou...
def fibonacci(num) return num if num < 2 result = [0,1] until num == 1 result << result[-1] + result[-2] num -= 1 end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_fibonacci_index_by_length(num_digits)\n prev = 1\n curr = 1\n index = 2\n return 1 if num_digits == 1\n while curr.digits.size < num_digits\n # puts \"number: #{curr} size: #{curr.digits.size} num_digits: #{num_digits}\"\n new = curr + prev \n prev = curr\n curr = new\n index += 1\n e...
[ "0.8149843", "0.80306506", "0.80058306", "0.7858878", "0.7851961", "0.7851085", "0.7805032", "0.7784021", "0.77717143", "0.7761556", "0.77462435", "0.77452755", "0.7722959", "0.77099395", "0.76609325", "0.76608324", "0.7639282", "0.763897", "0.7617283", "0.76083225", "0.76083...
0.0
-1
The client code works with complex subsystems through a simple interface provided by the Facade. When a facade manages the lifecycle of the subsystem, the client might not even know about the existence of the subsystem. This approach lets you keep the complexity under control.
def client_code(facade) puts facade.operation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsystem(subsystem, &block); end", "def subsystem( subsystem, want_reply=true )\n send_request_string \"subsystem\", subsystem, want_reply\n end", "def subsystem\n \"unknown\"\n end", "def service; raise NotImplementedError; end", "def child_factories; end", "def par...
[ "0.66796154", "0.62831", "0.6130704", "0.56440717", "0.54696256", "0.5434254", "0.5434254", "0.5322722", "0.53133327", "0.5266652", "0.52627605", "0.52288544", "0.5226946", "0.5190329", "0.5186871", "0.51860857", "0.5170292", "0.51261145", "0.51243746", "0.50727046", "0.50697...
0.53068775
9
test whether the transition is allowed; if yes, transit to next state
def transit_state(signal) permitted_transitions = transitions[signal.to_sym] unless permitted_transitions.nil? next_state = permitted_transitions[state] # if current state is not explicitly permitted, is any state (referred by '*') permitted? next_state = permitted_transitions['*'] unless nex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_walk_to?(transition); end", "def valid_transition?(new_state)\n VALID_TRANSITIONS[@state][:valid].include?(new_state)\n end", "def perform_initial_transition?\n !current_state\n end", "def transition_allowed?(event)\n allowed = case event\n when :charge\n [...
[ "0.70214826", "0.686666", "0.6792187", "0.6733784", "0.6709921", "0.66906476", "0.6654076", "0.65953624", "0.6584525", "0.6547596", "0.65432537", "0.64479965", "0.6393985", "0.6389688", "0.6369007", "0.6344303", "0.63216996", "0.6271262", "0.62694895", "0.62369645", "0.623642...
0.69728756
1
Helper methods for display of transitions
def to_dot(include_starred_states = false) all_states = transitions.values.map(&:to_a).flatten.uniq.reject { |t| t == "*" } "".tap do |s| s << "digraph #{self.class.name.inspect} {\n" transitions.each do |signal, signal_transitions| signal_transitions.each do |from, to| next if !i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions; end", "def render_Transition t\n return if @rendered[t]\n @rendered[t] = true\n\n # Do not render Transition if source and target States are both rendered.\n return unless @rendered[t.target] && @rendered[t.source]\n\n sequence = [ ]\n \n if options[:history]\n...
[ "0.7954194", "0.69478977", "0.68772733", "0.68676865", "0.66836166", "0.64579093", "0.64579093", "0.63993317", "0.63617015", "0.6277065", "0.62683284", "0.6253831", "0.6250393", "0.6194347", "0.61135817", "0.6075782", "0.6075782", "0.5994114", "0.59393525", "0.58779514", "0.5...
0.0
-1
if all_flag is true > return :all result if all?
def initialize(time_expression, time_type, all_flag=true) @time_type = time_type @tokens = time_expression.scan(/#{COMMA}|#{DEVIDE}|#{RANGE}|#{DIGIT}|#{ALL}/) @all_flag = all_flag end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all()\n merge(all: 'true')\n end", "def all?\n @options[:all].present?\n end", "def my_all?\n all = true\n self.my_each do |x|\n if !block_given?\n if !x || x.nil?\n all = false\n end\n elsif !yield x\n all = false\n end\n break if...
[ "0.7552455", "0.6995743", "0.6981959", "0.69055945", "0.687261", "0.68629503", "0.6862686", "0.6743535", "0.6680188", "0.6663257", "0.66631526", "0.66538775", "0.6646764", "0.6631207", "0.65886486", "0.6559216", "0.6529237", "0.6524688", "0.6508525", "0.64980316", "0.6425918"...
0.0
-1
GET /messages GET /messages.json
def index messages = ( can? :manage, Message ) ? Message.all : Message.for_member(current_member) @messages = messages.by_created.paginate(page: params[:page], per_page: 15) current_member.last_message = @messages.first current_member.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages\n get_json('messages.json')\n end", "def index\n messages = Message.all\n render json: messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @mess...
[ "0.8392115", "0.755332", "0.7461291", "0.7461291", "0.74388546", "0.74314713", "0.74295616", "0.74287003", "0.7412067", "0.73680776", "0.7355837", "0.7349781", "0.72963905", "0.72897035", "0.72890514", "0.7267814", "0.71833634", "0.7156361", "0.71530104", "0.71393275", "0.710...
0.0
-1
POST /messages POST /messages.json
def create @members = Member.all @message = Message.new(message_params) @message.sender = current_member respond_to do |format| if @message.save # Send managers an email letting them know there's a new message BackstageMailer.waiting_for_approval(@message).deliver_later unless can...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end", "def create\n @messag...
[ "0.7465386", "0.71694404", "0.7112854", "0.7095524", "0.70685273", "0.70200527", "0.69382447", "0.6844289", "0.683413", "0.683015", "0.68281627", "0.68281627", "0.6783851", "0.6763146", "0.67002374", "0.6698929", "0.66701055", "0.66322166", "0.66246116", "0.6623654", "0.66130...
0.0
-1
PATCH/PUT /messages/1 PATCH/PUT /messages/1.json
def update respond_to do |format| if @message.update(message_params) format.html { redirect_back_to messages_path, flash: { success: 'Message was successfully updated.' } } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end", "def update\n message = Message.find(params[:id])\n message...
[ "0.708431", "0.6978376", "0.690778", "0.6854797", "0.6815956", "0.6795405", "0.6790936", "0.675905", "0.67395717", "0.67395717", "0.66698396", "0.66626984", "0.665636", "0.66526294", "0.6645645", "0.66447604", "0.66447604", "0.66447604", "0.66447604", "0.66447604", "0.6644760...
0.67612135
7
DELETE /messages/1 DELETE /messages/1.json
def destroy unauthorized && return if @message.approved? @members = Member.all @message.destroy respond_to do |format| format.html { redirect_back_to messages_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @message.destroy\n \n ...
[ "0.79593897", "0.7747999", "0.7717827", "0.7663838", "0.76395816", "0.7632024", "0.76282775", "0.7612037", "0.7606504", "0.7606504", "0.7606487", "0.7593116", "0.75906074", "0.75906074", "0.75906074", "0.75906074", "0.7553734", "0.7552046", "0.7552046", "0.7552046", "0.755204...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_message @message = Message.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def message_params params.required(:message).permit(:subject, :message, member_ids: []) 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
def create_dives(user, number) dives.first(number).each_with_index do |dive, i| new_dive = user.dives.new(dive) if new_dive.save! begin new_dive.photo_urls = photos[i] puts "Dive created" rescue puts "Failure to connect to Cloudinary" end end end end
def photos [ ["http://res.cloudinary.com/jooleeanh/image/upload/v1480379642/my-dives/bali-dive-1.jpg", "http://res.cloudinary.com/jooleeanh/image/upload/v1480379642/my-dives/bali-dive-2.jpg", "http://res.cloudinary.com/jooleeanh/image/upload/v1480379642/my-dives/bali-dive-3.jpg"], ["http://res.cloudinar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n i = 0\n params[:post_attachments]['avatar'].each do |a|\n @post_attachment = @post.post_attachments.create\n @pic_count = @post.post_attachments.count\n file = a\n ...
[ "0.62488526", "0.60704124", "0.59238964", "0.5876658", "0.5849447", "0.5802445", "0.57904524", "0.5740733", "0.5726113", "0.5618409", "0.5617031", "0.55951333", "0.5575237", "0.5539898", "0.55207634", "0.55039924", "0.5489768", "0.5489194", "0.54870814", "0.54870814", "0.5458...
0.57992315
6
GET /map_areas/1 GET /map_areas/1.xml
def show @map_area = MapArea.find(params[:id]) @start = @map_area @zoom= 4 @houses = House.count(:conditions => ["map_area_id = ?",params[:id]]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @map_area } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end", "def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n res...
[ "0.6636507", "0.658433", "0.6573497", "0.64979964", "0.64641625", "0.6425993", "0.6315795", "0.6315795", "0.63074803", "0.6302391", "0.62746483", "0.625403", "0.61918247", "0.60812354", "0.600986", "0.5988855", "0.59841746", "0.5975226", "0.5963971", "0.5959714", "0.5939606",...
0.6418504
6
GET /map_areas/new GET /map_areas/new.xml
def new @map_area = MapArea.new @start = GeoLoc.new(:lat=>40.010492, :lng=> -105.276843) @zoom= 14 respond_to do |format| format.html # new.html.erb format.xml { render :xml => @map_area } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @area = Area.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n en...
[ "0.73611414", "0.73348", "0.73348", "0.7251168", "0.7216695", "0.7214031", "0.71847403", "0.68891627", "0.68618304", "0.6807173", "0.68048877", "0.68048877", "0.67606837", "0.6759648", "0.6712049", "0.6658706", "0.6635083", "0.6631533", "0.66181993", "0.6611113", "0.66055965"...
0.6814642
10
POST /map_areas POST /map_areas.xml
def create @map_area = MapArea.new(params[:map_area]) @map_area.craigslist = params[:craigslist] + ".craigslist.org" respond_to do |format| if @map_area.save flash[:notice] = 'MapArea was successfully created.' format.html { redirect_to(@map_area) } format.xml { render :xml =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def create\n #params[:area] == {\"parent_id\"=>\"21\",\"name\"=>\"test4\"} parent id from h...
[ "0.630032", "0.5881383", "0.5863109", "0.56986576", "0.569001", "0.5520591", "0.5494831", "0.5468766", "0.54546654", "0.54546654", "0.54444027", "0.5439435", "0.54299223", "0.54231703", "0.5417023", "0.5398709", "0.5386855", "0.5386339", "0.53767633", "0.53719157", "0.5359135...
0.5874135
2
PUT /map_areas/1 PUT /map_areas/1.xml
def update @map_area = MapArea.find(params[:id]) respond_to do |format| if @map_area.update_attributes(params[:map_area]) flash[:notice] = 'MapArea was successfully updated.' format.html { redirect_to map_areas_path } format.xml { head :ok } else format.html { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n #format.html { redirect_to(@area, :notice => \"#{@area.to_s} was successfully updated.\") }\n format.html { redirect_to(locations_url, :notice => \"#{@area.to_s} was success...
[ "0.6302117", "0.62718856", "0.62718856", "0.6104586", "0.59913033", "0.59913033", "0.59913033", "0.592846", "0.5912385", "0.58214444", "0.57772475", "0.57561314", "0.56832033", "0.5667586", "0.5629137", "0.560807", "0.5606854", "0.5596874", "0.5579682", "0.5573442", "0.552748...
0.678487
0
DELETE /map_areas/1 DELETE /map_areas/1.xml
def destroy @map_area = MapArea.find(params[:id]) @map_area.destroy respond_to do |format| format.html { redirect_to(map_areas_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n re...
[ "0.68447906", "0.6763525", "0.6696124", "0.66778713", "0.66778713", "0.6670607", "0.65227044", "0.6475137", "0.63840634", "0.63642997", "0.6344826", "0.6331257", "0.6319804", "0.6291145", "0.6289803", "0.62859124", "0.6261359", "0.6253295", "0.6253295", "0.6253295", "0.625214...
0.7324246
0
attr_accessible :account_id, :deleted_at, :first_name, :image, :last_name, :title, :usernotice
def email preferred_email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_params\n params.require(:account).permit(:fullname, :address, :phone, :user_id, :image)\n end", "def new_account_params\n params.require(:account).permit(:mg_account_name,:description,:is_deleted,:mg_school_id,:created_by,:updated_by,:mg_school_id)\n end", "def account_params\n param...
[ "0.6928175", "0.6849654", "0.6816874", "0.68072927", "0.67555845", "0.67285657", "0.6669596", "0.65995026", "0.6583778", "0.65427434", "0.6508371", "0.65030664", "0.649042", "0.648948", "0.648101", "0.64683276", "0.6461517", "0.64531875", "0.6436153", "0.6427404", "0.64255196...
0.0
-1
show me an individual story page
def show # params[#id] is form the URL, e.g if /stories/7 # then params[:id] is 7 @story = Story.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\t# params[:id] is the number in the url that we are looking for\n\t\t# @story = Story.find(params[:id])\n\t\t\n\tend", "def show\n\t\t#params[:id] is the number in the url we are looking for\n\t\t#@story = Story.find(params[:id])\n\tend", "def show\n\n\t# params[:id] is the number in the url we ar...
[ "0.8027867", "0.80027336", "0.7923712", "0.78744495", "0.7831402", "0.7811308", "0.74973106", "0.7481956", "0.7455027", "0.74433887", "0.7418436", "0.7307856", "0.7275771", "0.72382975", "0.71848565", "0.7184479", "0.7184479", "0.71657544", "0.712324", "0.712324", "0.712324",...
0.769498
6
new and create work together as a pair the create action actually adds things to the database
def create # make story be a blank story but with fields filled in @story = Story.new(story_params) # save this story to the database IF validations pass if @story.save # let's add a notification to the user to let them know # it's been saved to the db flash[:success] = "Yay, you've ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\r\n end", "def create\n end", "def create\n \n end", "def create; end", "def create; end", "def create; end", "def create; end", "def create\n \t\n end", "def create\n \n end", "def create\n end", "def create\n end", "def create\n end", "def create...
[ "0.7975315", "0.7959162", "0.79162985", "0.79087406", "0.79087406", "0.79087406", "0.79087406", "0.7871508", "0.7784636", "0.7783345", "0.7783345", "0.7783345", "0.77583325", "0.7757826", "0.77009475", "0.76793474", "0.76793474", "0.7644101", "0.7576532", "0.7552073", "0.7552...
0.0
-1
I want to show the edit form for an individual story
def edit # find the story based on the url @story = Story.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t# @story = Story.find(params[:id])\n\t\t\n\tend", "def edit \n\n\t# @story = Story.find(params[:id])\n\n\nend", "def edit\n\t\t#@story = Story.find(params[:id])\n\tend", "def edit\n @story = Story.find(params[:id])\n end", "def edit\n\n\t\t# @story = Story.find(params[:id])\n\n\t# actuall...
[ "0.8482771", "0.8443836", "0.8397335", "0.8345885", "0.81010294", "0.72732365", "0.7239533", "0.7198864", "0.7172932", "0.71722025", "0.71456504", "0.71442", "0.71294004", "0.71256816", "0.7119603", "0.7086522", "0.7086522", "0.7086522", "0.7086522", "0.7086522", "0.7086522",...
0.82224286
4
I want to update the database with the updated data
def update @story = Story.find(params[:id]) # update the record with the form data if @story.update(story_params) flash[:success] = "You've updated a story" redirect_to story_path(@story) else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n end", "def update\n\t\t\n\t\tend", "def update\n push_to_db\n end", "def update\n push_to_db\n end", "def update\n\n end", "def update\r\n end", "def update\r\n\r\n end", "def update\n\t\tend", "def update\n\t\tend", "def update\r\n end", "def update\r\n ...
[ "0.7822693", "0.7804186", "0.7798527", "0.7798527", "0.7766384", "0.77392286", "0.77352095", "0.7707757", "0.7707757", "0.7703605", "0.7703605", "0.7703605", "0.7703605", "0.7701787", "0.7668078", "0.76309144", "0.76251155", "0.76251155", "0.76251155", "0.76251155", "0.762511...
0.0
-1
let's destroy this story
def destroy @story = Story.find(params[:id]) @story.destroy flash[:success] = "You've deleted the #{@story.title} story" redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @story.destroy\n head :no_content\n end", "def destroy\n\t\t#@story = Story.find(params[:id])\n\n\t\t@story.destroy\n\n\t\tflash[:success] = \"its a goner\"\n\n\t\tredirect_to root_path\n\tend", "def destroy\n\n\t\t# @story = Story.find(params[:id])\n\n\t\t@story.destroy\n\n\t\tflash[:succ...
[ "0.7754505", "0.7600074", "0.74482566", "0.743682", "0.74327993", "0.74270564", "0.74244815", "0.73233795", "0.7271959", "0.72511655", "0.723827", "0.7226413", "0.7199774", "0.7198826", "0.7198826", "0.7198826", "0.7198826", "0.71984804", "0.718555", "0.7183356", "0.7183225",...
0.7226289
12
I want to get the right data from the form
def story_params # only get the title, description and link from the story params params.require(:story).permit(:title, :description, :link) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_data?; end", "def form_field_data\n @attributes[:form_field_data]\n end", "def form_data\n @form_data ||= {\n \"c\" => [\"China\", \"Venezuela\", \"Brazil\", \"United States\", \"Thailand\", \"Ukraine\", \"Indonesia\", \"Nepal\", \"Russian Federation\", \"Argentina\", \"Czech Republic...
[ "0.73507917", "0.6707365", "0.66980565", "0.66228145", "0.6550848", "0.6517851", "0.6385383", "0.63350755", "0.6222511", "0.6170766", "0.61105835", "0.6025563", "0.59885687", "0.5974687", "0.59605706", "0.59540087", "0.5875718", "0.5839786", "0.583955", "0.58348835", "0.58301...
0.0
-1
In hindsight... 1) could probably have just used nested arrays instead of getting hashes involved 2) didn't need to be crazy with building the deck. I know it's hard to read require 'pry'
def say(input) puts "=> #{input}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_deck\n deck = Array.new\n for number in 0..2\n for color in 0..2\n for shape in 0..2\n for shade in 0..2\n deck.push(Card.new(number,color,shape,shade))\n end\n end\n end\n end\n return deck\nend", "def build_deck\n# This function builds an array of 52 cards ...
[ "0.68223715", "0.680254", "0.6645282", "0.6641243", "0.6627574", "0.6539561", "0.6531678", "0.6531678", "0.6504159", "0.6491689", "0.6483784", "0.6476633", "0.6453791", "0.64343345", "0.6415481", "0.63758856", "0.63720876", "0.63688105", "0.6340432", "0.6322453", "0.6317496",...
0.0
-1
Global initialization from a class
def fight return "Punch to the chops!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n end", "def init\n end", "def init\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end", "def initialize(&block)\n ...
[ "0.712816", "0.712816", "0.712816", "0.712716", "0.712716", "0.712716", "0.712716", "0.70887583", "0.6982801", "0.6979399", "0.69106793", "0.69024104", "0.6892638", "0.6892638", "0.6851643", "0.68394566", "0.68394566", "0.68394566", "0.68394566", "0.68394566", "0.680495", "...
0.0
-1
todo: move me to DSL makes it easier to read test code todo: use re to capture groups etc
def from_slack(input) command_pattern = /(\/[a-zA-Z\-\_]+)(.*)/ if matched = command_pattern.match(input) command, text = matched[1], matched[2] return { 'command': command, 'text': text } else raise StandardError.new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matcher; end", "def matcher; end", "def submatcher; end", "def submatcher; end", "def pre_match() end", "def matcher_name; end", "def matcher_name; end", "def submatchers; end", "def post_match() end", "def matcher_name=(_arg0); end", "def test_dsl_3\n #------------------\n show...
[ "0.67599577", "0.67599577", "0.6588767", "0.6588767", "0.65089697", "0.640265", "0.640265", "0.63578624", "0.6343771", "0.6209052", "0.6119953", "0.6110888", "0.6110888", "0.6091283", "0.60641855", "0.60626876", "0.60517097", "0.6033049", "0.6026552", "0.59839624", "0.5951322...
0.0
-1
Delete Middle Node: Implement an algorithm to delete a node in the middle (i.e., any node but the first and last node, not necessarily the exact middle) of a singly linked list, given only access to that node.
def delete_middle_node(node) false if node.next.nil? nxt = node.next node.value = nxt.value node.next = nxt.next true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_middle_node(node)\n temp = node.prev\n temp.next = node.next\n node.next.prev = temp\nend", "def delete_middle_node(node)\n currNode = linked_list.head\n while(currNode)\n if(currNode.next.data == node.data)\n currNode = currNode.next.next\n return linked_list\n end\n currNode...
[ "0.8298566", "0.7997847", "0.7976112", "0.784752", "0.7693941", "0.76274765", "0.7431606", "0.73793197", "0.70059806", "0.69955486", "0.693057", "0.6865989", "0.6732792", "0.66618115", "0.653997", "0.64996904", "0.63291776", "0.6241951", "0.6226967", "0.61796343", "0.6179175"...
0.78574836
3
Put a file (specified using a Pathname or IO object) onto the grid and return a BSON::ObjectID. For security reasons, you can't pass a pathname as a string, but must always use an explicit Pathname. This makes it more difficult for a malicious HTTP client to pass a string when the server expected a file input, and ther...
def put_on_grid(path_or_io) if path_or_io.instance_of?(Pathname) File.open(path_or_io, 'r') do |f| grid.put(f, :filename => path_or_io.basename.to_s) end elsif [:eof?, :close].all? {|m| path_or_io.respond_to?(m) } have_cgi_metadata = [:original_filename, :content_type].all?...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_grid_file(file_path, name = nil, contentType = nil, metadata = nil)\n os_file = File.open(file_path, 'rb')\n description = {}\n description[:filename] = name if !name.nil?\n description[:contentType] = name if !contentType.nil?\n description[:metadata] = metadata if !metadata.nil?\n \n...
[ "0.6301399", "0.57719266", "0.5632681", "0.556504", "0.55169547", "0.5488248", "0.5487737", "0.54773164", "0.54594016", "0.5424386", "0.54103035", "0.53936034", "0.536268", "0.5358286", "0.53280634", "0.53216803", "0.53216803", "0.52718455", "0.52718455", "0.52718455", "0.527...
0.56823635
2
Declare an attachment named +name+. This will create a setter and a getter method.
def has_attachment(name) id_field_getter_name = "#{name}_id".to_sym id_field_setter_name = "#{id_field_getter_name}=".to_sym field id_field_getter_name, :type => BSON::ObjectID define_method("#{name}=".to_sym) do |value| unmemoize(name) # Remove any existing file from the grid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachment(name)\n self::Attachment.new(name)\n end", "def attachment_name=(name)\n @attachment_name = name\n end", "def attachment_name=(name)\n @attachment_name = name\n end", "def attachment(name, raise_errors: false, destroy: true, **options)\n super(name, raise_erro...
[ "0.7643645", "0.71674955", "0.7130324", "0.6755619", "0.6658283", "0.6444543", "0.62809545", "0.62248087", "0.61537474", "0.60899705", "0.6006656", "0.600393", "0.5966656", "0.595719", "0.5852676", "0.58406126", "0.5836828", "0.58334434", "0.5794435", "0.5763456", "0.57380545...
0.582518
18
Create new daemon Generic configuration: :device Location where device is located :max_per_day Maximum amount of messages sent per day (default: 500, 1 to disable) MySQL configuration: :host Hostname (default: localhost) :user Username :pass Password :database Database
def initialize(config={}) # Default values config[:host] ||= "localhost" config[:detach] ||= true config[:max_per_day] ||= 500 # Initialize the logger @logger = Logger.new(STDOUT) @logger.formatter = LogFormatter.new @logger.progname = $0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def declare_configuration_options\n ws.config.declare \"daemon_polling_period\", \"string\",\n default: \"60\",\n doc: \"Enter the github polling period\"\n\n ws.config.declare \"daemon_buildbot_host\", \"string\",\n ...
[ "0.61860245", "0.5820152", "0.5748068", "0.5699998", "0.5699071", "0.56010807", "0.55553293", "0.5489326", "0.5474469", "0.54453295", "0.54101706", "0.5391506", "0.5356212", "0.53554136", "0.53531903", "0.5336573", "0.5331905", "0.53304684", "0.53082347", "0.5307268", "0.5268...
0.57403785
3
Run the daemon Starts processing messages
def run @logger.info("Started.") begin loop do process_incoming @logger.debug("Sleeping between actions for " + "#{SLEEP_BETWEEN_ACTIONS} seconds.") sleep SLEEP_BETWEEN_ACTIONS process_outgoing ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end", "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end", "def start\r\n\t\t\tswdebug 'Started new thread for message processing.'\r\n\t\t\t# St...
[ "0.7462875", "0.7462875", "0.72887546", "0.7218411", "0.72158074", "0.7102243", "0.6998748", "0.67903537", "0.6785039", "0.67801124", "0.6747518", "0.6688358", "0.6653972", "0.6647615", "0.65497", "0.6545652", "0.6537935", "0.65341043", "0.6516001", "0.65022635", "0.64665717"...
0.68068326
7
Processes incoming Sms messages Executes and logs control ones, stores others
def process_incoming @logger.debug("Processing incoming.") # Incoming messages msgs = @phone.messages msgs.each do |msg| @logger.info("Incoming Sms: #{msg.to_s}.") @logger.debug(msg.inspect) sms = ISms.new({ :number => msg.number, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_msgs\n end", "def process_messages\n # Check status for all streams, reopen as necessary\n @streams.each { |_, stream| try { stream.keep_alive } }\n\n # Actual processing of incoming messages happens in event callbacks\n # Oбрабатываем пришедшее сообщение в интерфейсах обратн...
[ "0.7236841", "0.66481596", "0.657975", "0.6440599", "0.640617", "0.63500214", "0.63007784", "0.62889796", "0.6228822", "0.62191474", "0.6036224", "0.59944814", "0.5988243", "0.59809566", "0.5960423", "0.59253347", "0.59195805", "0.591486", "0.5911936", "0.59084964", "0.584565...
0.6906788
1
Send outgoing messages from MySQL
def process_outgoing @logger.debug("Processing outgoing.") # Outgoing messages to_send = OSms.find( :all, :conditions => [ "status IS NULL " + " AND (delayed_at <> ? OR delayed_at IS NULL)" + " AND (send_at <= NOW() OR send_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_a_message(conn, dest, message, headers={})\n return if not @need_sends \n @log.debug \"send_s_message starts\"\n return if not conn.connected?\n 1.upto(@max_msgs) do |mnum|\n outmsg = \"#{message} |:| #{mnum}\"\n conn.send(dest, outmsg, headers) # EM supplied Stomp method\n end\n @need_sen...
[ "0.66544753", "0.6567264", "0.63193893", "0.63142663", "0.63006735", "0.6204849", "0.6147682", "0.6115073", "0.6073754", "0.6069131", "0.605717", "0.60513854", "0.59877086", "0.59804606", "0.59597725", "0.59597725", "0.59580755", "0.59405404", "0.5932771", "0.59296685", "0.59...
0.56230575
43
GET /schools_users/1 GET /schools_users/1.xml
def show @schools_user = SchoolsUser.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @schools_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end", "def new\n @schools_user = SchoolsUser.new\n @schools = current_user.ladmin.schools\n respond_t...
[ "0.65818673", "0.6506057", "0.64890695", "0.64547485", "0.63861835", "0.6348728", "0.62639004", "0.624245", "0.622931", "0.6213104", "0.6175547", "0.6161519", "0.61508137", "0.6129248", "0.6084846", "0.6077176", "0.60761005", "0.6052154", "0.60503286", "0.60489047", "0.604890...
0.7409378
0
GET /schools_users/new GET /schools_users/new.xml
def new @schools_user = SchoolsUser.new @schools = current_user.ladmin.schools respond_to do |format| format.html # new.html.erb format.xml { render :xml => @schools_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @user = User.new\n @title = \"Signup to Studyers\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n render :xml => @user\n end", "def new\n @user = User.new\n\n respond_to do |f...
[ "0.71906286", "0.71872556", "0.7106436", "0.7094594", "0.7013535", "0.69741786", "0.69739324", "0.6967182", "0.69346774", "0.691374", "0.691374", "0.691374", "0.691374", "0.691374", "0.69099474", "0.69097877", "0.69097877", "0.68880785", "0.68819404", "0.6872826", "0.6872826"...
0.7243393
0
POST /schools_users POST /schools_users.xml
def create @schools_user = SchoolsUser.new(params[:schools_user]) @schools_user.user = current_user respond_to do |format| if @schools_user.save format.html { redirect_to(schools_users_path, :notice => 'Schools user was successfully created.') } format.xml { render :xml => @schools_us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def create\n @user_in_school = UserInSchool.new(user_in_school_params)\n\n respond_to do |format|\n if @user_in_school.save\n forma...
[ "0.6104786", "0.59162205", "0.5890198", "0.5760169", "0.5701474", "0.558468", "0.5562633", "0.5562235", "0.5547187", "0.5505305", "0.5502448", "0.5460154", "0.54491496", "0.54445916", "0.54382545", "0.54271454", "0.542276", "0.54225534", "0.54217577", "0.5416361", "0.54126066...
0.6804234
0
PUT /schools_users/1 PUT /schools_users/1.xml
def update @schools_user = SchoolsUser.find(params[:id]) respond_to do |format| if @schools_user.update_attributes(params[:schools_user]) format.html { redirect_to(schools_users_path, :notice => 'Schools user was successfully updated.') } format.xml { head :ok } else format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def create\n @schools_user = SchoolsUser.new(params[:...
[ "0.6329017", "0.611012", "0.58092886", "0.5778208", "0.5775926", "0.574713", "0.572795", "0.57256216", "0.5717197", "0.57151854", "0.5709594", "0.56779826", "0.5674921", "0.5655501", "0.5655414", "0.5647204", "0.5647204", "0.56391704", "0.56383616", "0.559903", "0.5594809", ...
0.70815974
0
DELETE /schools_users/1 DELETE /schools_users/1.xml
def destroy @schools_user = SchoolsUser.find(params[:id]) @schools_user.destroy respond_to do |format| format.html { redirect_to(schools_users_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def delete_users\n delete(users_path)\n end", "def destroy\n @student...
[ "0.7093349", "0.6686408", "0.660231", "0.6577777", "0.6575194", "0.6515411", "0.64707154", "0.64432096", "0.6440052", "0.638889", "0.63796914", "0.6373276", "0.63561296", "0.6354184", "0.6353903", "0.63506484", "0.634622", "0.63400954", "0.63400954", "0.6330109", "0.63263327"...
0.73665506
0
Gets the application version
def version detect_product('GSA').version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_version\n read('application_version')\n end", "def app_version\n return @app_version\n end", "def app_version\n return @app_version\n end", "def application_version\n return @application_version\n en...
[ "0.88064575", "0.864153", "0.864153", "0.8458564", "0.8458564", "0.8340475", "0.7966316", "0.7817149", "0.77130497", "0.7699396", "0.7684284", "0.75557077", "0.75355244", "0.75355244", "0.75355244", "0.75355244", "0.75355244", "0.75355244", "0.75355244", "0.75355244", "0.7535...
0.0
-1
override the devise method for where to go after signing out because theirs always goes to the root path.
def after_sign_out_path_for(resource) home_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_out_path_for(_resource)\n root_path\n end", "def after_sign_out_path_for(_resource)\n root_path\n end", "def after_sign_out_path_for(resource_or_scope)\n \t\t\troot_path\n \t\t end", "def after_sign_out_path_for(user)\n '/'\n end", "def after_sign_out_path_for(_resource)\n ...
[ "0.81407714", "0.81407714", "0.80772424", "0.7988859", "0.7982008", "0.7979017", "0.797828", "0.79709023", "0.7921802", "0.7921802", "0.7921802", "0.7876784", "0.78635037", "0.7860961", "0.78545547", "0.7852809", "0.7843102", "0.78387415", "0.78313726", "0.7819458", "0.781945...
0.78701496
12
GET /ubicacion_laborales GET /ubicacion_laborales.json
def index @ubicacion_laborales = UbicacionLaboral.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @laboratorios = Laboratorio.all\n end", "def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end", "def labors\n aux = WorkOrderLabor.by_name\n render json: serial...
[ "0.6605347", "0.6471139", "0.64634436", "0.63584733", "0.6355096", "0.62759495", "0.6209927", "0.6148734", "0.6129149", "0.6115914", "0.60994744", "0.60867196", "0.6050052", "0.6048602", "0.6015791", "0.60061", "0.5988132", "0.5975942", "0.5965996", "0.5961769", "0.5949568", ...
0.7510888
0
GET /ubicacion_laborales/1 GET /ubicacion_laborales/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ubicacion_laborales = UbicacionLaboral.all\n end", "def index\n @laboratorios = Laboratorio.all\n end", "def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end", "de...
[ "0.73400635", "0.6613734", "0.65302193", "0.641627", "0.6403564", "0.6337391", "0.63115996", "0.62753904", "0.6256875", "0.62551755", "0.6252938", "0.6250684", "0.6196974", "0.6188511", "0.60991895", "0.60991895", "0.60787594", "0.60681665", "0.6061734", "0.605442", "0.605353...
0.0
-1
POST /ubicacion_laborales POST /ubicacion_laborales.json
def create @ubicacion_laboral = UbicacionLaboral.new(ubicacion_laboral_params) respond_to do |format| if @ubicacion_laboral.save format.html { redirect_to new_desem_laboral_path, notice: 'Ubicacion laboral was successfully created.' } format.json { render :show, status: :created, location...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @insumolabore = Insumolabore.new(insumolabore_params)\n @insumolabore.labor = @labor\n\n \n if @insumolabore.save\n redirect_to labors_path, notice: 'Insumolabore was successfully created.'\n \n else\n respond_to do |format|\n format.html { render :new }\n ...
[ "0.6842913", "0.6825486", "0.6811315", "0.6766546", "0.6582301", "0.6580205", "0.6566346", "0.65146506", "0.65093255", "0.64959776", "0.64512086", "0.6360549", "0.63317114", "0.6279692", "0.6263714", "0.62204015", "0.6207433", "0.6199679", "0.6186762", "0.61653304", "0.615117...
0.6487391
10
PATCH/PUT /ubicacion_laborales/1 PATCH/PUT /ubicacion_laborales/1.json
def update respond_to do |format| if @ubicacion_laboral.update(ubicacion_laboral_params) format.html { redirect_to @ubicacion_laboral, notice: 'Ubicacion laboral was successfully updated.' } format.json { render :show, status: :ok, location: @ubicacion_laboral } else format.html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", ...
[ "0.7043388", "0.68164366", "0.6635625", "0.6622527", "0.6520525", "0.6503848", "0.6469597", "0.6462864", "0.64305615", "0.63863057", "0.63774806", "0.63751614", "0.637168", "0.6361175", "0.6360414", "0.63514984", "0.6321599", "0.6262973", "0.6260598", "0.6257742", "0.6236038"...
0.65932435
4
DELETE /ubicacion_laborales/1 DELETE /ubicacion_laborales/1.json
def destroy @ubicacion_laboral.destroy respond_to do |format| format.html { redirect_to ubicacion_laborales_url, notice: 'Ubicacion laboral was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n \n @laboratorio.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def destroy\n @colaborador.destroy\n respond_to do |format|\n format.html { redirect_to colaboradors_url...
[ "0.7576553", "0.733895", "0.7184929", "0.7146153", "0.71454066", "0.71233517", "0.7117543", "0.711268", "0.7080445", "0.70761454", "0.70758533", "0.7058058", "0.7056745", "0.70543516", "0.70328695", "0.7011907", "0.7011907", "0.7008276", "0.70006746", "0.6969392", "0.69299227...
0.7586282
0
Use callbacks to share common setup or constraints between actions.
def set_ubicacion_laboral @ubicacion_laboral = UbicacionLaboral.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 ubicacion_laboral_params params.require(:ubicacion_laboral).permit(:act_dedica, :estudia, :especialidad_institucion, :tiempo_empleo, :medio_empleo, :requisitos_contratacion, :idioma_trabajo, :hablar_idioma, :escribir_idioma, :leer_idioma, :escuchar_idioma, :anti_empleo, :ano_ingreso, :ingreso, :nivel_jerarqui...
{ "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
The following methods are helpers to reduce duplicated code and in many cases, reduce search and SQL queries Check format of lines is correct
def valid?(line_token) line_token[0] == 'VOTE' && line_token[1].scan(/\D/).empty? && line_token[2].scan(/^Campaign:[a-zA-Z]+/).any? && line_token[3].scan(/^Validity:(during|pre|post)/) && line_token[4].scan(/^Choice:[a-zA-Z]+/).any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditions\n sqlwhere = \"1 = 1 \"\n sqlwhere = sqlwhere + \"and orders.namel like ? \" if is_string_here?(namel)\n sqlwhere = sqlwhere + \"and orders.email like ? \" if is_string_here?(email)\n sqlwhere = sqlwhere + \"and addresses.street_address1 like ? \" if is_string_here?(street_address1)\n ...
[ "0.60726655", "0.57121825", "0.5536246", "0.548282", "0.54750794", "0.5447898", "0.54381347", "0.54381347", "0.54326165", "0.54124486", "0.54103297", "0.5406583", "0.5373609", "0.53631663", "0.5361298", "0.5359749", "0.5353329", "0.5332144", "0.53007627", "0.5277193", "0.5274...
0.0
-1
check if vailidity is pre or post
def early_or_late?(line_token) line_token[3].scan(/^Validity:(pre|post)/).any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def futur?\n before > 0\n end", "def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end", "def apply_post_processing?\n if self.is_video?\n return true\n elsif self.is_image?\n if self.is_seed\n return true\n end \n else \n return false \n end\n ...
[ "0.56993073", "0.5697799", "0.568918", "0.5685452", "0.5574986", "0.5528811", "0.55256003", "0.5496093", "0.54877794", "0.54737556", "0.54737556", "0.54666495", "0.5457588", "0.54509634", "0.54439753", "0.54353136", "0.5425267", "0.54129004", "0.5395865", "0.53578615", "0.535...
0.5270893
30
Check if entry exists, passing an active record model and the name of the candidate or campaign
def entry_exists?(model, name) bool = false model.each do |hash| hash.each do |k, v| if v == name bool = true end end end bool end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n model.exists?(@id)\n end", "def include?(model)\n exists?(model.id)\n end", "def model_exists?(model_type, name)\n get_model(model_type, name) != nil\n end", "def check_if_record_exists\n\tif MenuItem.exists?(:name =>self.name,:vendor_id=>self.vendor_id)\n\t\tputs\"This ...
[ "0.6372387", "0.6288888", "0.62356484", "0.6196796", "0.6182586", "0.6050281", "0.6014698", "0.59815085", "0.5965767", "0.5879969", "0.5852514", "0.58442867", "0.57952434", "0.5779376", "0.5706404", "0.5687687", "0.56619555", "0.5649883", "0.5644338", "0.5644092", "0.56244224...
0.68048316
0
Create hash of ID : name for candidates to reduce SQL queries
def map_current_candidates obj = Candidate.all obj.map { |i| {i.id => i.name} } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_name_to_id\n build_hash('name', 'id')\n end", "def make_id_to_name\n build_hash('id', 'name')\n end", "def name_to_id\n @name_to_id ||= build_hash('name', 'id')\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def name...
[ "0.7331904", "0.73284036", "0.677168", "0.6492797", "0.6490983", "0.6487131", "0.6429937", "0.64127344", "0.6341353", "0.6341353", "0.6320308", "0.63112515", "0.630228", "0.6300586", "0.62879354", "0.6281806", "0.62808985", "0.62808985", "0.62808985", "0.62808985", "0.6280898...
0.0
-1