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 |
|---|---|---|---|---|---|---|
Instantiates the participant and calls its on_pause (or on_resume) method. | def dispatch_pause(msg)
action = (msg['action'] == 'dispatch_resume' ? :on_resume : :on_pause)
participant = @context.plist.instantiate(
msg['participant'], :if_respond_to? => action)
return unless participant
Ruote.participant_send(
participant,
action,
'fei'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch_pause(msg)\n\n action = (msg['action'] == 'dispatch_resume' ? :on_resume : :on_pause)\n\n participant = @context.plist.instantiate(\n msg['participant'], :if_respond_to? => action)\n\n return unless participant\n\n participant.send(action, Ruote::FlowExpressionId.new(msg['fe... | [
"0.6234527",
"0.5878496",
"0.5616641",
"0.55199796",
"0.5496673",
"0.5468712",
"0.54668695",
"0.54668695",
"0.53850526",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297",
"0.536297... | 0.6362799 | 0 |
GET /origamis/1 GET /origamis/1.json | def show
@origami = Origami.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @origami }
format.pdf
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @origami = Origami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @origami }\n end\n end",
"def new\n @origami = Origami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json:... | [
"0.71211874",
"0.62508464",
"0.62508464",
"0.61709267",
"0.6030156",
"0.60274875",
"0.6009985",
"0.5728792",
"0.5714061",
"0.5640858",
"0.55758363",
"0.5556823",
"0.54749054",
"0.54749054",
"0.5469015",
"0.54662555",
"0.54522365",
"0.5450201",
"0.5435533",
"0.5405166",
"0.540... | 0.5390021 | 21 |
GET /origamis/new GET /origamis/new.json | def new
@origami = Origami.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @origami }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @origami = Origami.new(params[:origami])\n\n respond_to do |format|\n if @origami.save\n format.html { redirect_to @origami, notice: 'Origami was successfully created.' }\n format.json { render json: @origami, status: :created, location: @origami }\n else\n format.... | [
"0.692432",
"0.692432",
"0.68046343",
"0.66900337",
"0.6454525",
"0.6442433",
"0.6414335",
"0.6392666",
"0.63908684",
"0.63675946",
"0.63591856",
"0.6344144",
"0.6314898",
"0.6299168",
"0.62970287",
"0.6283222",
"0.62645835",
"0.62628627",
"0.62600607",
"0.6259877",
"0.625845... | 0.7875174 | 1 |
POST /origamis POST /origamis.json | def create
@origami = Origami.new(params[:origami])
respond_to do |format|
if @origami.save
format.html { redirect_to @origami, notice: 'Origami was successfully created.' }
format.json { render json: @origami, status: :created, location: @origami }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @origen = Origen.new(origen_params)\n\n respond_to do |format|\n if @origen.save\n format.html { redirect_to @origen, notice: 'Origen was successfully created.' }\n format.json { render :show, status: :created, location: @origen }\n else\n format.html { render :new... | [
"0.6125532",
"0.5775381",
"0.5775381",
"0.5456727",
"0.53988874",
"0.5356543",
"0.530913",
"0.5293421",
"0.5194449",
"0.5156719",
"0.5148489",
"0.51156163",
"0.509315",
"0.5078044",
"0.5066367",
"0.50625676",
"0.5053",
"0.50320524",
"0.5016952",
"0.5011234",
"0.49983326",
"... | 0.64283305 | 1 |
PUT /origamis/1 PUT /origamis/1.json | def update
@origami = Origami.find(params[:id])
respond_to do |format|
if @origami.update_attributes(params[:origami])
format.html { redirect_to @origami, notice: 'Origami was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @origen.update(origen_params)\n format.html { redirect_to @origen, notice: 'Origen was successfully updated.' }\n format.json { render :show, status: :ok, location: @origen }\n else\n format.html { render :edit }\n format.json { rend... | [
"0.63362646",
"0.600945",
"0.59294236",
"0.58221203",
"0.5780434",
"0.5777522",
"0.57226914",
"0.57226914",
"0.5721555",
"0.56937635",
"0.5688685",
"0.568545",
"0.5635309",
"0.5628384",
"0.5611043",
"0.5596645",
"0.55700666",
"0.5509061",
"0.5508927",
"0.5489505",
"0.54186934... | 0.69390994 | 1 |
DELETE /origamis/1 DELETE /origamis/1.json | def destroy
@origami = Origami.find(params[:id])
@origami.destroy
flash[:notice] = "You have successfully deleted the origami"
respond_to do |format|
format.html { redirect_to origamis_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @origami = Origami.find(params[:id])\n @origami.destroy\n\n respond_to do |format|\n format.html { redirect_to origamis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @origen.destroy\n respond_to do |format|\n format.html { redirect_to origen... | [
"0.75597095",
"0.7047868",
"0.690768",
"0.66648376",
"0.6654518",
"0.6651862",
"0.66380477",
"0.6588479",
"0.6574595",
"0.6551791",
"0.654958",
"0.6523197",
"0.6519822",
"0.6507113",
"0.6502129",
"0.649129",
"0.6486584",
"0.6477532",
"0.6477532",
"0.6471672",
"0.6460782",
"... | 0.7261546 | 1 |
GET /account_roles/1 GET /account_roles/1.json | def show
@account_role = AccountRole.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRole id\n\n APICall(path: \"custom_roles/#{id}.json\")\n\n end",
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def get_r... | [
"0.76382744",
"0.75398856",
"0.7496689",
"0.74960876",
"0.7204451",
"0.7204259",
"0.71804893",
"0.71488863",
"0.7135919",
"0.7133894",
"0.71269405",
"0.7118353",
"0.7118353",
"0.7118353",
"0.7118353",
"0.7118353",
"0.7118353",
"0.7108807",
"0.70966405",
"0.7078999",
"0.705983... | 0.69936216 | 25 |
GET /dish_categories GET /dish_categories.json | def index
@dish_categories = DishCategory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter:... | [
"0.75622624",
"0.75366324",
"0.74408054",
"0.73934174",
"0.72038144",
"0.71371514",
"0.71133524",
"0.71045613",
"0.7090174",
"0.7037746",
"0.7025063",
"0.6998177",
"0.6966943",
"0.69615936",
"0.6958539",
"0.69325614",
"0.6922444",
"0.69047046",
"0.68657297",
"0.6817559",
"0.6... | 0.74131393 | 3 |
GET /dish_categories/1 GET /dish_categories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.7351765",
"0.7329773",
"0.73149353",
"0.7297294",
"0.718186",
"0.7175465",
"0.7166708",
"0.7066217",
"0.7009838",
"0.6957099",
"0.6932391",
"0.69166464",
"0.68212175",
"0.68114537",
"0.6798045",
"0.6758361",
"0.67513484",
"0.6748549",
"0.673669",
"0.6725545",
"0.67176574",... | 0.0 | -1 |
POST /dish_categories POST /dish_categories.json | def create
@dish_category = DishCategory.new(dish_category_params)
respond_to do |format|
if @dish_category.save
format.html { redirect_to @dish_category, notice: 'Категория блюда создана.' }
format.json { render :show, status: :created, location: @dish_category }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @categoria = Ca... | [
"0.72146744",
"0.68211913",
"0.6618871",
"0.65241176",
"0.6467257",
"0.6455225",
"0.64539313",
"0.6411016",
"0.63920665",
"0.63820404",
"0.6379909",
"0.63668394",
"0.63180625",
"0.6285201",
"0.6260645",
"0.6238544",
"0.6202526",
"0.6200323",
"0.6182308",
"0.6181432",
"0.61689... | 0.6821802 | 1 |
PATCH/PUT /dish_categories/1 PATCH/PUT /dish_categories/1.json | def update
respond_to do |format|
if @dish_category.update(dish_category_params)
format.html { redirect_to @dish_category, notice: 'Категория блюда обновлена.' }
format.json { render :show, status: :ok, location: @dish_category }
else
format.html { render :edit }
format.j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci... | [
"0.74128443",
"0.7364404",
"0.7058667",
"0.67937255",
"0.67937255",
"0.67460304",
"0.67447126",
"0.6725099",
"0.6723332",
"0.667984",
"0.66632354",
"0.66201633",
"0.65509826",
"0.6539433",
"0.6523977",
"0.64965075",
"0.6483392",
"0.64695007",
"0.6464848",
"0.6458868",
"0.6445... | 0.6871107 | 3 |
DELETE /dish_categories/1 DELETE /dish_categories/1.json | def destroy
@dish_category.destroy
respond_to do |format|
format.html { redirect_to dish_categories_url, notice: 'Категория блюда удалена.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to category_dishes_url(@category) }\n format.json { head :no_content }\n end\n end",
"def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end",
"def ... | [
"0.758626",
"0.74875075",
"0.732052",
"0.72634923",
"0.72531277",
"0.7252908",
"0.72089255",
"0.7119746",
"0.71120715",
"0.709443",
"0.70778155",
"0.70727754",
"0.705171",
"0.7044577",
"0.7042069",
"0.7042069",
"0.6977682",
"0.69772553",
"0.69723856",
"0.6960322",
"0.695953",... | 0.7738339 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_dish_category
@dish_category = DishCategory.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def dish_category_params
params.require(:dish_category).permit(:name, :position, :dish_category_id, :dish_ids,
dishes_attributes: [:id, :_destroy, :name, :instruction, :cooking_time])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
================================================================== Instance methods ================================================================== GET /mnoe/jpi/v1/marketplace | def index
expires_in 0, public: true, must_revalidate: true
@last_modified = app_relation.order_by('updated_at.desc').limit(1).first.try(:updated_at)
if stale?(last_modified: @last_modified)
@apps = Rails.cache.fetch("marketplace/index-apps-#{@last_modified}") do
apps = app_relation.to_a
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marketplace\n @marketplace or raise MissingMarketplace\n end",
"def marketplace\n @marketplace ||= Marketplace.new self\n end",
"def set_market_place\n @market_place = MarketPlace.find(params[:id])\n end",
"def return_market_place_api(name)\n self.seller_market_places.w... | [
"0.75195676",
"0.70058453",
"0.6868513",
"0.6843345",
"0.6661336",
"0.6661336",
"0.66115576",
"0.6504542",
"0.6351082",
"0.62538594",
"0.6190334",
"0.6088347",
"0.6088347",
"0.6067074",
"0.6067074",
"0.6008004",
"0.5992793",
"0.59372884",
"0.590513",
"0.58922124",
"0.5889172"... | 0.0 | -1 |
Precondition: thePredecessor is an EndVertex Precondition: theSuccessor is an ItemVertex | def initialize(thePredecessor, theSuccessor)
super(thePredecessor, theSuccessor)
do_set_key(thePredecessor, theSuccessor)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit(predecessor)\n\t\t@predecessor = predecessor\n\t\t@visited = true\n\tend",
"def changePredecessor(i, predecessor)\n\t\t@graph[i].predecessor = predecessor\n\tend",
"def insert_predecessor\n insert_node('insert_predecessor')\n end",
"def direct_predecessors_of(item)\n @graph.direct_predeces... | [
"0.6205747",
"0.6169608",
"0.6157867",
"0.5916985",
"0.5877961",
"0.5810074",
"0.5749503",
"0.572077",
"0.5655278",
"0.56020844",
"0.5494147",
"0.5484801",
"0.5393178",
"0.5377615",
"0.5366811",
"0.5366811",
"0.53593415",
"0.53317696",
"0.5239531",
"0.52052665",
"0.51686436",... | 0.5387038 | 13 |
User gets routed here sometimes from improper request methods | def index
# Handle bookmarked or otherwise incorrect GETs to the login action
if request.method == :get
redirect_to login_path
else
redirect_to vault_dashboard_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_unverified_request\n unless action_name == \"fire_object_search\" || action_name == \"fire_populate_drop_down\" \n super\n end\n end",
"def routing_mismatch\n raise ::ActionController::RoutingError,\"URL not supported\"\n end",
"def anchored_routes; end",
"def index\n # Handle b... | [
"0.63195527",
"0.6141582",
"0.60507745",
"0.60492444",
"0.6046143",
"0.5994503",
"0.59796447",
"0.5978948",
"0.5965316",
"0.5946591",
"0.5876676",
"0.58733875",
"0.58708405",
"0.5865176",
"0.58645976",
"0.5825811",
"0.5825055",
"0.5819654",
"0.5814415",
"0.5806411",
"0.578124... | 0.5747373 | 27 |
Strip whitespace from credentials login failures can be caused by this from coreg emails with passwords in them that contain invisible newlines or something! | def sanitize_credentials
if params[:user_session]
params[:user_session][:login].strip!
params[:user_session][:password].strip!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_login\n self.login.to_s.strip!\n end",
"def clean_space_in_email\n self.unconfirmed_email.gsub!(' ', '') if self.unconfirmed_email.present?\n self.email.gsub!(' ', '') if self.email.present?\n end",
"def scrub\n self.gsub(/[^a-zA-Z\\s0-9\\.]/, '').gsub(/\\t/, ' ').gsub(/\\r/, ' ').gsu... | [
"0.75197506",
"0.6302158",
"0.6223582",
"0.61469954",
"0.6126169",
"0.6126169",
"0.6076483",
"0.6073177",
"0.60609037",
"0.6058425",
"0.605102",
"0.59801483",
"0.59521765",
"0.5946943",
"0.5943255",
"0.5937071",
"0.59216774",
"0.5904653",
"0.58898175",
"0.5876739",
"0.5852831... | 0.6917113 | 1 |
GET /play/:id/moves/1 GET /play/:id/moves/1.json | def show
#render show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @moves = @game.moves.all\n render json: @moves, status: 200\n end",
"def show\n @game = Game.find(params[:id])\n @moves = @game.moves\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @moves = Mo... | [
"0.7267913",
"0.7211719",
"0.6656644",
"0.639238",
"0.639238",
"0.6342017",
"0.62806946",
"0.6243849",
"0.6243849",
"0.6133046",
"0.6106439",
"0.6046568",
"0.59907144",
"0.5956883",
"0.59382325",
"0.58965987",
"0.5871463",
"0.58057487",
"0.58054334",
"0.570726",
"0.57019573",... | 0.0 | -1 |
POST /play/:id/moves POST /play/:id/moves.json | def create
return render json: {error: "Game closed. Play another"}, status: 200 if @play.completed?
# Wrap the transaction in a block to avoid race conditions
Move.transaction do
#Unless play completed allow update/create
if @play.last_move_id.value.present? and !Move.find(@play.last_move_id.va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @board = Board.where(game_id: 47).first\n puts \"here\"\n @move = Move.new(move_params)\n puts @move\n puts params[:move][:squares]\n puts \"after\"\n\n #@move.squares = []\n #@move.squares.push(params[:move][:squares].split(','))\n\n\n puts @move.squares\n @move.created_... | [
"0.6798703",
"0.6629948",
"0.6568542",
"0.6515839",
"0.64810616",
"0.6437018",
"0.6346405",
"0.61710757",
"0.6129832",
"0.6019426",
"0.60015786",
"0.60015786",
"0.59353185",
"0.5931703",
"0.5894176",
"0.58795303",
"0.5846432",
"0.5800153",
"0.57881945",
"0.5767397",
"0.572567... | 0.6526356 | 3 |
Set move in callbacks | def set_move
@move = Move.includes(:player, :opponent, :winner, :play).find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n \n end",
"def move\n \n end",
"def move(new_position)\n yield(new_position, self) if block_given?\n self.position = new_position\n self.moved = true\n nil\n end",
"def move\n\n end",
"def move; end",
"def move; end",
"def move\n\t\t'moved passed'\n\tend",
"def moving!... | [
"0.7249102",
"0.7249102",
"0.72361267",
"0.72318804",
"0.720478",
"0.720478",
"0.7144544",
"0.7078892",
"0.70456123",
"0.6919921",
"0.68331265",
"0.68312603",
"0.68057",
"0.67851377",
"0.67654604",
"0.67396975",
"0.6659143",
"0.66382253",
"0.66382253",
"0.66238594",
"0.656014... | 0.0 | -1 |
Set move in callbacks | def set_play
@play = Play.includes(:opponent, :player, :winner).find(params[:play_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n \n end",
"def move\n \n end",
"def move(new_position)\n yield(new_position, self) if block_given?\n self.position = new_position\n self.moved = true\n nil\n end",
"def move\n\n end",
"def move; end",
"def move; end",
"def move\n\t\t'moved passed'\n\tend",
"def moving!... | [
"0.7248644",
"0.7248644",
"0.72364014",
"0.7231202",
"0.720395",
"0.720395",
"0.71448445",
"0.70785064",
"0.7044862",
"0.69184726",
"0.6832675",
"0.6831618",
"0.6805428",
"0.6784199",
"0.6765478",
"0.6739771",
"0.6658945",
"0.6637604",
"0.6637604",
"0.66227835",
"0.6559819",
... | 0.0 | -1 |
Return the all entry count, not limited by limit. This overrides Enumerablecount. Not necessarily equal to the data size. | def count
@attributes['count']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n all.size\n end",
"def size\n\n fetch_all(:count => true)\n end",
"def total_entries\n collection.total_count\n end",
"def count\n all.count\n end",
"def count\n @all.size\n end",
"def total_count\n total_entries\n end... | [
"0.73020035",
"0.7245658",
"0.7202547",
"0.7189562",
"0.7167519",
"0.71302426",
"0.7123931",
"0.7098716",
"0.6978691",
"0.6978691",
"0.6972587",
"0.69590396",
"0.69483864",
"0.6934707",
"0.6911251",
"0.6903392",
"0.6899053",
"0.6895681",
"0.68024147",
"0.6797938",
"0.674902",... | 0.0 | -1 |
Override the default setter to normalise the events and validate them (TODO) | def events=(events)
events = Array(events).map { |event| event.to_s.underscore }
# TODO: Validate events from specified list in Integral.config which can be used to
# list them on the backend for click and create
# super(Webhook::Event::EVENT_TYPES & events)
super(events)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event=(value)\n @event = convert(value)\n end",
"def event=(value)\n @event = convert(value)\n end",
"def set_event_values\n self.domain ||= self.class.event_domain\n end",
"def events=(value)\n @events = value\n end",
"def events=(_); end",
"def use_event_at... | [
"0.6608104",
"0.6608104",
"0.63553774",
"0.6043891",
"0.5963703",
"0.5902196",
"0.58927494",
"0.5867251",
"0.58197105",
"0.5764846",
"0.5761224",
"0.57413286",
"0.5717912",
"0.5678447",
"0.5645108",
"0.5630309",
"0.5601357",
"0.55878687",
"0.53825384",
"0.53755414",
"0.534215... | 0.6294869 | 3 |
Deliver a particular event to the endpoint | def deliver(event)
Webhook::DeliveryJob.perform_later(id, event.to_json)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliver(ev)\n\t\tbegin\n\t\t\tlookup(ev.id).tell(ev)\n\t\trescue NoMethodError => error\n\t\t\tputs \"Gameman: Error delivering event to object #{ev.id}:\"\n\t\t\tputs error\n\t\tend\n\tend",
"def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end",
"def call(eve... | [
"0.67281437",
"0.66984683",
"0.66984683",
"0.66832316",
"0.64734095",
"0.6466495",
"0.6375922",
"0.6299874",
"0.62519264",
"0.61929744",
"0.6180171",
"0.6168488",
"0.6154",
"0.61053336",
"0.6083125",
"0.60588115",
"0.6020592",
"0.59690523",
"0.5923089",
"0.58758265",
"0.58746... | 0.7344709 | 0 |
GET /file_uploads GET /file_uploads.json | def index
@file_uploads = FileUpload.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @uploads = @user.uploads\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads }\n end\n end",
"def file_uploads; end",
"def index\n @upload = Upload.new # Allow file uploads on index page via jq_fu\n\n respond_to do |format|\n ... | [
"0.76315427",
"0.72767544",
"0.70810884",
"0.7047393",
"0.6961849",
"0.68474394",
"0.6846425",
"0.6761526",
"0.6701913",
"0.67015845",
"0.6691468",
"0.66329587",
"0.6631488",
"0.6598865",
"0.6552749",
"0.65077674",
"0.64836735",
"0.6475164",
"0.64745533",
"0.64745533",
"0.647... | 0.67368835 | 8 |
GET /file_uploads/1 GET /file_uploads/1.json | def show
@file_upload_attachments = @file_upload.file_upload_attachments.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @uploads = @user.uploads\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads }\n end\n end",
"def index\n @upload = Upload.new # Allow file uploads on index page via jq_fu\n\n respond_to do |format|\n format.html # index.html.... | [
"0.743519",
"0.7086551",
"0.6997674",
"0.6963697",
"0.69635653",
"0.69089",
"0.67231977",
"0.66272223",
"0.66105074",
"0.6556244",
"0.6556244",
"0.6556244",
"0.6556244",
"0.6548755",
"0.6502114",
"0.6497457",
"0.6466195",
"0.6422796",
"0.64184916",
"0.641194",
"0.63953555",
... | 0.5871739 | 80 |
POST /file_uploads POST /file_uploads.json | def create
@file_upload = FileUpload.new(file_upload_params)
respond_to do |format|
if @file_upload.save
params[:file_upload_attachments]['scenario'].each do |s|
@file_upload_attachment = @file_upload.file_upload_attachments.create!(:scenario => s, :file_upload_id => @file_upload.id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSO... | [
"0.7256358",
"0.72353",
"0.71163124",
"0.7020854",
"0.69205695",
"0.6912144",
"0.68324864",
"0.6818822",
"0.6750674",
"0.67186046",
"0.664109",
"0.65937364",
"0.6580122",
"0.6580122",
"0.65701854",
"0.6567926",
"0.6567394",
"0.6489876",
"0.64867204",
"0.6453498",
"0.6439798",... | 0.59754384 | 77 |
PATCH/PUT /file_uploads/1 PATCH/PUT /file_uploads/1.json | def update
respond_to do |format|
if @file_upload.update(file_upload_params)
format.html { redirect_to @file_upload, notice: 'File upload was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n upload = params.require(:file)\n handler = setup_handler(upload)\n\n if handler.valid?\n handler.call\n render json: {}, status: 202\n else\n render json: { errors: handler.errors }, status: 422\n end\n end",
"def update\n @treq =... | [
"0.664298",
"0.6614471",
"0.65380055",
"0.64206576",
"0.6330784",
"0.63097537",
"0.6246818",
"0.6241637",
"0.6221901",
"0.6190591",
"0.6173168",
"0.61447835",
"0.6120615",
"0.6120615",
"0.6120615",
"0.6094131",
"0.6066303",
"0.6066069",
"0.6048005",
"0.60281664",
"0.6025047",... | 0.633914 | 4 |
DELETE /file_uploads/1 DELETE /file_uploads/1.json | def destroy
@file_upload.destroy
respond_to do |format|
format.html { redirect_to file_uploads_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @upload = Upload.find(params[:id])\n\tif File.exists?(Rails.root.join('..', 'uploads', @upload.file_name))\n\t\tFile.delete(Rails.root.join('..', 'uploads', @upload.file_name))\t\n\tend\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.... | [
"0.74517834",
"0.7403808",
"0.7361329",
"0.7361329",
"0.73364884",
"0.7326261",
"0.73099315",
"0.7278542",
"0.72603047",
"0.7259731",
"0.7216876",
"0.72095615",
"0.72025317",
"0.7169735",
"0.7164387",
"0.7141945",
"0.7130237",
"0.71031743",
"0.7093379",
"0.70923805",
"0.70923... | 0.7551901 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_file_upload
@file_upload = FileUpload.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def file_upload_params
params.require(:file_upload).permit(:title, file_upload_attachments_attributes: [:id, :file_upload_id, :scenario])
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 |
TODO(dtan4): Use terraform's utility method | def apply_template(client)
ERB.new(open(template_path).read, nil, "-").result(binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_terraform_output\n {\n 'chef_server_ip' => `terraform output chef-server-ip`.chomp,\n 'chef_server_dns' => `terraform output chef-server-private-dns`.chomp,\n 'test_db_ip' => `terraform output test-db-ip`.chomp,\n 'test_db_dns' => `terraform output test-db-private-dns`.chomp,\n 't... | [
"0.6200458",
"0.59314775",
"0.59272844",
"0.56383437",
"0.5445994",
"0.5442934",
"0.5437836",
"0.5415278",
"0.5310311",
"0.52802396",
"0.5262231",
"0.5252333",
"0.52307",
"0.52051365",
"0.5137076",
"0.5127723",
"0.5098435",
"0.5085495",
"0.50844425",
"0.5083481",
"0.50778234"... | 0.0 | -1 |
Returns a representative FHIR::Observation for an instance of a Sara Alert Laboratory. | def as_fhir
laboratory_as_fhir(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resourceType\n 'Observation'\n end",
"def as_fhir\n FHIR::Observation.new(\n meta: FHIR::Meta.new(lastUpdated: updated_at.strftime('%FT%T%:z')),\n id: id,\n subject: FHIR::Reference.new(reference: \"Patient/#{patient_id}\"),\n status: 'final',\n effectiveDateTime: report.s... | [
"0.5142933",
"0.5117254",
"0.5048424",
"0.47829005",
"0.47404295",
"0.47126168",
"0.4642147",
"0.46251673",
"0.46145976",
"0.46058103",
"0.4555673",
"0.45456335",
"0.45358565",
"0.4532779",
"0.44817692",
"0.4471391",
"0.4471024",
"0.44666183",
"0.44496417",
"0.44450688",
"0.4... | 0.5055384 | 2 |
Bersepadu (4) Sokongan (2) Pengurusan & Profesional (1) when ONE group selected | def bersepadu
a='(staffgrade_id=? ' if Employgrade.find(:all, :conditions=>['group_id=?', 4]).map(&:id).uniq.count!=0
0.upto(Employgrade.find(:all, :conditions=>['group_id=?', 4]).map(&:id).uniq.count-2) do |l|
a=a+'OR staffgrade_id=? '
end
a=a+')'
return a if position==1 && position2==0 &&... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_group\n self.groups.each do |group|\n if group != Group.find_by_name(\"Default\")\n if group != Group.find_by_name(\"Global\")\n return group.name\n end\n end\n end\n return \"N/A\"\n end",
"def select_tiporelacion\n [ \n [\"BENEFICIARIO\",\"BENEFICIA... | [
"0.6015292",
"0.59976065",
"0.5837488",
"0.5815716",
"0.57583535",
"0.56482047",
"0.5622295",
"0.56052387",
"0.5574683",
"0.5572394",
"0.5569996",
"0.5537821",
"0.5527913",
"0.5527913",
"0.55196756",
"0.55053085",
"0.5500985",
"0.5497663",
"0.5493048",
"0.5485861",
"0.5438362... | 0.58584964 | 2 |
when TWO groups selected | def sokongan
a='(staffgrade_id=? ' if Employgrade.find(:all, :conditions=>['group_id=? or group_id=?', 4,2]).map(&:id).uniq.count!=0
0.upto(Employgrade.find(:all, :conditions=>['group_id=? or group_id=?', 4,2]).map(&:id).uniq.count-2) do |l|
a=a+'OR staffgrade_id=? '
end
a=a+')'
return a if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_choosen?\n !current_group.nil?\n end",
"def group_choosen?\n !current_group.nil?\n end",
"def allows_multiple_groups?\n max_groups && max_groups > 1\n end",
"def requested_groups\n @request.empty? ? GROUPS : select_groups\n end",
"def in_frontend_groups\n # groups = []\n # x... | [
"0.6262063",
"0.6262063",
"0.6243557",
"0.6046302",
"0.6002146",
"0.5984739",
"0.59786284",
"0.5945753",
"0.5938355",
"0.59291565",
"0.581348",
"0.5797659",
"0.57935184",
"0.57935184",
"0.57935184",
"0.5792687",
"0.5711915",
"0.56988937",
"0.56828874",
"0.56828874",
"0.563919... | 0.0 | -1 |
when THREE groups selected | def pengurusan_profesional
a='(staffgrade_id=? ' if Employgrade.find(:all, :conditions=>['group_id=? or group_id=? or group_id=?', 4,2,1]).map(&:id).uniq.count!=0
0.upto(Employgrade.find(:all, :conditions=>['group_id=? or group_id=? or group_id=?', 4,2,1]).map(&:id).uniq.count-2) do |l|
a=a+'OR staffgr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze_groups_and_components\n if not @selection.empty?\n begin\n @model.start_operation \"Freeze groups and components\"\n puts \"Freezing selection...\" if @debug\n @selection.each { |e| \n if e.is_a? Sketchup::Group or e.is_a? Sketchup::ComponentInstan... | [
"0.6007109",
"0.57915384",
"0.57915384",
"0.57915384",
"0.5719889",
"0.570379",
"0.5670381",
"0.56282127",
"0.56021124",
"0.55911094",
"0.54050285",
"0.53801304",
"0.53801304",
"0.53751504",
"0.53611",
"0.53611",
"0.5356965",
"0.5348213",
"0.5309105",
"0.5308081",
"0.5297727"... | 0.0 | -1 |
def category_conditions ["staffs.category_id = ?", category_id] unless category_id.blank? end | def orders
"staffgrade_id ASC"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_conditions\n [\"words.category LIKE ?\", \"%#{category}\"]\n end",
"def potential_categories\n if categories.length > 0\n Category.all(:conditions => \"id NOT IN (#{category_ids})\")\n else\n Category.all\n end\n end",
"def category_id; (category.id rescue ''); end",
"def... | [
"0.68429494",
"0.64759564",
"0.61470735",
"0.61057913",
"0.6043621",
"0.6010457",
"0.5902671",
"0.57901543",
"0.5752614",
"0.572827",
"0.57237655",
"0.5717733",
"0.5710837",
"0.5709819",
"0.5704095",
"0.5697008",
"0.5693267",
"0.5692633",
"0.5690574",
"0.56687105",
"0.5658258... | 0.0 | -1 |
def api_migrate migrate('roles_mask') end | def api_name
:roles_mask
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_hydra_role_management\n generate('roles')\n rake('db:migrate')\n end",
"def roles=(roles)\n self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.inject(0, :+)\n end",
"def roles=(roles)\n self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.inject(0, :+)\n end",... | [
"0.6070563",
"0.5932271",
"0.5932271",
"0.5856993",
"0.5812731",
"0.577269",
"0.57577807",
"0.57577807",
"0.5701781",
"0.5696716",
"0.56930727",
"0.56930727",
"0.56598264",
"0.55598605",
"0.5537823",
"0.5517689",
"0.5478973",
"0.5471134",
"0.5444854",
"0.54427016",
"0.5433658... | 0.69652206 | 0 |
FIXME: Will not register me as logged in so I can vote | def login
# **********
user_name = params[:user][:user_name]
if user_name and @user = User.find_by(user_name: user_name)
session[:user_id] = @user.id
flash[:result_text] = "Successfully logged in as exsisting user #{@user.user_name}"
else
@user = User.new(user_name: user_name)
if @u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_vote?\n # override with true to allow voting for users who are not logged in\n # and save votes in session\n false\nend",
"def user_has_voted(post)\n if (current_user)\n if (post.voted_by?(current_user))\n 1\n else\n 0\n end\n else\n 2\n end\nend",
"def vote\n\tend",
"... | [
"0.7443888",
"0.70763594",
"0.70194066",
"0.6826879",
"0.6814095",
"0.67257273",
"0.672522",
"0.67154896",
"0.67154896",
"0.66482496",
"0.659994",
"0.65990376",
"0.6538933",
"0.6494354",
"0.6490352",
"0.64648193",
"0.64598805",
"0.64585817",
"0.6440159",
"0.64250094",
"0.6410... | 0.0 | -1 |
NEED A DIFFERENT NUMBERING SCHEME FOR PRODUCTION | def number
"#{Time.now.to_i}-#{rand(1_000_000)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upc_e_with_composite_symbology; end",
"def english_number original_number\r\n current_number = original_number\r\n exploded_number = []\r\n # Convert number into an array of multiples of base units\r\n CONVERSIONS.each do |base_pair|\r\n if current_number >= base_pair[:number] * 2\r\n # Enter the... | [
"0.5829558",
"0.58087665",
"0.57819456",
"0.57740575",
"0.56688637",
"0.5656465",
"0.5604366",
"0.5561611",
"0.5521632",
"0.5496795",
"0.54699385",
"0.5462214",
"0.5459948",
"0.5454166",
"0.54500157",
"0.54277295",
"0.5420532",
"0.54175264",
"0.54097044",
"0.5366759",
"0.5363... | 0.0 | -1 |
GET /phone_items GET /phone_items.json | def index
@phone_item = PhoneItem.new #use for search_form
if params[:phone_item] && (mobi = params[:phone_item][:mobile_phone])
mobi = mobi.gsub(/[^0-9]/, '') if mobi =~ /\d+/
@phone_items = PhoneItem
.where(:user_id => current_user.id)
.where('mobile_phone like ? OR source_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end",
"... | [
"0.6388483",
"0.6348217",
"0.6267292",
"0.62329787",
"0.6201436",
"0.6161689",
"0.6086795",
"0.60700166",
"0.603759",
"0.60205173",
"0.6011047",
"0.60102934",
"0.59581673",
"0.5944292",
"0.58902305",
"0.5871812",
"0.587158",
"0.5866027",
"0.58494276",
"0.58415097",
"0.5836358... | 0.63959926 | 0 |
GET /phone_items/1 GET /phone_items/1.json | def show
@sms_logs = @phone_item.sms_logs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n @items = Item.find(params[:... | [
"0.653468",
"0.6435782",
"0.6353106",
"0.6268999",
"0.62415004",
"0.61993295",
"0.619711",
"0.6179649",
"0.6179649",
"0.61028534",
"0.6094015",
"0.6068591",
"0.6013396",
"0.6011201",
"0.59936935",
"0.5955251",
"0.593426",
"0.58918077",
"0.5885045",
"0.5865279",
"0.58606863",
... | 0.0 | -1 |
POST /phone_items POST /phone_items.json | def create
@phone_item = PhoneItem.new(phone_item_params)
@phone_item.user_id = current_user.id
respond_to do |format|
if @phone_item.save
format.html { redirect_to phone_items_url, notice: '添加成功.' }
format.json { render action: 'show', status: :created, location: @phone_item }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def phone_item_params\n params.require(:phone_item).permit(:mobile_phone, :source_name, :name, :city, :area, :description, :is_processed)\n end",
"def create\n @request_item = RequestItem.new(request... | [
"0.69280565",
"0.65283567",
"0.6449701",
"0.634431",
"0.62411714",
"0.6203774",
"0.6190156",
"0.61794806",
"0.60581565",
"0.6005369",
"0.5997529",
"0.5964576",
"0.5955554",
"0.59548354",
"0.59439003",
"0.5919434",
"0.58880365",
"0.58753735",
"0.5855682",
"0.5852222",
"0.58377... | 0.67910796 | 1 |
PATCH/PUT /phone_items/1 PATCH/PUT /phone_items/1.json | def update
respond_to do |format|
if @phone_item.update(phone_item_params)
format.html { redirect_to phone_items_url, notice: '修改成功.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @phone_item.errors, status: :unpr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].p... | [
"0.6530954",
"0.6528518",
"0.65128136",
"0.64853966",
"0.6356171",
"0.63509166",
"0.6319125",
"0.6289356",
"0.62844455",
"0.6267042",
"0.62641174",
"0.6262317",
"0.62322545",
"0.6200849",
"0.6184622",
"0.61769605",
"0.6161441",
"0.61475253",
"0.6144073",
"0.6144073",
"0.61361... | 0.6772255 | 0 |
DELETE /phone_items/1 DELETE /phone_items/1.json | def destroy
@phone_item.destroy
respond_to do |format|
format.html { redirect_to phone_items_url, notice: '删除成功.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @phone = Phone.find(params[:id])\n... | [
"0.7119711",
"0.7054019",
"0.7026403",
"0.69823116",
"0.6947442",
"0.6945779",
"0.69392395",
"0.69392395",
"0.6857524",
"0.68078154",
"0.6798373",
"0.67596865",
"0.6750504",
"0.6731266",
"0.6725991",
"0.67049134",
"0.6693654",
"0.66787463",
"0.6664782",
"0.6652635",
"0.665214... | 0.7599366 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_phone_item
@phone_item = PhoneItem.find(params[:id])
@phone_item = @phone_item.user_id == current_user.id ? @phone_item : PhoneItem.where(:user_id => current_user.id).last
can_access?(@phone_item)
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 phone_item_params
params.require(:phone_item).permit(:mobile_phone, :source_name, :name, :city, :area, :description, :is_processed)
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 |
defining a method for clicking the options | def user_selection
menu
choice = gets.to_i
case choice
when 1
add_items
when 2
view_cart
when 3
remove_items
when 4
check_out
when 5
puts "Thank you, come again!"
exit
else
puts "Invalid Choice Try Again"
sleep(2)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click; end",
"def click; end",
"def click; end",
"def on_click\n\t\tend",
"def clicked;end",
"def click_on_event option\n visits event_path(option.event)\n clicks_link option.description\n end",
"def clicked(e)\n \n end",
"def click\n raise \"Must implement custom click met... | [
"0.7130488",
"0.7130488",
"0.7130488",
"0.70502037",
"0.6971936",
"0.68460387",
"0.6824968",
"0.6551389",
"0.64596415",
"0.64140046",
"0.6394011",
"0.63545585",
"0.6209466",
"0.6176491",
"0.6160549",
"0.6118053",
"0.61127204",
"0.61127204",
"0.60978",
"0.60832685",
"0.6068443... | 0.0 | -1 |
This is working right | def check_out
@cart.each_with_index do |item, i|
puts "#{i + 1}) #{item[:name]} - $#{item[:price]}"
end
def tally_up
@total = @cart.inject(0) {|sum, hash| sum + hash[:price]}
@totalWithTax = @total * @sales_tax
puts "You owe us #{@totalWithTax}!"
sleep(2)
end
def payment
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def suivre; end",
"def probers; end",
"def formation; end",
"def terpene; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def refutal()\n end",
"def apply\n\t\t\t\t\n\t\t\tend",
"def verdi; end",
"def hd\n \n end",
"def weber; end",... | [
"0.6597028",
"0.65250564",
"0.63379335",
"0.62892604",
"0.6268652",
"0.611105",
"0.6107151",
"0.6107151",
"0.6078231",
"0.6069198",
"0.60236454",
"0.6004561",
"0.5987466",
"0.5980467",
"0.59108806",
"0.59108806",
"0.59108806",
"0.59108806",
"0.59005105",
"0.5884478",
"0.58468... | 0.0 | -1 |
Create a new doorman. You should pass the returned value to the Rack's `run` method. | def initialize(params)
@params = params
@sessions = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(env)\n @traits = Class.new { include Attributes }.new( :waves => {} )\n @request = Rack::Request.new(env).freeze\n @response = Waves::Response.new( self )\n end",
"def run!\n Sword._\n Rack::Handler.default.run(Sword.new, @settings)\n end",
"def build(*args, &bk)\n... | [
"0.5406014",
"0.53808165",
"0.533217",
"0.5328701",
"0.50853366",
"0.50336975",
"0.502817",
"0.4944776",
"0.49378318",
"0.49097925",
"0.48932886",
"0.48637846",
"0.48637846",
"0.48637846",
"0.48637846",
"0.48412836",
"0.4795815",
"0.47763646",
"0.4764053",
"0.4764053",
"0.475... | 0.0 | -1 |
This method is created for Rack to call it when a new connection is coming. So you would better do not touch it. | def call(env)
if @params[:io].player?(env)
io = @params[:io].new env
open_game_inst io
io.response
else
@params[:server].call env
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_connection; end",
"def inherit_socket; end",
"def pre_connect(request); end",
"def set_keep_alive; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def connection_closed\n end",
"def wait_connection; end",
"def wait_connection; end"... | [
"0.66154915",
"0.6503489",
"0.64907455",
"0.64732265",
"0.64083016",
"0.64083016",
"0.64083016",
"0.64083016",
"0.64083016",
"0.6375666",
"0.6371615",
"0.6371615",
"0.6327097",
"0.6327097",
"0.6322485",
"0.6313292",
"0.6283344",
"0.62564903",
"0.6223383",
"0.6223383",
"0.6221... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_painting
@painting = Painting.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def painting_params
params.require(:painting).permit( :user_id, :name, :public, photos:[] )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
I worked on this challenge [by myself, with: ]. shortest_string is a method that takes an array of strings as its input and returns the shortest string +list_of_words+ is an array of strings shortest_string(array) should return the shortest string in the +list_of_words+ If +list_of_words+ is empty the method should ret... | def shortest_string(list_of_words)
if list_of_words.length == 0
nil
else
index = 0
shortest_word = list_of_words[0]
while index < list_of_words.length do
if list_of_words[index].length <= shortest_word.length
shortest_word = list_of_words[index]
end
index+=1
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest = list_of_words[0]\n list_of_words.each.to_s do |x|\n if list_of_words.length < shortest\n shortest = x\n end\n end\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n # ... | [
"0.8862656",
"0.881294",
"0.8812617",
"0.8806273",
"0.87307817",
"0.87156886",
"0.8701727",
"0.8657666",
"0.8640694",
"0.8634052",
"0.86236686",
"0.85985315",
"0.8597571",
"0.85817295",
"0.8558412",
"0.854666",
"0.8532773",
"0.85307354",
"0.8492746",
"0.8454883",
"0.83863217"... | 0.87745047 | 4 |
returns true if at unsafe speeds using if statements | def unsafe?(speed)
if(speed < 40 || speed > 60)
return true;
else
return false;
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsafe?(speed)\n\t# binding.pry\n\tif speed < 40 || speed > 60\n\t\treturn true\n\tend\n\treturn false\nend",
"def unsafe?(speed)\n if speed < 40 || speed > 60\n true\n else\n false\n end\nend",
"def unsafe?(speed)\n\tif unsafe = speed > 60 || speed < 40\n\tputs unsafe = speed > 60 || speed < 40\n... | [
"0.80419457",
"0.7769504",
"0.7703925",
"0.7593094",
"0.71475804",
"0.7036673",
"0.6978",
"0.6940454",
"0.6940454",
"0.68794835",
"0.6746351",
"0.674317",
"0.67317355",
"0.67072076",
"0.6702522",
"0.63847613",
"0.6332134",
"0.63054436",
"0.6281543",
"0.617447",
"0.6161415",
... | 0.7635642 | 3 |
returns true if at unsafe speeds using ternary operator | def not_safe?(speed)
return speed < 40 || speed > 60 ? true : false;
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsafe?(speed)\n\tif unsafe = speed > 60 || speed < 40\n\tputs unsafe = speed > 60 || speed < 40\n\tunsafe\n\telse\n\tputs !!unsafe\n\t!!unsafe\n\tend\nend",
"def unsafe?(speed)\n\t# binding.pry\n\tif speed < 40 || speed > 60\n\t\treturn true\n\tend\n\treturn false\nend",
"def unsafe?(speed)\n if speed < ... | [
"0.75262225",
"0.74750376",
"0.733187",
"0.71601546",
"0.71273357",
"0.6983626",
"0.66911",
"0.66911",
"0.6622851",
"0.65868765",
"0.65746915",
"0.65548855",
"0.648715",
"0.64444524",
"0.6378325",
"0.6239215",
"0.609053",
"0.60383224",
"0.60383224",
"0.6029151",
"0.59340185",... | 0.6687297 | 8 |
Checks to see if the game has ten frames, numbered 1 through 10 attached to it. | def finished?
sorted_frames = frames.sort {|a,b| a.number <=> b.number}
finished = true
if sorted_frames.length == 10
sorted_frames.zip(1..10).each do |frame_index_pair|
if frame_index_pair[0].number != frame_index_pair[1]
finished = false
end
end
else
finishe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_over?\n # puts\n # p @frames.size\n # p @frames[9].last if @frames.size >= 10\n # p @frames[10].last if @frames.size >= 11\n # game_over =\n @frames.size == 10 && !(@frames[9].last =~ /[X\\/]/) ||\n @frames.size == 11 && (@frames[9].last == '/' ||\n (@frames[9].last == 'X' && @fr... | [
"0.6799183",
"0.6612513",
"0.64680386",
"0.62391955",
"0.61655015",
"0.61459786",
"0.60461116",
"0.6023549",
"0.5987605",
"0.58859795",
"0.58790797",
"0.58277607",
"0.5801317",
"0.5786497",
"0.5776787",
"0.5776787",
"0.5776787",
"0.57426244",
"0.56978154",
"0.56855994",
"0.56... | 0.68380827 | 0 |
Score the game by adding up the socres of each individual frame. | def score_game
self.score = frames.reduce(0) { |sum, frame| sum + score_frame(frame) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end",
"def calculate_score\n # @frames.flatten.compact.map(&:to_i).sum\n # @frames.map.with_index { |k, i| Frame.new((i+1), k.first, k.last).sum }.sum\n #my_frames = frames\n\n # TODO: actually calculate the score magically\n\n #... | [
"0.82714546",
"0.779238",
"0.77801996",
"0.77349484",
"0.7666329",
"0.7629241",
"0.7602587",
"0.7595615",
"0.75747377",
"0.7548755",
"0.74309343",
"0.74242246",
"0.7421487",
"0.74146503",
"0.7306746",
"0.72663087",
"0.71789503",
"0.7173635",
"0.7139322",
"0.7135343",
"0.71214... | 0.8647949 | 0 |
Score an individual frame. | def score_frame frame
if frame.strike?
frame_score = frame.first_throw + next_two_throws(frame)
elsif frame.spare?
frame_score = frame.first_throw + frame.second_throw + next_throw(frame)
else
frame_score = frame.first_throw + frame.second_throw
end
return frame_score
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end",
"def score_frame\n if strike?\n strike_frame\n elsif spare?\n spare_frame\n else\n regular_frame\n end\n\n @frame += 1\n end",
"def calculate_score\n # @frames.flatten.compact.map(&:to_i).sum\n # @fr... | [
"0.76398134",
"0.754184",
"0.7414905",
"0.7401449",
"0.73578215",
"0.72092265",
"0.71458256",
"0.70955443",
"0.7012992",
"0.69669485",
"0.69467187",
"0.6940574",
"0.6919074",
"0.68829733",
"0.68361324",
"0.6822697",
"0.6729989",
"0.65327173",
"0.65177166",
"0.650629",
"0.6503... | 0.72514516 | 5 |
Get the next frame from the frame a spare happened on | def next_throw frame
if frame.number != 10
#next_frame = frames.where(number: frame.number + 1).take
next_frame = frames.select{ |related_frame| related_frame.number == frame.number + 1}.first
return next_frame.first_throw
else
return frame.third_throw
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_frame\n next_frame\n rescue StopIteration => e\n return nil\n end",
"def bonus_spare(index)\n frame = frames[index + 1]\n frame.first\n end",
"def last_frame_with_previous_spare\n return false if number < 11\n\n previous_frame.spare\n end",
"def last_frame; frames.last; end",
... | [
"0.76048374",
"0.7212624",
"0.692318",
"0.64497256",
"0.6234003",
"0.6184862",
"0.5865737",
"0.58468634",
"0.5845113",
"0.58443725",
"0.5837949",
"0.58334816",
"0.58259606",
"0.58146626",
"0.5811167",
"0.58089143",
"0.5786189",
"0.57609844",
"0.5737257",
"0.5727623",
"0.57173... | 0.697475 | 2 |
Get the next two throws from the frame a strike happened on. | def next_two_throws frame
if frame.number != 10
next_frame = frames.select{|related_frame| related_frame.number == frame.number + 1}.first
first_throw = next_frame.first_throw
if next_frame.strike?
if next_frame.number != 10
secondary_frame = frames.select{|related_frame| relate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_throw frame\n if frame.number != 10\n #next_frame = frames.where(number: frame.number + 1).take\n next_frame = frames.select{ |related_frame| related_frame.number == frame.number + 1}.first\n return next_frame.first_throw\n else\n return frame.third_throw\n end\n end",
"def... | [
"0.7136958",
"0.61927044",
"0.617383",
"0.60231626",
"0.6002752",
"0.5538",
"0.5530659",
"0.5392781",
"0.53546107",
"0.5342856",
"0.5313574",
"0.52791595",
"0.52774835",
"0.52719545",
"0.5250516",
"0.523077",
"0.52102876",
"0.51512957",
"0.5101421",
"0.5082691",
"0.50805956",... | 0.8731854 | 0 |
valid_token? return true if the given timestamp is older than five minutes ago and the given token is valid. | def valid_token?
five_minutes_ago = DateTime.now - 5.minutes
params[:timestamp].to_i > five_minutes_ago.to_i &&
params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_token\n if self.transaction_token_created_at + 720.minutes > Time.now\n true\n else\n false\n end\n end",
"def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if ... | [
"0.80762476",
"0.7669272",
"0.76306933",
"0.750148",
"0.7448383",
"0.7356957",
"0.7347673",
"0.7289618",
"0.7251878",
"0.71869624",
"0.7079715",
"0.70709544",
"0.7061432",
"0.7046131",
"0.7027825",
"0.7010768",
"0.69894606",
"0.69500554",
"0.6897351",
"0.6892341",
"0.684615",... | 0.8662023 | 0 |
List enabled Plugins Retrieve a list of all installed plugins on the Kong node. | def enabled_plugins
get('/plugins/enabled')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_plugins\n PluginList.availables(@client)\n end",
"def installed_plugins\n PluginList.installed(@client)\n end",
"def available_plugins\n @plugins.keys\n end",
"def plugins\n @plugin_list\n end",
"def plugins\n return @plugins if @plugins\n\n respo... | [
"0.78956926",
"0.78927284",
"0.74851394",
"0.7407076",
"0.7387745",
"0.7279391",
"0.71505654",
"0.6857193",
"0.6808697",
"0.67537564",
"0.6737538",
"0.6687178",
"0.66626626",
"0.65942854",
"0.65465844",
"0.6442444",
"0.64061403",
"0.64059967",
"0.6396569",
"0.6381127",
"0.637... | 0.80303204 | 0 |
Retrieve Plugin Schema Retrieve the schema of a plugin's configuration. This is useful to understand what fields a plugin accepts, and can be used for building thirdparty integrations to the Kong's plugin system. | def plugin_schema(name)
get("/plugins/schema/#{name}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema\n @schema ||= get_parser(options)\n end",
"def plugin_info\n info = nil\n if installed? and engine.respond_to? \"plugin_info\"\n info = engine.plugin_info(Concerto::PluginInfo)\n end\n info\n end",
"def schema\n return @schema\n end",
"def schema... | [
"0.6090036",
"0.59635246",
"0.5808369",
"0.57273376",
"0.5719983",
"0.57116413",
"0.5669203",
"0.55808735",
"0.555837",
"0.5503686",
"0.5461089",
"0.54430395",
"0.5405838",
"0.5403368",
"0.53997993",
"0.53940797",
"0.5357316",
"0.53150195",
"0.52955925",
"0.5290142",
"0.52699... | 0.7306239 | 0 |
List Plugins per API | def api_plugins(api_identifier, options = {})
get(api_plugins_path(api_identifier), options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugins\n return @plugins if @plugins\n\n response = get('plugins')\n @plugins = JSON.parse(response.body, symbolize_names: true)[:plugins]\n end",
"def list\n logger.info \"Retrieving Vagrant plugin list for #{description}\"\n output = instance.execute!(:plugin, \"list\").std... | [
"0.7606671",
"0.72659016",
"0.7088379",
"0.7084154",
"0.6917825",
"0.68440443",
"0.6834653",
"0.6830954",
"0.68176013",
"0.681562",
"0.6778921",
"0.67299956",
"0.6710048",
"0.669423",
"0.6661297",
"0.6583817",
"0.65671605",
"0.65173817",
"0.65045625",
"0.64969045",
"0.6477769... | 0.74223197 | 1 |
Simplified access to the definition of a task of this type. | def definition; Mrowka::Tasks[self.type.to_sym]; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_definition_id\n return @task_definition_id\n end",
"def task\n @keys[:task]\n end",
"def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end",
"def task\n return @task\n end",
"def ... | [
"0.73022825",
"0.723564",
"0.70160264",
"0.70044386",
"0.6946254",
"0.6771253",
"0.6577535",
"0.6577535",
"0.6569219",
"0.65404713",
"0.65333587",
"0.65108734",
"0.6505239",
"0.6480011",
"0.64169574",
"0.64095473",
"0.64025277",
"0.631375",
"0.62947965",
"0.6288087",
"0.62762... | 0.8210836 | 0 |
Simplified access to the definition of a list of this type. | def definition; Mrowka::Lists[self.type.to_sym]; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_definition_list; end",
"def list\n @list_helper ||= ListWrapper.new(self)\n end",
"def definition\n @definition ||= []\n end",
"def list_type\n base = self.class.to_s.split('::').last.sub(/List$/,'')\n base[0] = base[0].downcase\n base.to_sym\n end",
"def... | [
"0.6794555",
"0.6690825",
"0.66022044",
"0.6543427",
"0.65352535",
"0.6443525",
"0.64269274",
"0.6416212",
"0.63856936",
"0.6381633",
"0.63617367",
"0.63405377",
"0.63211703",
"0.63175446",
"0.63175446",
"0.63175446",
"0.63175446",
"0.63175446",
"0.62717557",
"0.62717557",
"0... | 0.77843153 | 0 |
GET /game_tournaments/1 GET /game_tournaments/1.json | def show
@game_tournament = GameTournament.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @game_tournament }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def index\n @tournaments = Tournament.all\n end",
"def index\n @tournaments = Tournament.all\n end",
"def index\n @tournaments = Tournament.all\n end",
"def index\n @tournaments = Tournament.all\n end",
"def index\n @t... | [
"0.7180357",
"0.69020236",
"0.69020236",
"0.69020236",
"0.69020236",
"0.69020236",
"0.6618427",
"0.65354294",
"0.65058297",
"0.6472976",
"0.64690447",
"0.64323604",
"0.64133924",
"0.6368223",
"0.63625926",
"0.63516575",
"0.6344854",
"0.63105226",
"0.6308102",
"0.62819946",
"0... | 0.6676259 | 6 |
GET /game_tournaments/new GET /game_tournaments/new.json | def new
@game_tournament = GameTournament.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @game_tournament }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @tournament = Tournament.new\n\n respond_to do |format|\n format.htm... | [
"0.7451481",
"0.74124306",
"0.7262676",
"0.7187729",
"0.71663254",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.71576977",
"0.70761555",
"0.7015723",
"0.700839",
"0.7005259",
"0.... | 0.7465958 | 0 |
POST /game_tournaments POST /game_tournaments.json | def create
@game_tournament = GameTournament.new(params[:game_tournament])
respond_to do |format|
if @game_tournament.save
format.html { redirect_to @game_tournament, notice: 'Game tournament was successfully created.' }
format.json { render json: @game_tournament, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def create\n @tournament = Tournament.new(tournament_params)\n\n @tournament.qualifier_stage = false\n @tournament.main_stage = false\n\n puts @tournament.name\n puts @tournament.event\n #b... | [
"0.62570554",
"0.6204091",
"0.6171853",
"0.6169583",
"0.61522216",
"0.6148507",
"0.61482584",
"0.61199665",
"0.6112942",
"0.6098923",
"0.60972005",
"0.599139",
"0.59734255",
"0.5970876",
"0.59695005",
"0.59614044",
"0.5920861",
"0.5920861",
"0.5920861",
"0.5920861",
"0.592086... | 0.64857 | 0 |
PUT /game_tournaments/1 PUT /game_tournaments/1.json | def update
@game_tournament = GameTournament.find(params[:id])
respond_to do |format|
if @game_tournament.update_attributes(params[:game_tournament])
format.html { redirect_to @game_tournament, notice: 'Game tournament was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @tournament.update_attributes(params[:tournament])\n format.html { redirect_to @tournament, notice: 'Tournament was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format... | [
"0.62523043",
"0.6166778",
"0.61529064",
"0.611854",
"0.61058414",
"0.6078205",
"0.6078205",
"0.6017107",
"0.5976407",
"0.59545076",
"0.59217465",
"0.58790827",
"0.587177",
"0.5848713",
"0.5787522",
"0.57823026",
"0.5778694",
"0.5773163",
"0.57719296",
"0.575377",
"0.5753114"... | 0.6523517 | 0 |
DELETE /game_tournaments/1 DELETE /game_tournaments/1.json | def destroy
@game_tournament = GameTournament.find(params[:id])
@game_tournament.destroy
respond_to do |format|
format.html { redirect_to game_tournaments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n game = @goal.game\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to game_path(game) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tournament.destroy\n respond_to do |format|\n format.html { redirect_to tournaments_url }\n ... | [
"0.7564398",
"0.7510555",
"0.7510555",
"0.72334635",
"0.72083336",
"0.71977043",
"0.71942675",
"0.71882874",
"0.71876985",
"0.7187041",
"0.71741194",
"0.71741194",
"0.7170302",
"0.7153403",
"0.71526825",
"0.7136945",
"0.7108692",
"0.7108692",
"0.7108692",
"0.7108692",
"0.7108... | 0.7748592 | 0 |
POST /likes POST /likes.json | def create
@parrent.add_like!
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postlikes\n render json: @likes.length, status: 200\n end",
"def create_likes\n end",
"def create_likes\n end",
"def create_likes\n end",
"def create\n @todo_like = Todo::Like.new(todo_like_params)\n @todo_user.likes << @todo_like\n\n if @todo_like.save\n render :show, status... | [
"0.75687647",
"0.73669565",
"0.73669565",
"0.73669565",
"0.7138716",
"0.713482",
"0.7111497",
"0.7076941",
"0.703383",
"0.7001242",
"0.6945511",
"0.6908757",
"0.68972063",
"0.68793523",
"0.6873474",
"0.68543434",
"0.6854053",
"0.6848015",
"0.68358755",
"0.6784897",
"0.6779753... | 0.0 | -1 |
accepts_nested_attributes_for :order_machines_usages, reject_if: :all_blank, allow_destroy: true | def to_s
"#{title} (#{order_machine_usages.count})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accepts_nested_attributes_for(*attr_names)\n options = attr_names.extract_options!\n options[:reject_if] = PARA_REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank\n super(*attr_names, options)\n end",
"def order_params\n params.require(:order).permit(:client_id, :... | [
"0.61571354",
"0.6056833",
"0.5838738",
"0.57570505",
"0.5695683",
"0.56309277",
"0.5606321",
"0.5579206",
"0.5545794",
"0.55374944",
"0.55374944",
"0.55374944",
"0.55374944",
"0.55374944",
"0.55374944",
"0.55374944",
"0.55374944",
"0.5487169",
"0.5455152",
"0.5450656",
"0.54... | 0.0 | -1 |
Execute command and capture any output | def capture(command)
run(command).output.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_for_output(cmd)\n LOG.debug \"RUNNING (for output): #{cmd}\"\n out, _status = Open3.capture2e(cmd)\n out.strip\n end",
"def run_and_output(cmd)\n run(cmd).output\n end",
"def capture(cmd)\n output = `#{cmd}`\n\n check_status!\n\n output\n end",
"def exe... | [
"0.74089485",
"0.7349321",
"0.72939897",
"0.72691417",
"0.7267284",
"0.7238875",
"0.7212708",
"0.71719503",
"0.71554285",
"0.7154827",
"0.7107175",
"0.70747054",
"0.70060736",
"0.69768435",
"0.69398856",
"0.6936313",
"0.68464756",
"0.68401587",
"0.6837981",
"0.6828279",
"0.67... | 0.7093897 | 11 |
Read remote file contents | def read_file(path)
result = run("cat #{path}")
result.success? ? result.output : ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read\n connection.open(full_remote_path).read\n end",
"def read_file(path)\n response = with_remote do |http|\n http.get(path)\n end\n response.body\n end",
"def fetch_file_contents(remote_path)\n result = backend.file(remote_path)\n if result.exist? && result.file?... | [
"0.83945334",
"0.8039709",
"0.7610015",
"0.7591021",
"0.73785686",
"0.7071661",
"0.70213187",
"0.6867045",
"0.68478817",
"0.6837612",
"0.6837612",
"0.68375564",
"0.67929864",
"0.6668956",
"0.66537136",
"0.66382354",
"0.6618108",
"0.65779316",
"0.6551598",
"0.647975",
"0.64608... | 0.6018627 | 71 |
Check if remote directory exists | def directory_exists?(path)
run("test -d #{path}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_dir_exist?( dir )\n path = dir.split( \"/\" )\n find = path.pop\n path = path.join( \"/\" )\n path = \".\" if path == \"\"\n altdir = dir\n altdir = dir[2..-1] if dir[0,2] == \"./\"\n \n return true if dir == \".\"\n \n begin\n nlst( path ).includ... | [
"0.76001155",
"0.7562805",
"0.74658763",
"0.73486763",
"0.734052",
"0.7242612",
"0.7090624",
"0.7042151",
"0.70404774",
"0.6974336",
"0.68993646",
"0.685415",
"0.6845508",
"0.6812142",
"0.68086684",
"0.6792121",
"0.6761376",
"0.6741693",
"0.6700152",
"0.6698791",
"0.66887665"... | 0.6234138 | 40 |
Check if remote file exists | def file_exists?(path)
run("test -f #{path}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\n end",
"def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.req... | [
"0.8622818",
"0.84879845",
"0.84730566",
"0.8306724",
"0.7767444",
"0.7713721",
"0.7643134",
"0.76390076",
"0.7596143",
"0.7570281",
"0.7565956",
"0.7513744",
"0.75104064",
"0.735449",
"0.72948235",
"0.723628",
"0.7225984",
"0.71624196",
"0.71502936",
"0.71502936",
"0.7150293... | 0.0 | -1 |
Check if a symbilic link exists | def symlink_exists?(path)
run("test -h #{path}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_exists_on(host, link_path)\n # Links are weird on windows, fall back to seeing if the file exists\n return file_exists_on(host, link_path) if host[:platform].include?('windows')\n\n return on(host, Command.new(%(test -L \"#{link_path}\"), accept_all_exit_codes: true)).exit_code.... | [
"0.7553659",
"0.70640004",
"0.7028933",
"0.6971089",
"0.69193405",
"0.69020766",
"0.6775632",
"0.6771459",
"0.67342305",
"0.67292607",
"0.67184764",
"0.66806227",
"0.66765594",
"0.66463274",
"0.66268057",
"0.6544909",
"0.65388966",
"0.6510948",
"0.6502635",
"0.648543",
"0.648... | 0.72226864 | 1 |
Check if process with PID is running | def process_exists?(pid)
run("ps -p #{pid}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running?(pid)\n !(pid.nil? || Sys::ProcTable.ps(pid.to_i).nil?)\n end",
"def check_running?(pid_file)\n return false unless File.file?(pid_file)\n is_running?(pid_in(pid_file))\n end",
"def process_running?(pid)\n return false unless pid\n Process.getpgid(pid) != -1\n re... | [
"0.84417534",
"0.8434762",
"0.8397699",
"0.8383008",
"0.83564866",
"0.83266944",
"0.830059",
"0.8299125",
"0.8228005",
"0.82177615",
"0.82026434",
"0.8178044",
"0.8166825",
"0.8161001",
"0.80602324",
"0.805753",
"0.80364317",
"0.8023138",
"0.7999164",
"0.79909134",
"0.7980655... | 0.8379573 | 4 |
Kill a process with the signal | def kill_process(pid, signal='SIGTERM')
run("kill -#{signal} #{pid}")
process_exists?(pid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill(signal = 'TERM')\n Process.kill(signal, @pid)\n end",
"def kill(signo)\n Process.kill(signo, pid)\n end",
"def killpid(signal, pid)\n if signal =~ /^\\d+$/\n signal = signal.to_i\n else\n signal = sig... | [
"0.8284683",
"0.82524496",
"0.79520494",
"0.79007727",
"0.7863437",
"0.785754",
"0.77705014",
"0.7692351",
"0.765809",
"0.7629923",
"0.7509578",
"0.74927986",
"0.7390506",
"0.7371073",
"0.73045224",
"0.7224597",
"0.72146887",
"0.7213546",
"0.71768016",
"0.7104852",
"0.7072372... | 0.75966394 | 10 |
Check if user exists | def has_user?(name, options={})
run("id #{name}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_exists?(username)\n users(username: username).present?\n end",
"def user_exists?(username)\n Sys::Admin.get_user(username)\n true\n rescue\n false\n end",
"def user_exists?(user)\n return !get_user(user).nil?\n end",
"def user_exists?\n return (session[:... | [
"0.8425433",
"0.83099806",
"0.82137257",
"0.817556",
"0.8054339",
"0.8031439",
"0.8021899",
"0.7933679",
"0.79153204",
"0.79153204",
"0.78681266",
"0.78425056",
"0.7840074",
"0.7838521",
"0.78138876",
"0.78050286",
"0.7784532",
"0.77602404",
"0.775596",
"0.7753595",
"0.765356... | 0.78473043 | 11 |
Check if group exists | def has_group?(name)
run("id -g #{name}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_exists?(group)\n Sys::Admin.get_group(group)\n true\n rescue\n false\n end",
"def has_group?\n @group == ''\n end",
"def group_exists?(name)\n @project.groups.where(name: name).count > 0\n end",
"def has_group?\n\t\t@group == ''\n\tend",
"def exists?\n !g... | [
"0.8454061",
"0.82662266",
"0.8260274",
"0.79841685",
"0.78808993",
"0.78722024",
"0.7870444",
"0.78351486",
"0.77434456",
"0.7717313",
"0.7714516",
"0.7710593",
"0.7660804",
"0.76550126",
"0.7649727",
"0.76322925",
"0.7608336",
"0.7607364",
"0.755966",
"0.7553915",
"0.752206... | 0.84552854 | 0 |
Export an environment variable | def export(key, value)
run("export #{key}=#{value}").success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_env(env = {})\n @env = env\n end",
"def export_env(script)\n environment = script.job_environment\n (environment ? environment : {}).tap{\n |hsh|\n hsh['SINGULARITY_BINDPATH'] = singularity_bindpath(script.native)\n }.map{\n |key, value| \"export #{key}=#{Shellw... | [
"0.72282517",
"0.70616484",
"0.6911408",
"0.68600345",
"0.68464494",
"0.6761212",
"0.6537308",
"0.6512191",
"0.65020525",
"0.644356",
"0.6372599",
"0.630135",
"0.62924206",
"0.6285279",
"0.61941797",
"0.61899364",
"0.618264",
"0.6174501",
"0.61739206",
"0.61118615",
"0.610654... | 0.6368857 | 11 |
Export environment vars from hash | def export_hash(data={})
data.each_pair do |k, v|
export(k, v)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exports\n File.exist?(ENV_LOG) or return {}\n env = {}\n File.read(ENV_LOG).each_line do |row|\n (var, val) = row.strip.split(\"=\")\n env[var] = val\n end\n env\n end",
"def export_env(script)\n environment = script.job_environment\n (environment ? environment : {}).tap{\n ... | [
"0.7232431",
"0.71439564",
"0.6844929",
"0.6767253",
"0.64986426",
"0.6395944",
"0.6376832",
"0.63686484",
"0.6367627",
"0.6365226",
"0.6346057",
"0.63374877",
"0.6334086",
"0.6287145",
"0.628106",
"0.62784106",
"0.62779516",
"0.62760335",
"0.62459874",
"0.62272334",
"0.62158... | 0.0 | -1 |
Get an environment variable | def env(key)
capture("echo $#{key}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end",
"def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end",
"def get_env_var(var, error = true)\n if ENV[var]\n return ENV[var]\n else... | [
"0.82533294",
"0.7746189",
"0.75317264",
"0.74689764",
"0.73861396",
"0.72738236",
"0.722927",
"0.72096133",
"0.7206347",
"0.69794303",
"0.6955651",
"0.6882117",
"0.6880429",
"0.67511725",
"0.66958463",
"0.6651457",
"0.65930057",
"0.6534796",
"0.6472876",
"0.64562887",
"0.645... | 0.6461101 | 19 |
Get last executed command exit code | def last_exit_code
Integer(capture("echo $?"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exitstatus\n subexec.try(:exitstatus)\n end",
"def exit_code\n self.__options[:exit_code]\n end",
"def get_ssh_exitcode( index = 1 )\n index.is_a?(Fixnum) and index > 0 ? self.ssh_exitcode[-index] : self.ssh_exitcode[index]\n end",
"def last_command_successful?\n $?.exitstatus == 0\n ... | [
"0.76262283",
"0.72706515",
"0.71549237",
"0.714196",
"0.7113799",
"0.7050779",
"0.70331097",
"0.69962615",
"0.68754315",
"0.68706936",
"0.68513584",
"0.6822762",
"0.6803048",
"0.66990036",
"0.6632998",
"0.6557214",
"0.65054965",
"0.6429208",
"0.6397939",
"0.6397939",
"0.6370... | 0.8725615 | 0 |
Set a timeout context for execution | def with_timeout(time, &block)
Timeout.timeout(time) do
block.call(self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end",
"def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end",
"def timeout=(timeout)\n @timeout = timeout\n end",
"def timeouts_set=(_arg0); end",
"def timeout=(_arg0); end",
"def timeout=(value)\n @... | [
"0.7276492",
"0.7276492",
"0.70021564",
"0.69245857",
"0.6817695",
"0.67245805",
"0.6672088",
"0.6671502",
"0.6634467",
"0.6630561",
"0.6583863",
"0.65832555",
"0.65832555",
"0.65832555",
"0.65832555",
"0.65832555",
"0.6564612",
"0.6551457",
"0.6523841",
"0.64944744",
"0.6462... | 0.0 | -1 |
Combines all data entry methods | def enter_media_info_data(data_set)
hide_notifications_bar
enter_id_number data_set
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(*args); end",
"def methods() end",
"def define_additional_data\n hash = options[:additional_data]\n if !hash.to_h.empty?\n hash.each do |k,v|\n define_singleton_method(k) do\n instance_variable_get(:\"@#{k}\") || \n instance_variable_set(:\"@... | [
"0.5985771",
"0.5888579",
"0.57993406",
"0.5623669",
"0.5557333",
"0.54844594",
"0.54844594",
"0.54844594",
"0.54844594",
"0.54822725",
"0.54226965",
"0.54226965",
"0.54226965",
"0.54226965",
"0.54160786",
"0.54058605",
"0.5403894",
"0.5403894",
"0.5403894",
"0.5403894",
"0.5... | 0.0 | -1 |
GET /matches GET /matches.json | def index
@matches = Match.order(:name).page(params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end",
"def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end",
"def index\n @matches = @current_user.matches.include... | [
"0.752813",
"0.7394124",
"0.730342",
"0.7210067",
"0.72072196",
"0.7200118",
"0.7068271",
"0.7068271",
"0.7068271",
"0.7068271",
"0.7068271",
"0.70285064",
"0.69965607",
"0.69690144",
"0.69647396",
"0.6962711",
"0.6949953",
"0.69074726",
"0.6834273",
"0.6762692",
"0.6753257",... | 0.66473657 | 23 |
GET /matches/1 GET /matches/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end",
"def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end",
"def index\n @matches = Match.where(\"player2_id IS N... | [
"0.76179665",
"0.747113",
"0.7408183",
"0.72241014",
"0.7158438",
"0.71064603",
"0.7097788",
"0.6979289",
"0.69566995",
"0.6949862",
"0.69414395",
"0.69414395",
"0.69414395",
"0.69414395",
"0.69414395",
"0.6835067",
"0.68285567",
"0.6806905",
"0.6789736",
"0.6748504",
"0.6724... | 0.0 | -1 |
GET /matches/1/edit def edit end POST /matches POST /matches.json | def create
@match = Match.new(match_params)
@match.owner = current_user
@match.test = params[:match][:test] || false;
params[:match][:tanks].each do |tank_id|
unless tank_id.empty? # get around strange rails thing with multi selects
tank = Tank.find tank_id
if tank.public || user_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @match = @contest.matches.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(contest_path) }\n format.xml { head :ok }\n else\n format.h... | [
"0.6845182",
"0.6770978",
"0.67572033",
"0.67331606",
"0.67220277",
"0.67126095",
"0.67122144",
"0.66029155",
"0.66029155",
"0.6575127",
"0.65412134",
"0.6470609",
"0.6436678",
"0.6436678",
"0.6436678",
"0.6436678",
"0.6436678",
"0.6436678",
"0.6436678",
"0.6436678",
"0.64366... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_match
@match = Match.find params[:id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def match_params
param_list = [:name, :public]
param_list << :max_ticks if current_user.admin?
params[:match].permit param_list if params[:match]
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 |
TODO check what call to use for active | def active?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active; end",
"def active; end",
"def active?; end",
"def active=(_arg0); end",
"def active=(_arg0); end",
"def activate; end",
"def active?; @active; end",
"def active?; @active; end",
"def active?\n end",
"def active?\n end",
"def active\n active?\n end",
"def active?\... | [
"0.813655",
"0.813655",
"0.78658545",
"0.7561186",
"0.7561186",
"0.7119286",
"0.70273155",
"0.70273155",
"0.69917184",
"0.69917184",
"0.6991173",
"0.6949474",
"0.6949474",
"0.6949474",
"0.6843473",
"0.68430835",
"0.6834183",
"0.6834183",
"0.6834183",
"0.6834183",
"0.6827683",... | 0.66856533 | 25 |
Use callbacks to share common setup or constraints between actions. | def set_server
@server = Server.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def server_params
params.require(:server).permit(:instance_id, :name, :public_ip, :private_ip, :flavor, :image, :ssh_key_name, :security_groups, :state)
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.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
Returns an array of relationships of the given name | def relationships_with_name(input, name)
input.relations(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_relationships(name)\n self.class.find_relationship(name).find_by_participant(self)\n end",
"def relationships\n return [] if empty?\n\n map { |table| Relationship.new(table, TABLE_R, \"../#{table.pn}\") }\n end",
"def relationships\n model.relationships(repository.name)\n end",
... | [
"0.7039794",
"0.7001035",
"0.68054026",
"0.67510086",
"0.67224586",
"0.64262384",
"0.6413276",
"0.6371461",
"0.62964135",
"0.6279847",
"0.6278407",
"0.62520343",
"0.6235754",
"0.6206332",
"0.6100424",
"0.6068334",
"0.6062228",
"0.6049405",
"0.6038787",
"0.60343385",
"0.601666... | 0.7764375 | 0 |
merge this TextElement with another (adjust size and text content accordingly) | def merge!(other)
raise TypeError, "argument is not a TextElement" unless other.instance_of?(TextElement)
if (self <=> other) < 0
self.text = other.text + self.text
else
self.text << other.text
end
super(other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <<(text_element)\n self.text_elements << text_element\n self.merge!(text_element)\n end",
"def append_text(content)\n temp_text_ele = @text_ele.clone\n temp_text_ele.elements[1].content = content\n last_para = @main_doc.xpath('.//w:p')[-1]\n last_para.add_child(temp_text_ele)\n end"... | [
"0.69313675",
"0.6300748",
"0.59719545",
"0.58361375",
"0.57834494",
"0.5723809",
"0.5704813",
"0.56932884",
"0.5609813",
"0.55864215",
"0.55380833",
"0.5521937",
"0.5505603",
"0.548468",
"0.5413991",
"0.5397956",
"0.53867936",
"0.53826445",
"0.5379523",
"0.5284615",
"0.52826... | 0.8092124 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.