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 |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions. | def set_about
@about = About.first_or_create!
# load images
@images = @about.images
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def about_params
params.require(:about).permit(:body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
GET /lodgings GET /lodgings.json | def index
@lodgings = Lodging.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lodges = Lodge.all\n end",
"def index\n #@lodgings = Lodging.all\n @lodgings = @travel.lodgings.all\n end",
"def set_lodging\n @lodging = Lodging.find(params[:id])\n end",
"def set_lodging\n @lodging = Lodging.find(params[:id])\n end",
"def set_lodging\n @lodging = ... | [
"0.7084891",
"0.68889487",
"0.6880118",
"0.6856197",
"0.6855801",
"0.6811629",
"0.6759549",
"0.6687838",
"0.64834344",
"0.6457795",
"0.63722825",
"0.6336974",
"0.6325085",
"0.63226616",
"0.6287584",
"0.62772465",
"0.6251119",
"0.6244638",
"0.6237279",
"0.61889595",
"0.6076521... | 0.80210656 | 1 |
GET /lodgings/1 GET /lodgings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lodgings = Lodging.all\n end",
"def index\n @lodgings = Lodging.all\n end",
"def set_lodging\n @lodging = Lodging.find(params[:id])\n end",
"def set_lodging\n @lodging = Lodging.find(params[:id])\n end",
"def set_lodging\n @lodging = Lodging.find(params[:id])\n end"... | [
"0.7832272",
"0.7832272",
"0.7284881",
"0.7239848",
"0.72393036",
"0.71551895",
"0.7009253",
"0.6923152",
"0.67135316",
"0.66822976",
"0.66386366",
"0.65226895",
"0.649195",
"0.6467527",
"0.63697636",
"0.6334923",
"0.6212418",
"0.6193876",
"0.6184142",
"0.6167205",
"0.6142103... | 0.0 | -1 |
POST /lodgings POST /lodgings.json | def create
@lodging = Lodging.new(lodging_params)
respond_to do |format|
if @lodging.save
format.html { redirect_to @lodging, notice: 'Lodging was successfully created.' }
format.json { render :show, status: :created, location: @lodging }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@lodging = Lodging.new(lodging_params)\n params.permit!\n @lodging = @travel.lodgings.new(params[:lodging])\n\n respond_to do |format|\n if @lodging.save\n #format.html { redirect_to @lodging, notice: 'Lodging was successfully created.' }\n format.html { redirect_to [@t... | [
"0.708042",
"0.69358915",
"0.6722788",
"0.6722788",
"0.64450985",
"0.6398752",
"0.63964957",
"0.6379664",
"0.6375446",
"0.6374609",
"0.62774575",
"0.6203495",
"0.6179832",
"0.61392593",
"0.6137563",
"0.60438114",
"0.5913405",
"0.59058726",
"0.590367",
"0.58372617",
"0.5827257... | 0.7613948 | 0 |
PATCH/PUT /lodgings/1 PATCH/PUT /lodgings/1.json | def update
respond_to do |format|
if @lodging.update(lodging_params)
format.html { redirect_to @lodging, notice: 'Lodging was successfully updated.' }
format.json { render :show, status: :ok, location: @lodging }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @lodging.update(lodging_params)\n format.html { redirect_to @lodging, notice: \"Lodging was successfully updated.\" }\n format.json { render :show, status: :ok, location: @lodging }\n else\n format.html { render :edit, status: :unprocessabl... | [
"0.7310702",
"0.6768554",
"0.64231724",
"0.6375912",
"0.6375541",
"0.63541037",
"0.6305267",
"0.6280893",
"0.61196107",
"0.6087406",
"0.60771966",
"0.60697997",
"0.6067996",
"0.58687603",
"0.58629674",
"0.58541286",
"0.58279645",
"0.58279645",
"0.58265895",
"0.5826155",
"0.58... | 0.7306533 | 1 |
DELETE /lodgings/1 DELETE /lodgings/1.json | def destroy
@lodging.destroy
respond_to do |format|
format.html { redirect_to lodgings_url, notice: 'Lodging was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lodging.destroy\n respond_to do |format|\n format.html { redirect_to lodgings_url, notice: \"Lodging was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lodge = Lodge.find(params[:id])\n @lodge.destroy\n\n respond_to do |for... | [
"0.76188177",
"0.68948406",
"0.6885328",
"0.6778005",
"0.67078876",
"0.66607976",
"0.66104203",
"0.6602906",
"0.6601686",
"0.65981656",
"0.6581363",
"0.65662646",
"0.65658003",
"0.6560653",
"0.6554413",
"0.655174",
"0.6505607",
"0.6502417",
"0.64891696",
"0.64804494",
"0.6480... | 0.76265377 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_lodging
@lodging = Lodging.find(params[:name])
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 lodging_params
params.require(:lodging).permit(:owner, :company, :capacity, :address, :name, :phone_number, :email)
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 |
Add more helper methods to be used by all tests here... | def login user
@request.session[:user_id] = user.id
@controller.instance_variable_set('@current_user', user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n assert_nil @patron.secondary_address_mobile_phone\n end",
"def helpers; end",
"def... | [
"0.7330966",
"0.701972",
"0.701972",
"0.701972",
"0.6772961",
"0.6679903",
"0.6679903",
"0.6583205",
"0.65507036",
"0.6377433",
"0.63762784",
"0.632961",
"0.6280821",
"0.6280821",
"0.6249786",
"0.6142927",
"0.6137607",
"0.6121912",
"0.6108209",
"0.60972595",
"0.60949636",
"... | 0.0 | -1 |
GET /users/:id GET /users/:id.json GET /users/:id.xml | def show
@user = User.from_param params[:id]
respond_to do |format|
format.html # show.html.haml
format.json { render_for_api :public, :json => @user }
format.xml { render_for_api :public, :xml => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def GetUser id\n\n ... | [
"0.76485753",
"0.74843454",
"0.7372701",
"0.7372597",
"0.736864",
"0.72499585",
"0.72366405",
"0.72330874",
"0.72133327",
"0.7198165",
"0.7184416",
"0.71812034",
"0.71725965",
"0.7166306",
"0.7164029",
"0.71545184",
"0.7150598",
"0.7135059",
"0.71271396",
"0.71195066",
"0.711... | 0.0 | -1 |
GET /users/:id/liked.json GET /users/:id/liked.xml | def liked
@user = User.from_param params[:id]
@beers = @user.liked_beers
respond_to do |format|
format.json { render_for_api :public, :json => @beers }
format.xml { render_for_api :public, :xml => @beers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liked\n get '/users/self/media/liked', auth_params\n end",
"def user_likes\n user = User.find(params[:user_id])\n likes = user.likes\n render json: likes\n\nend",
"def disliked\n @user = User.from_param params[:id]\n @beers = @user.disliked_beers\n\n respond_to do |format|\n fo... | [
"0.73478913",
"0.7084887",
"0.6886089",
"0.68848825",
"0.67410433",
"0.66171724",
"0.6602429",
"0.64871234",
"0.64794046",
"0.64436644",
"0.63631845",
"0.63028383",
"0.6297781",
"0.62839305",
"0.6227684",
"0.6210084",
"0.61753535",
"0.61602676",
"0.6151682",
"0.61338013",
"0.... | 0.7851552 | 0 |
GET /users/:id/disliked.json GET /users/:id/disliked.xml | def disliked
@user = User.from_param params[:id]
@beers = @user.disliked_beers
respond_to do |format|
format.json { render_for_api :public, :json => @beers }
format.xml { render_for_api :public, :xml => @beers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dislikes = Dislike.find_user_dislikes(params[:user_id])\n render :index\n end",
"def liked\n @user = User.from_param params[:id]\n @beers = @user.liked_beers\n\n respond_to do |format|\n format.json { render_for_api :public, :json => @beers }\n format.xml { render_for_api ... | [
"0.6942592",
"0.6593565",
"0.63586074",
"0.63250667",
"0.6304595",
"0.6286044",
"0.6248881",
"0.60493255",
"0.60178035",
"0.60042053",
"0.59677035",
"0.5952157",
"0.5928698",
"0.59260046",
"0.59102666",
"0.5896901",
"0.58399546",
"0.5833823",
"0.58301735",
"0.57924134",
"0.57... | 0.806615 | 0 |
GET /users/:id/ignored.json GET /users/:id/ignored.xml | def ignored
@user = User.from_param params[:id]
@beers = @user.ignored_beers
respond_to do |format|
format.json { render_for_api :public, :json => @beers }
format.xml { render_for_api :public, :xml => @beers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_user(user)\n @ignored_ids << user.resolve_id\n end",
"def ignore_user(user)\n @ignored_ids << user.resolve_id\n end",
"def ignore\n users = User.where(username: [params[:username], params[:other_username]])\n raise Discourse::InvalidParameters.new if users.size != 2\n\n Disc... | [
"0.63587916",
"0.63587916",
"0.62699527",
"0.6264081",
"0.60764444",
"0.6017697",
"0.6006508",
"0.59940356",
"0.5953791",
"0.58272475",
"0.57481486",
"0.5710182",
"0.56987584",
"0.5687502",
"0.5645188",
"0.5631912",
"0.5631912",
"0.56247634",
"0.56117064",
"0.5606535",
"0.558... | 0.7271402 | 0 |
GET /users/:id/stashed.json GET /users/:id/stashed.xml | def stashed
@user = User.from_param params[:id]
@beers = @user.stashed_beers
respond_to do |format|
format.json { render_for_api :public, :json => @beers }
format.xml { render_for_api :public, :xml => @beers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end",
"def index\n #@parent_stashes = Stash.order('title ASC').where(:parent_id => nil) \n @stashes = Stash.... | [
"0.58517087",
"0.58414483",
"0.5620978",
"0.5421006",
"0.53536516",
"0.5339763",
"0.532078",
"0.5278278",
"0.5253184",
"0.5245668",
"0.5235326",
"0.5203929",
"0.518844",
"0.51499575",
"0.51417303",
"0.51382583",
"0.51309025",
"0.51269853",
"0.5126693",
"0.51223224",
"0.510290... | 0.7564654 | 0 |
GET /users/:id/similar.json GET /users/:id/similar.xml | def similar
@user = User.from_param params[:id]
@users = @user.similar_raters
respond_to do |format|
format.json { render_for_api :public, :json => @users }
format.xml { render_for_api :public, :xml => @users }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def similar\n Enceladus::MovieCollection.new(\"movie/#{id}/similar\", Enceladus::Movie.default_params(only: [:language, :append_to_response]))\n end",
"def similars(id, params = {})\n args = '?' + paramify(params) unless params.empty?\n get(\"/catalog/titles/#{id.to_s}/similars#{args}\")\n end",... | [
"0.6014863",
"0.5918969",
"0.58836967",
"0.5871422",
"0.5727213",
"0.56061834",
"0.55972093",
"0.55697954",
"0.5562236",
"0.55535775",
"0.55408776",
"0.5522784",
"0.54955494",
"0.5483928",
"0.5467178",
"0.54524803",
"0.543792",
"0.54338723",
"0.53932333",
"0.5384009",
"0.5348... | 0.814325 | 0 |
GET /users/new GET /users/new.json GET /users/new.xml | def new
@user = User.new
respond_to do |format|
format.html # new.html.haml
format.json { render_for_api :public, :json => @user }
format.xml { render_for_api :public, :xml => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"... | [
"0.7755096",
"0.75021756",
"0.74542516",
"0.74354833",
"0.74120563",
"0.7406198",
"0.73699546",
"0.73427904",
"0.73402727",
"0.7307287",
"0.7218683",
"0.72167265",
"0.714703",
"0.714703",
"0.714703",
"0.714703",
"0.714703",
"0.7130176",
"0.7121766",
"0.7121766",
"0.71062934",... | 0.71067756 | 20 |
POST /users POST /users.json POST /users.xml | def create
@user = User.new params[:user]
respond_to do |format|
if @user.save
cookies.permanent[:auth_token] = @user.auth_token
format.html { redirect_to dashboard_path, :notice => 'Welcome to goodbre.ws!'}
format.json { render_for_api :public, :json => @user, :status =>... | {
"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 CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.7537491",
"0.6851498",
"0.6830923",
"0.65962255",
"0.64606553",
"0.6455672",
"0.6349617",
"0.6303454",
"0.62776655",
"0.6276402",
"0.62533283",
"0.6252411",
"0.6244828",
"0.6218306",
"0.6206548",
"0.62036675",
"0.6171018",
"0.6144633",
"0.61183715",
"0.6109175",
"0.6107368... | 0.0 | -1 |
PUT /account PUT /account.json PUT /account.xml | def update
respond_to do |format|
# Controller should handle attribute whitelisting, not the Model.
params[:user].slice!(:email, :password, :password_confirmation)
if current_user.update_attributes params[:user]
format.html { redirect_to current_user }
format.json { head :ok }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update_account(client, options)\n ... | [
"0.68218416",
"0.6661317",
"0.64694667",
"0.6469445",
"0.6438114",
"0.63829184",
"0.6365022",
"0.6320173",
"0.6300979",
"0.62901604",
"0.6271632",
"0.62689054",
"0.6249174",
"0.62473285",
"0.624108",
"0.6237464",
"0.6216447",
"0.621126",
"0.6205694",
"0.6201602",
"0.61925775"... | 0.0 | -1 |
DELETE /account DELETE /account.json DELETE /account.xml | def destroy
current_user.destroy
respond_to do |format|
format.html { redirect_to users_sign_in_path }
format.json { head :ok }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end",
"def delete!\n resource = RESOURCE % { account_id: account.id, id: ... | [
"0.8507834",
"0.8436973",
"0.7398932",
"0.73383003",
"0.7326844",
"0.72535604",
"0.72305673",
"0.72238284",
"0.7221173",
"0.7209462",
"0.7195931",
"0.7167287",
"0.71556777",
"0.71556777",
"0.7155395",
"0.71477276",
"0.71474314",
"0.7140188",
"0.7123561",
"0.71104527",
"0.7108... | 0.0 | -1 |
[NOT SURE THIS IS USED AT ALL NOW...] handle Facebook Auth Cookie generated by JavaScript SDK | def show
auth = Facebook.auth.from_cookie(cookies)
authenticate Facebook.identify(auth.user)
redirect_to dashboard_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_cookie\n @raw_cookie ||= controller.cookies[\"fbs_#{self.facebook_api_key}\"]\n end",
"def credentials\n if self.authenticating_with_facebook?\n {\n :facebook_cookie => self.raw_cookie\n }\n else\n super\n end\n end",
"def fgra... | [
"0.716645",
"0.70011026",
"0.6912825",
"0.6857006",
"0.6853654",
"0.68163574",
"0.68031603",
"0.6796637",
"0.6754196",
"0.6672695",
"0.6672695",
"0.6672695",
"0.6672695",
"0.6660977",
"0.6623112",
"0.65862095",
"0.6567727",
"0.6567727",
"0.6567727",
"0.6567727",
"0.6567727",
... | 0.6219485 | 42 |
handle Normal OAuth flow: start NB making calls on the model facebook.rb, to set up FBGraph::Auth object | def new
client = Facebook.auth(callback_facebook_url).client
redirect_to client.authorization_uri(
:scope => Facebook.config[:scope]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook\n handle_oauth\n end",
"def facebook\n handle_auth \"facebook\"\n end",
"def new\n \n fb_auth = FbGraph::Auth.new('155275974530339', '309d340d359061c890906926e8139e4a')\n fb_auth.client # => Rack::OAuth2::Client\n \n client = fb_auth.client\n client.redirect_uri = \"http://localhos... | [
"0.80041003",
"0.7332032",
"0.71843266",
"0.69866514",
"0.6982431",
"0.6953214",
"0.6949974",
"0.69448376",
"0.68350196",
"0.67934525",
"0.6769969",
"0.673842",
"0.6738258",
"0.67194057",
"0.67111087",
"0.66618687",
"0.6632702",
"0.66133887",
"0.6612916",
"0.6605936",
"0.6605... | 0.0 | -1 |
handle Normal OAuth flow: callback now verifies access token to give user access | def create
client = Facebook.auth(callback_facebook_url).client
client.authorization_code = params[:code]
access_token = client.access_token! :client_auth_body
user = FbGraph::User.me(access_token).fetch
authenticate Facebook.identify(user)
redirect_to dashboard_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.to... | [
"0.80051327",
"0.76409525",
"0.76312584",
"0.7569813",
"0.7317161",
"0.7279733",
"0.7270183",
"0.72681844",
"0.7208035",
"0.71854246",
"0.71761686",
"0.71634245",
"0.71580565",
"0.71469706",
"0.71212596",
"0.7092302",
"0.7055428",
"0.697269",
"0.69629973",
"0.69598967",
"0.69... | 0.0 | -1 |
Configuration varibales :url of linuxcontainers market place :sizemb default size for container images :fs filesystem for the image file :format for the image file, qcow2, raw :agent for HTTP client | def initialize(options = {})
@options = DEFAULTS
@options.merge!(options)
version_path = File.dirname(__FILE__) + '/../../VERSION'
if File.exists? version_path
@options[:agent] = "OpenNebula #{File.read(version_path)}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configureImages()\n #Fetch the server configuration\n config = fetchServerConfig()\n #Used the gathered configuration information to build a URL for accessing images\n $imageBase = config['images']['base_url']+config['images']['poster_sizes'][5]\nend",
"def small(config)\n config.vm.provider \... | [
"0.6388633",
"0.5934256",
"0.5761881",
"0.5703778",
"0.56299853",
"0.56228894",
"0.5599255",
"0.55604404",
"0.55170715",
"0.5516349",
"0.5506603",
"0.5506603",
"0.5506603",
"0.5506603",
"0.5506603",
"0.5506603",
"0.5485285",
"0.5477422",
"0.54518414",
"0.5431566",
"0.5414643"... | 0.0 | -1 |
Get the list of appliances | def get_appliances()
first_level = '/images/'
rc, body = get(first_level)
return rc, body if rc != 0
distros = body.scan(/a href="([a-z].*\/)">/)
tree = Hash.new
distros.each do |distro|
rc, body = get(first_level + distro[0])
next if rc !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def index\n @compliances = Compliance.all\n end",
"def compliant_apps_list\n return @compliant_apps_list\n end",
"def compliant_apps_list\n return @compliant_apps_list\n end",
... | [
"0.6918902",
"0.6786014",
"0.6691609",
"0.6691609",
"0.65959966",
"0.6566209",
"0.65640694",
"0.65404594",
"0.65374297",
"0.65374297",
"0.64582074",
"0.6410937",
"0.6407873",
"0.63749725",
"0.6342747",
"0.6248516",
"0.6217274",
"0.61975133",
"0.6186198",
"0.6178655",
"0.61452... | 0.6309622 | 15 |
Generate the URL for the appliance path of the continer at linuxcontainers.org Example: lxd:// ./20181214_07:42/rootfs.tar.xz?size=5120&filesystem=ext4&format=raw | def app_url(path)
"\\\"lxd://#{@options[:url]}#{path}?size=#{@options[:sizemb]}&filesystem=" \
"#{@options[:fs]}&format=#{@options[:format]}\\\""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_path_location\n dmptool_url = 'https://dmptool.org/' if Rails.env.production?\n dmptool_url = 'https://dmptool-dev.cdlib.org/' if dashboard_url.include?('-dev.cdlib.org')\n dmptool_url = 'https://dmptool-stg.cdlib.org/' unless dmptool_url.present?\n dmptool_url\n end",
"def build_uri_path_c... | [
"0.6347993",
"0.6150532",
"0.6071602",
"0.60519296",
"0.59984696",
"0.5947082",
"0.59112394",
"0.5842494",
"0.58263797",
"0.5786091",
"0.57704896",
"0.57546306",
"0.57521456",
"0.5747389",
"0.5732128",
"0.5725291",
"0.567532",
"0.56750035",
"0.564745",
"0.56369156",
"0.563320... | 0.7036743 | 0 |
Print variable in an APP template | def print_var(str, name, val)
return if val.nil?
return if val.class == String && val.empty?
str << "#{name}=\"#{val}\"\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end",
"def render_variable(context); end",
"def view_thing thing\n\t@thing = thing\n\trender :template => 'things/view'\n\t#render :text => '<pre>'+YAML::dump(@thing)\n en... | [
"0.633188",
"0.61813986",
"0.6008097",
"0.59364897",
"0.58383924",
"0.5815275",
"0.57889533",
"0.5775617",
"0.57700634",
"0.57700634",
"0.57637",
"0.5763116",
"0.5758949",
"0.5753658",
"0.5749403",
"0.57488334",
"0.57477784",
"0.5742748",
"0.5733249",
"0.57179356",
"0.5711686... | 0.0 | -1 |
Main Program. Outpust the list of marketplace appliances | def set_option(o, d, name, path)
o[name] = d.elements[path].text if d.elements[path]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n puts \"➔ Listing all APK! Current #{publisher.current_version} - #{publisher.apk_date}\"\n versions = publisher.list_apks\n versions.each do |a|\n color = publisher.current_version == a.version_code ? :green : :black\n puts Paint[\"#{a.version_code} ➔ #{a.binary.sha1}\", col... | [
"0.61188334",
"0.60887253",
"0.6044074",
"0.59985256",
"0.5881833",
"0.5864176",
"0.5826865",
"0.5797425",
"0.5752091",
"0.5748464",
"0.5741177",
"0.57359606",
"0.5700629",
"0.5690388",
"0.5670828",
"0.5623433",
"0.5599876",
"0.5594135",
"0.5572099",
"0.5572099",
"0.55718696"... | 0.0 | -1 |
GET /transactions Optional Params: journal= tags=tag text | def index
@journal = Journal.find(params[:journal]) if params[:journal]
@transactions = Transaction.rev_chrono
@transactions = @transactions.for_journal(params[:journal]) if params[:journal]
if params[:filter] == 'tagged' && params[:tags]
@transactions = @transactions.with_tag(params[:tags])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTransactions\n\t\t\n\tend",
"def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end",
"def gettransaction(txid)\n request :gettransaction, txid\n end",
"def get_transactions(service)\n\t\treturn @transport.get_path(\"transact... | [
"0.6289064",
"0.6189933",
"0.61453885",
"0.60883456",
"0.60553813",
"0.60139227",
"0.60071886",
"0.60071886",
"0.59998834",
"0.59527755",
"0.5940981",
"0.5940981",
"0.5936486",
"0.58926827",
"0.5871033",
"0.5847719",
"0.5844663",
"0.5838585",
"0.5829962",
"0.57722014",
"0.576... | 0.7404542 | 0 |
POST /transactions POST /transactions.json | def create
@transaction = Transaction.new(params[:transaction])
respond_to do |format|
if @transaction.save
format.html { redirect_to home_url, notice: 'Transaction was posted to the journal.' }
format.json { render json: @transaction, status: :created, location: @transaction }
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/js... | [
"0.7124941",
"0.71085167",
"0.7107366",
"0.70616746",
"0.6970805",
"0.69395524",
"0.6882131",
"0.6873944",
"0.6864678",
"0.68382066",
"0.682873",
"0.6797429",
"0.6790942",
"0.67898583",
"0.6742485",
"0.67210656",
"0.67054796",
"0.66835666",
"0.6677946",
"0.66753876",
"0.66521... | 0.659287 | 35 |
PUT /transactions/1 PUT /transactions/1.json | def update
@transaction = Transaction.find(params[:id])
respond_to do |format|
if @transaction.update_attributes(params[:transaction])
format.html { redirect_to home_url, notice: 'Transaction was updated.' }
format.json { render json: @transaction, status: :updated, location: @transaction... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['basket_total'] = basket_total\n params['basket'] = basket\n params['currency'] = currency\n params['notes'] = notes\n ... | [
"0.68900895",
"0.68322974",
"0.6629446",
"0.63650894",
"0.6301225",
"0.6280184",
"0.6280184",
"0.6280184",
"0.6280184",
"0.6254173",
"0.6199193",
"0.61917174",
"0.6177884",
"0.61587065",
"0.6143153",
"0.61083794",
"0.60714877",
"0.6070388",
"0.60589755",
"0.60521424",
"0.6050... | 0.62586546 | 9 |
DELETE /transactions/1 DELETE /transactions/1.json | def destroy
@transaction = Transaction.find(params[:id])
@transaction.destroy
respond_to do |format|
format.html { redirect_to session[:return_to], alert: 'Transaction was deleted.' }
format.json { render json: true }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.dest... | [
"0.74672043",
"0.74672043",
"0.74672043",
"0.74672043",
"0.74672043",
"0.74672043",
"0.74672043",
"0.74672043",
"0.7446662",
"0.7431593",
"0.7431593",
"0.7431593",
"0.7431593",
"0.7431593",
"0.7431593",
"0.7431593",
"0.73309535",
"0.724183",
"0.72055084",
"0.7149197",
"0.7149... | 0.69753945 | 53 |
Modify HTML to remove time dependent stuff so we can compare HTML files more reliably | def extract_test(xml)
xml.gsub!(/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/, "UUID")
xml.gsub!(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(([-+]\d{2}:\d{2})|Z)/, "REPLACED_DATE")
xml.gsub!(/\w{3} \w{3} \d{2} \d{2}:\d{2}:\d{2} \w{3} \d{4}/, "REPLACED_DATE_TIME")
xml.gsub!(/\w{3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rewrite_html (html_file)\n\t\tdoc = Nokogiri::HTML(open(html_file))\n\t\tUNNECESARY_HTML_NODES.each do |node_path|\n \tnode = doc.xpath(node_path)\n \tnode.remove\n \t\tend\n \t\tFile.open(html_file,'w') { |file| doc.write_html_to file }\n\tend",
"def normalise(html)\n doc = Nokogiri::... | [
"0.6240056",
"0.61035943",
"0.59052765",
"0.57744575",
"0.57362574",
"0.57077545",
"0.5671899",
"0.5670239",
"0.5667249",
"0.5625142",
"0.5613589",
"0.55703664",
"0.5554155",
"0.5539631",
"0.5532555",
"0.5532555",
"0.5532555",
"0.5493595",
"0.5488256",
"0.5479859",
"0.5479859... | 0.5124079 | 47 |
Generate a Pingback UUID and write it to the database | def generate_pingback_uuid
self.pingback_uuid ||= SecureRandom.uuid()
self.pingback_uuid.to_s.gsub!("-", "")
datastore['PingbackUUID'] = self.pingback_uuid
vprint_status("PingbackUUID = #{datastore['PingbackUUID']}")
if framework.db.active
vprint_status("Writing UUID #{datastore['PingbackUUID'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_uuid\n self.uuid = SecureRandom.hex(12)\n end",
"def create_uuid\n SecureRandom.uuid\n end",
"def gen_uuid\n `uuidgen -t`.chomp.delete('-')\nend",
"def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end",
"def create_uu... | [
"0.71124256",
"0.7065751",
"0.6967761",
"0.6947676",
"0.6841674",
"0.6724652",
"0.6703942",
"0.67037606",
"0.67021066",
"0.6696503",
"0.66867363",
"0.6669969",
"0.6666332",
"0.6649242",
"0.6644519",
"0.6621837",
"0.66097105",
"0.66097105",
"0.65985155",
"0.6582368",
"0.658159... | 0.83030087 | 0 |
true if all possible segments are known to either exist or not, according to the voter | def check_deductions(node)
return if @explored_nodes.include? node
all_neighbors_known = node.cartesian_neighbors.map do |neighbor|
voter.known?(node, neighbor)
end.inject(:&)
if all_neighbors_known
@deduced_nodes << node
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applicable?\n super && route.segment_keys.size > 0\n end",
"def circular?\n self.overlaps.size == self.segment_names.size\n end",
"def any_duplicates?\n return @any_duplicates if defined? @any_duplicates\n\n return @any_duplicates = false if @composition.allow_duplicates?\n\n @... | [
"0.64240146",
"0.60926634",
"0.5901481",
"0.5787112",
"0.57804734",
"0.5745546",
"0.57358277",
"0.57132435",
"0.5702412",
"0.5699954",
"0.56773204",
"0.5672389",
"0.5666881",
"0.5615608",
"0.5615608",
"0.5587284",
"0.5585527",
"0.55686325",
"0.55486655",
"0.55332476",
"0.5521... | 0.0 | -1 |
After sign in path. | def after_sign_in_path_for(_resource_or_scope)
backend_dashboard_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end",
"def after_authentication\n @initiating_url = session[:initiating_url]\n session[:initiating_url] = nil\n render :'authentication/after_authentication'\n end",
"def after_successful_sign_in_url\n r... | [
"0.70341176",
"0.67845964",
"0.67745674",
"0.67498535",
"0.6718494",
"0.6674881",
"0.6652696",
"0.6638519",
"0.66385",
"0.6623106",
"0.661483",
"0.65972537",
"0.6589331",
"0.65534735",
"0.6551148",
"0.6551148",
"0.6551148",
"0.6534188",
"0.65339005",
"0.6524684",
"0.6519144",... | 0.0 | -1 |
After sign up path. | def after_sign_up_path_for(resource)
after_sign_in_path_for(resource)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_up_path_for(user)\n after_sign_in_path_for(user)\n end",
"def after_sign_up_path_for(resource)\n '/carrier/sign_up_complete'\n end",
"def after_sign_up_path_for(resource)\n after_register_path\n end",
"def after_sign_up_path_for(resource)\n :new_reparation\nend",
"def after_... | [
"0.77833617",
"0.7781738",
"0.7689808",
"0.7665222",
"0.7658061",
"0.7615758",
"0.75848854",
"0.7576719",
"0.755447",
"0.75358206",
"0.74436194",
"0.7418562",
"0.7418562",
"0.740536",
"0.7388353",
"0.7385871",
"0.7385871",
"0.7385871",
"0.7385871",
"0.7385871",
"0.7385871",
... | 0.73417234 | 45 |
After sign out path. | def after_sign_out_path_for(_resource)
I18n.locale == I18n.default_locale ? '/' : "/#{I18n.locale}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def after_sign_out_path_for(user)\n '/'\n end",
... | [
"0.79433477",
"0.7890694",
"0.7869484",
"0.7801537",
"0.7758264",
"0.77408516",
"0.7722663",
"0.7722663",
"0.7700474",
"0.76788616",
"0.76779443",
"0.7657583",
"0.76559573",
"0.7625112",
"0.76027286",
"0.757796",
"0.7568092",
"0.75672233",
"0.7561856",
"0.75616634",
"0.756100... | 0.0 | -1 |
Reads locale param in the url and setup the language, if empty sets to default language. | def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_locale(locale)\n # Parse the HTTP GET header for languages and create an array\n # from them\n locales = ::R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE'])\n\n # If we passed in a locale param, put it at the front of the\n # locales array\n if ((locale.is_a? String) ... | [
"0.73517936",
"0.73068374",
"0.71276057",
"0.7106825",
"0.70402896",
"0.69721746",
"0.6972078",
"0.6949854",
"0.69211936",
"0.6901356",
"0.6871972",
"0.6862272",
"0.6837855",
"0.68352133",
"0.6826487",
"0.680584",
"0.6776087",
"0.677434",
"0.6761501",
"0.67592794",
"0.6732854... | 0.63437545 | 84 |
Set locale and default_locale in JS. | def set_js_locale
gon.default_locale = I18n.default_locale
gon.locale = I18n.locale
gon.full_locale = I18n.full_locale
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_locale=(locale); end",
"def set_locale\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale] || I18... | [
"0.8272043",
"0.7882079",
"0.78148276",
"0.78148276",
"0.7800784",
"0.7800784",
"0.7800784",
"0.7800784",
"0.7783483",
"0.77753294",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306",
"0.777306... | 0.8169527 | 1 |
Set default URL options. | def default_url_options(options = {})
if I18n.locale.to_sym.eql?(I18n.default_locale.to_sym) ||
params[:locale]
{}.merge(options)
else
{ locale: I18n.locale }.merge(options)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_url_options=(_arg0); end",
"def default_url_options(*args); end",
"def default_url_options; end",
"def default_url_options\n {}\n end",
"def default_url_options\n Linkable.default_url_options\n end",
"def default_url_options(options = {})\n\n # Force for url locale\n ... | [
"0.86965436",
"0.8525445",
"0.8380389",
"0.80374414",
"0.76534516",
"0.7630578",
"0.7533004",
"0.7492441",
"0.74440014",
"0.74371946",
"0.74329954",
"0.740816",
"0.73964936",
"0.7370084",
"0.73569274",
"0.73445183",
"0.7339037",
"0.7326959",
"0.73225236",
"0.7308433",
"0.7304... | 0.69042754 | 68 |
:nocov: Load site model | def load_site
@site = Site.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_subdirectory_model_load=(_arg0); end",
"def load_models!\n require \"models\"\n end",
"def test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app\r\n \t assert_equal 'AppAndPluginModel (from app)',\tAppAndPluginModel.report_location \r\n \t assert_raises(NoMethodError) {... | [
"0.6635778",
"0.64903706",
"0.6077949",
"0.60268074",
"0.6012925",
"0.58643824",
"0.5860614",
"0.5854137",
"0.5844876",
"0.58104664",
"0.57747304",
"0.57747304",
"0.56986654",
"0.5696381",
"0.566567",
"0.56302655",
"0.55943555",
"0.5540576",
"0.5540576",
"0.5540576",
"0.55405... | 0.6471256 | 2 |
def is a keyword | def introduction
puts "Hi #{target}, I'm #{first_name}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyword_constant?\n token = peek\n return false unless token\n\n token.value == \"true\" ||\n token.value == \"false\" ||\n token.value == \"null\" ||\n token.value == \"this\"\n end",
"def isKeyword?\n self.category =~ /(keyword)/i\n end",
"def keyword_check(kw)\n unless ... | [
"0.7406297",
"0.70988095",
"0.70194185",
"0.6889449",
"0.6862656",
"0.67204696",
"0.655136",
"0.64968103",
"0.6431764",
"0.6418788",
"0.640576",
"0.62732136",
"0.62438625",
"0.62327707",
"0.62327707",
"0.62130654",
"0.6195736",
"0.6185554",
"0.61417556",
"0.613351",
"0.612636... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_inquiry_detail
@inquiry_detail = InquiryDetail.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def inquiry_detail_params
params.require(:inquiry_detail).permit(:content, :subject, :house_id, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
should return a new array containing the results of adding together corresponding elements of the original arrays. You can assume the arrays have the same length. Steps create an empty array create a temp variable to hold the sum of arr1 and arr2 Shovel the temp value into empty array return new array My Attempt | def sum_elements(arr1, arr2)
sum_array = []
i = 0
while i < arr1.length && i < arr2.length
temp = arr1[i] + arr2[i]
sum_array << temp
i += 1
end
return sum_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_arr(arr_1, arr_2)\n [arr_1,arr_2].transpose.map { |el| el.reduce(&:+) }\nend",
"def sum_array(a1,a2)\n\t\ta3_0 = a1[0] + a2[0]\n\t\ta3_1 = a1[1] + a2[1]\n\t\treturn [a3_0, a3_1]\n end",
"def sum_elements(arr1, arr2)\n i = 0\n newArr = []\n while i < arr1.length\n newArr << arr1[i] + a... | [
"0.8251551",
"0.79009336",
"0.7899342",
"0.7893854",
"0.78582364",
"0.77049464",
"0.7675474",
"0.7637516",
"0.76011014",
"0.7457435",
"0.73483866",
"0.72042584",
"0.71574014",
"0.70614815",
"0.6932973",
"0.6924463",
"0.6888519",
"0.6868082",
"0.68330073",
"0.6820256",
"0.6818... | 0.7797153 | 5 |
Return the latitude of the marker. | def lat
@position[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latitude\n geo_attribute('lat')\n end",
"def latitude\n self.to_coordinates[0]\n end",
"def latitude\n @latitude\n end",
"def lat\n round(@lat)\n end",
"def lat\n self.event['lat'].to_f\n end",
"def lat\n return self.city['lat'].to_f\n ... | [
"0.779881",
"0.76979977",
"0.7612265",
"0.74954027",
"0.7468346",
"0.7401519",
"0.7343227",
"0.7275951",
"0.72495604",
"0.72247934",
"0.7162962",
"0.7024502",
"0.7024502",
"0.70120627",
"0.6957226",
"0.69514954",
"0.6930727",
"0.68444484",
"0.6816929",
"0.67739445",
"0.674408... | 0.7110201 | 11 |
return the longitude of the marker. | def lon
@position[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longitude\n self.to_coordinates[1]\n end",
"def lon\r\n return @longitude\r\n end",
"def longitude\n @longitude\n end",
"def longitude\n if public_address?\n (location['location'] || {})['longitude']\n elsif zip_coords.present?\n zip_coords[1]\n end\n end... | [
"0.82661545",
"0.81515884",
"0.81367123",
"0.7929752",
"0.791569",
"0.77746654",
"0.7770937",
"0.7727009",
"0.7511636",
"0.74083877",
"0.72587866",
"0.725481",
"0.7201164",
"0.7189509",
"0.7063874",
"0.7041854",
"0.68597233",
"0.6764372",
"0.6682888",
"0.6633832",
"0.65525866... | 0.7472569 | 9 |
GET /weeks/1 GET /weeks/1.xml | def show
@season = Season.find(params[:season_id])
@week = @season.weeks.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @week }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:league_id]\n league = League.find(params[:league_id])\n start_week = league.start_week\n @weeks = @season.weeks.started.where('starts_at >= ?', start_week[:starts_at]).includes(:week_type, :season).order(starts_at: :asc)\n else\n @weeks = @season.weeks.order(starts_... | [
"0.6758261",
"0.6719954",
"0.6703616",
"0.64423835",
"0.6394545",
"0.6167918",
"0.61543167",
"0.61509454",
"0.61315036",
"0.61246306",
"0.6123143",
"0.6118651",
"0.6118371",
"0.6111018",
"0.6109145",
"0.6105246",
"0.6011797",
"0.5967344",
"0.5966165",
"0.5964927",
"0.5871757"... | 0.6680904 | 3 |
GET /weeks/new GET /weeks/new.xml | def new
@season = Season.find(params[:season_id])
@week = @season.weeks.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @week }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week }\n end\n end",
"def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week }\n end\n end",
"d... | [
"0.6633959",
"0.6633959",
"0.6613286",
"0.6465988",
"0.6436965",
"0.6143322",
"0.6136477",
"0.61145455",
"0.6099477",
"0.60359985",
"0.60103005",
"0.6002543",
"0.5971142",
"0.59153694",
"0.5901436",
"0.58599377",
"0.5859152",
"0.5858069",
"0.5833692",
"0.5830655",
"0.5803689"... | 0.7199863 | 0 |
POST /weeks POST /weeks.xml | def create
@season = Season.find(params[:season_id])
@week = @season.weeks.new(params[:week])
respond_to do |format|
if @week.save
format.html { redirect_to season_week_url(@season, @week) }
format.xml { render :xml => @week, :status => :created, :location => @week }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @week = Week.new(params[:week])\n\n respond_to do |format|\n if @week.save\n format.html { redirect_to @week, :notice => 'Week was successfully created.' }\n format.json { render :json => @week, :status => :created, :location => @week }\n else\n format.html { rende... | [
"0.64837635",
"0.64045787",
"0.63950807",
"0.61675096",
"0.6071052",
"0.59980285",
"0.5995232",
"0.5994006",
"0.5987935",
"0.59800386",
"0.5930494",
"0.59104216",
"0.5897305",
"0.5889793",
"0.5877124",
"0.5873293",
"0.58659095",
"0.5849734",
"0.58070385",
"0.5803539",
"0.5789... | 0.64975715 | 0 |
PUT /weeks/1 PUT /weeks/1.xml | def update
@season = Season.find(params[:season_id])
@week = Week.find(params[:id])
respond_to do |format|
if @week.update_attributes(params[:week])
format.html { redirect_to(@week, :notice => 'Week was successfully updated.') }
format.xml { head :ok }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @week = Week.find(params[:id])\n\n respond_to do |format|\n if @week.update_attributes(params[:week])\n format.html { redirect_to @week, :notice => 'Week was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit... | [
"0.637882",
"0.63510966",
"0.5977263",
"0.5928413",
"0.59262854",
"0.58775145",
"0.5847462",
"0.5847462",
"0.58450896",
"0.5811366",
"0.5809347",
"0.5784679",
"0.57554793",
"0.5744563",
"0.56794095",
"0.56553257",
"0.56510156",
"0.5616677",
"0.561469",
"0.5572782",
"0.5511876... | 0.6063281 | 2 |
DELETE /weeks/1 DELETE /weeks/1.xml | def destroy
@season = Season.find(params[:season_id])
@week = Week.find(params[:id])
@week.destroy
respond_to do |format|
format.html { redirect_to season_weeks_path(@season) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @reading_week = ReadingWeek.find(params[:id])\n @reading_week.destroy\n\n respond_to do |format|\n format.html { redirect_to(reading_weeks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gameweek = Gameweek.find(params[:id])\n @gameweek.destroy\n\n re... | [
"0.6859716",
"0.68412554",
"0.6743155",
"0.6743155",
"0.6705786",
"0.6676831",
"0.6656724",
"0.6566831",
"0.6519135",
"0.64367783",
"0.64367783",
"0.6432583",
"0.6415029",
"0.6414734",
"0.64080256",
"0.6294655",
"0.6231735",
"0.6228861",
"0.62041396",
"0.6181889",
"0.6154814"... | 0.6495606 | 9 |
Define fields we want searchable in Elasticsearch, and how they're analyzed mappings dynamic: 'false' do indexes :id, type: 'string', index: 'no' indexes :created_at, type: 'date', format: 'date_time_no_millis' indexes :permission, type: 'string', index: 'not_analyzed' indexes :source, type: 'string', index: 'not_analy... | def initialize(attributes = {})
super
self.type = 'story'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_searchable_fields\n NUMBER_TO_OBJECT_MAP.each do |num, object|\n @searchable_fields[num] = object.column_names - ['id']\n end\n \n @searchable_fields.each do |key, _|\n @searchable_fields[key] += ['_id', 'tags']\n end\n\n @searchable_fields['1'] << 'domain_names'\n end",
"def i... | [
"0.6710156",
"0.6686237",
"0.66624385",
"0.65822047",
"0.6486499",
"0.64308906",
"0.64308906",
"0.6429832",
"0.6345048",
"0.6266205",
"0.62326086",
"0.6191742",
"0.6172087",
"0.60848624",
"0.6028699",
"0.6019942",
"0.5999204",
"0.59833133",
"0.5972343",
"0.59492797",
"0.59393... | 0.0 | -1 |
Disable some message functionality def forward_message_id=(args); end | def send_forward_meta_messages(*args); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_message_id=(*args); end",
"def disableConversation _obj, _args\n \"_obj disableConversation _args;\" \n end",
"def set_message_id\n self.message_id ||= @cur_message.id\n end",
"def update!(**args)\n @message_ids = args[:message_ids] unless args[:message_ids].nil?\n end... | [
"0.8415277",
"0.644584",
"0.58328193",
"0.5832239",
"0.5743418",
"0.57416606",
"0.57063556",
"0.5695555",
"0.5695555",
"0.5692266",
"0.5658824",
"0.5640659",
"0.5637792",
"0.5631933",
"0.5628906",
"0.5625619",
"0.5611243",
"0.5579236",
"0.55463797",
"0.55444074",
"0.5541714",... | 0.6193688 | 2 |
Update the user's last public story attrs if this was the last public story but it's been changed to friends or private | def check_last_public_story
return unless (user.last_public_story_id == id && !allowed_in_public_feed?) ||
(user.last_public_story_id != id && allowed_in_public_feed?)
# Get the next most recent public story that's allowed in the public feed, if there is one
stories = NonFriendStoriesList.new(id: use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # Check whether current user is a member of this story, then persist changes to the DB.\n end",
"def change_to_public(old_permission)\n # From private:\n # Add to my followers' feeds\n # Add to my FriendStoriesList and NonFriendStoriesList\n if old_permission == 'private'\n frie... | [
"0.64855564",
"0.59383595",
"0.57953715",
"0.57649803",
"0.5694535",
"0.5647218",
"0.55903316",
"0.55089635",
"0.54338354",
"0.54265624",
"0.53924227",
"0.538072",
"0.53583175",
"0.53503954",
"0.5350325",
"0.53410274",
"0.5316933",
"0.5263001",
"0.52582955",
"0.52582955",
"0.... | 0.6593356 | 0 |
If changing to private: Remove from my followers' feeds Remove from my FriendStoriesList (and NonFriendStoriesList if changing from public) | def change_to_private(old_permission)
friend_ids = user.follower_ids.members
delete_from_friend_feeds(friend_ids)
FriendStoriesList.new(id: user.id).message_ids.delete(id)
if old_permission == 'public'
NonFriendStoriesList.new(id: user.id).message_ids.delete(id)
check_last_public_story
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_to_friends(old_permission)\n # From private:\n # Add to my mutual friends' feeds\n # Add to my FriendStoriesList\n if old_permission == 'private'\n friend_ids = user.mutual_friend_ids\n pushed_user_ids = add_to_friend_feeds(friend_ids)\n\n FriendStoriesList.new(id: user.id).ad... | [
"0.7278042",
"0.6975226",
"0.6957556",
"0.6645768",
"0.65865076",
"0.65335965",
"0.65209216",
"0.64221257",
"0.6290974",
"0.62860304",
"0.61761886",
"0.6154066",
"0.609849",
"0.609849",
"0.609849",
"0.6098024",
"0.6091995",
"0.60912776",
"0.608761",
"0.60710627",
"0.605259",
... | 0.79272085 | 0 |
If changing to friends: | def change_to_friends(old_permission)
# From private:
# Add to my mutual friends' feeds
# Add to my FriendStoriesList
if old_permission == 'private'
friend_ids = user.mutual_friend_ids
pushed_user_ids = add_to_friend_feeds(friend_ids)
FriendStoriesList.new(id: user.id).add_message(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends\n active_friends | received_friends\n end",
"def friends\n active_friends | received_friends\n end",
"def friends\n active_friends + passive_friends\n end",
"def is_friend?\n @friended\n end",
"def friends\n self.friended_users + self.users_friended_by\n end",
"def friends... | [
"0.7495014",
"0.7495014",
"0.74475867",
"0.73103684",
"0.7305445",
"0.73020136",
"0.7282798",
"0.72672534",
"0.72660476",
"0.7226502",
"0.7212665",
"0.7127427",
"0.70265776",
"0.70203847",
"0.70044124",
"0.69972664",
"0.6996706",
"0.6907238",
"0.6891358",
"0.6884614",
"0.6877... | 0.7791097 | 0 |
If changing to public: | def change_to_public(old_permission)
# From private:
# Add to my followers' feeds
# Add to my FriendStoriesList and NonFriendStoriesList
if old_permission == 'private'
friend_ids = user.follower_ids.members
pushed_user_ids = add_to_friend_feeds(friend_ids)
FriendStoriesList.new(id: us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def public; end",
"def public; end",
"def public_method; end",
"def private_method\n end",
"def internal; end",
"def private_method; end",
"def expose; end",
"def accessibility; end",
"def is_public?\n true\n end",
"def method4 # and this will be 'public'\r\n\t\t#..... | [
"0.8543356",
"0.85041946",
"0.85041946",
"0.7985924",
"0.78495055",
"0.7650157",
"0.74670184",
"0.7113091",
"0.71019113",
"0.7059489",
"0.7013882",
"0.7010021",
"0.7010021",
"0.7002027",
"0.6956237",
"0.6947719",
"0.69473326",
"0.6917229",
"0.6908717",
"0.6904459",
"0.687966"... | 0.0 | -1 |
Add to the creator's stories list(s), depending on the story's permission | def add_to_stories_lists
non_friend_stories_list = NonFriendStoriesList.new(id: user.id)
friend_stories_list = FriendStoriesList.new(id: user.id)
my_stories_list = MyStoriesList.new(id: user.id)
redis.pipelined do
non_friend_stories_list.add_message(self) if public?
friend_stories_list.add_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if current_user\n story = current_user.stories.new(story_params)\n story.save\n redirect_to story_path(story)\n else\n redirect_to login_path\n end\n # @story.user = current_user\n # redirect_to story_path(story)\n end",
"def push_to_lists_and_feeds\n add_to_st... | [
"0.62459254",
"0.61743724",
"0.6139081",
"0.6113187",
"0.604866",
"0.60482484",
"0.5991788",
"0.5935568",
"0.59076107",
"0.5844386",
"0.5829626",
"0.5816619",
"0.57711303",
"0.5761833",
"0.5754953",
"0.574716",
"0.572576",
"0.56885844",
"0.5663946",
"0.5663946",
"0.5635831",
... | 0.6538832 | 0 |
Add its id to the FriendFeeds of the given friends, unless it's already there | def add_to_friend_feeds(friend_ids = nil)
# If friend_ids is not given (i.e. this is the first time setting the permission),
# add it to the default friend ids for the permission
friend_ids ||= if public?
user.follower_ids.members
elsif friends?
u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_fb_friends(fb_user_info)\n friend_ids = self.friends.pluck(:id)\n\n (fb_user_info ||= []).each do |index, friend|\n\n auth = UserAuthentication.find_by(provider: \"facebook\", uid: friend['id'])\n user_friend = auth.user if auth\n\n if user_friend && !(friend_ids.include? user_friend.i... | [
"0.6841137",
"0.6813387",
"0.672277",
"0.64361686",
"0.6411239",
"0.63694227",
"0.6328981",
"0.627719",
"0.6245803",
"0.6197847",
"0.6178946",
"0.61590314",
"0.6145471",
"0.61009914",
"0.6082119",
"0.6070251",
"0.60597783",
"0.6019992",
"0.600219",
"0.59961295",
"0.59830254",... | 0.7341759 | 0 |
Delete its id from the FriendFeeds of the given friends | def delete_from_friend_feeds(friend_ids)
redis.pipelined do
friend_ids.each do |friend_id|
feed = FriendFeed.new(id: friend_id)
feed.message_ids.delete(id)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n another_user = User.find params[:user_id]\n current_user.friends.delete(another_user)\n redirect_to users_path\n end",
"def destroy\n @friend = current_user.friendships.find(params[:id])\n @friend.destroy\n flash[:notice] = \"Removed friend.\"\n redirect_to current_user\n end... | [
"0.68550843",
"0.6838626",
"0.67952853",
"0.6630037",
"0.65824115",
"0.65722436",
"0.6568537",
"0.6550306",
"0.653184",
"0.6522725",
"0.64907694",
"0.6450742",
"0.645027",
"0.64362943",
"0.6430011",
"0.64119446",
"0.64056987",
"0.6399074",
"0.6398477",
"0.6386058",
"0.6383405... | 0.74673724 | 0 |
Push to the creator's stories list(s) and the relevant friend feeds | def push_to_lists_and_feeds
add_to_stories_lists
pushed_user_ids = add_to_friend_feeds
pushed_user_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_stories_lists\n non_friend_stories_list = NonFriendStoriesList.new(id: user.id)\n friend_stories_list = FriendStoriesList.new(id: user.id)\n my_stories_list = MyStoriesList.new(id: user.id)\n\n redis.pipelined do\n non_friend_stories_list.add_message(self) if public?\n friend_stori... | [
"0.7285768",
"0.68462604",
"0.6403449",
"0.6333201",
"0.6312579",
"0.6288481",
"0.6218344",
"0.62118256",
"0.6183187",
"0.6159333",
"0.61480784",
"0.6082744",
"0.6069389",
"0.60679555",
"0.6067891",
"0.6067891",
"0.6067891",
"0.6067891",
"0.60567135",
"0.6045823",
"0.6017272"... | 0.8425334 | 0 |
Create video with branding and upload to Youtube using their API | def create_and_upload_youtube_video
return unless youtube_id.blank? && public? && !review? && !censored? && !blurred && shareable_to_youtube?
locked = redis.set(youtube_lock_key, Time.current.to_f, {nx: true})
unless locked
Rails.logger.warn("Failed to obtain YouTube lock for story #{id}")
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @file = vid_params['file'].tempfile\n type = vid_params['file'].content_type\n client = YouTubeIt::Client.new(:username => ENV['GMAIL'], :password => ENV['GMAIL_PASSWORD'], :dev_key => ENV[\"YOUTUBE_API_KEY\"])\n res = client.video_upload(@file, title: vid_params['title'], description: vid... | [
"0.7744207",
"0.7585097",
"0.7034885",
"0.6971025",
"0.69495934",
"0.6908898",
"0.683518",
"0.67971164",
"0.6755262",
"0.67425555",
"0.6739438",
"0.6721399",
"0.6678068",
"0.6621388",
"0.65567505",
"0.6552682",
"0.6538779",
"0.65338993",
"0.6530145",
"0.6524825",
"0.6515732",... | 0.69397026 | 5 |
Write a method that takes an array and a string. Return true if the string is found in the array only once. Otherwise return false. What's the time complexity of your solution? Can it be improved? Whiteboard this first Difficulty: 4/10 Example: includedOnce(['hello','hi','hi'], 'hi') > false includedOnce(['hello','hi',... | def includedOnce (haystack, needle)
# Your code here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def includedOnce(haystack, needle)\n \n counter = haystack.count { |x| x == needle}\n if counter == 1\n return true\n elsif counter > 1\n return false\n else\n return false\n end\n \nend",
"def included_once(haystack, needle)\n count = 0\n for hay in haystack\n if hay... | [
"0.7414031",
"0.7356176",
"0.7336759",
"0.68359685",
"0.66034573",
"0.6528866",
"0.6514537",
"0.64861095",
"0.6478886",
"0.64672774",
"0.64618695",
"0.64556795",
"0.6420436",
"0.641097",
"0.6386004",
"0.63607246",
"0.6331329",
"0.632307",
"0.6318514",
"0.6278959",
"0.62783116... | 0.67854744 | 4 |
Returns all repositories for a given organization | def get_repos_by_orga(orga)
return self.fetch("repos?owner_name=#{orga}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_repos\n @org_repos ||= (\n talk 'org repos'\n logins = orgs.map { |org| org[:login] }\n\n logins.map do |login|\n talk \"repos for #{login}\"\n client.organization_repositories login.to_s\n end.flatten\n )\n end",
"def repositories\n @repositories ||= (organiza... | [
"0.77014637",
"0.76360404",
"0.7274076",
"0.7224983",
"0.7049349",
"0.70048684",
"0.6876549",
"0.68268526",
"0.6822912",
"0.6807338",
"0.6799725",
"0.6765631",
"0.6759801",
"0.6758169",
"0.67539287",
"0.67226815",
"0.6715958",
"0.66849047",
"0.6673766",
"0.6659997",
"0.663490... | 0.7031398 | 5 |
repo (string) Fully qualified name, incl. owner Returns a single repository as a Hash | def get_repo(repo)
return self.fetch("repos/#{repo}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name repo\n \"#{repo.owner.login}/#{repo.name}\"\n end",
"def repo_to_hash(repo)\n { :path => repo.path }\n end",
"def repo_to_hash(repo)\n { :path => repo.path }\n end",
"def repo\n @attributes[:repo]\n end",
"def repo\n @attributes[:repo]\n end",
"def fo... | [
"0.7475702",
"0.7324698",
"0.7324698",
"0.71627164",
"0.71627164",
"0.6984151",
"0.6977138",
"0.697584",
"0.695187",
"0.6950671",
"0.69051665",
"0.6883541",
"0.68162084",
"0.68087834",
"0.6785064",
"0.67783093",
"0.675587",
"0.6751209",
"0.67220163",
"0.6711901",
"0.67041016"... | 0.7146251 | 5 |
repo (string) Fully qualified name, incl. owner Returns a single repository as a Hash | def get_builds_by_repo(repo)
return self.fetch("repos/#{repo}/builds")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name repo\n \"#{repo.owner.login}/#{repo.name}\"\n end",
"def repo_to_hash(repo)\n { :path => repo.path }\n end",
"def repo_to_hash(repo)\n { :path => repo.path }\n end",
"def repo\n @attributes[:repo]\n end",
"def repo\n @attributes[:repo]\n end",
"def ge... | [
"0.74754333",
"0.73248816",
"0.73248816",
"0.7162709",
"0.7162709",
"0.7145572",
"0.6984898",
"0.6976358",
"0.6976299",
"0.6951442",
"0.6950341",
"0.6904853",
"0.6882912",
"0.6816608",
"0.68081856",
"0.67855996",
"0.6778716",
"0.6755872",
"0.67511",
"0.6721489",
"0.6711059",
... | 0.0 | -1 |
setting instance variable of current user | def set_current_user! #naming convention to have the !
@current_user = User.find_by(id: session[:user_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user\r\n @user = current_user\r\n end",
"def set_user\n @user = current_user \n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = @current_user\n end",
"def set_us... | [
"0.85580754",
"0.84696925",
"0.8398692",
"0.8398692",
"0.83918446",
"0.83532906",
"0.83491194",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756",
"0.8343756"... | 0.0 | -1 |
Train the predictor for the given user. | def train_for(user)
dataset = Predictors::StopRequestDataset.for(user)
train(dataset)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(u,m)\n viewer_list = []\n viewers(m).each do |id|\n viewer_list << @user_list[id]\n end\n @user_list[u].predict(m, viewer_list)\n end",
"def set_user_prediction\n @user_prediction = UserPrediction.find(params[:id])\n end",
"def predict(predictive_users, movie_id, user_id)\... | [
"0.64648837",
"0.63604826",
"0.6232688",
"0.61256343",
"0.5953969",
"0.5947417",
"0.59110314",
"0.5903429",
"0.58800393",
"0.58696854",
"0.5846231",
"0.5839735",
"0.58270097",
"0.5798101",
"0.57883424",
"0.57621723",
"0.5738622",
"0.5714327",
"0.5686576",
"0.56435937",
"0.562... | 0.80231225 | 0 |
Create and train the predictor given a dataset. Should be overriden. | def train(dataset)
raise 'Override me!'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_data\n ::RubyFann::TrainData.new(\n :inputs => inputs, \n :desired_outputs=> desired_outputs)\n end",
"def train\n raise NotImplementedError\n end",
"def train\n classifiers_initializer = ClassifiersInitializer.load_or_create\n classifiers_initializer.r... | [
"0.63725317",
"0.6360117",
"0.63396865",
"0.62444615",
"0.62347573",
"0.6195223",
"0.61407834",
"0.61255014",
"0.61168975",
"0.6094681",
"0.60720336",
"0.60469645",
"0.6008617",
"0.5981216",
"0.5957518",
"0.5957518",
"0.5956734",
"0.58999693",
"0.584726",
"0.5809901",
"0.5787... | 0.69239885 | 0 |
Predict the stop based on the +day_of_week+ and +minute_of_day+. | def predict(day_of_week, minute_of_day)
return nil if @predictor.nil?
@predictor.eval([day_of_week, minute_of_day])
rescue Ai4r::Classifiers::ModelFailureError
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_now\n timestamp = Time.now\n day_of_week = timestamp.wday\n minute_of_day = timestamp.hour * 60 + timestamp.min\n predict(day_of_week, minute_of_day)\n end",
"def time_of_day_week(delta_minutes)\n # first sunday of the year at midnight\n first_sunday = Date.commercial(2019, 1, 7)... | [
"0.6801618",
"0.55330896",
"0.5435933",
"0.5431763",
"0.54197913",
"0.5418856",
"0.5397403",
"0.5352311",
"0.5347516",
"0.5327704",
"0.5327704",
"0.5322951",
"0.53102785",
"0.53053075",
"0.52907455",
"0.52862245",
"0.5282715",
"0.52584064",
"0.52331835",
"0.523227",
"0.516080... | 0.64592165 | 1 |
Predict the stop based on the current date and time. | def predict_now
timestamp = Time.now
day_of_week = timestamp.wday
minute_of_day = timestamp.hour * 60 + timestamp.min
predict(day_of_week, minute_of_day)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predicted_time(previous_stops = nil)\n return nil if Travel.where('bus_id = ?', bus.id).empty?\n current_time = Time.now\n current_time_normal = Time.utc(2000, \"jan\", 1, current_time.hour, current_time.min, 0)\n delay = Delay.get_delay(id, current_time)\n return nil if delay.nil?\n start_ti... | [
"0.69626784",
"0.6568954",
"0.6186624",
"0.60625196",
"0.58133376",
"0.57627",
"0.5757116",
"0.568156",
"0.5649423",
"0.5597226",
"0.55655575",
"0.55368686",
"0.54555464",
"0.54535043",
"0.5395108",
"0.53854716",
"0.52986634",
"0.52896756",
"0.5287565",
"0.5287565",
"0.526111... | 0.7014876 | 0 |
Prepare the predictor for caching | def prepare_for_caching
@predictor.instance_variable_set(:@data_set, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare\n scope.send(:memoized_methods).instance_variable_get(:@memory).delete(name)\n super\n self\n end",
"def cache_classes=(_arg0); end",
"def cache_classes=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"de... | [
"0.60097533",
"0.59743005",
"0.59743005",
"0.5767299",
"0.5767299",
"0.5767299",
"0.5767299",
"0.5677197",
"0.566758",
"0.56612283",
"0.56442165",
"0.56230605",
"0.56230605",
"0.56215036",
"0.56215036",
"0.56215036",
"0.56215036",
"0.56215036",
"0.56215036",
"0.56215036",
"0.... | 0.7921349 | 0 |
By default paperclip doesn't allow to omit validation of name and contenttype This class can't be used as model holding files, it just adds common methods and settings. You should define your own validations in subclasses | def read
File.read(uploaded.path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_as_attachment\n validates_presence_of :size, :content_type, :filename\n validate :attachment_attributes_valid?\n end",
"def validate\n if self.filename.nil?\n errors.add_to_base(\"You must choose an image to upload\")\n else\n [:size, :content_type].e... | [
"0.74830544",
"0.71736795",
"0.6982308",
"0.69690406",
"0.68560326",
"0.67202914",
"0.6690923",
"0.669076",
"0.6681946",
"0.6616279",
"0.6611408",
"0.6559204",
"0.65234506",
"0.6380738",
"0.63772804",
"0.6324457",
"0.6314405",
"0.6266868",
"0.6194774",
"0.6154688",
"0.6137057... | 0.0 | -1 |
human readable description of modeling approach | def modeler_description
return 'Adds a heat recovery system to all air loops. Does not replace or update efficiencies for exisitng heat recovery systems.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def m... | [
"0.7710149",
"0.76145315",
"0.75934714",
"0.74018747",
"0.7299891",
"0.7296635",
"0.727943",
"0.71912926",
"0.71912926",
"0.7191264",
"0.7100944",
"0.70977926",
"0.70629936",
"0.7045383",
"0.7044268",
"0.70413125",
"0.7040473",
"0.7032938",
"0.70267737",
"0.70182866",
"0.6987... | 0.0 | -1 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Measure::OSArgumentVector.new
return args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",... | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# build standard to access methods
template = 'ComStock 90.1-2013'
std = Standard.build(te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n ... | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.6242... | 0.0 | -1 |
Not for every reader a cleanup is needed. Look for those readers with at least one single read mark | def readers_to_cleanup(reader_class)
reader_class.
reader_scope.
joins(:read_marks).
where(ReadMark.table_name => { readable_type: readable_class.name }).
group("#{ReadMark.quoted_table_name}.reader_type, #{ReadMark.quoted_table_name}.reader_id, #{reader_class.quoted_table_name}.#{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_auto_clean_up; end",
"def clear_reader_buffers\n @readers.each do |reader|\n reader.clear_buffer\n end\n end",
"def unmark!\n STDERR.puts \"unmark!\" if @trace > 0\n return if @paths.empty?\n n = @paths.rindex {|x| x.instance_o... | [
"0.5741339",
"0.5646754",
"0.5544903",
"0.549014",
"0.5447222",
"0.5402876",
"0.5362845",
"0.53342164",
"0.53278774",
"0.53065926",
"0.53021026",
"0.52546924",
"0.5243694",
"0.5214491",
"0.51977366",
"0.51734763",
"0.5156431",
"0.5067172",
"0.5063865",
"0.50607073",
"0.505236... | 0.6985133 | 0 |
title Cannot be repeated by the same artist in the same year | def same_year?
same_year_songs = Song.all.select{|song| song.release_year == release_year}
same_year_songs.select!{|song| song.title == title}
!same_year_songs.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title_unique?\n song = Song.find_by(title: self.title)\n if song && song.release_year == self.release_year\n errors.add(:title, \"Artist cannot release same song in one year.\")\n end\n end",
"def uniqueness_of_title\n if project\n relation = self.class.for_projects_and_groups([project... | [
"0.77048707",
"0.62653357",
"0.62153566",
"0.6200315",
"0.60401577",
"0.60201263",
"0.59733033",
"0.58950657",
"0.5840066",
"0.58055145",
"0.5761943",
"0.5727478",
"0.57014346",
"0.56528914",
"0.5593291",
"0.55542475",
"0.5546378",
"0.5542196",
"0.55393785",
"0.5523209",
"0.5... | 0.6713065 | 1 |
Returns the files you would want in a `ploy init`like environment. | def bootstrap_dir
File.join(data_dir, 'bootstrap')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files\n Dir[root_path(\"app\", \"**\", \"*.rb\")] + [@app_class.app_file]\n end",
"def files\n @files ||= preferred_sources([@path])\n end",
"def files_for_rotation\n files = Set.new\n Padrino.dependency_paths.each do |path|\n files += Dir.glob(path)\n end\n reloadabl... | [
"0.6401896",
"0.6386761",
"0.6248516",
"0.6240823",
"0.61944216",
"0.6179644",
"0.61303484",
"0.6124236",
"0.6117655",
"0.6117655",
"0.6117655",
"0.6117655",
"0.60760206",
"0.60692894",
"0.60532",
"0.60325783",
"0.60299814",
"0.6025156",
"0.60151935",
"0.6015055",
"0.5994948"... | 0.0 | -1 |
Path to build script | def build_script
File.join(data_dir, 'build-script')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_path\n @build_path ||= \"#{@ant_path}/#{@config[:build_name]}\"\n end",
"def package_scripts_path\n \"#{Config.project_root}/package-scripts/#{name}\"\n end",
"def build_path\n @build_path ||= Pathname.new(source_dir).join(data['build_path'] || './build').to_s\n end",
"d... | [
"0.69777685",
"0.69604385",
"0.67621577",
"0.6698085",
"0.6664747",
"0.66403455",
"0.658783",
"0.6544897",
"0.6544051",
"0.653052",
"0.6466893",
"0.6462477",
"0.64564586",
"0.64530593",
"0.6438436",
"0.6438436",
"0.640108",
"0.6378106",
"0.63399166",
"0.63399166",
"0.633679",... | 0.8617085 | 0 |
Generates a deploy script This can then be uploaded and executed on a target server. | def gen_deploy(deploy_id, slug_url, config)
require 'erb'
require 'shellwords'
template = ERB.new(File.read(File.join(data_dir, 'deploy.bash.erb')))
template.result(binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end",
"def deploy()\n release = create_release_name()\n\n write_deploy_version_file()\n\n ... | [
"0.7787735",
"0.7544461",
"0.71230114",
"0.7107521",
"0.7079642",
"0.6817417",
"0.6653835",
"0.6651452",
"0.6648789",
"0.65879345",
"0.65850115",
"0.65850115",
"0.6529945",
"0.63968205",
"0.6385736",
"0.6379978",
"0.63541275",
"0.63424903",
"0.6325723",
"0.6313025",
"0.629900... | 0.74690676 | 2 |
Used to ensure that candy is in a shelf within the same shop | def valid_shelf(shelf_id)
# If shelf_id is not nil, check to make sure it exists, then check if it is in same shop
if Shelf.exists?(id: shelf_id)
@shelf = Shelf.find(shelf_id)
# Check to see if shelf is in the same shop as candy
if self.shop.id == @shelf.shop.id
return true
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveCandyFromShelf(candyIndex, shelfIndex)\n if shelfIndex > @shelves.length\n print \"Please choose a proper shelf\"\n elsif candyIndex > @shelves[shelfIndex].getCandies.length\n print \"Please choose a proper candy\"\n else\n @unShelvedCandies.push(@shelves[shelfIndex].ge... | [
"0.6563174",
"0.6406331",
"0.6224716",
"0.61960596",
"0.5847311",
"0.5814531",
"0.56754076",
"0.5670736",
"0.5646741",
"0.5646741",
"0.5623586",
"0.5590204",
"0.55725026",
"0.55632734",
"0.5558794",
"0.5557954",
"0.5535013",
"0.5474101",
"0.5466073",
"0.54656553",
"0.54450417... | 0.7174673 | 0 |
End valid_shelf method Used to make sure candy belong to appropriate shop | def candy_belongs_to_user(current_user)
if self.shop.user_id == current_user.id
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_shelf(shelf_id)\n # If shelf_id is not nil, check to make sure it exists, then check if it is in same shop\n if Shelf.exists?(id: shelf_id)\n @shelf = Shelf.find(shelf_id)\n # Check to see if shelf is in the same shop as candy\n if self.shop.id == @shelf.shop.id\n return true\... | [
"0.70708776",
"0.6219304",
"0.61419946",
"0.57489914",
"0.55824095",
"0.5546626",
"0.5464816",
"0.544238",
"0.5385806",
"0.5365537",
"0.53534883",
"0.5334732",
"0.5247106",
"0.523085",
"0.5229992",
"0.5225481",
"0.5219131",
"0.5212632",
"0.520887",
"0.5205392",
"0.51923925",
... | 0.5098345 | 32 |
Called before every test method runs. Can be used to set up fixture information. | def setup
@b = Backup.new
Dir.chdir('c:/Hotspare/backup')
@actual_count = Dir.glob('*').size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_setup\n # do nothing by default\n end",
"def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_prov... | [
"0.75348765",
"0.74499375",
"0.74493515",
"0.74480784",
"0.7275264",
"0.7149302",
"0.7149302",
"0.71076894",
"0.7100397",
"0.7063954",
"0.70639265",
"0.70463806",
"0.7017298",
"0.7007138",
"0.7007138",
"0.69979763",
"0.696969",
"0.694969",
"0.694969",
"0.69133675",
"0.68669",... | 0.0 | -1 |
Called after every test method runs. Can be used to tear down fixture information. | def teardown
# Do nothing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def tear... | [
"0.8025238",
"0.79543626",
"0.79543626",
"0.78571093",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.7845288",
"0.78336143",
"0.78336143",
"0.7750328",
"0.77483624",
"0.77483624",
"0.7734571",
"0.7713144",
"0.7711698",
"0.771169... | 0.0 | -1 |
has_many :registrations, :through => :exercise_groups | def allows_multiple_groups?
max_groups && max_groups > 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def girl_groups; end",
"def test_course_has_many_instructors_through_course_instructors\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n mason = User.create(first_name: \"Mason\", last_name: \"Matthews\", email: \"mason@email.com\", photo_url: \"https://avatar... | [
"0.58884287",
"0.5724921",
"0.5462216",
"0.5459455",
"0.53832227",
"0.5376374",
"0.5335766",
"0.53130627",
"0.53005654",
"0.5246882",
"0.5239904",
"0.52374786",
"0.5223617",
"0.5221361",
"0.5201963",
"0.51910895",
"0.51910895",
"0.5139104",
"0.51258963",
"0.5115451",
"0.50928... | 0.0 | -1 |
From Typo: Converts a post title to itstitleusingdashes All special chars are stripped in the process options: :maxlen max length of the resulting string :keep_case don't downcase the string | def to_url(options = {})
if options.is_a?(Fixnum)
maxlen = options
options = {}
else
maxlen = options[:maxlen]
end
result = self.strip
result.downcase! unless options[:keep_case]
# replace quotes by nothing
result.gsub!(/['"]/, '')
# Handle Danish chars
resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title_of(post_name)\n post_name[9..-1].gsub('_',' ').titleize\n end",
"def jekyll_sluggify( title )\n\t\t\t\t\tbegin\n\t\t\t\t\t\trequire 'unidecode'\n\t\t\t\t\t\ttitle = title.to_ascii\n\t\t\t\t\trescue LoadError\n\t\t\t\t\t\tSTDERR.puts \"Could not require 'unidecode'. If your post titles have non-ASCI... | [
"0.7376879",
"0.72176534",
"0.7206014",
"0.71227634",
"0.70630634",
"0.7035913",
"0.7025496",
"0.702208",
"0.7007278",
"0.69724286",
"0.69078946",
"0.6902774",
"0.68719035",
"0.6867206",
"0.68412495",
"0.6840665",
"0.6832825",
"0.6826883",
"0.68017507",
"0.6790198",
"0.678502... | 0.0 | -1 |
parse found expression line found_tags the tags found by ctags | def parse_expression_line(found_tags)
@tags = []
found_tags.each do |tag_line|
begin
parsed_line = Parser.new.parse(tag_line)
@tags << ParserTransform.new.apply(parsed_line)
rescue Parslet::ParseFailed => error
message = ['[RbTags] Error: ', 'line: ', "#{tag_line} ", 'error: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(tags); end",
"def extractTags()\n line = @lines[@currentLine]\n re = /\\[([^\\[]+)\\]/m\n while line =~ re\n @currentBlock.addTag($~[1])\n line = line.sub(re, '')\n end\n end",
"def parse_tagfile\n tagfile_sections = tagfile.split(\"\\f\\n\")\n tagfile_s... | [
"0.6717623",
"0.644442",
"0.6398093",
"0.61776924",
"0.6056992",
"0.5971316",
"0.589367",
"0.5841815",
"0.58216226",
"0.574076",
"0.5677515",
"0.55614597",
"0.5526335",
"0.55018777",
"0.5494887",
"0.5463239",
"0.54166454",
"0.5409096",
"0.54077464",
"0.5367135",
"0.5362224",
... | 0.72367287 | 0 |
converts array of hashes into single hash | def generate_hash
@tags.group_by do |x|
x[:name]
x.delete(:name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_of_hashes_2_hash(arr)\n Hash[*arr.collect{|h| h.to_a}.flatten]\nend",
"def hashes_convert(array)\n Array.new(array).map do |elem|\n Hash.new elem\n end\n end",
"def hashes_convert(array)\n Array.new(array).map do |elem|\n Hash.new elem\n end\n end",
"def array_to_hash(array... | [
"0.7622241",
"0.76122856",
"0.76122856",
"0.73541653",
"0.7105913",
"0.7097465",
"0.6977664",
"0.6969538",
"0.68556106",
"0.6705702",
"0.66288036",
"0.6601049",
"0.64260864",
"0.64069337",
"0.6315777",
"0.6315777",
"0.63050985",
"0.6289744",
"0.6289744",
"0.6289744",
"0.62897... | 0.0 | -1 |
check if user u is attending an event e | def isAttending(e, u)
if u != nil
@a = Attending.find_by(event_id: e, user_id: u)
if @a != nil
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invited?(event)\n\t\tattended_events.include?(event)\n\tend",
"def attending?(event)\n attended_events.include?(event)\n end",
"def member_is_event_attendee?(user_id,event_id)\n event_attendee = EventAttendee.find(:first, :conditions => { :user_id => user_id, :event_id => event_id })\n if event_a... | [
"0.7869883",
"0.7690277",
"0.7631512",
"0.7609726",
"0.7454076",
"0.73940563",
"0.7388993",
"0.72631764",
"0.7233487",
"0.71500325",
"0.71281046",
"0.70770556",
"0.7045886",
"0.69677866",
"0.6950812",
"0.6950812",
"0.6938067",
"0.6914774",
"0.6902677",
"0.69022244",
"0.681382... | 0.7941826 | 0 |
send u an invite to event e owned by current user (event id, user id) | def sendEventInvite(e, u)
if !isSignedIn
redirect_to root_url, notice: "You must be signed in to send invites."
else
@e = current_user.events.find_by(id: e)
@u = User.find_by(id: u)
if @e == nil
redirect_to '/users/' + u, notice: "You do n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acceptEventInvite(e, u)\n if e == nil\n redirect_to '/events/', notice: \"This event does not exist.\"\n elsif u == nil\n redirect_to root_url, notice: \"This user does not exist.\"\n else\n @e = Event.find_by(id: e)\n @u = User.find_by(id: u)\n\... | [
"0.741187",
"0.7389723",
"0.7229578",
"0.719259",
"0.71538496",
"0.7016665",
"0.6972141",
"0.69364065",
"0.6911184",
"0.69032204",
"0.68127877",
"0.6810533",
"0.6808448",
"0.6798481",
"0.67892504",
"0.6740635",
"0.6729877",
"0.672451",
"0.6710275",
"0.6692194",
"0.66852194",
... | 0.8179124 | 0 |
user u is accepting an invite to event e (event id, user id) | def acceptEventInvite(e, u)
if e == nil
redirect_to '/events/', notice: "This event does not exist."
elsif u == nil
redirect_to root_url, notice: "This user does not exist."
else
@e = Event.find_by(id: e)
@u = User.find_by(id: u)
if @e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendEventInvite(e, u)\n if !isSignedIn\n redirect_to root_url, notice: \"You must be signed in to send invites.\"\n else\n @e = current_user.events.find_by(id: e)\n @u = User.find_by(id: u)\n\n if @e == nil\n redirect_to '/users/' + u, no... | [
"0.7816421",
"0.77461237",
"0.7588072",
"0.72503936",
"0.71417195",
"0.70897657",
"0.7059068",
"0.70412105",
"0.70226395",
"0.69200134",
"0.6909198",
"0.6857293",
"0.68098253",
"0.68018955",
"0.67925215",
"0.6790642",
"0.67780924",
"0.67706156",
"0.6765763",
"0.67420787",
"0.... | 0.7897465 | 0 |
find out if event e has ended (event id) | def eventEnded(e)
return Date.today > Event.find_by(id: e).date
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ended?\n\t\t\tstate == 'ended'\n\t\tend",
"def ended?\n @ended\n end",
"def ended?\n !!@ended\n end",
"def contains_event?(e)\n (e.time_from_start >= @start) && (e.time_from_start <= @end)\n end",
"def finish_turn_end_evs\n events = $game_map.events\n not_done = false\n ... | [
"0.7286586",
"0.7259165",
"0.7196315",
"0.6862199",
"0.6858185",
"0.6815093",
"0.67333746",
"0.6681492",
"0.6642663",
"0.6629018",
"0.6628365",
"0.6628365",
"0.6610881",
"0.65066546",
"0.6473867",
"0.645332",
"0.6450334",
"0.64486825",
"0.641102",
"0.63850075",
"0.62889814",
... | 0.80356485 | 0 |
get user's events that haven't ended (user id) | def getUnfinishedEvents(u)
@es = []
if u != nil
@alles = User.find_by(id: u).events
@alles.each do |e|
if !eventEnded(e)
@es.push(e)
end
end
end
return @es
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFinishedEvents(u, b)\n @es = []\n if u != nil\n @alles = User.find_by(id: u).events\n @alles.each do |e|\n if eventEnded(e) && (b ? e.private : true)\n @es.push(e)\n end\n end\n end\n return @es\n ... | [
"0.6820353",
"0.6748786",
"0.66965836",
"0.6683489",
"0.66823894",
"0.66219676",
"0.65982777",
"0.6573799",
"0.63895196",
"0.6383143",
"0.63811356",
"0.63294923",
"0.63286227",
"0.6272734",
"0.62068284",
"0.61535794",
"0.6094117",
"0.60304874",
"0.5963929",
"0.59230477",
"0.5... | 0.7618026 | 0 |
get user's events that have ended (user id, boolean includePrivate) | def getFinishedEvents(u, b)
@es = []
if u != nil
@alles = User.find_by(id: u).events
@alles.each do |e|
if eventEnded(e) && (b ? e.private : true)
@es.push(e)
end
end
end
return @es
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this... | [
"0.69110477",
"0.6834122",
"0.67229533",
"0.6676736",
"0.6521698",
"0.6406423",
"0.6344779",
"0.63325906",
"0.6315968",
"0.62570906",
"0.62505007",
"0.6150077",
"0.6120543",
"0.61181724",
"0.6109955",
"0.60751915",
"0.60592705",
"0.60536355",
"0.60496306",
"0.5999858",
"0.599... | 0.7278587 | 0 |
delete all x (array x) used by eventsdestroy / users > registrations_controller > destroy for deleting info for event / user being deleted | def deleteAll(xs)
xs.each do |x|
x.destroy
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if(@check)\n # => delete entrada_usuarios\n EntradaUsuario.where(:evento_id => @evento.id).destroy_all\n # => delete event_tags\n EventTag.where(:evento_id => @evento.id).destroy_all\n # => delete favourites\n Favourite.where(:evento_id => @evento.id).destroy_all\n ... | [
"0.7580928",
"0.727773",
"0.7195996",
"0.71193403",
"0.7092626",
"0.6809867",
"0.6790022",
"0.67797303",
"0.67764837",
"0.6754059",
"0.67110366",
"0.6696916",
"0.6632563",
"0.6626208",
"0.659149",
"0.65843457",
"0.6566219",
"0.6558917",
"0.6544706",
"0.6503282",
"0.6488784",
... | 0.0 | -1 |
delete all attendings/comments/reviews/invites/notifications for event e (event id) | def deleteEventData(e)
@e = Event.find_by(id: e)
deleteAll(@e.attendings)
deleteAll(@e.comments)
deleteAll(@e.reviews)
deleteEventNotifications(nil, @e.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteForEvent\n deleteEventNotifications(current_user.id, params[:eid])\n end",
"def deleteEventNotifications(u, e)\n @ns = getEventNotifications(u, e)\n @ns.each do |n|\n n.destroy\n end\n if u != nil\n redirect_to \"/notifications\", notice: \"All noti... | [
"0.7397903",
"0.7373209",
"0.7173562",
"0.7115868",
"0.6975066",
"0.691979",
"0.6815814",
"0.6792787",
"0.66938186",
"0.66893333",
"0.664874",
"0.6618048",
"0.65684575",
"0.65386605",
"0.6473508",
"0.6463955",
"0.6414831",
"0.6407272",
"0.63842833",
"0.637262",
"0.6285528",
... | 0.81086993 | 0 |
get eventsm for event (event id) used on homepage | def getEventSm(e)
@e = Event.find_by(id: e)
@html = '<div class="col-xs-6 col-md-4">' +
'<div class="event-sm">' +
'<a href="/events/' + e.to_s + '">' +
'<p class="image">'
@html += @e.avatar.attached? ? '<image src="' + url_for(@e.avatar) + '">' : image_tag("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event(event_id)\n result = self.class.get(\"/events/#{event_id}.json\")\n # and now for some dirrty hack\n Songkickr::Event.new result[\"resultsPage\"][\"results\"][\"event\"]\n end",
"def find_event\n\t\t\tif params[:event_id] && params[:event_id].length > 0\n\t\t\t\t@event = Event.find(:f... | [
"0.7320571",
"0.717395",
"0.717395",
"0.700018",
"0.6924224",
"0.6853783",
"0.6843189",
"0.676873",
"0.67668265",
"0.6763736",
"0.6750579",
"0.674701",
"0.6737532",
"0.6736879",
"0.6722282",
"0.6717525",
"0.66965157",
"0.6695643",
"0.6673915",
"0.6645174",
"0.6644544",
"0.6... | 0.65882677 | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.