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 |
|---|---|---|---|---|---|---|
If you don't specify these, it's possible to have issues when encodings mismatch on the server. | def setup_encoding
# TODO: Deprecate and remove this setup - it should be the responsibility of the server to set this correctly.
if @external_encoding and Encoding.default_external != @external_encoding
warn "Updating Encoding.default_external from #{Encoding.default_external} to #{@external_encoding}" if $V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_encoding_error; end",
"def force_default_encoding; end",
"def encoding_found; end",
"def encoding_found; end",
"def default_encoding; end",
"def default_encoding; end",
"def meta_encoding; end",
"def meta_encoding; end",
"def encodings; end",
"def suppress_encoding; end",
"def ignore... | [
"0.80756944",
"0.7460794",
"0.7404844",
"0.7404844",
"0.7377576",
"0.7377576",
"0.7376942",
"0.7376942",
"0.73288494",
"0.7322891",
"0.72067565",
"0.7094008",
"0.708283",
"0.70693547",
"0.70693547",
"0.70693547",
"0.6973361",
"0.6973361",
"0.6973361",
"0.6973361",
"0.6973361"... | 0.62735116 | 83 |
Create new client session | def save_session(username)
consumer = fetch_consumer(username)
consumer.session_token = SecureRandom.hex
consumer.save!
consumer.session_token.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_session\n @connection.create_session(@config || {})\n end",
"def create\n @client = current_client\n @session = @client.session\n debug { \"SessionsController#create - #{@session.inspect}\"}\n raise \"ResourceOwner from token != session.owner\" if doorkeeper_token.r... | [
"0.74348104",
"0.7222111",
"0.7107012",
"0.6948435",
"0.6908423",
"0.6827826",
"0.6774391",
"0.6759977",
"0.6673508",
"0.660458",
"0.653711",
"0.65355337",
"0.64882755",
"0.64788604",
"0.64762074",
"0.6443971",
"0.6440006",
"0.6435148",
"0.6417136",
"0.6377964",
"0.6377882",
... | 0.0 | -1 |
check user is admin or client | def check_admin(username)
consumer = fetch_consumer(username)
consumer.admin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\n end\n end",
"def is_admin?(user)\n user.admin > 0\n end",
"def admin_user?\n self.admin ==true\n end",
"def admin? ; us... | [
"0.79785734",
"0.79475933",
"0.79395527",
"0.79364675",
"0.7856753",
"0.7847651",
"0.7841373",
"0.78309673",
"0.7818261",
"0.7785563",
"0.7780675",
"0.7764129",
"0.7747446",
"0.77405417",
"0.77403396",
"0.77308017",
"0.77283233",
"0.77134126",
"0.77132547",
"0.7696463",
"0.76... | 0.0 | -1 |
Unlocks the current job, then lock for processing | def execute(callback)
unlock(:server)
runtime_lock.execute(callback) do
yield
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock\n if job\n job.report_running if report_job_status\n job.set_status(\"Unlocking #{to_s}\")\n end\n\n attempt_unlock\n\n report(true)\n end",
"def unlock\n locksmith.unlock # Only signal to release the lock\n end",
"def unlock\n @locking = false\n... | [
"0.80560195",
"0.792052",
"0.7761226",
"0.7562767",
"0.7459773",
"0.73170596",
"0.7281347",
"0.72716385",
"0.72716385",
"0.722592",
"0.7220226",
"0.7204193",
"0.71734554",
"0.7151579",
"0.71470064",
"0.7051378",
"0.69854",
"0.69005275",
"0.6865165",
"0.68508303",
"0.6839796",... | 0.0 | -1 |
Initialize a new Topping | def initialize(name, vegetarian: false)
@name = name
@vegetarian = vegetarian
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @top = nil\n end",
"def initialize(toppings = [Topping.new(\"cheese\", vegetarian: true)])\n @toppings = toppings\n end",
"def initialize (toppings = [Pizza::Topping.new('cheese', vegetarian: true)])\n @toppings = toppings \n @delivery_time\n end",
"def initialize(to... | [
"0.67978287",
"0.6734882",
"0.6524095",
"0.64332455",
"0.63178706",
"0.6309961",
"0.63091785",
"0.6182614",
"0.61291856",
"0.6102263",
"0.60342616",
"0.5961404",
"0.5940597",
"0.593372",
"0.5926325",
"0.58585566",
"0.57854456",
"0.57647914",
"0.5760392",
"0.57515204",
"0.5747... | 0.0 | -1 |
... doctor.first_name = 'Carlos' = attr_accessor :first_name | def initialize(attributes = {})
@id = attributes[:id]
# TODO: store other attributes as instanced variable (exercise)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_accessor(name)\n attr_reader(name)\n attr_writer(name)\n nil\n end",
"def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end",
"def first_name=(first_name)\n @first_name = first_name\n end",
"def first_name=(first_name)\n @first_name = first_name\n end",
"def n... | [
"0.7063225",
"0.70529985",
"0.67424804",
"0.67424804",
"0.6699787",
"0.6659352",
"0.66510713",
"0.6628049",
"0.6597046",
"0.6586247",
"0.65412384",
"0.6521226",
"0.65154845",
"0.6430901",
"0.6427275",
"0.6397374",
"0.6381212",
"0.6381129",
"0.6369219",
"0.6357247",
"0.6357247... | 0.0 | -1 |
this can be called on a object/instance of the class Doctor instance class (doctor.save) doctor must be an object/instance of this class (Doctor) | def save
# Insert OR Update object values into DB
# DB.execute("INSERT INTO .....")
# @id = DB.last_insert_row_id # get the last id from the DB
# OR
# DB.execute("UPDATE .....")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_doctor\n @doctor = Doctor.find(params[:id])\n end",
"def set_doctor\n @doctor = Doctor.find(params[:id])\n end",
"def set_doctor\n @doctor = Doctor.find(params[:id])\n end",
"def set_doctor\n @doctor = Doctor.find(params[:id])\n end",
"def set_doctor\n @doctor =... | [
"0.67024785",
"0.67024785",
"0.67024785",
"0.67024785",
"0.67024785",
"0.67024785",
"0.67024785",
"0.67019695",
"0.66758364",
"0.6622188",
"0.6370385",
"0.636696",
"0.63638794",
"0.62718225",
"0.6230397",
"0.61923885",
"0.61724335",
"0.6166102",
"0.61572105",
"0.61377853",
"0... | 0.0 | -1 |
this can be called on a object/instance of the class Doctor | def destroy
# delete object from the DB
# DB.execute("DELETE .....")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def the_doctor; end",
"def doors; end",
"def doctorView \n end",
"def droid; end",
"def initialize(date, doctor)\n @date = date\n @doctor = doctor\n doctor.add_appointment(self) #upon instatiation, make an appointment through the Doctor class #add_appointment method, which in turn sets this ap... | [
"0.7573614",
"0.63717955",
"0.6336559",
"0.6176266",
"0.6149293",
"0.6114734",
"0.61062366",
"0.60507196",
"0.6050536",
"0.6036655",
"0.60264516",
"0.6020653",
"0.6006742",
"0.5993518",
"0.5993518",
"0.5993518",
"0.5993518",
"0.5993518",
"0.5993518",
"0.5993518",
"0.59249836"... | 0.0 | -1 |
todo Manage diferent states of the page. | def find_page(url)
found = Page.find_by_url(url)
found if found #and (found.published?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_page\n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def set_page\n @articlespage = 'active'\n end",
"def p... | [
"0.67010725",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.6689271",
"0.64467865",
"0.6426666",
"0.6385554",
"0.6363547",
"0.63117373",
"0.63002527",
"0.62980294",
"0.629646",... | 0.0 | -1 |
this allows 'dup' to work in a desirable way for these instances, ie use a dup'd properties hash instance for the dup, meaning it can be updated without affecting the state of the original. | def initialize_copy(other)
super
@values = @values.dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_dup\n puts \"warning: #{self.class}: deep_dup not implement\"\n end",
"def deep_dup; end",
"def dup\n obj = super\n obj.duplicated_from = self\n obj.resource = self.resource_file\n uhook_duplicated_object(obj)\n\n obj\n end",
"def deep_dup\n dupl... | [
"0.7873889",
"0.7573002",
"0.75136524",
"0.75119525",
"0.75119525",
"0.748015",
"0.7466466",
"0.74377644",
"0.7426024",
"0.74219996",
"0.7418329",
"0.73522955",
"0.7339464",
"0.73213774",
"0.73163086",
"0.72770643",
"0.7271726",
"0.72697425",
"0.7266225",
"0.72660094",
"0.726... | 0.0 | -1 |
Based on Matz's code for OpenStructinspect in the stdlib. Note the trick with the Threadlocal :__inspect_key__, which ruby internals appear to use but isn't documented anywhere. If you use it in the same way the stdlib uses it, you can override inspect without breaking its cycle avoidant behaviour | def inspect
str = "#<#{self.class}"
ids = (Thread.current[:__inspect_key__] ||= [])
if ids.include?(object_id)
return str << ' ...>'
end
ids << object_id
begin
first = true
for k,v in @values
str << "," unless first
first = false
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n id_text = __id__.to_s(16).rjust(14, ?0)\n addr_text = self.address.to_s(16).rjust(14, ?0)\n\n member_text = if ! null? && ::Snow::CStruct.long_inspect\n # Get member text\n all_members_text = (self.class::MEMBERS.map do |member|\n name = member.name\n typ... | [
"0.66296273",
"0.6444158",
"0.6444158",
"0.6444158",
"0.6444158",
"0.6444158",
"0.6428228",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0.63086724",
"0... | 0.0 | -1 |
Returns current frame's `location.href`. | def url
evaluate("document.location.href")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_url\n evaluate(\"window.top.location.href\")\n end",
"def href\n `window.location.href`\n end",
"def actual_url\n @browser.current_url\n end",
"def current_url\n @rawpage.current_url\n end",
"def current_url\n request.env['REQUEST_URI']\n end",
"def cur... | [
"0.80965084",
"0.71785486",
"0.6995556",
"0.6910226",
"0.6843511",
"0.6820817",
"0.6812508",
"0.6775048",
"0.6736839",
"0.66783345",
"0.66783345",
"0.6664685",
"0.65422636",
"0.65134716",
"0.64588803",
"0.6351641",
"0.6296681",
"0.6283395",
"0.62478876",
"0.62277806",
"0.6169... | 0.724398 | 1 |
Returns current frame's title. | def title
evaluate("document.title")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currentWindowTitle\n begin\n return theBrowser.title\n rescue\n return nil\n end\n end",
"def current_title\n evaluate(\"window.top.document.title\")\n end",
"def getPageTitle(frameName = \"\" )\n container = getObjectFrameReference( \"\" , frameName )\n ... | [
"0.80988544",
"0.80489486",
"0.77392864",
"0.7659522",
"0.7587632",
"0.7587632",
"0.7381258",
"0.7353406",
"0.7343722",
"0.73325276",
"0.72012085",
"0.7177491",
"0.71357876",
"0.7127385",
"0.7127385",
"0.7127385",
"0.711938",
"0.71153504",
"0.7100578",
"0.707911",
"0.707785",... | 0.75207907 | 6 |
If current frame is the main frame of the page (top of the tree). | def main?
@parent_id.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nav\n frame_text = self.redirect {$ie.show_frames}\n if frame_text =~ /mainFrameSet/ then $ie.frame(:id, 'main').frame(:id, 'navigationFrame')\n else $ie.frame(:id, 'navigationFrame')\n end\n end",
"def parent_frame; end",
"def nav\r\n frame_text = self.redirect {$ie.show_frames}\r\n if ... | [
"0.68766874",
"0.6859186",
"0.65871674",
"0.64006937",
"0.6364613",
"0.6326518",
"0.6326518",
"0.6212763",
"0.616797",
"0.61507756",
"0.61222523",
"0.6083357",
"0.6049696",
"0.60402966",
"0.6029266",
"0.6022104",
"0.5998965",
"0.59682083",
"0.5939741",
"0.59285015",
"0.589862... | 0.5468405 | 53 |
Execution context id which is used by JS, each frame has it's own context in which JS evaluates. | def execution_id
value = @execution_id.value
return if value.instance_of?(Object)
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execution_context\n raise \"Execution Context is not available in detached frame \\\"#{frame.url}\\\" (are you trying to evaluate?)\" if @_detached\n\n @_context_promise.value\n end",
"def execution_context\n @context\n end",
"def current_execution_context\n @current_execution_conte... | [
"0.6845661",
"0.64666",
"0.6380627",
"0.6309493",
"0.62887275",
"0.61380875",
"0.6109944",
"0.60675323",
"0.5990168",
"0.5939775",
"0.5897475",
"0.58891565",
"0.5880571",
"0.5878176",
"0.5837324",
"0.5814406",
"0.5771475",
"0.57363814",
"0.57363814",
"0.57363814",
"0.57363814... | 0.5673979 | 31 |
GET /drug_stores GET /drug_stores.json | def index
@drug_stores = DrugStore.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @stores = Store.all\n render json: @stores\n end",
"def show\n render json: @store\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\... | [
"0.6709867",
"0.65023243",
"0.64579064",
"0.6446975",
"0.64360434",
"0.6435191",
"0.6431837",
"0.6297562",
"0.6259508",
"0.62141985",
"0.6208471",
"0.6195126",
"0.6195126",
"0.6195126",
"0.6195126",
"0.61933506",
"0.61603856",
"0.6156894",
"0.6149985",
"0.6133582",
"0.6106834... | 0.7264478 | 0 |
GET /drug_stores/1 GET /drug_stores/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @drug_stores = DrugStore.all\n end",
"def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end",
"def index\n @api_v... | [
"0.7030095",
"0.65447104",
"0.6540039",
"0.6510994",
"0.65091765",
"0.6461106",
"0.6447425",
"0.6432432",
"0.64111364",
"0.6401272",
"0.6401272",
"0.6401272",
"0.6401272",
"0.6386951",
"0.63640505",
"0.6341184",
"0.6339917",
"0.63063395",
"0.6279408",
"0.6266929",
"0.6247279"... | 0.0 | -1 |
POST /drug_stores POST /drug_stores.json | def create
@drug_store = DrugStore.new(drug_store_params)
respond_to do |format|
if @drug_store.save
format.html { redirect_to @drug_store, notice: 'Drug store was successfully created.' }
format.json { render :show, status: :created, location: @drug_store }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(add_params = nil)\n params = {\n }\n api_call('/stores(.:format)',:post,params,add_params)\n end",
"def create\n @store = Store.new(params.require(:store).permit(:break_even, :capacity, :city, :county_id, :manager_id,\n :name, :number, :number_of_lifts, :pho... | [
"0.65901494",
"0.646261",
"0.6295786",
"0.62833464",
"0.62730956",
"0.62726563",
"0.62284404",
"0.6222316",
"0.6216965",
"0.62096083",
"0.61872613",
"0.617285",
"0.617285",
"0.6149776",
"0.6136852",
"0.6096941",
"0.60839796",
"0.60568315",
"0.5993013",
"0.59866303",
"0.595221... | 0.7323824 | 0 |
PATCH/PUT /drug_stores/1 PATCH/PUT /drug_stores/1.json | def update
respond_to do |format|
if @drug_store.update(drug_store_params)
format.html { redirect_to @drug_store, notice: 'Drug store was successfully updated.' }
format.json { render :show, status: :ok, location: @drug_store }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @store.update(store_params)\n render json: @store\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params.require(:s... | [
"0.65545964",
"0.6262163",
"0.6226827",
"0.6209489",
"0.6165126",
"0.61627114",
"0.61604273",
"0.61604273",
"0.61604273",
"0.61604273",
"0.6131849",
"0.61309266",
"0.60972077",
"0.60814285",
"0.6067092",
"0.6060184",
"0.6058264",
"0.60133386",
"0.60096925",
"0.60095274",
"0.5... | 0.6767939 | 0 |
DELETE /drug_stores/1 DELETE /drug_stores/1.json | def destroy
@drug_store.destroy
respond_to do |format|
format.html { redirect_to drug_stores_url, notice: 'Drug store was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @datastore = Datastore.find(params[:id])\n @datastore.destroy\n\n respond_to do |format|\n format.html { redirect_to datastores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\t @store = Store.find(params[:id])\n\t\t\t\t @store.destroy\n\n\t\... | [
"0.7103534",
"0.6975748",
"0.6972588",
"0.6972448",
"0.6972448",
"0.6972448",
"0.6972448",
"0.6964395",
"0.6964395",
"0.6964395",
"0.6964395",
"0.6918858",
"0.6855227",
"0.6850654",
"0.6846446",
"0.6846399",
"0.68323153",
"0.68154836",
"0.6805286",
"0.678241",
"0.67671454",
... | 0.7445788 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_drug_store
@drug_store = DrugStore.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 drug_store_params
params.require(:drug_store).permit(:name, :email, :web_page_url, :logo_img_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /user_game_levels GET /user_game_levels.json | def index
@user_game_levels = UserGameLevel.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @founda... | [
"0.7679649",
"0.74169904",
"0.7085923",
"0.69168246",
"0.6909223",
"0.67923754",
"0.67761004",
"0.6735388",
"0.6557576",
"0.6480894",
"0.6480894",
"0.64552176",
"0.6388151",
"0.63154495",
"0.6302286",
"0.6289503",
"0.628408",
"0.62678546",
"0.62046224",
"0.6203519",
"0.620216... | 0.74439305 | 1 |
GET /user_game_levels/1 GET /user_game_levels/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @founda... | [
"0.7429315",
"0.7391055",
"0.7305927",
"0.7098908",
"0.69656956",
"0.6920374",
"0.677276",
"0.6653614",
"0.65859896",
"0.65767497",
"0.6520773",
"0.6520773",
"0.6509786",
"0.6464133",
"0.6360373",
"0.6352174",
"0.6283946",
"0.62469923",
"0.6162511",
"0.61332774",
"0.6114295",... | 0.0 | -1 |
POST /user_game_levels POST /user_game_levels.json | def create
@user_game_level = UserGameLevel.new(user_game_level_params)
respond_to do |format|
if @user_game_level.save
format.html { redirect_to @user_game_level, notice: 'User game level was successfully created.' }
format.json { render :show, status: :created, location: @user_game_leve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_game_level_params\n params.require(:user_game_level).permit(:user_game_id, :game_level_id)\n end",
"def create\n @game_level = GameLevel.new(game_level_params)\n\n respond_to do |format|\n if @game_level.save\n format.html { redirect_to @game_level, notice: 'Game level was succ... | [
"0.68166804",
"0.66407984",
"0.66223514",
"0.6443282",
"0.64159703",
"0.6394431",
"0.63865507",
"0.63865507",
"0.6385977",
"0.6376677",
"0.6305708",
"0.62947303",
"0.6218576",
"0.6195919",
"0.6159602",
"0.61058134",
"0.60856575",
"0.6084296",
"0.6029324",
"0.60020775",
"0.599... | 0.7171693 | 0 |
PATCH/PUT /user_game_levels/1 PATCH/PUT /user_game_levels/1.json | def update
respond_to do |format|
if @user_game_level.update(user_game_level_params)
format.html { redirect_to @user_game_level, notice: 'User game level was successfully updated.' }
format.json { render :show, status: :ok, location: @user_game_level }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @game_level.update(game_level_params)\n format.html { redirect_to @game_level, notice: 'Game level was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_level }\n else\n format.html { render :edit }\n ... | [
"0.7083745",
"0.6962488",
"0.69384944",
"0.6766968",
"0.67299163",
"0.6706209",
"0.6613066",
"0.6599353",
"0.65270686",
"0.65017706",
"0.64997035",
"0.6496667",
"0.6411599",
"0.63944346",
"0.63325256",
"0.63192433",
"0.6298037",
"0.6285173",
"0.62652344",
"0.625497",
"0.62305... | 0.7388686 | 0 |
DELETE /user_game_levels/1 DELETE /user_game_levels/1.json | def destroy
@user_game_level.destroy
respond_to do |format|
format.html { redirect_to user_game_levels_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @game_level.destroy\n respond_to do |format|\n format.html { redirect_to game_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level.destroy\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_co... | [
"0.7574058",
"0.73912174",
"0.73760444",
"0.7357212",
"0.7175903",
"0.71207124",
"0.70038354",
"0.6990399",
"0.6952091",
"0.6905523",
"0.6818826",
"0.6762851",
"0.675949",
"0.675949",
"0.6747088",
"0.6666204",
"0.6618588",
"0.65951085",
"0.6594954",
"0.65947294",
"0.65925294"... | 0.7834086 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_user_game_level
@user_game_level = UserGameLevel.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 user_game_level_params
params.require(:user_game_level).permit(:user_game_id, :game_level_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
GET /glass_store_links GET /glass_store_links.json | def index
@glass_store_links = GlassStoreLink.all
@glass_store_links.each do |glass_store_link|
@glass = Glass.find(glass_store_link.glass_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_glass_store_link\n @glass_store_link = GlassStoreLink.find(params[:id])\n end",
"def index\n render json: @links\n end",
"def index\n links = all_links\n render json: { success: true, links: links }\n end",
"def get_links(service)\n\t\treturn @transport.get_path(\"links\",service)\... | [
"0.68160135",
"0.6572148",
"0.65378535",
"0.6456903",
"0.63367766",
"0.6296662",
"0.6205558",
"0.6098075",
"0.60904443",
"0.60904443",
"0.6042652",
"0.59915334",
"0.5979884",
"0.59631354",
"0.59516263",
"0.59302264",
"0.5912459",
"0.5906209",
"0.5906209",
"0.5906209",
"0.5906... | 0.74833053 | 0 |
GET /glass_store_links/1 GET /glass_store_links/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @glass_store_links = GlassStoreLink.all\n @glass_store_links.each do |glass_store_link|\n @glass = Glass.find(glass_store_link.glass_id)\n end\n end",
"def set_glass_store_link\n @glass_store_link = GlassStoreLink.find(params[:id])\n end",
"def index\n render json: @links\... | [
"0.7269414",
"0.6822114",
"0.66408694",
"0.6549453",
"0.63980824",
"0.63980824",
"0.6312608",
"0.63011116",
"0.62857455",
"0.62674475",
"0.61972606",
"0.6174476",
"0.61673266",
"0.61542404",
"0.60944045",
"0.60434026",
"0.60434026",
"0.6029031",
"0.59953207",
"0.59783363",
"0... | 0.0 | -1 |
POST /glass_store_links POST /glass_store_links.json | def create
@glass_store_link = GlassStoreLink.new(glass_store_link_params)
@stores = Store.all
#@glass_store_link.glass_id = params[:glass_id]
@glass = Glass.find_by_id(params[:glass_id])
@glass_store_link2 = @glass_store_link.is_unique_for_same_glass_kind(@glass_store_link.store_id, @glass_store_li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end",
"def glass_store_link_params\n params.require(:glass_store_link).permit(:glass_id, :store_id, :quantity)\n end",
"def se... | [
"0.6705851",
"0.644812",
"0.6308752",
"0.6285573",
"0.6258482",
"0.62554085",
"0.62554085",
"0.6111631",
"0.60189956",
"0.60105133",
"0.60105133",
"0.60094875",
"0.600619",
"0.6001159",
"0.5993234",
"0.5987758",
"0.59798765",
"0.5932593",
"0.5914696",
"0.59143496",
"0.5909006... | 0.6432219 | 2 |
PATCH/PUT /glass_store_links/1 PATCH/PUT /glass_store_links/1.json | def update
respond_to do |format|
if @glass_store_link.update(glass_store_link_params)
format.html { redirect_to @glass_store_link, notice: 'Glass store link was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n update_and_respond(@link, link_params)\n end",
"def update\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully updated.... | [
"0.64537716",
"0.64327043",
"0.6407661",
"0.63829696",
"0.63622206",
"0.6321147",
"0.62963456",
"0.6267089",
"0.62629944",
"0.62629944",
"0.625568",
"0.6173176",
"0.6167491",
"0.61569244",
"0.6146763",
"0.61368936",
"0.61368936",
"0.61368936",
"0.61368936",
"0.61368936",
"0.6... | 0.7342254 | 0 |
DELETE /glass_store_links/1 DELETE /glass_store_links/1.json | def destroy
@glass_store_link.destroy
respond_to do |format|
format.html { redirect_to glass_store_links_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end",
"def delete\n delete_from_server single_url\n end",
... | [
"0.72141606",
"0.72141606",
"0.6916389",
"0.6848405",
"0.67865056",
"0.6749795",
"0.6717293",
"0.670681",
"0.6705216",
"0.6702807",
"0.6702807",
"0.6702807",
"0.6688399",
"0.66583216",
"0.66334695",
"0.6627897",
"0.66239774",
"0.66220963",
"0.66187125",
"0.66187125",
"0.66187... | 0.7869396 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_glass_store_link
@glass_store_link = GlassStoreLink.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def glass_store_link_params
params.require(:glass_store_link).permit(:glass_id, :store_id, :quantity)
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 |
test comment ^^^ meta.function.method.withoutarguments.ruby keyword.control.def.ruby ^^^^^^ meta.function.method.withoutarguments.ruby entity.name.function.ruby ^ punctuation.separator.statement.ruby ^^^^^ variable.other.ruby ^ punctuation.separator.object.ruby ^^^^^ variable.other.ruby ^ keyword.operator.assignment.ru... | def method # test comment
# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby
# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby
# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby
# ^^^^^^^^^^^^^ comment.line.number-sign.ru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_without_parentheses *a, **b, &c # test comment\n# ^^^ meta.function.method.with-arguments.ruby keyword.control.def.ruby\n# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.with-arguments.ruby entity.name.function.ruby\n# ^ meta.function.method.with-arguments.ruby storag... | [
"0.74315435",
"0.73857355",
"0.7227881",
"0.67796427",
"0.67796427",
"0.67796427",
"0.67796427",
"0.6574589",
"0.6574589",
"0.6574589",
"0.6574589",
"0.65241516",
"0.6462989",
"0.6428282",
"0.6350332",
"0.6297015",
"0.6294113",
"0.6287649",
"0.6274447",
"0.62367874",
"0.62367... | 0.90345776 | 0 |
test comment ^^^ meta.function.method.witharguments.ruby keyword.control.def.ruby ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.witharguments.ruby entity.name.function.ruby ^ meta.function.method.witharguments.ruby punctuation.definition.parameters.ruby ^ meta.function.method.witharguments.ruby storage.type.variable.rub... | def method_with_parentheses(a, b, c = [foo,bar,baz]) hello, world = [1,2] end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.numbe... | [
"0.8632499",
"0.7251508",
"0.71520406",
"0.7132776",
"0.61249",
"0.60706925",
"0.5999838",
"0.5999838",
"0.5999838",
"0.5999838",
"0.5949081",
"0.5949081",
"0.5949081",
"0.5949081",
"0.5947842",
"0.58501226",
"0.58395183",
"0.5733192",
"0.57169205",
"0.57169205",
"0.5703677",... | 0.0 | -1 |
test comment ^^^ meta.function.method.witharguments.ruby keyword.control.def.ruby ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.witharguments.ruby entity.name.function.ruby ^ meta.function.method.witharguments.ruby punctuation.definition.parameters.ruby ^ meta.function.method.witharguments.ruby variable.parameter.functi... | def method_with_parentheses(a, b, c = [foo,bar,baz]) # test comment
# ^^^ meta.function.method.with-arguments.ruby keyword.control.def.ruby
# ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.with-arguments.ruby entity.name.function.ruby
# ^ meta.function.method.with-arguments.ruby punctuation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.numbe... | [
"0.85339177",
"0.7283759",
"0.71949273",
"0.62480134",
"0.60588056",
"0.594318",
"0.594318",
"0.594318",
"0.594318",
"0.5935349",
"0.5935349",
"0.5935349",
"0.5935349",
"0.58191425",
"0.58144915",
"0.5764691",
"0.57327837",
"0.5720057",
"0.5716596",
"0.568763",
"0.56681824",
... | 0.7403491 | 1 |
test comment ^^^ meta.function.method.witharguments.ruby keyword.control.def.ruby ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.witharguments.ruby entity.name.function.ruby ^ meta.function.method.witharguments.ruby variable.parameter.function.ruby ^ meta.function.method.witharguments.ruby punctuation.separator.object... | def method_without_parentheses a, b, c = [foo,bar,baz] # test comment
# ^^^ meta.function.method.with-arguments.ruby keyword.control.def.ruby
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.with-arguments.ruby entity.name.function.ruby
# ^ meta.function.method.with-arguments.ruby va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.numbe... | [
"0.8579387",
"0.74072075",
"0.7207451",
"0.62161624",
"0.6124276",
"0.60473174",
"0.60473174",
"0.60473174",
"0.60473174",
"0.60101485",
"0.60101485",
"0.60101485",
"0.60101485",
"0.59200907",
"0.58432525",
"0.58233386",
"0.5794839",
"0.57923937",
"0.5786963",
"0.5758313",
"0... | 0.72911394 | 2 |
test comment ^^^ meta.function.method.witharguments.ruby keyword.control.def.ruby ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.witharguments.ruby entity.name.function.ruby ^ meta.function.method.witharguments.ruby storage.type.variable.ruby ^ meta.function.method.witharguments.ruby variable.parameter.function.ruby ^... | def method_without_parentheses *a, **b, &c # test comment
# ^^^ meta.function.method.with-arguments.ruby keyword.control.def.ruby
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.method.with-arguments.ruby entity.name.function.ruby
# ^ meta.function.method.with-arguments.ruby storage.type.v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.numbe... | [
"0.8669121",
"0.7291724",
"0.7146618",
"0.6158466",
"0.6070861",
"0.6070861",
"0.6070861",
"0.6070861",
"0.6063512",
"0.60394895",
"0.60394895",
"0.60394895",
"0.60394895",
"0.6017666",
"0.5932104",
"0.5873244",
"0.57960224",
"0.57834524",
"0.5782268",
"0.5730857",
"0.5725715... | 0.7183241 | 2 |
use callbacks to share common setup or constraints between actions. | def set_dashboard
@dashboard = current_user.dashboards.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 run_actions; end",
"def action_hook; end",
"def callbacks; end",
"def callbacks; end",
"def actions; end",
"def define_action_hook; end",
"def add_actions; end",
"def define_action_helpers\n ... | [
"0.621042",
"0.60981137",
"0.6067648",
"0.59914476",
"0.59914476",
"0.59525734",
"0.5909465",
"0.5891942",
"0.58147264",
"0.57994914",
"0.5528828",
"0.55052435",
"0.54776007",
"0.54693365",
"0.5458017",
"0.54283196",
"0.5421073",
"0.5387869",
"0.5378564",
"0.5378564",
"0.5378... | 0.0 | -1 |
never trust parameters from the scary internet, only allow the white list through. | def dashboard_params
# remove single/double quotes from name which cause chart's to fail:
params[:dashboard][:name] = params[:dashboard][:name].gsub(/'/, '').gsub(/"/, '') unless params[:dashboard][:name].blank?
params.require(:dashboard).permit(
:name,
widgets_attributes: [:id, :_destroy, :char... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n ... | [
"0.71857256",
"0.7074159",
"0.70514226",
"0.691041",
"0.6892328",
"0.6847316",
"0.6694351",
"0.66658026",
"0.6661469",
"0.6598603",
"0.65809244",
"0.65768236",
"0.6571983",
"0.6558189",
"0.65302294",
"0.6505491",
"0.6487933",
"0.6457244",
"0.6441075",
"0.64410084",
"0.6408059... | 0.0 | -1 |
Reverse the IP address for the inaddr.arpa zone | def reverse_ip(ipaddress)
reverse_ip = IPAddr.new ipaddress
reverse_ip.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverses\n if @family == Socket::AF_INET\n if self.length == 32\n [ self.reverse ]\n else\n boundary = self.length % 8 == 0 && self.length != 0 ? self.length / 8 - 1 : self.length / 8\n divisor = (boundary + 1) * 8\n count = (self.last.to_i - self.first.to_i) / (1 << 32... | [
"0.68461573",
"0.6763319",
"0.6297015",
"0.6206993",
"0.61474293",
"0.6120734",
"0.60907465",
"0.6047302",
"0.6026123",
"0.5990444",
"0.58971715",
"0.5872474",
"0.58502626",
"0.58052695",
"0.5774855",
"0.57199717",
"0.5684227",
"0.5684227",
"0.56642294",
"0.5632766",
"0.56078... | 0.8084351 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_goal
@goal = Goal.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 goal_params
params.require(:goal).permit(:futsal_game_id, :team_id, :goal_id, :own_goal, :assist_id, :goalkeeper_id, :time, :video_link, :picture)
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 /police_units GET /police_units.json | def index
@police_units = PoliceUnit.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foods_units\n get('/foods/units.json')\n end",
"def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @uni... | [
"0.77088684",
"0.6707797",
"0.66707706",
"0.65505856",
"0.6391909",
"0.6391407",
"0.6386095",
"0.63806885",
"0.63610554",
"0.62738866",
"0.62525475",
"0.6187228",
"0.6159946",
"0.6151872",
"0.6151586",
"0.61315656",
"0.61315656",
"0.61315656",
"0.61315656",
"0.61315656",
"0.6... | 0.7100343 | 1 |
GET /police_units/1 GET /police_units/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foods_units\n get('/foods/units.json')\n end",
"def index\n @police_units = PoliceUnit.all\n end",
"def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%... | [
"0.7347725",
"0.6999178",
"0.665674",
"0.6631179",
"0.64239013",
"0.6416045",
"0.63548094",
"0.6345466",
"0.6345466",
"0.6345466",
"0.63292897",
"0.6275956",
"0.626924",
"0.61934394",
"0.61554784",
"0.60439914",
"0.6037014",
"0.6022603",
"0.5972396",
"0.59405184",
"0.59405184... | 0.0 | -1 |
POST /police_units POST /police_units.json | def create
@police_unit = PoliceUnit.new(police_unit_params)
respond_to do |format|
if @police_unit.save
format.html { redirect_to @police_unit, notice: 'Police unit was successfully created.' }
format.json { render :show, status: :created, location: @police_unit }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def police_unit_params\n params.require(:police_unit).permit(:name)\n end",
"def unit_params\n params.require(:unit).permit(:user_id, :building_id, :floor_number, :side, :unit_number, :area, :resident_count)\n end",
"def unit_params\n params.require(:unit).permit(:short_label, :long_label,... | [
"0.68024886",
"0.6286745",
"0.61887956",
"0.61375326",
"0.6131262",
"0.6131262",
"0.6064084",
"0.6011934",
"0.599415",
"0.5967944",
"0.5943915",
"0.59236676",
"0.5913525",
"0.59119546",
"0.59108055",
"0.5897829",
"0.5892359",
"0.5868904",
"0.5855435",
"0.5854826",
"0.5852203"... | 0.70055985 | 0 |
PATCH/PUT /police_units/1 PATCH/PUT /police_units/1.json | def update
respond_to do |format|
if @police_unit.update(police_unit_params)
format.html { redirect_to @police_unit, notice: 'Police unit was successfully updated.' }
format.json { render :show, status: :ok, location: @police_unit }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query... | [
"0.725439",
"0.66535574",
"0.64343554",
"0.64299977",
"0.63783497",
"0.6377676",
"0.6337713",
"0.63096845",
"0.62711847",
"0.62492824",
"0.61797994",
"0.6176337",
"0.6156407",
"0.6142014",
"0.61223763",
"0.6110088",
"0.61057603",
"0.60966545",
"0.6091156",
"0.60808694",
"0.60... | 0.7327537 | 0 |
DELETE /police_units/1 DELETE /police_units/1.json | def destroy
@police_unit.destroy
respond_to do |format|
format.html { redirect_to police_units_url, notice: 'Police unit was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end",
"def destroy\n @base_unit.destroy\n respond_to do ... | [
"0.7377552",
"0.7196428",
"0.7112594",
"0.70558965",
"0.70533097",
"0.70533097",
"0.70533097",
"0.70533097",
"0.7045154",
"0.704073",
"0.70177144",
"0.6928192",
"0.69131756",
"0.6911436",
"0.6890533",
"0.68621445",
"0.6824292",
"0.68233156",
"0.6813879",
"0.6808456",
"0.68017... | 0.74588656 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_police_unit
@police_unit = PoliceUnit.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 police_unit_params
params.require(:police_unit).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Must refactor this to make the test for just first or last name pass. | def full_name
"#{first_name} #{last_name}" if first_name || last_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_name\n super || (name and name.split.first)\n end",
"def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end",
"def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n ... | [
"0.74373317",
"0.7412166",
"0.73751235",
"0.7364687",
"0.7344664",
"0.7300716",
"0.7276813",
"0.72759324",
"0.726786",
"0.72499263",
"0.7236219",
"0.7231581",
"0.72306216",
"0.7229518",
"0.71942973",
"0.7190315",
"0.7189695",
"0.71855974",
"0.7151715",
"0.7151385",
"0.7126773... | 0.72286993 | 14 |
GET /students/1 GET /students/1.json | def show
@report=Student.where(:student_id=>params[:id])
if @report.blank?
flash[:warning]="Student with id #{params[:id]} not found"
redirect_to '/managers/options'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end",
"def show\n student = Student.find(params[:id])\n render json: student\nend",
"def show\n @student = User.find params[:id]\n respond_to do |format|\n format.html # index.html.erb\n format.jso... | [
"0.799139",
"0.7715401",
"0.7640336",
"0.7618208",
"0.7568598",
"0.7556323",
"0.7556323",
"0.7556323",
"0.7556323",
"0.7556323",
"0.7556323",
"0.7556323",
"0.7556323",
"0.74949914",
"0.74949914",
"0.74892485",
"0.7465394",
"0.7465394",
"0.7444688",
"0.74417126",
"0.7441199",
... | 0.0 | -1 |
GET /students/new GET /students/new.json | def new
@student = Student.new
@possible_classes = Gclass.all.map {|elem| elem.gclass}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n ... | [
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.8022949",
"0.79333663",
"0.79333663",
"0.7850608",
"0.7614127",
"0.7548974",
"0.75125027",
"0.74463147",
"0.7424611",
"0.7406299",
"0.7399139",... | 0.0 | -1 |
POST /students POST /students.json | def create
answer = Student.createNew(params[:student])
redirect_to teachers_path, notice: "Student wasn't created! Please bind at least one teacher to class #{gcl} before." unless answer
redirect_to "/gclasses/#{Gclass.where(:gclass=>params[:student][:gclass]).first.id}", notice: "Student was success... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student = current_user.students.create(student_params)\n\n respond_... | [
"0.7277736",
"0.7135355",
"0.71114737",
"0.71114737",
"0.70372117",
"0.70311",
"0.70311",
"0.70311",
"0.70311",
"0.70311",
"0.70311",
"0.70311",
"0.6981121",
"0.6974331",
"0.6952658",
"0.6951065",
"0.6949918",
"0.6949918",
"0.6949918",
"0.6949918",
"0.6949918",
"0.6949918",... | 0.0 | -1 |
PUT /students/1 PUT /students/1.json | def update
@student = Student.find(params[:id])
respond_to do |format|
if @student.update_attributes(params[:student])
format.html { redirect_to @student, notice: params[:student]}#'Debug: #{params[:student]} Student was successfully updated.' }
format.json { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def update\n begin\n student = Student.find(params[:id])\n student.update_attributes!(student_params)\n\n render json: ... | [
"0.7224749",
"0.6994907",
"0.6908403",
"0.69019437",
"0.68976754",
"0.688167",
"0.688167",
"0.6871342",
"0.6871342",
"0.6871342",
"0.6871342",
"0.6871342",
"0.68621904",
"0.68586385",
"0.679477",
"0.6747145",
"0.66869766",
"0.6664319",
"0.66471314",
"0.66471314",
"0.66471314"... | 0.65117097 | 45 |
DELETE /students/1 DELETE /students/1.json | def destroy
gclass = Gclass.findClassIdByStudent params[:id]
@stu = Student.destroy_student params[:id]
redirect_to "/gclasses/#{gclass}", notice: "Student destroyed."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to studen... | [
"0.78189677",
"0.7671591",
"0.7663451",
"0.76590925",
"0.7656559",
"0.7656559",
"0.7656559",
"0.7656559",
"0.7656559",
"0.7656559",
"0.7656559",
"0.7656559",
"0.76210016",
"0.76210016",
"0.76210016",
"0.76210016",
"0.7596511",
"0.7527479",
"0.7474381",
"0.74670345",
"0.746572... | 0.0 | -1 |
GET /team_years GET /team_years.json | def index
@team_years = TeamYear.all
#
## Get TeamYears grouped by year
#
@year_groups = {}
# get unique team_years
@yrs = @team_years.map{|ty| ty.year }.uniq!
# for each unique season
@yrs.each{|yr|
# create the array we'll feed the final hash
@year_bucket = []
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_years_participated ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/years_participated\"\n end",
"def index\n @team_years = TeamYear.all\n end",
"def years(make)\n make_id = get_object_id make\n response = get_url \"Years/#{make_id}\"\n response_obj = JSON... | [
"0.8241581",
"0.744053",
"0.71287674",
"0.70271456",
"0.7022471",
"0.68313533",
"0.66481465",
"0.6623735",
"0.66005033",
"0.65320617",
"0.65320617",
"0.6421576",
"0.6400581",
"0.6306302",
"0.62922055",
"0.62922055",
"0.6290931",
"0.62324244",
"0.62201345",
"0.6197621",
"0.618... | 0.66145504 | 8 |
index GET /team_years/1 GET /team_years/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @team_years = TeamYear.all\n end",
"def index\n @years = Year.all\n end",
"def index\n @years = Year.all\n end",
"def index\n @years = Year.order(:id)\n end",
"def index\n @team_years = TeamYear.all\n\n #\n ## Get TeamYears grouped by year\n #\n @year_groups = {}\... | [
"0.82920885",
"0.7637988",
"0.7637988",
"0.73149335",
"0.72832507",
"0.71298736",
"0.70979303",
"0.7072276",
"0.70589054",
"0.7044989",
"0.6923835",
"0.6923835",
"0.6917807",
"0.6908079",
"0.6908079",
"0.6898542",
"0.6888238",
"0.6886169",
"0.6875952",
"0.6838489",
"0.6836939... | 0.0 | -1 |
POST /team_years POST /team_years.json | def create
@team_year = TeamYear.new(team_year_params)
respond_to do |format|
if @team_year.save
format.html { redirect_to @team_year, notice: 'Team year was successfully created.' }
format.json { render :show, status: :created, location: @team_year }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @team_year = TeamYear.new(team_year_params)\n\n respond_to do |format|\n if @team_year.save\n format.html { redirect_to @team_year, notice: 'Team year was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team_year }\n else\n ... | [
"0.7126538",
"0.68674433",
"0.68016756",
"0.667947",
"0.65270364",
"0.65270364",
"0.6486491",
"0.6351944",
"0.62293893",
"0.6184752",
"0.6135743",
"0.6135743",
"0.6118629",
"0.61119145",
"0.60461664",
"0.6036638",
"0.60352916",
"0.59885275",
"0.59883964",
"0.5967399",
"0.5892... | 0.7204664 | 0 |
PATCH/PUT /team_years/1 PATCH/PUT /team_years/1.json | def update
respond_to do |format|
if @team_year.update(team_year_params)
format.html { redirect_to @team_year, notice: 'Team year was successfully updated.' }
format.json { render :show, status: :ok, location: @team_year }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @team_year.update(team_year_params)\n format.html { redirect_to @team_year, notice: 'Team year was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json... | [
"0.7258103",
"0.6863658",
"0.67249566",
"0.6508965",
"0.6507997",
"0.6507997",
"0.6499393",
"0.6488017",
"0.6484749",
"0.6467119",
"0.64489543",
"0.64489543",
"0.6444716",
"0.6444716",
"0.6444716",
"0.6444716",
"0.6444716",
"0.6444716",
"0.64426476",
"0.64426476",
"0.64086086... | 0.72314394 | 1 |
DELETE /team_years/1 DELETE /team_years/1.json | def destroy
@team_year.destroy
respond_to do |format|
format.html { redirect_to team_years_url, notice: 'Team year was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @team_year.destroy\n respond_to do |format|\n format.html { redirect_to team_years_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @built_year.destroy\n respond_to do |format|\n format.html { redirect_to built_years_url }\n format.json { hea... | [
"0.7851154",
"0.73274475",
"0.7215139",
"0.7191586",
"0.716026",
"0.7109318",
"0.7105632",
"0.7105632",
"0.7105632",
"0.7105632",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"0.7089488",
"... | 0.75810444 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_team_year
@team_year = TeamYear.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 team_year_params
params.require(:team_year).permit(:year, :team, :wins, :losses, :win_percentage, :offensive_rating, :defensive_rating, :season_outcome, :team_url, :team_home_url)
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 |
Initializes Configuration instance with nil values unless config file was created previously | def initialize
@config = config_from_file || empty_config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n create_config unless File.exists?(config_file)\n load_settings\n set_domain\n end",
"def create_config\n self.config = {} if !self.config\n end",
"def create_config\n self.config = {} if !self.config\n end",
"def _init_configuration\n\t\t# Set defaults\n\t\t@setup =... | [
"0.7210453",
"0.71546143",
"0.71546143",
"0.70793617",
"0.70626146",
"0.70488423",
"0.6986784",
"0.6969369",
"0.681132",
"0.6809749",
"0.67693996",
"0.67334914",
"0.67288727",
"0.6713797",
"0.6652697",
"0.66519606",
"0.6637692",
"0.6631253",
"0.66237146",
"0.6612343",
"0.6612... | 0.80591923 | 0 |
Resets configuration instance to initial values | def reset
@config = empty_config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n Configuration.new\n end",
"def reset\n self.configuration = Configuration.new\n end",
"def reset_config\n config.reset_to_defaults\n end",
"def reset\n @config = Config.new\n end",
"def reset\n @configuration = Configuration.new\n end",
"def reset\n... | [
"0.8442297",
"0.83911383",
"0.8345757",
"0.82853997",
"0.82737195",
"0.82721204",
"0.825779",
"0.8239228",
"0.82293814",
"0.8137434",
"0.8110226",
"0.8109662",
"0.8011063",
"0.7871168",
"0.77363336",
"0.7604266",
"0.75576735",
"0.75576735",
"0.7519718",
"0.75136846",
"0.74923... | 0.85413563 | 0 |
Sets absolute path of cloud path | def cloud_path=(path)
raise Error::InvalidCloudPath unless File.directory?(path)
@config[:cloud_path] = File.expand_path(path)
config_to_file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_set(path)\n absolute_path = (Pathname.new(uri.path) + path).to_s\n rebuild_uri :path => absolute_path\n end",
"def set_path(path)\n path\n end",
"def path=(new_path)\n super\n if new_path[0..0] != '/' # addressable adds a / but scp-style uris are altered by this behavior\n ... | [
"0.65640116",
"0.6447197",
"0.63692504",
"0.6271299",
"0.6270105",
"0.62292993",
"0.6225625",
"0.61635387",
"0.6145113",
"0.61386853",
"0.61344",
"0.6098893",
"0.6085709",
"0.6024676",
"0.60211545",
"0.6008003",
"0.59889364",
"0.59889364",
"0.59889364",
"0.59530973",
"0.59280... | 0.75120026 | 0 |
GET /oauth_tokens GET /oauth_tokens.xml | def index
@oauth_tokens = OauthToken.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @oauth_tokens }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokens\n\t\tresource = \"/oauth/access_token\"\n\t\t\n\t\tbegin\n\t\t\tresponse = @connection.post resource do |request|\n\t\t\t\trequest.params['client_id'] = @api_key\n\t\t\t\trequest.params['client_secret'] = @secret_key\n\t\t\t\trequest.params['grant_type'] = @grant_type\n\t\t\t\trequest.params[... | [
"0.7360809",
"0.73178715",
"0.69142103",
"0.6913528",
"0.6738037",
"0.6737193",
"0.67218316",
"0.65898293",
"0.65898293",
"0.6588971",
"0.6574",
"0.6526953",
"0.64884716",
"0.6401391",
"0.638914",
"0.63251615",
"0.63213825",
"0.6287768",
"0.62388456",
"0.62256736",
"0.6213137... | 0.71752983 | 2 |
GET /oauth_tokens/1 GET /oauth_tokens/1.xml | def show
if params[:id] == 'foursquare_categories'
foursquare_categories
render :action => :foursquare_categories
return
end
@oauth_token = OauthToken.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @oauth_token }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokens\n\t\tresource = \"/oauth/access_token\"\n\t\t\n\t\tbegin\n\t\t\tresponse = @connection.post resource do |request|\n\t\t\t\trequest.params['client_id'] = @api_key\n\t\t\t\trequest.params['client_secret'] = @secret_key\n\t\t\t\trequest.params['grant_type'] = @grant_type\n\t\t\t\trequest.params[... | [
"0.69459975",
"0.6941522",
"0.6887504",
"0.68795717",
"0.6638988",
"0.66004336",
"0.6593189",
"0.6554155",
"0.6470296",
"0.6461716",
"0.6358654",
"0.6358113",
"0.6357234",
"0.6357234",
"0.63467234",
"0.630794",
"0.62951463",
"0.6260778",
"0.62469316",
"0.6231196",
"0.6226835"... | 0.0 | -1 |
GET /oauth_tokens/new GET /oauth_tokens/new.xml | def new
@oauth_token = OauthToken.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @oauth_token }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @access_token = AccessToken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @access_token }\n end\n end",
"def new\n @api_token = ApiToken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :x... | [
"0.67472833",
"0.64514196",
"0.63993466",
"0.63331604",
"0.62461716",
"0.618578",
"0.61620504",
"0.613908",
"0.61387736",
"0.6074876",
"0.6041273",
"0.6035804",
"0.5994502",
"0.5948608",
"0.5906072",
"0.58988297",
"0.5896042",
"0.589371",
"0.58553654",
"0.58504736",
"0.584907... | 0.76072115 | 0 |
POST /oauth_tokens POST /oauth_tokens.xml | def create
@oauth_token = OauthToken.new(params[:oauth_token])
respond_to do |format|
if @oauth_token.save
format.html { redirect_to([:scaffold, @oauth_token], :notice => 'Oauth token was successfully created.') }
format.xml { render :xml => @oauth_token, :status => :created, :location =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange_oauth_tokens\n end",
"def get_tokens\n resource = \"/oauth/access_token\"\n\n begin\n response = @connection.post resource do |request|\n request.params['client_id'] = @api_key\n request.params['client_secret'] = @secret_key\n request.params['grant_type'] ... | [
"0.6542739",
"0.6441123",
"0.63619876",
"0.6182132",
"0.6182132",
"0.6179219",
"0.6123826",
"0.611147",
"0.6108818",
"0.5926301",
"0.5889381",
"0.5874254",
"0.5844551",
"0.5844551",
"0.581556",
"0.5786762",
"0.5779585",
"0.57456774",
"0.57453525",
"0.5706898",
"0.56471556",
... | 0.6152711 | 6 |
PUT /oauth_tokens/1 PUT /oauth_tokens/1.xml | def update
@oauth_token = OauthToken.find(params[:id])
respond_to do |format|
if @oauth_token.update_attributes(params[:oauth_token])
format.html { redirect_to([:scaffold, @oauth_token], :notice => 'Oauth token was successfully updated.') }
format.xml { head :ok }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange_oauth_tokens\n end",
"def update_tokens(oauth_params)\n# binding.pry\n self.oauth_token = oauth_params.credentials.token\n # facebook, google provide this; twitter, linkedin don't\n self.oauth_expires_at = Time.at(oauth_params.credentials.expires_at) if oauth_params.credentials.ex... | [
"0.65999633",
"0.6258865",
"0.6148939",
"0.59960383",
"0.5980706",
"0.58664656",
"0.57274854",
"0.57202005",
"0.56818384",
"0.5681778",
"0.5681412",
"0.56549394",
"0.5645008",
"0.56274855",
"0.55983543",
"0.55884033",
"0.55884033",
"0.5565079",
"0.5562939",
"0.5548942",
"0.55... | 0.64856654 | 1 |
DELETE /oauth_tokens/1 DELETE /oauth_tokens/1.xml | def destroy
@oauth_token = OauthToken.find(params[:id])
@oauth_token.destroy
respond_to do |format|
format.html { redirect_to(scaffold_oauth_tokens_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @access_token = AccessToken.find(params[:id])\n @access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(access_tokens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @oauth_remote_access_token = OauthRemoteAccessToken.find(params[:id])\n... | [
"0.71823555",
"0.70962703",
"0.6857149",
"0.68087286",
"0.66814786",
"0.6642044",
"0.65404487",
"0.6453824",
"0.6433901",
"0.6418886",
"0.6412061",
"0.64109045",
"0.6392825",
"0.63533264",
"0.62944674",
"0.6272732",
"0.6258594",
"0.62504417",
"0.6247066",
"0.6230055",
"0.6218... | 0.74273103 | 0 |
pennies caculation is off in either direction in the 15th or 16th decimal place. I thought there were supposed to be no decimal places with %. round fixed the problem, but shouldn't be necessary | def tell_change(change)
puts "You will need to give the customer"
if change[:dollars] !=0
puts "#{change[:dollars]} dollars"
else
puts ""
end
if change[:quarters] != 0
puts "#{change[:quarters]} quarters"
else
puts ""
end
if change[:dimes] != 0
puts "#{chang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round_to_nearest_cash_value; end",
"def kw_per_ton_to_cop(kw_per_ton)\n \n return 3.517/kw_per_ton\n \nend",
"def round_off_percentage_px_increase\n (@percentage_px_increase*100).round\n end",
"def cop_to_kw_per_ton(cop)\n \n return 3.517/cop\n \nend",
"def round() end",
"def irgrasassaturada... | [
"0.6706973",
"0.65944606",
"0.6501503",
"0.6462197",
"0.64513975",
"0.64154905",
"0.6414341",
"0.64071375",
"0.6406625",
"0.6393201",
"0.63717073",
"0.63387334",
"0.6331217",
"0.6319613",
"0.63056934",
"0.6304878",
"0.63010496",
"0.629392",
"0.62868536",
"0.6282284",
"0.62660... | 0.0 | -1 |
Gets the data of a widget GET widget_data | def widget_data
widget = Widget.find(params[:widget_id])
data = widget.get_filtered_dataset false, 10000
render json: {id: widget.id,
visualization: widget.visualization,
name: widget.name,
description: widget.description,
data: data['d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widget_data\n widget = WidgetService.widget(params[:widget_id])\n render json: {\n id: widget.id,\n dataset: widget.dataset,\n visualization: widget.widget_config,\n name: widget.name,\n description: widget.description,\n metadata: widget.metadata\n }\n end",
"def widg... | [
"0.76490235",
"0.75053275",
"0.698634",
"0.62444645",
"0.6195724",
"0.6006288",
"0.59895575",
"0.5933267",
"0.58755213",
"0.57870096",
"0.562851",
"0.562851",
"0.562851",
"0.56216526",
"0.5617045",
"0.56114966",
"0.56114966",
"0.56114966",
"0.5600424",
"0.5600424",
"0.5567163... | 0.75109273 | 1 |
Get hash of all active root level campuses/ORUs, sorted by ordering in unit_hier table | def getActiveCampuses
return Unit.join(:unit_hier, :unit_id=>:id).
filter(:ancestor_unit=>'root', :is_direct=>1).exclude(:status=>["hidden", "archived"]).
order_by(:ordering).to_hash(:id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_hash\n end",
"def roothash\n root_node._hash || recalculate_hash_at(root_node)\n end",
"def lands_hash\n []\n end",
"def index\n @first_level_units = FirstLevelUnit.active.order(:organization_id)\n end",
"def x_get_tree_roots\n u = User.current_user\n user_groups = u.repor... | [
"0.59638363",
"0.5772861",
"0.57499564",
"0.5585494",
"0.5489596",
"0.54625857",
"0.54336286",
"0.5419081",
"0.5408177",
"0.54011816",
"0.53897583",
"0.537059",
"0.533043",
"0.5322176",
"0.53209484",
"0.5305482",
"0.52887946",
"0.52430654",
"0.5200968",
"0.5196734",
"0.518938... | 0.718914 | 1 |
Parses and formats data availability statement. Returns [text, (link)] | def getDataAvail(itemAttrs)
ds = itemAttrs["data_avail_stmnt"] or return nil
case ds["type"]
when "publicRepo"
return "The data associated with this publication are available at: ", ds["url"]
when "publicRepoLater"
return "Associated data will be made available after this publication is publishe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def availability_link()\n $tracer.trace(format_method(__method__))\n\n tag = ToolTag.new(@tag.a.className(create_ats_regex_string('ats-avail_link')), format_method(__method__))\n if !tag.exists\n tag = ToolTag.new(@tag.span.className(create_ats_regex_string('ats-avail_link')), format_method(__method_... | [
"0.5885033",
"0.5722336",
"0.57221526",
"0.57125634",
"0.5372328",
"0.5294211",
"0.52822787",
"0.51872814",
"0.5184706",
"0.5175481",
"0.5075883",
"0.50668",
"0.50181067",
"0.49541885",
"0.4951227",
"0.49414322",
"0.4936676",
"0.49350795",
"0.4915281",
"0.48589793",
"0.483273... | 0.5191186 | 8 |
Move pending PDF files to their published location | def movePendingFiles(itemID)
noSplashKey = calcNoSplashKey(itemID)
pvwPfx = getEnv("S3_PREVIEW_PREFIX")
pvwLin = $s3Bucket.object("#{pvwPfx}/#{itemID}/#{itemID}_noSplash_#{noSplashKey}.pdf")
pvwSplash = $s3Bucket.object("#{pvwPfx}/#{itemID}/#{itemID}.pdf")
# If there's no preview file to move, we have nothi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_pdf\n page_paths = (1..document.page_count).map {|i| \"#{document.slug}_#{i}.pdf\" }\n #`pdftk #{page_paths.join(' ')} cat output #{@pdf}`\n `pdftailor stitch --output #{@pdf} #{page_paths.join(' ')} 2>&1`\n\n if File.exists? @pdf\n asset_store.save_pdf(document, @pdf, access)\n F... | [
"0.6199648",
"0.6034519",
"0.5940353",
"0.5876566",
"0.58104545",
"0.57956475",
"0.5758618",
"0.57388127",
"0.56893677",
"0.5676972",
"0.56698865",
"0.5658122",
"0.562783",
"0.56124794",
"0.5606567",
"0.5584885",
"0.55458784",
"0.55362004",
"0.55171365",
"0.5503927",
"0.54940... | 0.6521535 | 0 |
Delete files for withdrawn item | def deleteContentFiles(itemID)
noSplashKey = calcNoSplashKey(itemID)
# Remove the preview files if present
pvwPfx = getEnv("S3_PREVIEW_PREFIX")
pvwLin = $s3Bucket.object("#{pvwPfx}/#{itemID}/#{itemID}_noSplash_#{noSplashKey}.pdf")
pvwLin.exists? and pvwLin.delete
pvwSplash = $s3Bucket.object("#{pvwPfx}/#{i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_files\n self.bruse_files.each do |file|\n file.destroy\n end\n end",
"def delete_file\n unless $list_Item.curselection.empty?\n idx = $list_Item.curselection\n idx = idx[0]\n $bucket_item = $bucket_items[idx]\n ok_delete = Tk.messageBox('type' => 'okcancel',... | [
"0.6786215",
"0.66417307",
"0.6447713",
"0.64057434",
"0.632493",
"0.632493",
"0.6320871",
"0.6271678",
"0.62684005",
"0.6254861",
"0.6254861",
"0.6230634",
"0.621647",
"0.6210378",
"0.6100743",
"0.6067716",
"0.60552436",
"0.60392725",
"0.60035914",
"0.59971553",
"0.59946644"... | 0.6251912 | 11 |
Main driver for PDF display version generation | def convertPDF(itemID)
item = Item[itemID]
isPending = Item[itemID].status == "pending"
contentPfx = getEnv(isPending ? "S3_PREVIEW_PREFIX" : "S3_CONTENT_PREFIX")
# Skip non-published items (e.g. embargoed, withdrawn)
if !item || !%w{published pending}.include?(item.status)
puts " Not generating splash ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @staticdcs = Staticdc.all\n @sdc_dir = \"/usr/local/projects/pdf_test/\"\n @public_pdf_address = display_pdfs(\"public\")\n # @uva_pdf_address = display_pdfs(uva)\n\n end",
"def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_temp... | [
"0.6356347",
"0.62784755",
"0.6270002",
"0.6260341",
"0.6241639",
"0.6205919",
"0.6183901",
"0.6047671",
"0.60359865",
"0.5997929",
"0.5948304",
"0.59422046",
"0.59321773",
"0.58846617",
"0.58519673",
"0.58256805",
"0.5791354",
"0.57863605",
"0.5763888",
"0.5758017",
"0.57330... | 0.0 | -1 |
Uses the same Logger instance as ActiveRecord. | def logger
::ActiveRecord::Base.logger
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n ActiveRecord::Base.logger = Logger.new(STDOUT)\n end",
"def setup_database_logger\n ActiveRecord::Base.logger = PuppetHerald.logger\n nil\n end",
"def log_to(stream, colorize=true)\n ActiveRecord::Base.logger = Logger.new(stream)\n ActiveRecord::Base.clear_active... | [
"0.75238466",
"0.69362867",
"0.6859795",
"0.684676",
"0.67984843",
"0.6709869",
"0.6704235",
"0.64878684",
"0.64028716",
"0.64028716",
"0.6385451",
"0.6347033",
"0.6296572",
"0.6265681",
"0.6176897",
"0.61532813",
"0.6151292",
"0.6148919",
"0.61380625",
"0.6129229",
"0.611047... | 0.7409393 | 1 |
Generate scope at top level e.g. User.on_standby | def on_standby(name = :null_state)
# Why where(nil)?
# http://stackoverflow.com/questions/18198963/with-rails-4-model-scoped-is-deprecated-but-model-all-cant-replace-it
name = :userdb if user_db?
context = where(nil)
context.standby_target = name || :null_state
context.op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_level; end",
"def scope_name; end",
"def scopes; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope\n @scope ||= Array(@root_sco... | [
"0.68267345",
"0.6562429",
"0.6387693",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.63002384",
"0.6229262",
"0.6078659",
"0.6078659",
"0.60506463",
"0.59416234",
"0.59416234",
"0.5915341",
"0... | 0.584348 | 22 |
Generate scope at top level e.g. User.on_optional_standby | def on_optional_standby(name = :null_state)
# Why where(nil)?
# http://stackoverflow.com/questions/18198963/with-rails-4-model-scoped-is-deprecated-but-model-all-cant-replace-it
context = where(nil)
name = :userdb if user_db?
context.standby_target = name || :null_state
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_level; end",
"def scope_name; end",
"def scope_options; end",
"def scope_options; end",
"def scope\n @scope ||= Array(@root_scope) + [Inflector.underscore(name)]\n end",
"def prov_scope(opts)\n scope = []\n # Request date (created since X days ago)\n scope << [:created_recently... | [
"0.69047415",
"0.6576953",
"0.627777",
"0.627777",
"0.6260164",
"0.6244723",
"0.6184267",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61768425",
"0.61379915",
"0.6134263",
"0.60131955",
"0.59... | 0.535244 | 78 |
Getter (reader) for persons name | def name
@name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_reader\n @name\n end",
"def name\n person_name\n end",
"def name # getter method (or reader method)\n @name\n end",
"def retrieve_name\n return @name\n end",
"def get_name\n @name\n end",
"def get_name\n @name\n end",
"def get_name\n @name\n end",
"def get_name\n ... | [
"0.7642878",
"0.7585027",
"0.736689",
"0.7025312",
"0.69717634",
"0.69717634",
"0.69717634",
"0.69717634",
"0.69607306",
"0.69304323",
"0.691972",
"0.6883458",
"0.6841571",
"0.6814168",
"0.6791215",
"0.6791215",
"0.6763607",
"0.6752909",
"0.6725936",
"0.6725936",
"0.6702952",... | 0.64907753 | 77 |
Setter (writer) for the job of the person | def job= (work)
@job = work
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job=(person_job)\n @job = person_job\n end",
"def job=(job)\n @job = job\n end",
"def job=(job)\n @job = job\n end",
"def job=(job_name)\n @job = job_name\n end",
"def job=(job_title)\n @job = job_title\n end",
"def write_subject\n self.subject ||= s... | [
"0.75722456",
"0.6977642",
"0.6971576",
"0.6968285",
"0.6562866",
"0.6288532",
"0.61274505",
"0.58658063",
"0.580209",
"0.57968163",
"0.5796787",
"0.57782245",
"0.57782245",
"0.57683635",
"0.5756003",
"0.57535094",
"0.57321936",
"0.57262135",
"0.5723125",
"0.5715939",
"0.5715... | 0.67599744 | 4 |
Getter (reader) for the job of the person | def job
@job
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job # this is a getter\n @job\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def job \n @job\n end",
"def job=(person_job)\n @job = person_job\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def job_resource(job... | [
"0.7379256",
"0.68132335",
"0.68132335",
"0.6462181",
"0.6274558",
"0.62360686",
"0.62170976",
"0.60695523",
"0.60430247",
"0.6016825",
"0.59843475",
"0.594709",
"0.59391296",
"0.59321153",
"0.5923242",
"0.5911251",
"0.5880522",
"0.58699405",
"0.585709",
"0.5849762",
"0.58214... | 0.68591297 | 1 |
A strict Java 8 requirement (1.8) should prompt the user to install an OpenJDK 1.8 distribution. Versions newer than Java 8 are not completely backwards compatible, and contain breaking changes such as strong encapsulation of JDKinternal APIs and a modified version scheme (.0 not 1.). | def suggestion
if fits_latest?
JAVA_SUGGESTION_MAP.fetch(JAVA_SUGGESTION_MAP.keys.max)
else
JAVA_SUGGESTION_MAP.fetch("1.8")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def java_8_or_later?\n @version >= VERSION8\n end",
"def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end",
"def required_ruby_version=(req)\n @required_ruby_version = Gem::Requirement.create req\n end",
"def platform_require\n fail NotImplem... | [
"0.6014146",
"0.58819664",
"0.573308",
"0.5730352",
"0.57230943",
"0.5674882",
"0.56210905",
"0.5617931",
"0.55993146",
"0.5578023",
"0.55430055",
"0.55418116",
"0.5535801",
"0.55250776",
"0.5522423",
"0.5507627",
"0.5492896",
"0.546494",
"0.54272753",
"0.540666",
"0.5398961"... | 0.0 | -1 |
before_action to prevent undefined routes from throwing errors | def index
if (params[:subcategory_id])
render json: Item.where(subcategory_id: params[:subcategory_id]).as_json(:include => :photos)
elsif (params[:category_id])
render json: Item.find_by_category_id(params[:category_id]).as_json(:include => :photos)
else
render json: Item.search(params).a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undefined_route\n routing_error!\n end",
"def routing_error\n render_not_found\n end",
"def no_routes\n end",
"def handle_route_not_found\n raise ActionController::RoutingError.new(params[:path])\n end",
"def before_anyway\n set_path\n set_current\n # allows us to extend t... | [
"0.73105997",
"0.687186",
"0.6716984",
"0.6653653",
"0.6593902",
"0.64705294",
"0.6462371",
"0.64621884",
"0.64583254",
"0.6444509",
"0.64311355",
"0.64149696",
"0.64149696",
"0.64149696",
"0.64149696",
"0.64149696",
"0.64149696",
"0.6354106",
"0.63457304",
"0.6261043",
"0.62... | 0.0 | -1 |
Adds a pattern to the grammar. | def add_pattern(pattern)
@patterns << pattern
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_pattern( pattern )\n type_check( pattern, Elements::Pattern )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @patterns[pattern.name] = pattern\n end",
"def <<(pattern)\n @patterns << pattern\n end",
"def add pattern\n\t\t\tno... | [
"0.7800182",
"0.7321851",
"0.71719074",
"0.69735104",
"0.6959845",
"0.6906946",
"0.6666397",
"0.6614245",
"0.64810014",
"0.63464284",
"0.622856",
"0.6212766",
"0.62013966",
"0.6123034",
"0.6087397",
"0.60434186",
"0.6042121",
"0.60168535",
"0.60168535",
"0.60168535",
"0.60168... | 0.8067763 | 0 |
tests to make sure the facebook callback gets routes to the create method in sessions | def test_routes
assert_routing '/auth/:provider/callback', { :controller => 'sessions', :action => 'create', :provider => ':provider' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_facebook_connect\n set_facebook_session()\n if facebook_session && facebook_session.user.id\n @user = User.find_or_create_by_facebook_id(facebook_session.user.id)\n else\n redirect_to :controller=>:account, :action=>:login, :next_url=>request.request_uri\n end\n end",
"def creat... | [
"0.67118686",
"0.6650865",
"0.65736324",
"0.6565333",
"0.65608835",
"0.6557786",
"0.6541051",
"0.65158635",
"0.6480104",
"0.63783103",
"0.6358162",
"0.63418084",
"0.63207096",
"0.6272569",
"0.62436783",
"0.62429714",
"0.62318665",
"0.62291586",
"0.6212518",
"0.61860704",
"0.6... | 0.6253739 | 14 |
Common actions to delete graphics at their cached uri location Delete an image | def delete(preset, format)
only_provides(*graphics_mime_types)
raise NotFound unless content_type && preset_exists?(preset)
if full_request_path.index(preset_request_path) == 0 && File.exists?(full_request_path)
success = FileUtils.rm(full_request_path) rescue nil
cleanup_empty_dirs!(p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end",
"def delete(session, id)\n write_task('rvpe.image.delete', session) do\n err_msg = \"You don't have permission to delete the image.\"\n sanity_check(session, id, err_msg) do\n call_o... | [
"0.70272464",
"0.6893424",
"0.67356974",
"0.67155087",
"0.66464293",
"0.65887046",
"0.6575255",
"0.6556879",
"0.65383995",
"0.6536389",
"0.6523167",
"0.6509614",
"0.65048635",
"0.6493033",
"0.6482597",
"0.64684194",
"0.6458578",
"0.6441083",
"0.6427903",
"0.63980234",
"0.6395... | 0.0 | -1 |
Delete all images for a preset | def delete_preset_items(preset)
only_provides(*graphics_mime_types)
raise NotFound unless preset_exists?(preset)
files = Dir.glob(preset_request_path / "**" / "*.{#{graphics_mime_types.join(',')}}")
success = files.all? { |file| FileUtils.rm(file) rescue nil }
cleanup_empty_dirs!(preset_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_image_files\n [ :original , :medium , :thumb ].each do |size|\n path = image_path(size, true)\n File.delete(path) if path\n end\n end",
"def remove_all_images\n self.cover_image.purge if self.cover_image.attached?\n self.images.each {|image| image.purge} if self.... | [
"0.7357561",
"0.723533",
"0.72171783",
"0.7209806",
"0.7114806",
"0.7089455",
"0.6977054",
"0.6963914",
"0.69578016",
"0.68049896",
"0.6802123",
"0.6690086",
"0.6690086",
"0.6666248",
"0.6600262",
"0.6584008",
"0.65323263",
"0.65041995",
"0.6495861",
"0.649185",
"0.647351",
... | 0.7409171 | 0 |
Stub method to implement in your application | def authenticate
Merb.logger.info!("No authentication has been setup for GraphicsSlice")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stub_implementation; end",
"def stubs; end",
"def stubbed?\n raise NotImplementedError\n end",
"def implementation; end",
"def implementation; end",
"def initialize stub_method\n @stub_method = stub_method\n end",
"def stubs=(_arg0); end",
"def macro; raise NotImplementedError; end",
... | [
"0.823849",
"0.7136965",
"0.6987884",
"0.6866697",
"0.6866697",
"0.6817563",
"0.6753811",
"0.66756946",
"0.66756946",
"0.66756946",
"0.6632635",
"0.6632635",
"0.6590306",
"0.65612626",
"0.6508226",
"0.64300346",
"0.64279985",
"0.6407063",
"0.6400375",
"0.6390919",
"0.6334291"... | 0.0 | -1 |
Render a preset pass :doc_id to enable referencing in SofaCache | def show(preset, source_path, format)
only_provides(*graphics_mime_types)
raise NotFound unless source_path && preset_exists?(preset)
img = ImMagick::Image.file(source_path)
render_preset(preset, img)
if image_path = save_file(img)
store_cache_reference!(params[:doc_id], GraphicsSl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_document; end",
"def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end",
"def preview\r\n\t\t\trender(... | [
"0.5854299",
"0.5738233",
"0.55672073",
"0.55521834",
"0.5502645",
"0.5494652",
"0.54903424",
"0.5471691",
"0.5463941",
"0.5455128",
"0.54450744",
"0.5430332",
"0.54270226",
"0.5425831",
"0.5425831",
"0.5391101",
"0.5360389",
"0.53223485",
"0.52882814",
"0.52721",
"0.52658117... | 0.5724434 | 2 |
Return a JSON object with image information add &metadata=true for image metadata add &presets=true for preset url for this image add &relative=true for relative urls instead of absolute | def info(preset, source_path, format)
url_opts = { :storage => params[:storage], :preset => preset, :format => format }
relative_uri = url_for_image(params[:relative_path], url_opts)
absolute_path = Merb.dir_for(:public) / relative_uri
base_url = params[:relative] ? '' : (request.protocol ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_image_metadata\n {}\n end",
"def info(preset, source_uri, format)\n url_opts = { :storage => params[:storage], :preset => preset, :format => format }\n relative_uri = url_for_external_image(params[:relative_path], url_opts)\n absolute_path = Merb.dir_for(:public) / relative... | [
"0.7031549",
"0.6963861",
"0.690066",
"0.68072295",
"0.6803236",
"0.650662",
"0.650662",
"0.64883614",
"0.6450161",
"0.6448246",
"0.638009",
"0.6376391",
"0.6346044",
"0.63023746",
"0.6302329",
"0.6246139",
"0.62407583",
"0.6240012",
"0.6201065",
"0.61896676",
"0.6154038",
... | 0.7020652 | 1 |
Return the internal url for the given image location. | def image_location
url_opts = { :storage => params[:storage] || 'default', :preset => params[:preset] || 'default', :format => params[:format] || 'jpg' }
raise BadRequest if request.raw_post.blank?
base_url = params[:relative] ? '' : (request.protocol + "://" + request.host)
image_uri = base_ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_url(source)\n abs_path = image_path(source)\n unless abs_path =~ /^http/\n abs_path = \"#{request.protocol}#{request.host_with_port}#{abs_path}\"\n end\n abs_path\n end",
"def image_url\n return \"\" if @path.nil? || @path.empty?\n \"#{images_scheme}://#{... | [
"0.7859339",
"0.76939267",
"0.7672241",
"0.7546523",
"0.7546523",
"0.74603087",
"0.7318159",
"0.7304334",
"0.7295035",
"0.72645384",
"0.7262479",
"0.72599655",
"0.72440857",
"0.7239856",
"0.7204256",
"0.7164402",
"0.7145168",
"0.7133312",
"0.71148044",
"0.7112707",
"0.7105587... | 0.7138603 | 17 |
A preset method needs to have a _preset postfix in its name and recieves a ImMagick::Image instance to work with. | def default_preset(img)
img.crop_resized(128, 128, params[:gravity]).quality(75)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagemagick?; end",
"def imagemagick7?; end",
"def test_mosaic\n Pikl::Image.open(SAMPLE_IMAGE) do |img|\n img.mosaic(3,3)\n end\n end",
"def show(preset, character_data, format)\n only_provides(*graphics_mime_types)\n raise NotFound unless content_type && preset_exists?(pre... | [
"0.6250311",
"0.5998414",
"0.58087075",
"0.5551515",
"0.5542982",
"0.5494588",
"0.54826796",
"0.5481536",
"0.54781044",
"0.547226",
"0.5440048",
"0.5402712",
"0.53583354",
"0.5357549",
"0.53539926",
"0.5351549",
"0.5337047",
"0.5309052",
"0.5308399",
"0.51889366",
"0.518272",... | 0.57679087 | 3 |
The absolute path derived from the request where files will be stored | def base_request_path
Merb.dir_for(:public) / slice_url(:images_delete_all)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_path\n @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))\n end",
"def root_file_path; end",
"def path\n file.url\n end",
"def original_fullpath; end",
"def file_path\n dir\n end",
"def path\n \"/#{UPLOAD_DIR}/#{filena... | [
"0.7482371",
"0.7432581",
"0.7416603",
"0.73115605",
"0.73073536",
"0.72727",
"0.7268213",
"0.7244649",
"0.72251505",
"0.7214889",
"0.7193956",
"0.7193439",
"0.7189038",
"0.71808606",
"0.7142374",
"0.71413803",
"0.71373826",
"0.71269643",
"0.71257263",
"0.709214",
"0.70904994... | 0.683855 | 54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.