query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
This method will retain the boot devices that are passed in the options and disable all the other available boot devices on the node. | def set_bootable_devices(boot_source_type, options)
bootable_devices = options[:bootable_devices]
logger.info("bootable devices are %s" % [bootable_devices.to_s])
unless bootable_devices.empty?
bootable_devices_instance_ids = []
bootable_devices.each do |bootable_device|
boot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_disabled_adapters\n read_settings.fetch('Hardware', {}).each do |adapter, params|\n if adapter.start_with?('net') and !params.fetch('enabled', true)\n execute_prlctl('set', @uuid, '--device-del', adapter)\n end\n end\n end",
"def reset\n s... | [
"0.6273757",
"0.58485776",
"0.5746235",
"0.5723777",
"0.5680156",
"0.5657174",
"0.56116974",
"0.55985045",
"0.55714124",
"0.55629593",
"0.5559801",
"0.5521539",
"0.5489981",
"0.5477054",
"0.54576206",
"0.54490477",
"0.5446011",
"0.5445464",
"0.54446507",
"0.5415845",
"0.53924... | 0.73277366 | 0 |
solution_items/new/many?solution_id=1&kind=design new many items for a vendor_solution | def new_many
@solution = VendorSolution.find(params[:solution_id])
@kind_default = params[:kind]
@item_count = 5
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_many\n @brief = Brief.find(params[:brief_id]) \n @kind_default = params[:kind]\n @item_count = 5\n end",
"def brief_vendor_add_item\n brief = Brief.find(params[:brief_id])\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n brief_vendor.items << Item.new{|r| r.par... | [
"0.65215087",
"0.6455289",
"0.6436305",
"0.6303739",
"0.6133698",
"0.60276926",
"0.6013651",
"0.5999387",
"0.59453315",
"0.576635",
"0.5756222",
"0.5719809",
"0.5662219",
"0.56162137",
"0.5590376",
"0.5560267",
"0.5542815",
"0.5534216",
"0.55273056",
"0.5524412",
"0.54976916"... | 0.8222443 | 0 |
Puede ser leido y escribir en ellos | def initialize(text, line, column)
@text = text
@line = line
@column = column
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n \n end",
"def serialize!\n end",
"def serialize; end",
"def serialize; end",
"def serialize\n end",
"def serialize(object) end",
"def create\r\n \r\n @valor_oferta = sivic_relatorioscelula_params[:VALR_Oferta] \r\n @valor_oferta = @valor_oferta.gsub('.', '')\r\n @va... | [
"0.6209325",
"0.61227876",
"0.60685796",
"0.60685796",
"0.57416993",
"0.57231605",
"0.56746656",
"0.56626034",
"0.56626034",
"0.56626034",
"0.56626034",
"0.56626034",
"0.5647311",
"0.5520212",
"0.54857033",
"0.54813796",
"0.54270643",
"0.5404407",
"0.54009295",
"0.53866976",
... | 0.0 | -1 |
Se conoce como sigleton | def to_s #Salida especificada
"#{self.class.name}#{if self.class.name.eql?("TkIdent") then "(\"#{@text}\")" end}#{if self.class.name.eql?("TkNum") then "(#{@text})" end} "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def singleton\n class << self; self end\n end",
"def initialize\n \n end",
"def singleton\n @singleton = true\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n set_config\n end",
"def singleton!\n ... | [
"0.6527584",
"0.64879704",
"0.6475124",
"0.64728314",
"0.64728314",
"0.64728314",
"0.64728314",
"0.63735676",
"0.6369023",
"0.6363694",
"0.63577807",
"0.6355508",
"0.633822",
"0.63205916",
"0.6299395",
"0.6298083",
"0.6298083",
"0.62891054",
"0.62891054",
"0.62891054",
"0.626... | 0.0 | -1 |
Se le asigna la regexp respectiva a la clase | def initialize(text, line, column)
@text = text
@line = line
@column = column
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regexp; end",
"def regexp; end",
"def regexp=(_arg0); end",
"def regex(_obj)\n raise NotImplementedError\n end",
"def re; end",
"def match(regexp); end",
"def regexps; end",
"def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end",
"def pattern2regex(pattern)... | [
"0.79619527",
"0.79619527",
"0.7721961",
"0.749735",
"0.7459871",
"0.7099163",
"0.70896035",
"0.70149004",
"0.6968958",
"0.6871111",
"0.6757896",
"0.66903913",
"0.665103",
"0.66197747",
"0.65805435",
"0.657304",
"0.6572922",
"0.6572922",
"0.6572922",
"0.6553785",
"0.6552075",... | 0.0 | -1 |
GET /hazards GET /hazards.json | def index
@hazards = Hazard.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @awards = Award.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @awards }\n end\n end",
"def hazards\n if !@values.has_key?('hazards')\n @values['hazards'] = REXML::XPath.match(@xml, '/dwml/data[1]/parameters[1]/hazards[1]/haz... | [
"0.67628044",
"0.6512463",
"0.6495864",
"0.64123553",
"0.6369164",
"0.6242868",
"0.62329227",
"0.6175235",
"0.6150011",
"0.61225474",
"0.61184484",
"0.61017144",
"0.60972077",
"0.60832703",
"0.6054158",
"0.60501546",
"0.6002496",
"0.59535736",
"0.5943229",
"0.5923968",
"0.591... | 0.7274559 | 0 |
GET /hazards/1 GET /hazards/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t@hazards = Hazard.all\n\tend",
"def index\n @awards = Award.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @awards }\n end\n end",
"def index\n @api_v1_rewards = Api::V1::Reward.all\n end",
"def index\n @economy_hands = Eco... | [
"0.7287603",
"0.6701262",
"0.65554416",
"0.6526835",
"0.6344566",
"0.62148064",
"0.61933553",
"0.61860394",
"0.61629975",
"0.61349565",
"0.61242926",
"0.61173713",
"0.61157495",
"0.6113099",
"0.6100625",
"0.60964125",
"0.60956246",
"0.60588706",
"0.6058826",
"0.605524",
"0.60... | 0.0 | -1 |
POST /hazards POST /hazards.json | def create
@hazard = Hazard.new(hazard_params)
respond_to do |format|
if @hazard.save
format.html { redirect_to @hazard, notice: 'Hazard was successfully created.' }
format.json { render :show, status: :created, location: @hazard }
else
format.html { render :new }
format.json { render json: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @reward = current_business.rewards.build(reward_params)\n\n respond_to do |format|\n if @reward.save\n format.html { redirect_to @reward, notice: 'Reward was successfully created.' }\n format.json { rende... | [
"0.6329073",
"0.5901028",
"0.5896055",
"0.58273476",
"0.58262366",
"0.5768964",
"0.57642436",
"0.5752869",
"0.5745106",
"0.5731336",
"0.5693521",
"0.56716615",
"0.56716615",
"0.56068254",
"0.55954516",
"0.5585475",
"0.5579301",
"0.5573154",
"0.55308485",
"0.5501058",
"0.54818... | 0.53054345 | 41 |
PATCH/PUT /hazards/1 PATCH/PUT /hazards/1.json | def update
respond_to do |format|
if @hazard.update(hazard_params)
format.html { redirect_to @hazard, notice: 'Hazard was successfully updated.' }
format.json { render :show, status: :ok, location: @hazard }
else
format.html { render :edit }
format.json { render json: @hazard.errors, status: :un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @api_v1_reward.update(api_v1_reward_params)\n format.html { redirect_to @api_v1_reward, notice: 'Reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_reward }\n else\n format.html { render :edit }... | [
"0.6396244",
"0.6163369",
"0.6149012",
"0.6137655",
"0.6134303",
"0.6124844",
"0.61084795",
"0.6104303",
"0.6103521",
"0.60856694",
"0.6079463",
"0.60615695",
"0.60592747",
"0.60503685",
"0.60469395",
"0.6046842",
"0.6035882",
"0.6030569",
"0.6015974",
"0.5998877",
"0.5996107... | 0.5881918 | 43 |
DELETE /hazards/1 DELETE /hazards/1.json | def destroy
@hazard.destroy
respond_to do |format|
format.html { redirect_to hazards_url, notice: 'Hazard was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @hazard = Hazard.find(params[:id])\n @hazard.destroy\n\n respond_to do |format|\n format.html { redirect_to(hazards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_v1_reward.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_rew... | [
"0.72360003",
"0.7029056",
"0.69079894",
"0.68632877",
"0.68280905",
"0.6804607",
"0.676761",
"0.6763835",
"0.6757344",
"0.6746557",
"0.6725779",
"0.6722933",
"0.67191947",
"0.67180586",
"0.6697301",
"0.66817135",
"0.6675682",
"0.6674133",
"0.666998",
"0.66672295",
"0.6659722... | 0.6971433 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_hazard
@hazard = Hazard.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 hazard_params
params.require(:hazard).permit(:operator, :country, :htype, :year, :hde, :hda, :cd, :rd, :pd, :pi, :pm, :pa, :prl, :pe, :ha, :eca, :remark)
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 |
mrubyat_exit seems to not be complete :/ Let's instead hijack exit... | def exit(*args)
# Restore the console at exit.
VTConsole.map_console(1)
_exit(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_exit(&block); end",
"def exit!() end",
"def exit() end",
"def coolest_exit\n Kernel.exit! 99\n end",
"def set_exit_exception; end",
"def exit(res=0) end",
"def on_exit\n end",
"def handle_exit\n __exit! if respond_to?(:__exit!)\n exit(0)\n end",
"def exit!(res=0) ... | [
"0.82759666",
"0.78795314",
"0.7842493",
"0.75854164",
"0.75230706",
"0.74360436",
"0.7433635",
"0.73762846",
"0.73020285",
"0.7237542",
"0.7234305",
"0.7208209",
"0.7141956",
"0.7123596",
"0.70803314",
"0.70619667",
"0.68641186",
"0.68511885",
"0.6848092",
"0.68013",
"0.6788... | 0.6308514 | 57 |
Used to handle fadein/fadeout This is because opacity handles multiple overlaid objects wrong. | def add_cover()
@cover = LVGL::LVObject.new(@screen)
# Make it so we can use the opacity to fade in/out
@cover.set_opa_scale_enable(true)
@cover.set_width(@screen.get_width())
@cover.set_height(@screen.get_height())
@cover.set_click(false)
@cover.get_style().dup.tap do |style|
@cover.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_fade_in\n if @fade_in\n update_windowskin if contents_opacity == 0\n self.contents_opacity += 24\n @name_window.contents_opacity += 24\n @city_sprite.opacity += 24 if @city_sprite\n self.face_opacity = opacity\n @fade_in = false if contents_opacity == 255\n... | [
"0.71392715",
"0.69953984",
"0.69251245",
"0.6866696",
"0.6856389",
"0.6827871",
"0.67846537",
"0.6767229",
"0.6753792",
"0.6733051",
"0.667125",
"0.6582229",
"0.65679306",
"0.648386",
"0.6460062",
"0.6437986",
"0.6426388",
"0.6415479",
"0.6373911",
"0.6356809",
"0.6208183",
... | 0.0 | -1 |
+cb+ is a proc that wille be +call+'d with the text once submitted. | def ask_user(placeholder: "", identifier: , cb:)
return if identifier == @ask_identifier
@ask_identifier = identifier
@ta.set_placeholder_text(placeholder)
@ta.set_text("")
@ta.show()
@keyboard.set_ta(@ta)
@keyboard.show()
bottom_space = @screen.get_height() - (@ta.get_y() + @ta.get_he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback\n\tend",
"def callback=(_arg0); end",
"def callback\n\n end",
"def send_text\n\nend",
"def callback\n end",
"def text=(_arg0); end",
"def text_when_done(num, cmd, cntcs) #third argument may be unecessary. not familiar with ruby scope\n\n\tcontacts = cntcs #probably...maybe uneccesary?\... | [
"0.57665455",
"0.5749879",
"0.57223666",
"0.5715666",
"0.5709879",
"0.54707956",
"0.54583985",
"0.5433373",
"0.54324853",
"0.5431434",
"0.5431434",
"0.5431434",
"0.5431434",
"0.54163",
"0.54158366",
"0.5393393",
"0.53902435",
"0.5353248",
"0.5344088",
"0.53332496",
"0.5261796... | 0.0 | -1 |
Fadein animation Note that this looks like inverted logic because it is! We're actually fadingout the cover! | def fade_in(fade_length)
LVGL::LVAnim.new().tap do |anim|
anim.set_exec_cb(@cover, :lv_obj_set_opa_scale)
anim.set_time(fade_length, 0)
anim.set_values(255, 0)
anim.set_path_cb(LVGL::LVAnim::Path::EASE_OUT)
# Launch the animation
anim.create()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fade_in(duration)\n delta = (255/60/duration.to_f).round\n @surface.fade(delta)\n @finished = @surface.alpha == 0\n end",
"def fadeIn\n if @orig_opacity == nil || self.opacity < @orig_opacity\n @duration = self.animationSpeed\n if @orig_opacity == nil\n @orig_opacity = s... | [
"0.70756614",
"0.6942169",
"0.68719035",
"0.66798097",
"0.6565434",
"0.6485494",
"0.63844985",
"0.6359701",
"0.6298047",
"0.61978525",
"0.61978525",
"0.61154723",
"0.6088033",
"0.6083829",
"0.6083237",
"0.6048149",
"0.5998615",
"0.5993925",
"0.5985593",
"0.5938017",
"0.593376... | 0.65820855 | 4 |
Fadeout animation Note that this looks like inverted logic because it is! We're actually fadingin the cover! | def fade_out(fade_length)
LVGL::LVAnim.new().tap do |anim|
anim.set_exec_cb(@cover, :lv_obj_set_opa_scale)
anim.set_time(fade_length, PROGRESS_UPDATE_LENGTH)
anim.set_values(0, 255)
anim.set_path_cb(LVGL::LVAnim::Path::EASE_IN)
# Launch the animation
anim.create()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fadeOut\n if self.opacity > 0\n @duration = self.animationSpeed\n @orig_opacity = self.opacity\n @closing = true\n @opening = false\n @animationType = FADE\n end\n end",
"def fade_out(duration)\n delta = (255/60/duration.to_f).round\n @surface.fade(delta * -1)\n ... | [
"0.73487765",
"0.7259145",
"0.7025581",
"0.67781496",
"0.6580548",
"0.6473492",
"0.6432669",
"0.6376161",
"0.6347515",
"0.6306629",
"0.61702245",
"0.61702245",
"0.61667424",
"0.61166006",
"0.6081994",
"0.60658205",
"0.60606587",
"0.60403347",
"0.6018024",
"0.5941417",
"0.5939... | 0.6496861 | 5 |
Quits this applet, fadingout if needed. | def quit!(sticky: false)
fade_length = 0
unless sticky
fade_length = FADE_LENGTH
fade_out(fade_length)
end
set_progress(100)
# TODO: Callback on a timer or on the fade_out animation end.
# Though we **do** want to stop processing from the queue.
# This is not a callback yet be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def q\r\n @_done = true\r\n puts\r\n \"Bye bye for now!\"\r\n end",
"def fadeOut\n @fadingOut = true\n end",
"def command_shutdown\n Sound.play_decision\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = nil\n end",
"def cutFadeOut _obj, _args\n \"_obj... | [
"0.59287435",
"0.5794265",
"0.55730975",
"0.5565378",
"0.54848844",
"0.5318064",
"0.53165555",
"0.5237926",
"0.52304024",
"0.52174187",
"0.52133113",
"0.5184686",
"0.5144092",
"0.5138047",
"0.512567",
"0.5088315",
"0.5049744",
"0.50490916",
"0.5044192",
"0.5042979",
"0.504158... | 0.5970127 | 0 |
Included hook to pull in Celluloid | def included(klass)
klass.send :include, ::Celluloid
klass.mailbox_class Celluloid::ZMQ::Mailbox
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n ::Celluloid.logger = ::Karafka.logger\n # This is just a precaution - it should automatically close the current\n # connection and shutdown actor - but in case it didn't (hanged, etc)\n # we will kill it after waiting for some time\n ::Celluloid.shutdown_tim... | [
"0.592245",
"0.5864418",
"0.5739007",
"0.57182467",
"0.5659142",
"0.54368275",
"0.53838474",
"0.5346584",
"0.53095275",
"0.52492446",
"0.5242104",
"0.523557",
"0.52136093",
"0.52136093",
"0.5175702",
"0.5175702",
"0.5169689",
"0.5169689",
"0.5169689",
"0.5166376",
"0.5132446"... | 0.0 | -1 |
Obtain a 0MQ context (or lazily initialize it) | def context(worker_threads = 1)
return @context if @context
@context = ::ZMQ::Context.new(worker_threads)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n @context ||= ::ZMQ::Context.new\n end",
"def zmq_context\n @zmq_context ||= create_zmq_context\n end",
"def context\n @context ||= begin\n require 'ffi-rzmq'\n ZMQ::Context.new\n end\n block_given? ? yield(@context) : @context\n ... | [
"0.8228325",
"0.7898349",
"0.7837812",
"0.73082525",
"0.6934932",
"0.68290895",
"0.6076852",
"0.5981607",
"0.5966747",
"0.59367096",
"0.59032",
"0.58112067",
"0.5807773",
"0.577498",
"0.57646126",
"0.574896",
"0.5740734",
"0.571618",
"0.5704443",
"0.5666253",
"0.5646752",
"... | 0.76733655 | 3 |
GET /StaticContents/new GET /StaticContents/new.xml | def new
@static_content = StaticContent.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @static_page }\n end\n end",
"def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :... | [
"0.74321973",
"0.74321973",
"0.71542543",
"0.7128158",
"0.70067424",
"0.68732226",
"0.6867849",
"0.6867849",
"0.6772664",
"0.6708117",
"0.6684316",
"0.66731393",
"0.66731393",
"0.66731393",
"0.66731393",
"0.66558295",
"0.66558295",
"0.66558295",
"0.66558295",
"0.66558295",
"0... | 0.68863505 | 5 |
POST /StaticContents POST /StaticContents.xml | def create
@static_content = StaticContent.new(params[:static_content])
if @static_content.save
flash[:notice] = 'Content was successfully created.'
redirect_to(root_url)
else
render :action => "new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n params[:static_content][:name] = get_clean_name(params[:static_content][:name])\n\n @static_content = StaticContent.new(params[:static_content])\n\n respond_to do |format|\n if @static_content.save\n format.html { redirect_to @static_content, notice: 'Static content was successf... | [
"0.6249234",
"0.61625886",
"0.59449834",
"0.5924072",
"0.5917006",
"0.59136945",
"0.59103847",
"0.5902697",
"0.5891917",
"0.58887446",
"0.5859931",
"0.583686",
"0.5731378",
"0.57197183",
"0.5654402",
"0.5649016",
"0.56427383",
"0.56427383",
"0.56407154",
"0.56407154",
"0.5618... | 0.5872074 | 10 |
PUT /StaticContents/1 PUT /StaticContents/1.xml | def update
@static_content = StaticContent.find(params[:id])
if @static_content.update_attributes(params[:static_content])
flash[:notice] = 'Content was successfully updated.'
redirect_to(root_url)
else
render :action => "edit"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n static = @static_page\n static.assign_attributes(contents: get_contents(params),\n custom_file: ... | [
"0.64387745",
"0.6295354",
"0.62474775",
"0.61559874",
"0.60982674",
"0.5898084",
"0.5890885",
"0.58308154",
"0.58213234",
"0.5815833",
"0.5779428",
"0.57576984",
"0.5703279",
"0.5654736",
"0.5598763",
"0.5509031",
"0.5501403",
"0.5501403",
"0.54876953",
"0.54718316",
"0.5428... | 0.5788309 | 10 |
This is the QR code api that sends the request | def create_qrcode
@qr = RQRCode::QRCode.new( qr_code_params[:text], size: 4)
byebug
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qrcode\n\n #integration de la gestion des erreurs 1.0\n # Il est important de noter que chaque transaction de QRCODE generé par le telephone\n # contient une clé unique, cela permet a quelqu'un qui a deja payé cette transaction via\n # ce QRCODE ne le repaye pas par erreur\n # Add new params\n ... | [
"0.72223264",
"0.7052749",
"0.690138",
"0.68756104",
"0.6871479",
"0.68438125",
"0.6642708",
"0.6639011",
"0.6585862",
"0.6565046",
"0.6523958",
"0.65184695",
"0.6423302",
"0.6402191",
"0.6391755",
"0.638374",
"0.6353749",
"0.63486606",
"0.6340519",
"0.63246405",
"0.62692565"... | 0.6508541 | 12 |
default size is 50 megabytes | def size(new_size = nil)
new_size.nil? ? @size : @size = new_size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_size; end",
"def default_max_size; end",
"def max_size\n 1\n end",
"def size\n\t\t7500\n\tend",
"def size_mb \n return size / 1048576 # (1024 * 1024) \n end",
"def min_file_size\n (1024 * 200)\n end",
"def my_size\n 1\n end",
"def get_size\n\t\tend",
"def specific_ma... | [
"0.78734076",
"0.78167975",
"0.76354015",
"0.7541828",
"0.7334642",
"0.7289609",
"0.7232748",
"0.7219966",
"0.7207473",
"0.7205101",
"0.72018564",
"0.7188581",
"0.7188581",
"0.7165674",
"0.7156622",
"0.71454024",
"0.7144485",
"0.7144485",
"0.7116188",
"0.7040804",
"0.69938415... | 0.0 | -1 |
Complete the stones function below. | def stones(n, a, b)
ar=[0]
(n-1).times do |val|
tmp=[]
ar.each do |v|
tmp << v+a if !tmp.include?(v+a)
tmp << v+b if !tmp.include?(v+b)
end
ar=tmp
end
ar.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_ones\n self.class.ones(*shape)\n end",
"def place_stones\n # iterate through array and place 4 stones in all cups, except player stores\n @cups.each_with_index do |cup, idx|\n unless (idx == 6 || idx == 13)\n 4.times do\n cup << :stone\n end\n end\n end\n... | [
"0.5859624",
"0.5730123",
"0.56099",
"0.5485099",
"0.53143144",
"0.5270216",
"0.5232738",
"0.5159425",
"0.51467323",
"0.506495",
"0.50551957",
"0.50327146",
"0.50222754",
"0.4988408",
"0.4975822",
"0.4972991",
"0.49164373",
"0.49102625",
"0.4897648",
"0.4883537",
"0.48790544"... | 0.5702839 | 2 |
retourne la valeur (vide, X ou O) de l'instance | def to_s
return @value.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vd(value=1)\n @music.vd(value.to_i)\n end",
"def volume; self.class.volume; end",
"def get_x; \t\t@x \t\t\tend",
"def vat_number; end",
"def vida\n @vida_actual\n end",
"def x\n @x\n end",
"def value; end",
"def value; end",
"def value; end",
"def value; end",
"def value; en... | [
"0.56801176",
"0.5673415",
"0.567206",
"0.56265724",
"0.5598441",
"0.55896753",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
"0.5469262",
... | 0.0 | -1 |
Only allowed stores are taken in response. | def mall_result(mall)
lat = params[:latitude]
lng = params[:longitude]
stores = mall.stores.allowed_stores
{
mall_name: mall.name,
mall_address: mall.address,
steps: mall.steps(lat, lng),
stores: stores_list_result(stores)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_editorial_or_stock_for_sale\n return false if self.requests.length == 0\n self.requests.each do |r|\n return false if r.state == \"denied\"\n end\n true\n end",
"def employee_belongs_to_only_store\n errors.add(:location_id, \"Employee does not belong to a store\") if Location.find(lo... | [
"0.6038761",
"0.60372555",
"0.5860738",
"0.5833143",
"0.5811773",
"0.57141775",
"0.56976575",
"0.5659663",
"0.5636964",
"0.5513984",
"0.54893214",
"0.54852074",
"0.5438593",
"0.5425294",
"0.5416096",
"0.5400597",
"0.5384347",
"0.53500605",
"0.5337661",
"0.53335917",
"0.533153... | 0.0 | -1 |
GET /webs/1 GET /webs/1.json | def show
@web = Web.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @web }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @web_app = WebApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_app }\n end\n end",
"def show\n @website = Website.find(params[:id])\n\n render json: @website\n end",
"def show\n @web_page = WebPage.find(par... | [
"0.6844121",
"0.6693703",
"0.6693671",
"0.64704096",
"0.6430876",
"0.6339682",
"0.6321278",
"0.62609905",
"0.6236252",
"0.62326086",
"0.61807877",
"0.6178744",
"0.61171037",
"0.6030073",
"0.60125536",
"0.59712315",
"0.5926714",
"0.59145683",
"0.59065545",
"0.59065545",
"0.590... | 0.745923 | 0 |
GET /webs/new GET /webs/new.json | def new
@web= Web.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @web_app = WebApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @web_app }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",... | [
"0.75095004",
"0.7058178",
"0.7057049",
"0.68457323",
"0.6806603",
"0.67655563",
"0.67647994",
"0.6746132",
"0.6739131",
"0.67101413",
"0.6671961",
"0.6665762",
"0.66290665",
"0.662557",
"0.66068864",
"0.65817183",
"0.6560548",
"0.6559001",
"0.6559001",
"0.6559001",
"0.655900... | 0.6884265 | 3 |
POST /webs POST /webs.json | def create
#@word= params[:web][:word]
@result=[]
word=params[:web][:word]
word=word.split(' ')
i=0
word.each do |x|
#p x
@web=Web.find_by_sql("select id from webs where word= '#{x}'")
#@web=Web.where("word=?",params[:web][:word])
#@result= Container.joins('INNER JOI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @web = Web.new(web_params)\n\n respond_to do |format|\n if @web.save\n format.html { redirect_to @web, notice: 'Web was successfully created.' }\n format.json { render :show, status: :created, location: @web }\n else\n format.html { render :new }\n format.js... | [
"0.6659848",
"0.63210946",
"0.5958433",
"0.5936645",
"0.5894691",
"0.5861048",
"0.58557266",
"0.58455706",
"0.5697086",
"0.5642276",
"0.5636574",
"0.5621937",
"0.55018014",
"0.54857093",
"0.5477344",
"0.5440458",
"0.5398539",
"0.5395116",
"0.5392223",
"0.538897",
"0.53792363"... | 0.0 | -1 |
PUT /webs/1 PUT /webs/1.json | def update
@web = Web.find(params[:id])
respond_to do |format|
if @web.update_attributes(params[:web])
format.html { redirect_to @web, notice: 'Web was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @web.update(web_params)\n format.html { redirect_to @web, notice: 'Web was successfully updated.' }\n format.json { render :show, status: :ok, location: @web }\n else\n format.html { render :edit }\n format.json { render json: @web.e... | [
"0.66247493",
"0.6329996",
"0.6286372",
"0.61293715",
"0.60678655",
"0.59786034",
"0.59777075",
"0.5975192",
"0.596441",
"0.5921597",
"0.5912863",
"0.5875741",
"0.5854642",
"0.58110565",
"0.580346",
"0.5762286",
"0.5743069",
"0.5693363",
"0.5693178",
"0.5587976",
"0.5568379",... | 0.68166053 | 0 |
DELETE /webs/1 DELETE /webs/1.json | def destroy
@web = Web.find(params[:id])
@web.destroy
respond_to do |format|
format.html { redirect_to webs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @web.destroy\n respond_to do |format|\n format.html { redirect_to webs_url, notice: 'Web was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @web_app = WebApp.find(params[:id])\n @web_app.destroy\n\n respond_to do |format|\n ... | [
"0.7402667",
"0.714041",
"0.70407665",
"0.7022888",
"0.69710046",
"0.694338",
"0.6931364",
"0.6918031",
"0.6859245",
"0.6854125",
"0.6852613",
"0.68313617",
"0.6820462",
"0.68130714",
"0.68058145",
"0.67943597",
"0.67937773",
"0.67937773",
"0.67937773",
"0.67937773",
"0.67692... | 0.7678606 | 0 |
Determines which key should be used for indexing. | def index_key
PhraseIndexPolicy.index_key(key, meta_key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_index\n options[:key_index]\n end",
"def key\n (key_name || name).to_sym\n end",
"def _key\n @_key || self.class.key.(self)\n end",
"def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_... | [
"0.71746993",
"0.6621083",
"0.6294617",
"0.62646824",
"0.6234769",
"0.6224546",
"0.61881727",
"0.6185472",
"0.6099241",
"0.6071796",
"0.60676944",
"0.60549194",
"0.60492176",
"0.6040334",
"0.60256696",
"0.60256696",
"0.60256696",
"0.60256696",
"0.60256696",
"0.60256696",
"0.6... | 0.60805863 | 9 |
Determines which value should be used for indexing. | def index_value
PhraseIndexPolicy.index_value(key, meta_key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hit_value= int\n #This is a stub, used for indexing\n end",
"def selected_value\n return @keys ? @keys[self.index] : self.index\n end",
"def selected_value\n @keys ? @keys[self.index] : self.index\n end",
"def [](index)\n if @values.include?(index)\n return @values[i... | [
"0.6538709",
"0.6407438",
"0.639077",
"0.6323238",
"0.632081",
"0.6231469",
"0.6145354",
"0.6133477",
"0.6100657",
"0.59461474",
"0.59151363",
"0.58918613",
"0.5839699",
"0.58029467",
"0.58029467",
"0.5790456",
"0.5788791",
"0.5762942",
"0.5743573",
"0.57360756",
"0.5687175",... | 0.52140284 | 90 |
GET /lugars GET /lugars.json | def index
@lugars = Lugar.all
render json: @lugars
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @lugar\n end",
"def list\n slugs = Slug.all\n result = slugs.collect{ |x|\n\n {\n 'name' => x.name }\n }\n\n render json: {available_slugs: result}\n end",
"def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # s... | [
"0.7023736",
"0.6961233",
"0.67442816",
"0.633855",
"0.6160878",
"0.6156826",
"0.61489636",
"0.6118534",
"0.6113501",
"0.6084836",
"0.60628426",
"0.6058422",
"0.60580266",
"0.6054774",
"0.6043058",
"0.5981586",
"0.597617",
"0.5951559",
"0.59502596",
"0.59464216",
"0.59228635"... | 0.78252476 | 0 |
GET /lugars/1 GET /lugars/1.json | def show
render json: @lugar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end",
"def new\n @lugar = Lugar.new\n\n respond_to do |format|\n ... | [
"0.7638382",
"0.69948983",
"0.6441199",
"0.6361655",
"0.63419276",
"0.622315",
"0.61719745",
"0.61570466",
"0.61424106",
"0.61312157",
"0.61164665",
"0.6110832",
"0.61042374",
"0.6092222",
"0.6087509",
"0.6084547",
"0.6078436",
"0.606373",
"0.60551614",
"0.6054006",
"0.604372... | 0.7047987 | 1 |
POST /lugars POST /lugars.json | def create
@lugar = Lugar.new(lugar_params)
if @lugar.save
render json: @lugar, status: :created, location: @lugar
else
render json: @lugar.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @lugar = Lugar.new(params[:lugar])\n\n respond_to do |format|\n if @lugar.save\n format.html { redirect_to @lugar, notice: 'Lugar was successfully created.' }\n format.json { render json: @lugar, status: :created, location: @lugar }\n else\n format.html { render ac... | [
"0.66751546",
"0.62728226",
"0.6011285",
"0.5980999",
"0.5964479",
"0.5958374",
"0.5923346",
"0.58914334",
"0.5766374",
"0.5741633",
"0.57402635",
"0.5736245",
"0.57302785",
"0.57179165",
"0.57123655",
"0.5699641",
"0.5688916",
"0.5683926",
"0.5672645",
"0.56613994",
"0.56480... | 0.74904585 | 0 |
PATCH/PUT /lugars/1 PATCH/PUT /lugars/1.json | def update
@lugar = Lugar.find(params[:id])
if @lugar.update(lugar_params)
head :no_content
else
render json: @lugar.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'P... | [
"0.6477748",
"0.6371116",
"0.63365775",
"0.63207996",
"0.6240924",
"0.6204259",
"0.6176925",
"0.6162123",
"0.6118858",
"0.6118858",
"0.6005814",
"0.59973407",
"0.5990752",
"0.5981716",
"0.59725124",
"0.596652",
"0.596652",
"0.59650683",
"0.59519666",
"0.59319437",
"0.59272766... | 0.6631697 | 0 |
DELETE /lugars/1 DELETE /lugars/1.json | def destroy
@lugar.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delet... | [
"0.71825004",
"0.71359426",
"0.6943508",
"0.6864263",
"0.6849081",
"0.68459266",
"0.6821247",
"0.68208414",
"0.68048656",
"0.67718726",
"0.6765858",
"0.6757307",
"0.6735583",
"0.6731955",
"0.67221075",
"0.670964",
"0.6701227",
"0.6699796",
"0.6696176",
"0.66940224",
"0.669385... | 0.69841945 | 2 |
Enumerable builds everything on top of each. | def each(&block)
begin
while true
block.call(@fiber.resume)
end
rescue StopIteration
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def each(&block)\n return all.each(&block)\n end",
"def each\n... | [
"0.7286892",
"0.7220287",
"0.70725894",
"0.7036894",
"0.68838346",
"0.6874336",
"0.68120986",
"0.6755645",
"0.674361",
"0.674361",
"0.674361",
"0.6720394",
"0.6703623",
"0.66678995",
"0.6653633",
"0.66313165",
"0.66184235",
"0.66184235",
"0.66184235",
"0.66184235",
"0.6618423... | 0.0 | -1 |
x = (ra.sq + b) / c | def initialize(r, a, b, c)
@r = r; @a = a; @b = b; @c = c
normalize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quad(a,b,c)\n bsquaredminusfourac = b**2 - (4 * a * c)\n negb = b * -1\n twoa = 2 *a\n ans1 = negb + Math.sqrt(bsquaredminusfourac)\n ans2 = negb - Math.sqrt(bsquaredminusfourac)\n return (ans1 / twoa), (ans2 / twoa)\nend",
"def quadra (a, b, c)\n\tif a == 0\n\t\tputs \"Решение не возможно!\"\n\t\tretu... | [
"0.6967419",
"0.6903725",
"0.6521076",
"0.65104324",
"0.6462417",
"0.63930315",
"0.63580924",
"0.62488824",
"0.62170404",
"0.61291",
"0.6113803",
"0.60293704",
"0.60279036",
"0.59878266",
"0.5951449",
"0.5951449",
"0.5932122",
"0.59238636",
"0.58774656",
"0.5866296",
"0.58640... | 0.0 | -1 |
after due algebra .. | def x
@x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored; end",
"def schumann; end",
"def malts; end",
"def alg; end",
"def suivre; end",
"def formation; end",
"def in_law; end",
"def celebration; end",
"def calculated; end",
"def rassoc(p0) end",
"def dv; end",
"def schubert; end",
"def upc_a_with_composite_symbology; end",
"def b... | [
"0.67136323",
"0.64084446",
"0.63975227",
"0.63454926",
"0.63043606",
"0.619117",
"0.6151558",
"0.61157894",
"0.61153424",
"0.60760504",
"0.60294837",
"0.60272247",
"0.5999848",
"0.5985183",
"0.5979336",
"0.5979336",
"0.5959617",
"0.5925714",
"0.5923785",
"0.59093595",
"0.589... | 0.0 | -1 |
see problem065.rb for continued fractions with integers and their recursion the principle is the same .. but the fractions used are several instead of just the 10th and 100th convergence | def get_fraction( pattern )
r = nil
pattern.reverse.each_with_index do |n, i|
r = (i == 0 ? n : n + Rational(1, r))
end
return r
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_gcd_proper_fractions(n)\n return 0 if n == 1\n proper_fractions_found = 0\n\n (1..n-1).each do |i|\n if recursive_gcd(i, n) == 1\n proper_fractions_found += 1\n else\n next\n end\n end\n\n proper_fractions_found\nend",
"def continued_fraction(n)\n a0 = Math.sqrt(n).floor\n ... | [
"0.7200621",
"0.71885693",
"0.7087526",
"0.6701119",
"0.66619223",
"0.6628078",
"0.65457517",
"0.65141547",
"0.65021616",
"0.64966214",
"0.64773476",
"0.64689326",
"0.64676124",
"0.6330446",
"0.62867826",
"0.6267911",
"0.62531656",
"0.62474805",
"0.62204415",
"0.6203114",
"0.... | 0.60034764 | 26 |
helper function that will return true if a photo is original to the user | def original_photo(photourl)
if(current_user.upvotes.find_by(photourl: photourl) || current_user.downvotes.find_by(photourl: photourl))
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploaded_image_displayed?\n displayed? UPLOADED_IMAGE\n end",
"def images_add?\r\n\t\tuser_allowed_to_object?(user, record, [:edit])\r\n\tend",
"def image?\n image ? true : false\n end",
"def owner?(photo)\n !photo.nil? && photo.owner == current_user\n end",
"def photograph?\n ... | [
"0.64958",
"0.6488947",
"0.6476725",
"0.64721715",
"0.64609605",
"0.6436998",
"0.6421843",
"0.6411181",
"0.6402768",
"0.6390249",
"0.6386556",
"0.6374172",
"0.6374172",
"0.6370309",
"0.6351616",
"0.63306046",
"0.63306046",
"0.63306046",
"0.6298143",
"0.62882257",
"0.62703556"... | 0.7261193 | 0 |
Marks the element indicated by element as active, which causes it to be displayed as specified by the activeBackground and activeRelief options. The only element values understood by this command are arrow1, slider, or arrow2. If any other value is specified then no element of the scrollbar will be active. If element i... | def activate(element = None)
execute(:activate, element).to_s?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_element\n @bridge.switch_to_active_element\n end",
"def active_element\n logger.info 'EyesTargetLocator.active_element()'\n logger.info 'Switching to element...'\n element = __getobj__.active_element\n\n unless element.is_a? Selenium::WebDriver::Element\n raise A... | [
"0.64469385",
"0.6217002",
"0.6033308",
"0.5956273",
"0.543498",
"0.5146577",
"0.5135669",
"0.5102314",
"0.5093151",
"0.49618366",
"0.49038523",
"0.48803946",
"0.48587477",
"0.48587477",
"0.48218703",
"0.4813882",
"0.4798993",
"0.47933608",
"0.47784248",
"0.47593036",
"0.4731... | 0.5871863 | 4 |
Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in slider position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the slider deltaX pixels to the right (deltaY is ignored in this cas... | def delta(delta_x, delta_y)
execute(:delta, delta_x, delta_y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_change(current_value, previous_value)\n diff = current_value - previous_value\n change = nil\n if diff < -0.2\n change = -1\n elsif diff > 0.2\n change = 1\n else\n change = 0\n end\n\n return change\n end",
"def delta\n @delta ||= @max - @min\n end",
"d... | [
"0.56813794",
"0.5538503",
"0.5523786",
"0.5485984",
"0.53717476",
"0.53690314",
"0.5348837",
"0.52753574",
"0.5271073",
"0.5233263",
"0.52278435",
"0.5220178",
"0.5182136",
"0.5172841",
"0.51704794",
"0.51609474",
"0.5160804",
"0.51300925",
"0.5125955",
"0.5119719",
"0.51132... | 0.48140892 | 51 |
Returns a real number between 0 and 1 indicating where the point given by x and y lies in the trough area of the scrollbar. The value 0 corresponds to the top or left of the trough, the value 1 corresponds to the bottom or right, 0.5 corresponds to the middle, and so on. X and y must be pixel coordinates relative to th... | def fraction(x, y)
execute(:fraction, x, y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_cell_y_at(y); y / HEIGHT; end",
"def y\n OFFSET_FROM_TOP + (coordinates.y * 700).to_i\n end",
"def winding_number(x, y)\n return 0 if @x1 == @x2 || @x1 == x\n slope = (@y2 - @y1).to_f / (@x2 - @x1)\n y_intercept = @y1 + ((x - @x1) * slope)\n return 0 if y_intercept <= y\n if @x1 < x\... | [
"0.5548401",
"0.5523383",
"0.5450973",
"0.53628236",
"0.53167343",
"0.5276582",
"0.52588683",
"0.5195395",
"0.517551",
"0.517551",
"0.517551",
"0.5146898",
"0.5146027",
"0.5141154",
"0.5132951",
"0.51130366",
"0.51126456",
"0.51125073",
"0.50990707",
"0.50734985",
"0.50417066... | 0.0 | -1 |
Returns the scrollbar settings in the form of a list whose elements are the arguments to the most recent set widget command. | def get
execute(:get)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_scrollbar_param(hash)\n if hash\n hash[:max] = @content.max_origin\n hash[:min] = @content.min_origin\n hash[:direction] = @direction\n end\n return hash\n end",
"def window_handles; end",
"def settings_list\n setting.list\n end",
"def list_... | [
"0.58014673",
"0.53829455",
"0.5299161",
"0.5249012",
"0.52333456",
"0.51603496",
"0.5151129",
"0.51090884",
"0.5040847",
"0.50251526",
"0.5020978",
"0.50176895",
"0.5004788",
"0.49782735",
"0.49432048",
"0.49411887",
"0.49315205",
"0.49138293",
"0.49038148",
"0.4880199",
"0.... | 0.0 | -1 |
Returns the name of the element under the point given by x and y (such as arrow1), or an empty string if the point does not lie in any element of the scrollbar. X and y must be pixel coordinates relative to the scrollbar widget. | def identify(x, y)
execute(:identify, x, y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n $browser.element(@selector).h1(css: 'h1').text\n end",
"def cursor_x\n # x is \"0\" if cursor position at 0\n return -self.src_rect.x + 4 if !self.cursor_can_move_left?\n # find cursor position from text left from it\n display_text = get_display_text.scan(/./m)[0, @cursor_posit... | [
"0.512429",
"0.4995618",
"0.49773425",
"0.49706122",
"0.49297053",
"0.4924105",
"0.4916817",
"0.4915728",
"0.4915728",
"0.49004734",
"0.485551",
"0.485551",
"0.48402748",
"0.483944",
"0.48338258",
"0.48228586",
"0.48221317",
"0.4800462",
"0.47864845",
"0.4769796",
"0.4767167"... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.arch_request_mailer.confirm_request.subject | def confirm_request
@email = params[:email]
@confirmation_code = params[:confirmation_code]
mail to: @email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject\n self['subject'] || msg['subject']\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n ... | [
"0.7022837",
"0.6935834",
"0.69329625",
"0.69257665",
"0.6724196",
"0.669308",
"0.66510385",
"0.65937275",
"0.6546321",
"0.65333",
"0.6532378",
"0.65142894",
"0.64648145",
"0.64635885",
"0.64633846",
"0.6430715",
"0.6409645",
"0.6372393",
"0.63556385",
"0.6320305",
"0.6276343... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.arch_request_mailer.approve.subject | def approve
@greeting = "Hi"
mail to: "to@example.org"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n ... | [
"0.66219527",
"0.65412074",
"0.65410084",
"0.65199804",
"0.65193075",
"0.64521885",
"0.64389473",
"0.63571125",
"0.63311857",
"0.6289218",
"0.61919814",
"0.61674136",
"0.61674136",
"0.61674136",
"0.61674136",
"0.61674136",
"0.61674136",
"0.616324",
"0.612802",
"0.6119958",
"0... | 0.0 | -1 |
checks if pattern matches path and method matches request method | def matches?(req)
!(@pattern =~ req.path).nil? && req.request_method.downcase == @http_method.to_s.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches?(req)\n pattern.match(req.path) && req.request_method.downcase == http_method.to_s\n end",
"def matches?(req)\n match_method = req.request_method.downcase.to_sym == @http_method\n # match_pattern = req.path.match(Regexp.new(@pattern))\n match_pattern = req.path =~ @pattern\n m... | [
"0.83579284",
"0.8319882",
"0.82848954",
"0.828473",
"0.8237065",
"0.81436753",
"0.8133081",
"0.80609405",
"0.80598605",
"0.79880905",
"0.7947171",
"0.7420003",
"0.7199845",
"0.6931733",
"0.6876334",
"0.6746214",
"0.6668789",
"0.66678256",
"0.6642278",
"0.6539525",
"0.6517457... | 0.81289595 | 7 |
use pattern to pull out route params instantiate controller and call controller action | def run(req, res)
route_params = self.make_match_hash(req)
controller = @controller_class.new(req, res, route_params)
controller.invoke_action(@action_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end",
"def run(req, res)\n match_data = @pattern.match(req.path)\n route_params = (match_data) ?\n match_data.names.zip(match_data.captures).to_h\n : {}\n\n controller_instance = @controller_class.new(req, r... | [
"0.7502529",
"0.7223244",
"0.7196197",
"0.70761",
"0.69895256",
"0.6977831",
"0.697005",
"0.6824516",
"0.6802269",
"0.6746676",
"0.67267",
"0.6700301",
"0.6700301",
"0.6675907",
"0.6650932",
"0.65731615",
"0.65534",
"0.63209516",
"0.6275218",
"0.6148292",
"0.6119896",
"0.61... | 0.6924702 | 7 |
simply adds a new route to the list of routes | def add_route(pattern, method, controller_class, action_name)
@routes << Route.new(pattern, method, controller_class, action_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(new)\n @routes << new\n end",
"def add_route(route)\n @routes << route\n route\n end",
"def add_route(*p, &b)\n @routes ||= routes.dup\n @routes.route(*p, &b)\n end",
"def add_route(*args, &block)\n route = Route.new(*args, &block)\n @routes << route\n route\n end"... | [
"0.85295135",
"0.8367897",
"0.78327346",
"0.7637051",
"0.7450281",
"0.73050445",
"0.7292543",
"0.71862805",
"0.71708983",
"0.71410537",
"0.7077218",
"0.70692235",
"0.7020261",
"0.69830656",
"0.6973817",
"0.695908",
"0.6950988",
"0.6950988",
"0.6950988",
"0.6950988",
"0.692959... | 0.7109665 | 15 |
evalues proc in the context of the instance... syntactic sugar for our router. | def draw(&proc)
self.instance_eval(&proc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom=(&block)\n ## FIXME: validate number of arguments\n @route = Proc.new &block\n end",
"def router=(_arg0); end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def route(&block)\n @router ||= Router.new\n @router.instance_eval(&block)\... | [
"0.5921326",
"0.5857545",
"0.58560723",
"0.58560723",
"0.58560723",
"0.57203776",
"0.56248283",
"0.5602518",
"0.5602518",
"0.55956876",
"0.5576674",
"0.5560201",
"0.55596435",
"0.5525939",
"0.55237955",
"0.5479178",
"0.5477428",
"0.5473338",
"0.5463116",
"0.5458496",
"0.54300... | 0.0 | -1 |
should return the route that matches this request | def match(req)
@routes.each do |route|
if route.matches?(req)
return route
end
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end",
"def route() request.route end",
"def route\n @route\n end",
"def get_route( request )\n return nil unless defined?( ... | [
"0.80904377",
"0.7754476",
"0.77368975",
"0.7600707",
"0.7555522",
"0.74324554",
"0.7290994",
"0.7243001",
"0.72009724",
"0.71971935",
"0.7175109",
"0.7127711",
"0.7127711",
"0.7111193",
"0.71051043",
"0.71020573",
"0.7073606",
"0.70611846",
"0.7048058",
"0.70369387",
"0.6976... | 0.7218723 | 8 |
either throw 404 or call run on a matched route | def run(req, res)
route_to_run = self.match(req)
if route_to_run.nil?
res.status = 404
else
route_to_run.run(req, res)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(req, res)\n matched_route = match(req)\n \n if matched_route.nil?\n res.status = 404\n else\n matched_route.run(req, res)\n end\n end",
"def run(req, res)\n good_route = match(req)\n if good_route.nil?\n res.status = 404\n else\n good_route.run(req, ... | [
"0.815131",
"0.80625826",
"0.7789967",
"0.77764297",
"0.76829374",
"0.7661228",
"0.74770504",
"0.7431744",
"0.7412493",
"0.74065095",
"0.7353434",
"0.72307247",
"0.7149561",
"0.70094836",
"0.6971877",
"0.6958947",
"0.6893456",
"0.6867411",
"0.6862136",
"0.6834631",
"0.6834631... | 0.83203745 | 0 |
HELPERS First I build the merged hash to have all players in one place | def merged_players
game_hash[:home][:players].concat(game_hash[:away][:players])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def players\n #merge list of players\n game_hash[:home][:players].merge(game_hash[:away][:players])\nend",
"def players\n all_players = {}\n game_hash.each do |home_or_away, team_stats|\n all_players.merge!(team_stats[:players])\n end\n all_players\nend",
"def merge_player_info(keys,values)\n counter ... | [
"0.75915676",
"0.7475935",
"0.72660816",
"0.7251223",
"0.7100205",
"0.7048324",
"0.7023767",
"0.69849235",
"0.6933346",
"0.6890232",
"0.6890232",
"0.68828875",
"0.6759967",
"0.6749464",
"0.67311245",
"0.6695409",
"0.66939056",
"0.6679536",
"0.66703033",
"0.66673774",
"0.65752... | 0.7807274 | 0 |
Then I build a helper to find the right team | def team_by_name(team_name)
game_hash[:home].has_value?(team_name) ? game_hash[:home] : game_hash[:away]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team; end",
"def team\n return group\n end",
"def team\n diamond_mine_project.team\n end",
"def team\n @team ||= Struct.new(:name, :domain).new(@team_name, @domain)\n end",
"def get_team(game)\n ... | [
"0.7423891",
"0.7423891",
"0.7423891",
"0.7423891",
"0.7423891",
"0.7423891",
"0.7250787",
"0.7084685",
"0.7079112",
"0.6988709",
"0.6966458",
"0.6939954",
"0.6939954",
"0.6939954",
"0.6939954",
"0.69386315",
"0.6865187",
"0.68486387",
"0.68337536",
"0.6821425",
"0.6809703",
... | 0.64752465 | 44 |
Methods Required I will use [] notation over fetch | def num_points_scored(player_name)
player = player_by_name(player_name)
player.values[0][:points]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch; end",
"def fetch; end",
"def fetch\n end",
"def fetch\n raise \"not implemented\"\n end",
"def fetch(*)\n raise NotImplementedError, 'This should be defined in a subclass'\n end",
"def fetch\n raise NotImplementedError\n end",
"def fetch\n raise NotImp... | [
"0.8428636",
"0.8428636",
"0.8263324",
"0.7966334",
"0.7962929",
"0.78334105",
"0.7802871",
"0.7656299",
"0.74562216",
"0.7444178",
"0.735996",
"0.7127507",
"0.70188373",
"0.6931488",
"0.6931078",
"0.6871774",
"0.6809335",
"0.6727161",
"0.66650206",
"0.6632673",
"0.6594588",
... | 0.0 | -1 |
For Ruby >=2.4.0 you can use sum from Enumerables, I have 2.3.3 and will use reduce | def winning_team
home_points = collection_by_prop(game_hash[:home], :points).reduce(0, :+)
away_points = collection_by_prop(game_hash[:away], :points).reduce(0, :+)
home_points > away_points ? game_hash[:home][:team_name] : game_hash[:away][:team_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum\n reduce(0, &:+)\n end",
"def sum\n self.reduce('lambda{|sum, item| sum + item}')\n end",
"def sum(a)\n a.reduce(&:+)\nend",
"def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend",
"def total(list)\n list.reduce(:+)\nend",
"def iterate_reduce\n accu = 0\n self.list.each do |... | [
"0.8063785",
"0.79023314",
"0.7831267",
"0.78158027",
"0.775832",
"0.7756885",
"0.7754039",
"0.7750214",
"0.76807195",
"0.7676394",
"0.76702476",
"0.7651926",
"0.75908595",
"0.75786906",
"0.75693977",
"0.7559891",
"0.7555568",
"0.7555046",
"0.755138",
"0.75396335",
"0.7525849... | 0.0 | -1 |
Any method_missing call will create a state and accessor with that name | def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissing
$method_missing = [name, *args]
(class << self; self end).add_method(nil, name) #(class << self; self end).superclass.add_method(nil, name)
__send__(name, *args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(name, *params)\n if state.respond_to? name\n state.send name, *params\n else\n super\n end\n end",
"def method_missing(meth, *args)\n\t\t\tif @state_hash.has_key?(meth.to_s)\n\t\t\t\t@state_hash[meth.to_s]\n\t\t\telsif @state_hash['state'].has_key?(meth.to_s)\n\t\t\t\t@stat... | [
"0.7888525",
"0.75380105",
"0.75380105",
"0.7329777",
"0.72761184",
"0.70424247",
"0.7029419",
"0.7029419",
"0.690403",
"0.690403",
"0.68897337",
"0.6771437",
"0.6759337",
"0.67323",
"0.67323",
"0.67323",
"0.67323",
"0.6683701",
"0.66825783",
"0.66825783",
"0.66517395",
"0.... | 0.0 | -1 |
make_int_list is for testing purposes | def make_int_list(args)
head = Node.new args[0]
args[1..args.length - 1].each { |arg| head.append arg }
head
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lister(int)\n\tint.to_s.split('').map { |element| element.to_i }\nend",
"def makeInteger lst\n str = \"\"\n (0...(lst.length)).step(2).each do |i|\n flag = lst[i].length - 1\n n_rep = lst[i+1].length\n str = appendValue(str, flag.to_s, n_rep)\n end\n return str.to_i(2)\nend",
"def test_int_lis... | [
"0.68821293",
"0.65362525",
"0.6532592",
"0.6383347",
"0.63590854",
"0.622817",
"0.61392266",
"0.61135215",
"0.6096599",
"0.60240746",
"0.60031456",
"0.59657925",
"0.59564775",
"0.5913048",
"0.5908896",
"0.58963555",
"0.5846248",
"0.5841288",
"0.5834712",
"0.5807408",
"0.5803... | 0.6925685 | 0 |
POST /reporting_categories POST /reporting_categories.json | def create
@reporting_category = ReportingCategory.new(reporting_category_params)
if @reporting_category.save
flash[:success] = 'Reporting Category was successfully created.'
redirect_to :back
else
flash[:danger] = 'Reporting Category was not created.'
redirect_to :back
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n add_parent_categories (params[:report][:category_ids])\n @report = Report.create(report_params)\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, locat... | [
"0.71632844",
"0.6835236",
"0.6676635",
"0.65530646",
"0.62057257",
"0.61680365",
"0.61530703",
"0.61399466",
"0.6134969",
"0.6064355",
"0.6040536",
"0.60285145",
"0.60201204",
"0.6004251",
"0.5978351",
"0.5977586",
"0.5956946",
"0.5953878",
"0.5950367",
"0.5921445",
"0.59162... | 0.64860684 | 4 |
PATCH/PUT /reporting_categories/1 PATCH/PUT /reporting_categories/1.json | def update
if @reporting_category.update(reporting_category_params)
flash[:success] = 'Reporting Category was successfully updated.'
redirect_to :back
else
flash[:danger] = 'Reporting Category was not updated.'
redirect_to :back
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n add_parent_categories (params[:report][:category_ids])\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n ... | [
"0.69092566",
"0.6683525",
"0.6618643",
"0.6589052",
"0.6257039",
"0.61361367",
"0.6124573",
"0.6070492",
"0.60173005",
"0.6012181",
"0.6011022",
"0.598765",
"0.59865373",
"0.5967253",
"0.59653056",
"0.59648395",
"0.59444755",
"0.5928659",
"0.59253836",
"0.59076846",
"0.59033... | 0.6164364 | 5 |
DELETE /reporting_categories/1 DELETE /reporting_categories/1.json | def destroy
@reporting_category.destroy
flash[:success] = 'Reporting Category was successfully deleted.'
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cate... | [
"0.73778576",
"0.72096485",
"0.7149301",
"0.7065282",
"0.70034885",
"0.6852976",
"0.6849009",
"0.68102765",
"0.6805457",
"0.67946017",
"0.67882186",
"0.67525446",
"0.67490476",
"0.6744278",
"0.6741546",
"0.6737463",
"0.67344594",
"0.6731378",
"0.67243016",
"0.6722433",
"0.670... | 0.70283705 | 4 |
Use callbacks to share common setup or constraints between actions. | def js_request?
request.format.js?
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 reporting_category_params
params.require(:reporting_category).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 |
GET /mod_messages GET /mod_messages.json | def index
@mod_messages = ModMessage.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @mod_messages }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messages\n get_json('messages.json')\n end",
"def show\n @mod_message = ModMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mod_message }\n end\n end",
"def new\n @mod_message = ModMessage.new\n\n respond_to d... | [
"0.7580248",
"0.72217095",
"0.7016143",
"0.69513845",
"0.6635933",
"0.6617776",
"0.6604306",
"0.65923697",
"0.6585456",
"0.656965",
"0.65664405",
"0.65664405",
"0.654273",
"0.6539487",
"0.647037",
"0.64681476",
"0.6447369",
"0.6445072",
"0.6443967",
"0.6433591",
"0.6378542",
... | 0.7536759 | 1 |
GET /mod_messages/1 GET /mod_messages/1.json | def show
@mod_message = ModMessage.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @mod_message }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mod_messages = ModMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mod_messages }\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def new\n @mod_message = ModMessage.new\n\n respond_to do |format|... | [
"0.7616136",
"0.73637354",
"0.7080351",
"0.6758016",
"0.6746612",
"0.6725054",
"0.669923",
"0.669923",
"0.66970503",
"0.6675573",
"0.6627234",
"0.6617587",
"0.6609818",
"0.6596235",
"0.6595481",
"0.6575982",
"0.6568527",
"0.65600085",
"0.6534446",
"0.65245306",
"0.65107226",
... | 0.74397904 | 1 |
GET /mod_messages/new GET /mod_messages/new.json | def new
@mod_message = ModMessage.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @mod_message }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # we don't want to use /messages/new, always use root path /\n flash.keep and redirect_to root_path and return unless request.fullpath == root_path\n\n @message = Message.new\n @show_editable_fields = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { re... | [
"0.7758569",
"0.7743522",
"0.7734373",
"0.7734373",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"0.7728112",
"... | 0.8325608 | 0 |
POST /mod_messages POST /mod_messages.json | def create
@mod_message = ModMessage.new(params[:mod_message])
respond_to do |format|
if @mod_message.save
format.html { redirect_to @mod_message, notice: 'Mod message was successfully created.' }
format.json { render json: @mod_message, status: :created, location: @mod_message }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mod_message = ModMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mod_message }\n end\n end",
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def message(user, text)\n post('/direct_message... | [
"0.65512776",
"0.6498477",
"0.6413694",
"0.6413694",
"0.6377169",
"0.6364028",
"0.63638574",
"0.62654704",
"0.62617874",
"0.62490374",
"0.62334794",
"0.62149346",
"0.6200449",
"0.61776173",
"0.61752355",
"0.6139759",
"0.6137173",
"0.6115795",
"0.6113692",
"0.6111133",
"0.6097... | 0.70253515 | 0 |
PUT /mod_messages/1 PUT /mod_messages/1.json | def update
@mod_message = ModMessage.find(params[:id])
respond_to do |format|
if @mod_message.update_attributes(params[:mod_message])
format.html { redirect_to @mod_message, notice: 'Mod message was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @message.update(message_params)\n render... | [
"0.69102806",
"0.6800975",
"0.67954606",
"0.67820597",
"0.6754472",
"0.67105424",
"0.66919816",
"0.6614237",
"0.66034955",
"0.6572633",
"0.6572432",
"0.6572432",
"0.656473",
"0.6554712",
"0.65489084",
"0.65144336",
"0.65141314",
"0.6510682",
"0.6510582",
"0.650762",
"0.649574... | 0.7343907 | 0 |
DELETE /mod_messages/1 DELETE /mod_messages/1.json | def destroy
@mod_message = ModMessage.find(params[:id])
@mod_message.destroy
respond_to do |format|
format.html { redirect_to mod_messages_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def destroy\n # delete a speci... | [
"0.7511334",
"0.74518275",
"0.7353963",
"0.72840494",
"0.71938914",
"0.71330386",
"0.7082072",
"0.7075519",
"0.7057461",
"0.70537484",
"0.704549",
"0.7031444",
"0.70201015",
"0.70170957",
"0.6995798",
"0.69915104",
"0.69848824",
"0.69848824",
"0.69688946",
"0.69628173",
"0.69... | 0.77781075 | 0 |
FIXME: What happens on transaction abort? | def save
DB.transaction do
DB[self.class.name] ||= {}
DB[self.class.name][name] = self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def within_transaction; end",
"def within_transaction; end",
"def abort_transaction\n return System.abort_transaction\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def rollback; end",
... | [
"0.7795123",
"0.7795123",
"0.7450236",
"0.7450236",
"0.7292472",
"0.7276829",
"0.7276829",
"0.7276829",
"0.7201911",
"0.7201911",
"0.7201911",
"0.7201911",
"0.7201911",
"0.7158647",
"0.7158647",
"0.71516263",
"0.71516263",
"0.7148883",
"0.71052337",
"0.6981309",
"0.6981309",
... | 0.0 | -1 |
JSON resources usually have camelCase field names Want the methods on our resources to be snake_case | def format_keys(resource)
resource.keys.reduce({}) do |memo, key|
value = resource[key]
formatted_key = Ubw::Util.snakify(key)
formatted_key << '?' if !!value == value # Add a ? to the key if value is a Boolean
memo[formatted_key] = value
memo
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_camelcase_keys\n json_data.mappable!\n end",
"def resource_base_name\n 'JSON'\n end",
"def downcase_keys(json)\n json.gsub(/\"\\w+\":/) { |m| m.downcase }\n end",
"def jsonapi_type\n controller_name.dasherize\n end",
"def jsonapi_inflector\n ActiveSupport::... | [
"0.68633527",
"0.6638986",
"0.61821365",
"0.6176389",
"0.6075965",
"0.6030114",
"0.5965802",
"0.5923914",
"0.5910904",
"0.58949107",
"0.5891282",
"0.5783769",
"0.57193804",
"0.5712523",
"0.57075906",
"0.5685387",
"0.56836903",
"0.56579834",
"0.5654841",
"0.56263626",
"0.55978... | 0.0 | -1 |
GET /index GET /index.json | def index
@boxes = Box.by_filter(params.slice(:gender, :size)).active.page(params[:page]).per(12)
@charity = Charity.where(:status => "active").first
respond_to do |format|
format.html # index.html.erb
format.json { render json: @boxes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n get('')\n end",
"def index\n respond_to do |format|\n format.html {index_html}\n format.json {index_json}\n end\n end",
"def index\n get\n end",
"def index\n\t\trespond_to do |format|\n\t\t\tformat.html {html_index}\n\t\t\tformat.json {json_index}\n\t\tend\n\t... | [
"0.79493165",
"0.7847805",
"0.7726446",
"0.7687144",
"0.7279",
"0.72373414",
"0.72373414",
"0.72117543",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.71858627",
"0.... | 0.0 | -1 |
GET /boxes/1 GET /boxes/1.json | def show
@box = Box.find(params[:id])
@user = @box.user
respond_to do |format|
format.html # show.html.haml
format.json { render json: @box }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @box = Box.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @box }\n end\n end",
"def show\n @boxtype = Boxtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render j... | [
"0.7502414",
"0.71981156",
"0.70494217",
"0.68477297",
"0.68173265",
"0.6730506",
"0.66795444",
"0.6654223",
"0.6614578",
"0.66108817",
"0.66034377",
"0.6564673",
"0.64853114",
"0.6424952",
"0.6401306",
"0.6397845",
"0.6379324",
"0.62897474",
"0.6278802",
"0.6261006",
"0.6254... | 0.6943671 | 3 |
GET /boxes/new GET /boxes/new.json | def new
@box = Box.new
@box.items.build
respond_to do |format|
format.html # new.html.haml
format.json { render json: @box }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @box = Box.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @box }\n end\n end",
"def new\n @boxtype = Boxtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @boxtype }\n end\n end"... | [
"0.81703955",
"0.7921697",
"0.74618703",
"0.7307393",
"0.7181238",
"0.7061782",
"0.7006734",
"0.69866854",
"0.6947345",
"0.69465196",
"0.6937836",
"0.6849907",
"0.68058723",
"0.67820984",
"0.6741767",
"0.6705132",
"0.6697543",
"0.6646367",
"0.66153455",
"0.6599337",
"0.659095... | 0.7883601 | 2 |
POST /boxes POST /boxes.json | def create
@box = current_user.boxes.build(params[:box])
@box.status = 'draft'
respond_to do |format|
if current_user.address.blank?
flash[:notice] = "Please provide your address before posting a box"
format.html { redirect_to new_box_path }
format.json { render :json => {:edi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @box = Box.new(params[:box])\n\n respond_to do |format|\n if @box.save\n format.html { redirect_to @box, notice: 'Box was successfully created.' }\n format.json { render json: @box, status: :created, location: @box }\n else\n format.html { render action: \"new\" }\... | [
"0.71522236",
"0.71137536",
"0.68121517",
"0.65206623",
"0.6518912",
"0.64476407",
"0.641001",
"0.64029264",
"0.6361334",
"0.6329432",
"0.6327873",
"0.62240046",
"0.6178305",
"0.61443985",
"0.61362094",
"0.6023038",
"0.6016162",
"0.5950746",
"0.5937082",
"0.592858",
"0.589969... | 0.731798 | 0 |
PUT /boxes/1 PUT /boxes/1.json | def update
@box = Box.find(params[:id])
authorize! :edit, @box
respond_to do |format|
@box.update_attributes(params[:box])
@box.status = 'active'
if @box.save
format.html { redirect_to @box, notice: 'Box was successfully updated.' }
format.json { head :no_content }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n format.html { redirect_to @box, notice: 'Box was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format... | [
"0.7204833",
"0.6962075",
"0.66981435",
"0.66919404",
"0.65905523",
"0.6511471",
"0.65062803",
"0.65001374",
"0.65001374",
"0.65001374",
"0.6499588",
"0.64823693",
"0.63675815",
"0.63675725",
"0.62908536",
"0.62751335",
"0.6260555",
"0.62436324",
"0.62014985",
"0.61812955",
"... | 0.6800304 | 2 |
DELETE /boxes/1 DELETE /boxes/1.json | def destroy
@box = Box.find(params[:id])
authorize! :destroy, @box
@box.destroy
respond_to do |format|
format.html { redirect_to boxes_url }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @box = Box.find(params[:id])\n @box.destroy\n\n respond_to do |format|\n format.html { redirect_to boxes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @boxtype = Boxtype.find(params[:id])\n @boxtype.destroy\n\n respond_to do |format|\n format.htm... | [
"0.7871736",
"0.7485024",
"0.74170303",
"0.708809",
"0.7003376",
"0.6992994",
"0.6977591",
"0.69309264",
"0.68770933",
"0.68277895",
"0.6706392",
"0.66974425",
"0.6690753",
"0.66843927",
"0.6673746",
"0.6671072",
"0.6626779",
"0.66021866",
"0.6600097",
"0.657308",
"0.6571335"... | 0.7014086 | 4 |
PUT /boxes/rate PUT /boxes/rate | def rate
@box = Box.find(params[:id])
raise CanCan::AccessDenied unless @box.ordered_by?(current_user)
@box.update_attributes(params[:box])
flash[:alert] = "You must provide a rating between 1 and 5" if params[:box][:rating].blank?
respond_to do |format|
if @box.save
format.html { red... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to @rate, notice: 'Rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.5967321",
"0.59668565",
"0.59668565",
"0.5964175",
"0.5929234",
"0.5926754",
"0.5868999",
"0.583515",
"0.5763242",
"0.57168335",
"0.5676157",
"0.56580436",
"0.565079",
"0.56201905",
"0.56201905",
"0.56201905",
"0.5597403",
"0.5596251",
"0.5596251",
"0.5596251",
"0.5596251"... | 0.7099622 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_workflow
@workflow = Workflow.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 workflow_params
params.fetch(:workflow, {})
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 |
Dispatch the provided messages to the server. If the last message requires a response a reply will be returned. | def dispatch(messages)
with_connection do |connection|
connection.write(messages)
connection.read if messages.last.replyable?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispat... | [
"0.6969238",
"0.66883886",
"0.652009",
"0.6503406",
"0.6495812",
"0.6176541",
"0.6171574",
"0.605972",
"0.6022964",
"0.59687465",
"0.5948404",
"0.5927617",
"0.5913612",
"0.5842683",
"0.5817775",
"0.5758856",
"0.5757629",
"0.5752177",
"0.5716207",
"0.5698979",
"0.5689302",
"... | 0.7717075 | 0 |
Get the refresh interval for the server. This will be defined via an option or will default to 5. | def refresh_interval
@refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_timeout\n @refresh_timeout ||= (options[:timeout] || 5)\n end",
"def interval\n (self['resque.interval'] || 5).to_i\n end",
"def refresh=(value)\n conf['dashboard']['refresh'] = value.to_i\n end",
"def retry_interval\n @options[:retry_interval]\n end",
"d... | [
"0.7191789",
"0.669822",
"0.66190714",
"0.6508581",
"0.6437684",
"0.6354496",
"0.6323895",
"0.6310487",
"0.6274693",
"0.6169956",
"0.61604434",
"0.60650355",
"0.6034648",
"0.60166466",
"0.59933305",
"0.59167236",
"0.5893358",
"0.5893358",
"0.58923435",
"0.58643454",
"0.580935... | 0.80906487 | 2 |
methods described_classsendable method names | def class_implements(*methods)
methods.each do |method|
it("implements .#{method}") { described_class.should respond_to(method) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods() end",
"def instance_methods; end",
"def getter_method_names; end",
"def method_missing(meth, *args, &block)\n __describe_and_send__(meth, *args, &block)\n end",
"def method_names\n bindings.collec... | [
"0.6569677",
"0.6569677",
"0.6569677",
"0.6569677",
"0.6526174",
"0.6490101",
"0.645482",
"0.64074904",
"0.6404403",
"0.633954",
"0.62492824",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"0.6239685",
"... | 0.0 | -1 |
fields a Hash of sample assignment values that should be persisted after a save and reload. The key is an attribute name, and the value is both the assigned value and the expected value of the attribute after a save and reload. | def persists(fields = {})
it('saves') { subject.should respond_to(:save) }
fields.each_pair do |field, valid_value|
it("persists #{field}") do
subject.send :"#{field}=", valid_value
subject.save
subject.reload.send(field).should == valid_value
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_attributes\n { :val_1 => 1.1,\n :val_2 => 2.2,\n :val_3 => 3.3,\n :val_4 => 4.4,\n :notes => \"hi\"\n }\n end",
"def store_initial_values\n attributes.each do |attribute|\n next if attribute_values.key?(attribute)\n attribute_values[attribute] = subje... | [
"0.60663414",
"0.6062034",
"0.58581996",
"0.5839581",
"0.5839581",
"0.5839581",
"0.5824802",
"0.5643353",
"0.5639039",
"0.55719095",
"0.55618984",
"0.5552141",
"0.5538582",
"0.5532749",
"0.55322486",
"0.54534954",
"0.54357576",
"0.5432878",
"0.5417879",
"0.5405299",
"0.539319... | 0.5198847 | 51 |
Verifies that the subject receives := for each field when calling subject.() | def sets(*args)
params = args.extract_options!
m = params[:method]
p = params[:params].is_a?(Enumerable) ? params[:params] : [params[:params]]
args.each do |field|
it "sets the #{field}" do
subject.should_receive(:"#{field}=")
subject.send(:"#{m}", *p)
end
it "assigns... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_required_properties_set!; end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def clean\n self.subject =... | [
"0.57437366",
"0.5674075",
"0.5674075",
"0.5674075",
"0.5674075",
"0.5674075",
"0.5674075",
"0.5674075",
"0.5674075",
"0.5644604",
"0.5636296",
"0.56184566",
"0.5603535",
"0.5583491",
"0.5371104",
"0.5355716",
"0.5337386",
"0.5327402",
"0.5260385",
"0.5257127",
"0.52536076",
... | 0.55208635 | 14 |
GET /formularies GET /formularies.json | def index
if current_user.role_id == Rails.configuration.admin_role
@formularies = Formulary.select('formularies.*, formulary_profiles.name, users.email').joins(:formulary_profile, :user).load.page(params[:page]).per(Rails.configuration.per_page)
else
@formularies = Formulary.select('formularies.*, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { re... | [
"0.76327485",
"0.6854547",
"0.6504635",
"0.6421119",
"0.63911283",
"0.63354975",
"0.6306649",
"0.6175093",
"0.6137292",
"0.6133882",
"0.61142886",
"0.6114217",
"0.6069193",
"0.60650223",
"0.6064697",
"0.6059404",
"0.6057504",
"0.60444814",
"0.60400695",
"0.6018408",
"0.591875... | 0.0 | -1 |
GET /formularies/1 GET /formularies/1.json | def show
unless @formulary.user_id == current_user.id
check_user_ability
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { re... | [
"0.76360327",
"0.69512045",
"0.66616464",
"0.65730894",
"0.65645826",
"0.6547438",
"0.65275085",
"0.64597595",
"0.6431998",
"0.6427133",
"0.6346632",
"0.6339653",
"0.63157666",
"0.631389",
"0.625532",
"0.6236994",
"0.6214761",
"0.6212439",
"0.61926436",
"0.6174774",
"0.616825... | 0.0 | -1 |
POST /formularies POST /formularies.json | def create
@formulary = Formulary.new(formulary_params)
@formulary.user_id = current_user.id
respond_to do |format|
if @formulary.save
format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.created') }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_... | [
"0.6384448",
"0.6322881",
"0.61478",
"0.61131555",
"0.5831767",
"0.5761718",
"0.5747925",
"0.57271045",
"0.5689084",
"0.56352425",
"0.559565",
"0.5589256",
"0.5581747",
"0.55678475",
"0.55670905",
"0.55594844",
"0.5554934",
"0.55511993",
"0.5538715",
"0.5508129",
"0.54549026"... | 0.5670829 | 9 |
PATCH/PUT /formularies/1 PATCH/PUT /formularies/1.json | def update
respond_to do |format|
if @formulary.update(formulary_params)
format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }
format.json { head :no_content }
else
format.html { render action: 'edit'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.htm... | [
"0.642526",
"0.62606764",
"0.624066",
"0.6206058",
"0.6206058",
"0.60907274",
"0.60352427",
"0.6016543",
"0.59926826",
"0.59764284",
"0.5959964",
"0.59478694",
"0.59434897",
"0.5941055",
"0.593623",
"0.59288204",
"0.592771",
"0.5921987",
"0.5916878",
"0.59040374",
"0.59037626... | 0.6751584 | 0 |
DELETE /formularies/1 DELETE /formularies/1.json | def destroy
if @formulary.user_id == current_user.id
@formulary.destroy
respond_to do |format|
format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.deleted') }
format.json { head :no_content }
end
else
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @form1.destroy\n respond_to do |format|\n format.html { redirect_t... | [
"0.76085484",
"0.7269887",
"0.72249776",
"0.7219131",
"0.7215576",
"0.7187515",
"0.7138239",
"0.71350217",
"0.71253955",
"0.70532125",
"0.7041117",
"0.7010948",
"0.70061773",
"0.6971323",
"0.69713175",
"0.6963506",
"0.6914537",
"0.68751377",
"0.6862656",
"0.68578374",
"0.6852... | 0.71131265 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_formulary
@formulary = Formulary.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 formulary_params
params.require(:formulary)
.permit(
:user_id,
:formulary_profile_attributes => [:id, :formulary_id, :name, :project_begins, :project_ends, :region, :institution, :mining, :pesticide, :occupational_health, :community_paticipation, :watershed_management, ... | {
"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 |
we will feed some random data since we don't really care about truthness | def get_random_span(from, to)
rand(to - from) + from
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random\n result = [true, false].sample\nend",
"def random\n result = [true, false].sample\n result\nend",
"def random\n result = [true, false].sample\n result\nend",
"def random\n result = [true, false].sample\n result\nend",
"def random\n return [true, false].sample\nend",
"def random\n [tru... | [
"0.7107409",
"0.69864255",
"0.69864255",
"0.69864255",
"0.69474125",
"0.686463",
"0.686463",
"0.686463",
"0.6856424",
"0.6700221",
"0.66930896",
"0.6652967",
"0.66465086",
"0.65546966",
"0.65411484",
"0.65411484",
"0.65411484",
"0.64717346",
"0.64366686",
"0.64263946",
"0.641... | 0.0 | -1 |
dependency should match the name of the dependency yaml file in buildpacksci, binarybuilds branch | def initialize(dependency, new_releases_dir, binary_builds_dir, options = {})
@dependency = dependency
@new_releases_dir = new_releases_dir
@binary_builds_dir = binary_builds_dir
@options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meets_pods_project_source_dependency(source_filename, dependent_source_filename)\n has_pods_project_source_file(source_filename) ? has_pods_project_source_file(dependent_source_filename) : true\nend",
"def meets_pods_project_source_dependency(source_filename, dependent_source_filename)\n has_pods_project_s... | [
"0.6368956",
"0.6368956",
"0.6110469",
"0.6091853",
"0.6051041",
"0.5995844",
"0.5995844",
"0.58616686",
"0.58585143",
"0.58575445",
"0.58488065",
"0.58241016",
"0.57967407",
"0.5791517",
"0.5783505",
"0.576823",
"0.576823",
"0.5758872",
"0.5756768",
"0.5748892",
"0.5745063",... | 0.52593607 | 73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.