query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Get workers for image | def workers_for_image(path)
@workers_by_format[ImagePath.new(path).format]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workers_for_image(path)\n @workers_by_format[Path.convert(path).image_format]\n end",
"def workers\r\n @workers ||= []\r\n end",
"def workers\n if known?\n @workers\n else\n know heroku_get_workers\n end\n end",
"def workers\n @@workers ||= []\n end",
"de... | [
"0.775535",
"0.70451385",
"0.67590994",
"0.65343964",
"0.6477102",
"0.6402222",
"0.636424",
"0.62838197",
"0.6255335",
"0.6144404",
"0.60768616",
"0.60768616",
"0.6005684",
"0.5994892",
"0.5903826",
"0.58353275",
"0.5802939",
"0.5778444",
"0.5773191",
"0.5769697",
"0.5765234"... | 0.80580384 | 1 |
pay for an expense | def pay
@group = Group.find(params[:group_id])
@gexpense = Gexpense.find(params[:gexpense_id])
@member_expense = MemberExpense.find(params[:id])
@member_expense.update_attribute(:paid, true)
redirect_to request.referer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sell_at_any_cost(percent_decrease = 0.3)\n market_name = @market_name\n open_orders_url = get_url({ :api_type => \"market\", :action => \"open_orders\", :market => market_name })\n open_orders = call_secret_api(open_orders_url)\n #cancel all orders\n if open_orders.size > 0\n open_orders.each d... | [
"0.67751724",
"0.6688874",
"0.6603707",
"0.65652484",
"0.6536424",
"0.65258384",
"0.6479166",
"0.6443384",
"0.6443329",
"0.63481647",
"0.63456535",
"0.6323564",
"0.6309448",
"0.6303119",
"0.63005984",
"0.6292535",
"0.6288088",
"0.6288088",
"0.62750447",
"0.62258655",
"0.61872... | 0.6844418 | 0 |
Call the specified block passing tickers, it uses websocket | def listen_ticker(pair="BTCUSD", &block)
raise BlockMissingError unless block_given?
register_channel pair: pair, channel: "ticker", &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currencies(&blk)\n if block_given?\n websocket.subscribe :getcurrencies, &blk\n else\n http.get :getcurrencies\n end\n end",
"def execute_action(tubesock, block)\n begin\n # Execute block\n block.call\n rescue Exception => e\n # Log the... | [
"0.6266247",
"0.5962366",
"0.5946226",
"0.5891915",
"0.58505344",
"0.57507896",
"0.57465214",
"0.57025737",
"0.5692563",
"0.5692563",
"0.5692563",
"0.56445813",
"0.56443554",
"0.5623738",
"0.55874294",
"0.5578288",
"0.55475724",
"0.5491089",
"0.54773587",
"0.5454832",
"0.5421... | 0.6260305 | 1 |
::= KW_ELSE_IF L_PARANTH R_PARANTH | def parse_else_if_header
expect(:KW_ELSE_IF)
expect(:L_PARANTH)
cond = parse_expression
expect(:R_PARANTH)
cond
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def k_if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n\n\n\n type = K_IF\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 397:4: ( 'if' | 'when' )\n ... | [
"0.5920966",
"0.59008265",
"0.58194447",
"0.56824636",
"0.5659287",
"0.5627402",
"0.5571119",
"0.5571119",
"0.5547056",
"0.5543127",
"0.551833",
"0.5492725",
"0.54776794",
"0.54625237",
"0.53954214",
"0.5344238",
"0.53402555",
"0.5328973",
"0.53183",
"0.5267236",
"0.5267236",... | 0.71917933 | 0 |
::= LIT_INT | LIT_FLOAT | def parse_numeric_constant
if peek?(:LIT_INT)
ExprInt.new(expect(:LIT_INT))
else
ExprFloat.new(expect(:LIT_FLOAT))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integer?\n @kind == :integer_lit || @kind == :integer_exp_lit || @kind == :hex_lit || @kind == :bin_lit\n end",
"def itof(int, type, signed=true)\n val = Convert(int, :integer)\n type = LLVM::Script::Validate(type, :type)\n if signed\n @builder.si2fp(val, type)\n else... | [
"0.62954164",
"0.6150311",
"0.61205107",
"0.61074245",
"0.6096294",
"0.6048602",
"0.6027325",
"0.601131",
"0.5971841",
"0.5968325",
"0.59441686",
"0.59413105",
"0.5938971",
"0.590867",
"0.5824825",
"0.58104455",
"0.5800305",
"0.57768285",
"0.57626694",
"0.57379925",
"0.572270... | 0.66589266 | 0 |
looks for `scaleway` keyword in kernel command line | def has_scaleway_cmdline?
if file_exist?("/proc/cmdline") && file_read("/proc/cmdline").include?("scaleway")
logger.trace("Plugin Scaleway: has_scaleway_cmdline? == true")
return true
end
logger.trace("Plugin Scaleway: has_scaleway_cmdline? == false")
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def looks_like_scaleway?\n return true if hint?(\"scaleway\")\n return true if has_scaleway_cmdline? && can_socket_connect?(Ohai::Mixin::ScalewayMetadata::SCALEWAY_METADATA_ADDR, 80)\n\n false\n end",
"def ctrlMapScale _args\n \"ctrlMapScale _args;\" \n end",
"def ctrlScale _args\n \"ctr... | [
"0.65302163",
"0.5865534",
"0.5566145",
"0.52079463",
"0.51190007",
"0.5094323",
"0.4995106",
"0.49865115",
"0.48756528",
"0.47792915",
"0.47789696",
"0.47772342",
"0.47286475",
"0.4723276",
"0.4723066",
"0.47206545",
"0.46817",
"0.46816248",
"0.46377254",
"0.4637258",
"0.463... | 0.6197639 | 1 |
GET /qrcodes/1 GET /qrcodes/1.json | def show
@qrcode = Qrcode.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @qrcode }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_qrcodes\n @collection = Collection.find(params[:collection_id])\n @qrcodes = @collection.qrcodes\n respond_to do |format|\n format.html\n format.json { render json: [@collections, @qrcodes] }\n end\n end",
"def new\n @qrcode = Qrcode.new\n\n respond_to do |format|\n form... | [
"0.7723788",
"0.69533986",
"0.69113314",
"0.69058603",
"0.6852271",
"0.68074214",
"0.6698496",
"0.66318893",
"0.64716285",
"0.6429263",
"0.6411466",
"0.64038724",
"0.6396578",
"0.63904023",
"0.6386356",
"0.63857627",
"0.63323236",
"0.629623",
"0.62817985",
"0.6135043",
"0.612... | 0.7426767 | 1 |
GET /qrcodes/new GET /qrcodes/new.json | def new
@qrcode = Qrcode.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @qrcode }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @qrcode = Qrcode.new\n @quests= Quest.find_all_by_userid(current_user)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qrcode }\n end\n end",
"def create\n @qrcode = Qrcode.new(params[:qrcode])\n\n respond_to do |format|\n if @qrcode... | [
"0.73756915",
"0.73620415",
"0.7039016",
"0.6963035",
"0.69578063",
"0.6902514",
"0.68514246",
"0.6784027",
"0.675014",
"0.67052376",
"0.6668776",
"0.666442",
"0.65673745",
"0.65521264",
"0.6539872",
"0.6512652",
"0.64846367",
"0.64454746",
"0.643176",
"0.6387725",
"0.6380845... | 0.7943521 | 0 |
POST /qrcodes POST /qrcodes.json | def create
@qrcode = Qrcode.new(params[:qrcode])
respond_to do |format|
if @qrcode.save
format.html { redirect_to action: :index, notice: 'Qrcode was successfully created.' }
format.json { render json: @qrcode, status: :created, location: @qrcode }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @qr_code = QrCode.new(params[:qr_code])\n\n respond_to do |format|\n if @qr_code.save\n format.html { redirect_to(@qr_code, :notice => 'Qr code was successfully created.') }\n format.xml { render :xml => @qr_code, :status => :created, :location => @qr_code }\n else\n ... | [
"0.6882932",
"0.684261",
"0.66760176",
"0.65735656",
"0.64326525",
"0.63784814",
"0.63698685",
"0.636617",
"0.6315661",
"0.62856746",
"0.62460095",
"0.6231426",
"0.605467",
"0.6051921",
"0.60148084",
"0.59806925",
"0.59410304",
"0.59206957",
"0.5907139",
"0.58314484",
"0.5814... | 0.7298112 | 0 |
PUT /qrcodes/1 PUT /qrcodes/1.json | def update
@qrcode = Qrcode.find(params[:id])
respond_to do |format|
if @qrcode.update_attributes(params[:qrcode])
format.html { redirect_to action: :index, notice: 'Qrcode was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @qrcode = Qrcode.find(params[:id])\n\n respond_to do |format|\n if @qrcode.update_attributes(params[:qrcode])\n format.html { redirect_to @qrcode, notice: 'Qrcode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.72167844",
"0.6822033",
"0.62909347",
"0.62164843",
"0.6061056",
"0.600156",
"0.5938708",
"0.59223825",
"0.58954227",
"0.5807229",
"0.58017766",
"0.5733656",
"0.5717356",
"0.56948745",
"0.5687398",
"0.567053",
"0.5657182",
"0.56566954",
"0.5640772",
"0.56297606",
"0.561018... | 0.7229254 | 0 |
DELETE /qrcodes/1 DELETE /qrcodes/1.json | def destroy
@qrcode = Qrcode.find(params[:id])
@qrcode.destroy
respond_to do |format|
format.html { redirect_to qrcodes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@qrcode = Qrcode.find(params[:id])\n #@qrcode.destroy\nQrcode.destroy(Qrcode.find(params[:id]))\n\n respond_to do |format|\n\t format.html #\n format.json { head :no_content }\n end\n end",
"def destroy\n @qr.destroy\n respond_to do |format|\n format.html { redirect_to... | [
"0.7563045",
"0.7349996",
"0.71203464",
"0.69046575",
"0.68494654",
"0.68327475",
"0.6830064",
"0.68138987",
"0.6780254",
"0.6737906",
"0.66715086",
"0.6650497",
"0.66347164",
"0.66155213",
"0.6613638",
"0.659083",
"0.656161",
"0.65545774",
"0.654817",
"0.6546274",
"0.6532494... | 0.79303116 | 0 |
POST /positions POST /positions.xml | def create
respond_to do |format|
if position.save
format.html { redirect_to( position, flash: { success: 'Position created.' } ) }
format.xml { render xml: position, status: :created, location: position }
else
format.html { render action: "new" }
format.xml { render xm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @position = Position.new(params[:position])\n \n respond_to do |format|\n if @position.save\n format.html { redirect_to(@position, :notice => 'Position was successfully created.') }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n ... | [
"0.6968086",
"0.6844047",
"0.66578025",
"0.66483974",
"0.6642075",
"0.66412973",
"0.66412973",
"0.6587157",
"0.6512084",
"0.6322979",
"0.63059",
"0.625105",
"0.6223546",
"0.61890554",
"0.6184882",
"0.6164848",
"0.61175",
"0.6078293",
"0.60696125",
"0.60637444",
"0.6058795",
... | 0.69860995 | 0 |
PUT /positions/1 PUT /positions/1.xml | def update
respond_to do |format|
if position.save
format.html { redirect_to( position, flash: { success: 'Position updated.' } ) }
format.xml { head :ok }
else
format.html { render action: "edit" }
format.xml { render xml: position.errors, status: :unprocessable_entity... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @position = Position.find(params[:id])\n \n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to(@position, :notice => 'Position was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { ren... | [
"0.6826851",
"0.6661184",
"0.66557485",
"0.6565608",
"0.6449132",
"0.6449132",
"0.6449132",
"0.6363004",
"0.62839264",
"0.623918",
"0.6173183",
"0.6142297",
"0.6131789",
"0.6075356",
"0.6067277",
"0.6002475",
"0.59488994",
"0.59434015",
"0.59368193",
"0.5926219",
"0.589969",
... | 0.690748 | 0 |
Function to know if the result of this host is an error [Returns] A boolean that indicates if the result for this host is an error or not. | def is_error?
return (self.status == HostResult::STATUS_ERROR)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error?\n @status == ERROR_FLAG\n end",
"def error?\n status[:error] || false\n end",
"def error?\n status == STATUS_ERROR\n end",
"def error?\n error.to_bool\n end",
"def error?\n get_last_error['err'] != nil\n end",
"def error?\n get_last_error['err'] != ... | [
"0.73728275",
"0.73405445",
"0.7266452",
"0.7235242",
"0.71877277",
"0.71877277",
"0.7180711",
"0.7180711",
"0.7137245",
"0.707418",
"0.70738256",
"0.704222",
"0.7018286",
"0.7013747",
"0.6970105",
"0.6964809",
"0.6962691",
"0.69598883",
"0.6948919",
"0.69353867",
"0.6931578"... | 0.8839668 | 0 |
Validation function to check the result, error and value fields during the save of a HostResult [Returns] A boolean that indicates if everything was valid or not. | def check_status
if (self.status == HostResult::STATUS_OK)
# A valid result must have a value.
if (self.value.blank?)
# Return an error if no value is present
errors.add(:value, 'valid result must have a value')
return false
else
# If the value is present, clean the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(result)\n log(result)\n\n true\n end",
"def validated?\n !@result.nil?\n end",
"def valid?\n !!result\n end",
"def check_rest_result_valid(json_result)\n \n\tdevice = Api::Device.find_by(mac_address: @device_given_attrs['mac_address'], serial_number: @device_given_att... | [
"0.7361433",
"0.6836226",
"0.6755131",
"0.6568905",
"0.65379035",
"0.6518379",
"0.64655995",
"0.6447491",
"0.6434622",
"0.6397801",
"0.6360171",
"0.6247532",
"0.62312543",
"0.62170374",
"0.6202806",
"0.6199242",
"0.61922526",
"0.6183648",
"0.617696",
"0.61588556",
"0.6138563"... | 0.76920706 | 0 |
Set the controls array that will be drawn SET | def controls=(controls)
@ctrFrames = 0
@ucControls = []
if (controls != nil)
for i in 0 .. controls.size-1
@ucControls[i] = controls[i]
@ucControls[i].active = @active
@ucControls[i].visible = @visible
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controls=(*controls)\n controls.flatten.each do |control|\n self.add_control control\n end\n end",
"def draw_controls()\n startControlPos = (@ctrFrames / self.timeout).to_i * self.number\n if (startControlPos >= @ucControls.size)\n @ctrFrames = 0\n startControlPos = 0\n ... | [
"0.67654836",
"0.64915556",
"0.63252026",
"0.60881996",
"0.6033323",
"0.59400046",
"0.5890967",
"0.58876526",
"0.58761346",
"0.58705604",
"0.57593733",
"0.57422435",
"0.5721501",
"0.57208484",
"0.5668551",
"0.56517667",
"0.56392336",
"0.5599455",
"0.5570097",
"0.54904616",
"0... | 0.71462494 | 0 |
Set of the user control visibility | def visible=(visible)
@visible = visible
for i in 0 .. @ucControls.size-1
@ucControls[i].visible = visible
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible=(vis)\n if vis\n show\n else\n hide\n end\n end",
"def visible=(visibility)\n end",
"def setVisible(visible=true)\n DOM.setVisible(@element, visible)\n end",
"def visible=(bool)\n make_visible !!bool\n end",
"def visible=(visible)\n @v... | [
"0.74123544",
"0.7062997",
"0.7059563",
"0.6994438",
"0.6989306",
"0.69696873",
"0.69696873",
"0.68721",
"0.683458",
"0.68103814",
"0.6804023",
"0.67959535",
"0.67957485",
"0.675453",
"0.6745851",
"0.67452574",
"0.67219394",
"0.66369224",
"0.66369224",
"0.6616604",
"0.6599208... | 0.7325642 | 1 |
////////////////////////////////////////////////////////////////////////// Constructors ////////////////////////////////////////////////////////////////////////// Object Initialization rectControls : rectangle to position the controls controls : array containing the controls number : number of controls to show timeout ... | def initialize(rectControls, controls, number, timeout,
active=true, visible=true)
super(active, visible)
@rectControls = rectControls
@ctrFrames = 0
if controls != nil
self.controls = controls
end
@number = number
self.timeout = timeout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_controls()\n startControlPos = (@ctrFrames / self.timeout).to_i * self.number\n if (startControlPos >= @ucControls.size)\n @ctrFrames = 0\n startControlPos = 0\n end\n\n for i in startControlPos .. startControlPos + self.number-1\n if @ucControls[i] != nil\n draw_switchab... | [
"0.6513728",
"0.64407575",
"0.62825125",
"0.6159906",
"0.6159906",
"0.60745263",
"0.58544606",
"0.5839143",
"0.58371586",
"0.57835555",
"0.56327945",
"0.5609242",
"0.5569498",
"0.553569",
"0.553569",
"0.55329597",
"0.55210227",
"0.5450207",
"0.5441573",
"0.5370786",
"0.535039... | 0.80511004 | 0 |
////////////////////////////////////////////////////////////////////////// Public Methods ////////////////////////////////////////////////////////////////////////// Draw a batch of controls depending on the number to show | def draw()
draw_controls()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_controls()\n startControlPos = (@ctrFrames / self.timeout).to_i * self.number\n if (startControlPos >= @ucControls.size)\n @ctrFrames = 0\n startControlPos = 0\n end\n\n for i in startControlPos .. startControlPos + self.number-1\n if @ucControls[i] != nil\n draw_switchab... | [
"0.7188437",
"0.62111866",
"0.6122365",
"0.6051688",
"0.6003523",
"0.5990429",
"0.59260076",
"0.5862146",
"0.5845644",
"0.578309",
"0.5757147",
"0.57455105",
"0.5735612",
"0.5694313",
"0.5679385",
"0.56589735",
"0.5643518",
"0.5643509",
"0.559502",
"0.5571622",
"0.55714583",
... | 0.67085266 | 1 |
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Draw controls | def draw_controls()
startControlPos = (@ctrFrames / self.timeout).to_i * self.number
if (startControlPos >= @ucControls.size)
@ctrFrames = 0
startControlPos = 0
end
for i in startControlPos .. startControlPos + self.number-1
if @ucControls[i] != nil
draw_switchable(@ucControls... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw()\n draw_controls()\n end",
"def draw()\n @cLabel.draw()\n @cValue.draw()\n end",
"def draw\n @buttonLogin.draw\n @buttonClassicAI.draw\n @buttonOttoAI.draw\n @buttonHelp.draw\n\n @buttonHelpLogin.draw\n @buttonHelpClassicAI.draw\n @buttonHelpOttoAI.draw\n... | [
"0.82919574",
"0.6644041",
"0.65423524",
"0.65352625",
"0.6513636",
"0.6437586",
"0.6437586",
"0.6437586",
"0.6437586",
"0.6436579",
"0.64046246",
"0.6403173",
"0.6383399",
"0.63702554",
"0.63477665",
"0.6333135",
"0.63245016",
"0.63172823",
"0.6316176",
"0.63032556",
"0.6303... | 0.72851026 | 1 |
Draw the control (contents are defined by the subclasses) control : control to draw index : index to position the control | def draw_switchable(control, index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw()\n draw_controls()\n end",
"def draw_controls()\n startControlPos = (@ctrFrames / self.timeout).to_i * self.number\n if (startControlPos >= @ucControls.size)\n @ctrFrames = 0\n startControlPos = 0\n end\n\n for i in startControlPos .. startControlPos + self.number-1\n if ... | [
"0.6697772",
"0.6355447",
"0.6275354",
"0.620543",
"0.6171335",
"0.6118641",
"0.61172336",
"0.6103762",
"0.6067699",
"0.6052879",
"0.60339516",
"0.59749156",
"0.5951961",
"0.5917702",
"0.5911551",
"0.5810709",
"0.5810709",
"0.5798502",
"0.57910365",
"0.5776677",
"0.5743049",
... | 0.67364824 | 0 |
Return the size of the connection pool | def pool_size
@pool.pool_size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n @pool.size\n end",
"def current_pool_size(pool_name)\n pool(pool_name).count\n end",
"def size\n @pool_mutex.synchronize { @pool.size } \n end",
"def length\n @executor.getPoolSize\n end",
"def _size\n @allocated.length + @available_connections.length\n end",... | [
"0.8389977",
"0.8308885",
"0.80855346",
"0.79738456",
"0.75005805",
"0.74935335",
"0.7483879",
"0.74669284",
"0.7463033",
"0.74446726",
"0.74446726",
"0.74131644",
"0.736215",
"0.73041606",
"0.7296415",
"0.72348535",
"0.7204587",
"0.7084416",
"0.7084416",
"0.70752186",
"0.701... | 0.8769907 | 0 |
Makes a request per +req+. If +req+ is nil a Net::HTTP::Get is performed against +default_path+. If a block is passed request behaves like Net::HTTPrequest (the body of the response will not have been read). +req+ must be a Net::HTTPRequest subclass (see Net::HTTP for a list). If there is an error and the request is id... | def request(req = nil, options = {}, &block)
@pool.with_connection do |connection|
begin
connection.request req, options, &block
rescue Exception => e
@pool.remove(connection)
raise
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request(req)\n if opts[:retry_connections]\n request_with_timeout(req)\n else\n request_without_timeout(req)\n end\n end",
"def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n\n if NetRecorder.recording?\n s... | [
"0.6905851",
"0.6648386",
"0.66224545",
"0.6308925",
"0.6247317",
"0.6223271",
"0.6174452",
"0.6140528",
"0.6075388",
"0.60344183",
"0.6027762",
"0.5999722",
"0.59659904",
"0.5907429",
"0.586208",
"0.58308977",
"0.5822206",
"0.5801685",
"0.57560843",
"0.57337534",
"0.5694605"... | 0.6839027 | 1 |
peruser NGINX config path | def config_path
NginxStage.pun_config_path(user: user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conf\n home.join('nginx.conf')\n end",
"def config_nginx(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n first_port = app_config[:port0]\n\n # Can be specified as comma-separated string or array.\n if app_config[:dns_name].respond_to? :to_str\n ... | [
"0.75633955",
"0.7188769",
"0.7169731",
"0.6465299",
"0.6444059",
"0.6210691",
"0.61722475",
"0.6154809",
"0.6042072",
"0.58839625",
"0.5819865",
"0.57538104",
"0.5703524",
"0.5697195",
"0.56413496",
"0.56311584",
"0.5608235",
"0.5535326",
"0.54866755",
"0.54866755",
"0.54628... | 0.7349639 | 1 |
GET /RiGse/expectation_stems/1 GET /RiGse/expectation_stems/1.xml | def show
@expectation_stem = RiGse::ExpectationStem.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @expectation_stem }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @expectation = RiGse::Expectation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expectation }\n end\n end",
"def new\n @expectation_stem = RiGse::ExpectationStem.new\n\n respond_to do |format|\n format.html # n... | [
"0.677889",
"0.6350808",
"0.5975865",
"0.59706724",
"0.5790006",
"0.5787881",
"0.5770658",
"0.57660437",
"0.5747295",
"0.57369995",
"0.57368803",
"0.55696344",
"0.5541799",
"0.55340207",
"0.5532906",
"0.5511701",
"0.550651",
"0.54956305",
"0.5468333",
"0.5467415",
"0.54346776... | 0.6837756 | 0 |
GET /RiGse/expectation_stems/new GET /RiGse/expectation_stems/new.xml | def new
@expectation_stem = RiGse::ExpectationStem.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @expectation_stem }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @expectation = RiGse::Expectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expectation }\n end\n end",
"def new\n @expectation = Expectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {... | [
"0.7463623",
"0.6929699",
"0.6777516",
"0.661015",
"0.6598134",
"0.65090823",
"0.6464351",
"0.64479923",
"0.64098954",
"0.63988274",
"0.6396979",
"0.6376416",
"0.63683015",
"0.6340656",
"0.6324162",
"0.6323754",
"0.6315518",
"0.6306365",
"0.630289",
"0.6298573",
"0.6290581",
... | 0.74711204 | 0 |
POST /RiGse/expectation_stems POST /RiGse/expectation_stems.xml | def create
@expectation_stem = RiGse::ExpectationStem.new(params[:expectation_stem])
respond_to do |format|
if @expectation_stem.save
flash[:notice] = 'RiGse::ExpectationStem.was successfully created.'
format.html { redirect_to(@expectation_stem) }
format.xml { render :xml => @ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expectation = RiGse::Expectation.new(params[:expectation])\n\n respond_to do |format|\n if @expectation.save\n flash[:notice] = 'RiGse::Expectation.was successfully created.'\n format.html { redirect_to(@expectation) }\n format.xml { render :xml => @expectation, :stat... | [
"0.6843822",
"0.6128069",
"0.60839283",
"0.5880189",
"0.57756746",
"0.5696515",
"0.553565",
"0.54517573",
"0.5398139",
"0.53386736",
"0.532013",
"0.52601516",
"0.52014047",
"0.52008027",
"0.5189674",
"0.51735693",
"0.51046234",
"0.5097321",
"0.50916976",
"0.50811666",
"0.5064... | 0.66055447 | 1 |
PUT /RiGse/expectation_stems/1 PUT /RiGse/expectation_stems/1.xml | def update
@expectation_stem = RiGse::ExpectationStem.find(params[:id])
respond_to do |format|
if @expectation_stem.update_attributes(params[:expectation_stem])
flash[:notice] = 'RiGse::ExpectationStem.was successfully updated.'
format.html { redirect_to(@expectation_stem) }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @expectation = RiGse::Expectation.find(params[:id])\n\n respond_to do |format|\n if @expectation.update_attributes(params[:expectation])\n flash[:notice] = 'RiGse::Expectation.was successfully updated.'\n format.html { redirect_to(@expectation) }\n format.xml { head :o... | [
"0.672891",
"0.6572276",
"0.6290094",
"0.6163934",
"0.61085844",
"0.607222",
"0.5825806",
"0.5808394",
"0.58065504",
"0.5773718",
"0.57656246",
"0.57297623",
"0.571674",
"0.5694142",
"0.5665054",
"0.55464226",
"0.55322343",
"0.55210936",
"0.5503867",
"0.55008",
"0.54610306",
... | 0.6969947 | 0 |
DELETE /RiGse/expectation_stems/1 DELETE /RiGse/expectation_stems/1.xml | def destroy
@expectation_stem = RiGse::ExpectationStem.find(params[:id])
@expectation_stem.destroy
respond_to do |format|
format.html { redirect_to(expectation_stems_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @expectation = RiGse::Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectations_url) }\n format.xml { head :ok }\n end\n end",
"def delete_expectation\n orgId = params[:id].to_i\n expectationId = pa... | [
"0.7395989",
"0.6780177",
"0.6641823",
"0.6618266",
"0.654956",
"0.6460815",
"0.64184487",
"0.63947225",
"0.6334933",
"0.6270876",
"0.626586",
"0.6231006",
"0.6204725",
"0.62010455",
"0.61189055",
"0.61162406",
"0.6115345",
"0.61082006",
"0.61030585",
"0.6086335",
"0.6079053"... | 0.73111004 | 1 |
projects (id, title, category, funding_goal, start_date, end_date) VALUES (1, 'Help me buy a guitar', 'music', 500.00, '20130630', '20130730') | def selects_the_titles_and_amount_over_goal_of_all_projects_that_have_met_their_funding_goal
"SELECT projects.title, (sum(pledges.amount) - projects.funding_goal)
FROM projects
INNER JOIN pledges
ON projects.id = pledges.project_id
GROUP BY pledges.project_id
HAVING (sum(pledges.amount) >= projects.funding_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selects_the_titles_and_amount_over_goal_of_all_projects_that_have_met_their_funding_goal\n\"SELECT projects.title, (SUM(pledges.amount)-projects.funding_goal) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title HAVING (SUM(pledges.amount)) >= projects.funding_goal\";\n#... | [
"0.6738574",
"0.57322514",
"0.5522414",
"0.5466057",
"0.5437738",
"0.54263836",
"0.5404417",
"0.5372184",
"0.53718495",
"0.5351269",
"0.53372616",
"0.5290283",
"0.5286941",
"0.524603",
"0.5244977",
"0.522534",
"0.5219389",
"0.5218274",
"0.5208506",
"0.5205199",
"0.51966727",
... | 0.5816059 | 1 |
PUT to upload a wetsigned 526 form. Required if first ever claim for Veteran. | def upload_form_526
validate_document_provided
validate_documents_content_type
validate_documents_page_size
pending_claim = ClaimsApi::AutoEstablishedClaim.pending?(params[:id])
if pending_claim && (pending_claim.form_data['autoCestPDFGenerationDisabled'] == true)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aw_params\n params.require(:aw).permit(:file, :uploaded_file)\n end",
"def update\n @covenant_form.signature_date = Time.now\n respond_to do |format|\n if @covenant_form.update(covenant_form_params)\n format.html { redirect_to @covenant_form, notice: 'Covenant form was successfully ... | [
"0.5293686",
"0.5277355",
"0.52414083",
"0.52263904",
"0.52092355",
"0.5189164",
"0.5177735",
"0.51693845",
"0.51361936",
"0.51361936",
"0.5111843",
"0.51081806",
"0.5091192",
"0.5088751",
"0.50679684",
"0.50564444",
"0.5030267",
"0.5009788",
"0.50035465",
"0.49915966",
"0.49... | 0.598025 | 0 |
POST to upload additional documents to support relevent disability compensation claim. | def upload_supporting_documents
validate_documents_content_type
validate_documents_page_size
claim = ClaimsApi::AutoEstablishedClaim.get_by_id_or_evss_id(params[:id])
raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Resource not found') unless claim
ClaimsApi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_document(file, disability_claim_document)\n uploader = DisabilityClaimDocumentUploader.new(@user.uuid, disability_claim_document.tracked_item_id)\n uploader.store!(file)\n # the uploader sanitizes the filename before storing, so set our doc to match\n disability_claim_document.file_name = up... | [
"0.6359887",
"0.61086184",
"0.5961775",
"0.5942593",
"0.5939694",
"0.59240985",
"0.5922985",
"0.58877516",
"0.58580446",
"0.5857903",
"0.5851433",
"0.5837623",
"0.5805057",
"0.576494",
"0.5736388",
"0.5697861",
"0.56865174",
"0.56767327",
"0.56716526",
"0.5671216",
"0.5669202... | 0.6529439 | 0 |
POST to validate 526 submission payload. | def validate_form_526
ClaimsApi::Logger.log('526', detail: '526/validate - Request Started')
add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)
sanitize_account_type if form_attributes.dig('directDeposit', 'accountType')
validate_jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if params['HandshakeKey'].present?\n if Logan::Application.config.wufoo_handshake_key != params['HandshakeKey']\n Rails.logger.warn(\"[wufoo] received request with invalid handshake. Full request: #{request.inspect}\")\n head(403) && return\n end\n\n @submission = Submi... | [
"0.57094234",
"0.55644596",
"0.55037457",
"0.54846895",
"0.54689705",
"0.5456261",
"0.5418853",
"0.534542",
"0.52402574",
"0.52299345",
"0.52210695",
"0.5192015",
"0.518795",
"0.5182769",
"0.51792043",
"0.51289034",
"0.51215035",
"0.5096041",
"0.5090132",
"0.5087626",
"0.5083... | 0.5763265 | 0 |
matches image name with game board value and returns that image name for display purposes | def return_image(tictactoe, num)
return "blank.jpg" if tictactoe.squares[num].value == "" || tictactoe.squares[num].value == nil
return "x.jpg" if tictactoe.squares[num].value == "X"
return "o.jpg" if tictactoe.squares[num].value == "O"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_filename_for_match(match)\n sane_name(match.image_filename)\n end",
"def image( name )\n @images[name]\n end",
"def images_hadouken player_name\n images = {\n \"helen\"=> 'hadouken_game/media/hadouken/helen_hadouken.png',\n \"mateus\"=> 'hadouken_game/media/hadouken/mateus_ha... | [
"0.680581",
"0.65978014",
"0.65942764",
"0.6542209",
"0.65128475",
"0.64817756",
"0.642137",
"0.63964146",
"0.63831884",
"0.63634783",
"0.63424563",
"0.63415694",
"0.6321909",
"0.63186336",
"0.6313845",
"0.63035953",
"0.6279542",
"0.6194012",
"0.6192461",
"0.6165007",
"0.6144... | 0.6707001 | 1 |
generates computer move value. creates a minimax object and calls create_minimax_tree on that object. File for class definition is located at /lib/minimax.rb | def computer_move(tictactoe)
moves = [p1_moves(tictactoe),p2_moves(tictactoe)]
avail_moves = tictactoe.open_squares(p1_moves(tictactoe),p2_moves(tictactoe))
node = Minimax.new moves, avail_moves
node.create_minimax_tree(tictactoe)
return node.select_computer_move.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computer_move\n return nil if @current_state.done?\n # Pick best move using minimax algorithm\n move = @current_state.best_move\n # Make the move\n move.display\n make_move(move)\n end",
"def create_minimax_tree(ttt)\n \n\n #\n # Checks for all possible endgame scenarios\n # If t... | [
"0.6963116",
"0.673095",
"0.63001674",
"0.6256658",
"0.6167568",
"0.6085731",
"0.6075713",
"0.60342634",
"0.6020146",
"0.60072863",
"0.5988249",
"0.59580415",
"0.59455085",
"0.58241266",
"0.5766068",
"0.5750148",
"0.57337636",
"0.5716974",
"0.5715319",
"0.5715156",
"0.5712487... | 0.6941436 | 1 |
sets first_to_act values. Called in tictactoes controller update. | def set_first_to_act(tictactoe)
if tictactoe.players[0].first_to_act == "true"
tictactoe.players[0].first_to_act = "false"
else
tictactoe.players[0].first_to_act = "true"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFirst(first)\n @first = first\n end",
"def first=(val)\n puts \"Setting first='#{val}'\"\n self.old_first=val\n end",
"def set_first_sequence(battler)\n next_skill = battler.current_action.action_sequence.shift\n return if next_skill.nil?\n battler.current_action.skill_id = nex... | [
"0.6522716",
"0.63217205",
"0.6193574",
"0.6037994",
"0.5795785",
"0.57904917",
"0.57458323",
"0.56763303",
"0.5659214",
"0.5659214",
"0.5659214",
"0.565322",
"0.5642989",
"0.56154335",
"0.55979323",
"0.5447348",
"0.5437363",
"0.5425074",
"0.5414066",
"0.5399945",
"0.5397773"... | 0.7233339 | 0 |
Generates the relevant exception instance based on the XML error data received | def from_error(error)
child = error.get_elements('Errors')[0].get_elements('error')[0]
code = child.attributes['code']
exception = exceptions.find{|exc| exc.http_code == code }
exception ||= self
message = child.children.empty? ? '' : child.children[0].attributes['message']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_xml(code, msg)\n xml = ''\n doc = Builder::XmlMarkup.new(:target => xml)\n \n doc.Response do\n doc.Errors do\n doc.Error do\n doc.Code code.to_s\n doc.Message msg\n doc.BoxUsage \"0\"\n end\n end\n \n doc.... | [
"0.6331263",
"0.6331128",
"0.62808037",
"0.6255255",
"0.62548876",
"0.61238",
"0.60715526",
"0.6053392",
"0.5937469",
"0.5884866",
"0.5809688",
"0.5809688",
"0.5809688",
"0.5809688",
"0.57900333",
"0.5775817",
"0.5762613",
"0.57525307",
"0.5749817",
"0.5749297",
"0.57131505",... | 0.63318914 | 0 |
GET /question_types/1 GET /question_types/1.json | def show
@question_type = QuestionType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @question_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n @question_types = QuestionType.all\n end",
"def index\n @question_types = QuestionType.all\n end",
"def index\n @questiontypes = Questiontype.all\n end",
"def index\n @types = Type.all\n\... | [
"0.7394965",
"0.7100002",
"0.7100002",
"0.6966831",
"0.66933143",
"0.6662116",
"0.6589868",
"0.6551395",
"0.65500015",
"0.65495104",
"0.6391946",
"0.6371311",
"0.6328852",
"0.6315136",
"0.628529",
"0.6266559",
"0.6250347",
"0.62437844",
"0.621691",
"0.62023395",
"0.6199803",
... | 0.7438301 | 0 |
GET /question_types/new GET /question_types/new.json | def new
@question_type = QuestionType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @question_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end",
"def create\n @question_type = QuestionType.new(params[:question_type])\n\n respond_to do |format|\n if @question_type.save\n format.html { r... | [
"0.7606995",
"0.7356382",
"0.73211354",
"0.7146845",
"0.71167266",
"0.71110743",
"0.71080494",
"0.7104802",
"0.7039503",
"0.7039195",
"0.7039195",
"0.7039195",
"0.7039195",
"0.7039195",
"0.7015805",
"0.70152634",
"0.70071906",
"0.6998006",
"0.69925845",
"0.6988969",
"0.696761... | 0.80546343 | 0 |
PUT /question_types/1 PUT /question_types/1.json | def update
@question_type = QuestionType.find(params[:id])
respond_to do |format|
if @question_type.update_attributes(params[:question_type])
format.html { redirect_to @question_type, notice: 'Question type was successfully updated.' }
format.json { head :no_content }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def update\n respond_to do |format|\n if @question_type.update(question_type_params)\n format.html { redirect_to... | [
"0.7718617",
"0.71139276",
"0.6908822",
"0.682934",
"0.6744532",
"0.6420247",
"0.6399364",
"0.63700813",
"0.6322356",
"0.63213307",
"0.62699735",
"0.62618834",
"0.62524235",
"0.6238541",
"0.62259954",
"0.6093388",
"0.6046593",
"0.603272",
"0.60146296",
"0.60080963",
"0.599541... | 0.71347684 | 1 |
DELETE /question_types/1 DELETE /question_types/1.json | def destroy
@question_type = QuestionType.find(params[:id])
@question_type.destroy
respond_to do |format|
format.html { redirect_to question_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @question_type.destroy\n respond_to do |format|\n format.html { redirect_to question_types_url, notice: 'Question type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questiontype.destroy\n respond_to do |format|\n forma... | [
"0.7788268",
"0.7692437",
"0.73602664",
"0.72652435",
"0.7175972",
"0.7153753",
"0.7105089",
"0.7069817",
"0.70362145",
"0.7008312",
"0.69939834",
"0.6987722",
"0.6981219",
"0.6971181",
"0.6965678",
"0.69613266",
"0.6945801",
"0.6943692",
"0.69355303",
"0.6929376",
"0.692424"... | 0.8039112 | 0 |
Updates the cache by placing the data for the give URI on the file system. | def update (uri, data)
return nil unless @enabled
cache_name = translate_uri(uri)
mkdir # FIXME include cache_name to build all necessary directories
File.open(File.join(@directory, cache_name), 'w') do |f|
f << data
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end",
"def put(src, uri)\n # prepare cache path\n path = prepare_cache_path\n\n ... | [
"0.69364065",
"0.6885499",
"0.67785627",
"0.64649236",
"0.64633405",
"0.6392582",
"0.62936646",
"0.62936646",
"0.62771887",
"0.6273223",
"0.6240279",
"0.62337726",
"0.61926967",
"0.61926967",
"0.61926967",
"0.61926967",
"0.6178533",
"0.6172842",
"0.61272013",
"0.6106077",
"0.... | 0.8155686 | 0 |
helper method to translate a URL to a MD5 | def uri_to_md5 (uri)
Digest::MD5.hexdigest(uri.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_id\n Digest::MD5.hexdigest(url)\n end",
"def calc_url_tps(tps_type)\r\n Digest::MD5.hexdigest(tps_type)\r\n end",
"def calc_url_tps(tps_type)\r\n Digest::MD5.hexdigest(tps_type)\r\n end",
"def to_md5(pass)\r\n return Digest::MD5.hexdigest(pass)\r\nend",
"def to_md5(pass)\n return Dige... | [
"0.7307648",
"0.67464465",
"0.67464465",
"0.653571",
"0.64767504",
"0.64654607",
"0.6449571",
"0.62992287",
"0.626509",
"0.6250468",
"0.61939615",
"0.61542064",
"0.61457705",
"0.61382765",
"0.61198527",
"0.608037",
"0.60680795",
"0.6052032",
"0.6049392",
"0.59998345",
"0.5995... | 0.7921989 | 0 |
write a method where if platform is PC, print "PC are great!" | def what_platform
if @platform == "PC"
puts "PC are Awesome!"
else
puts "This platform is inferior"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end",
"def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não c... | [
"0.840172",
"0.69158167",
"0.670781",
"0.6690334",
"0.66320467",
"0.6566002",
"0.6566002",
"0.6566002",
"0.6438062",
"0.6370521",
"0.6298057",
"0.6295291",
"0.62513626",
"0.62513626",
"0.6245766",
"0.6227594",
"0.6215345",
"0.62000614",
"0.6189155",
"0.61773515",
"0.6138573",... | 0.8619716 | 0 |
setups export to csv | def export_csv
# Find all Setup with the stored restrictions
sorting :default => @@default_sort
collection = @@model.find :all, :order => @sort, :conditions => session[:conditions]
# Creation of the file
file_name = "#{@@param_name}_export_" + current_user.id.to_s + ".csv"
csv_string = CSV.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => 'es_setups.path, es_setups.name'\n setups = EsSetup.find :all, :order => @sort, :conditions => session[:conditions_setup]\n # Creation of the file\n file_name = \"setups_export_\" + current_user.id.to_s + \".csv\"\n... | [
"0.82238036",
"0.7855604",
"0.7855604",
"0.77174425",
"0.74869406",
"0.74433124",
"0.71358114",
"0.7130235",
"0.7107694",
"0.7079673",
"0.70785064",
"0.70609504",
"0.70372957",
"0.70336086",
"0.702135",
"0.6990408",
"0.69852",
"0.69775146",
"0.6945867",
"0.6929899",
"0.692793... | 0.8185777 | 1 |
network: ip: 172.23.194.100 netmask: 255.255.254.0 gateway: 172.23.194.1 dns: 172.22.22.153 172.22.22.154 cloud_properties: name: VLAN2194 | def network_configuration
dns = settings.provider.network.dns
dns = dns.split(",") if dns.is_a?(String)
{
"ip"=>public_ip,
"netmask"=>settings.provider.network.netmask,
"gateway"=>settings.provider.network.gateway,
"dns"=>dns,
"cloud_properties"=>{
"na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_networks(vm, host)\n if host.has_key?('public_networks')\n public_networks = host['public_networks']\n public_networks.each do |public_network|\n options = {}\n options[:ip] = public_network['ip'] if public_network.key?('ip') && public_network['ip'] != 'dhcp'\n op... | [
"0.6406279",
"0.6401684",
"0.6302471",
"0.6140923",
"0.6140923",
"0.6123395",
"0.6118075",
"0.61103517",
"0.6096357",
"0.60687673",
"0.60687673",
"0.60687673",
"0.60671514",
"0.6067039",
"0.6043179",
"0.604118",
"0.59801805",
"0.5939977",
"0.5939977",
"0.5932985",
"0.5914455"... | 0.67668295 | 0 |
GET /foodhampers GET /foodhampers.json | def index
@foodhampers = Foodhamper.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @foodhampers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @foodhamper = Foodhamper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foodhamper }\n end\n end",
"def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end",
"def show\n @food = Food.find(params[:id])\n\n... | [
"0.7317068",
"0.67444193",
"0.6719133",
"0.67179817",
"0.67167115",
"0.6579607",
"0.6515333",
"0.636667",
"0.63552606",
"0.63366675",
"0.6307593",
"0.6292426",
"0.6275889",
"0.6269088",
"0.6260948",
"0.62585115",
"0.62488943",
"0.62307936",
"0.6199832",
"0.6190754",
"0.618909... | 0.7816024 | 0 |
GET /foodhampers/1 GET /foodhampers/1.json | def show
@foodhamper = Foodhamper.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @foodhamper }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r... | [
"0.7669938",
"0.7027405",
"0.7027391",
"0.69057876",
"0.6891401",
"0.66551656",
"0.6597831",
"0.6589113",
"0.6554404",
"0.6548135",
"0.6525193",
"0.6473865",
"0.64682865",
"0.64604926",
"0.6433289",
"0.6429597",
"0.64126354",
"0.64063793",
"0.6397204",
"0.6397204",
"0.6397204... | 0.7514199 | 1 |
GET /foodhampers/new GET /foodhampers/new.json | def new
@foodhamper = Foodhamper.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @foodhamper }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food }\n end\n end",
"def new\n @favourite_food = FavouriteFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favourite_... | [
"0.7516162",
"0.7315745",
"0.7190816",
"0.7151094",
"0.7106249",
"0.7104331",
"0.70989984",
"0.70847034",
"0.708154",
"0.7079434",
"0.70554316",
"0.70345813",
"0.70345813",
"0.70345813",
"0.70345813",
"0.70345813",
"0.702721",
"0.7000955",
"0.69946235",
"0.6980811",
"0.696046... | 0.7835971 | 0 |
POST /foodhampers POST /foodhampers.json | def create
@foodhamper = Foodhamper.new(params[:foodhamper])
respond_to do |format|
if @foodhamper.save
format.html { redirect_to @foodhamper, notice: 'Foodhamper was successfully created.' }
format.json { render json: @foodhamper, status: :created, location: @foodhamper }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def create\n @fast_food = FastFood.new(fast_food_params)\n\n respond_to do |format|\n if @fast_food.save\n format.html { redirect_to @fast_food, notice: 'Fast food wa... | [
"0.65500873",
"0.65466774",
"0.64248085",
"0.6305848",
"0.62981373",
"0.6284137",
"0.61766785",
"0.617316",
"0.61567783",
"0.6109196",
"0.6076999",
"0.60377944",
"0.6025599",
"0.6020611",
"0.6019092",
"0.601474",
"0.5965601",
"0.59441876",
"0.593013",
"0.5908581",
"0.5905744"... | 0.71457505 | 0 |
PUT /foodhampers/1 PUT /foodhampers/1.json | def update
@foodhamper = Foodhamper.find(params[:id])
respond_to do |format|
if @foodhamper.update_attributes(params[:foodhamper])
format.html { redirect_to @foodhamper, notice: 'Foodhamper was successfully updated.' }
format.json { head :no_content }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n respond_to do |format|\n if @fast_food.update(fast_food_params)\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully updated.' }\n format.json... | [
"0.65901774",
"0.6255864",
"0.61985373",
"0.61237025",
"0.61157775",
"0.6066608",
"0.60483366",
"0.6025284",
"0.6024381",
"0.60227174",
"0.5997842",
"0.5988594",
"0.5926851",
"0.592371",
"0.5920154",
"0.5915483",
"0.59023",
"0.5901177",
"0.58741665",
"0.5861301",
"0.5857414",... | 0.667205 | 0 |
DELETE /foodhampers/1 DELETE /foodhampers/1.json | def destroy
@foodhamper = Foodhamper.find(params[:id])
@foodhamper.destroy
respond_to do |format|
format.html { redirect_to foodhampers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { re... | [
"0.7468995",
"0.7468995",
"0.72728354",
"0.726515",
"0.7188963",
"0.71590453",
"0.7141821",
"0.7141821",
"0.7141821",
"0.71363693",
"0.7101338",
"0.7096297",
"0.70916075",
"0.7090462",
"0.7071005",
"0.7054368",
"0.705357",
"0.7044052",
"0.70296174",
"0.7022382",
"0.70177317",... | 0.78019524 | 0 |
Stub up all the role methods for a given role. This is necessary because cancan routinely hits all the roles in the spec of a controller that calls 'load_and_authorize_resource'. | def stub_role_methods(mock_user, roles)
roles = [roles] unless roles.is_a?(Array)
Role::ROLES.each do |role_token|
role = role_token.to_s # allow a symbol to be passed - e.g., pretend_to_be_authenticated(:role => :admin)
allow(mock_user).to receive(role.downcase+"?").and_return roles.include?(role)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_auth_user(stubs={})\n role = stubs[:role].present? ? stubs[:role] : Role::ADMIN\n @mock_auth_user ||= double(User, {\n :name => 'Testing Userperson',\n :email => 'tester@example.com',\n :time_zone => \"Central Time (US & Canada)\"\n }.merge(stubs.except(:role)))\n # sets up the role me... | [
"0.6121115",
"0.5907183",
"0.57827616",
"0.5736182",
"0.5660734",
"0.5629059",
"0.56216717",
"0.5553901",
"0.5544766",
"0.55325735",
"0.5526459",
"0.54727024",
"0.5455772",
"0.5451456",
"0.54387146",
"0.54181147",
"0.53974545",
"0.53772426",
"0.5363685",
"0.5363685",
"0.53457... | 0.77184737 | 0 |
sets up a mock user that handles the methods around being logged in, having role(s) and being authorized for certain resources. | def mock_auth_user(stubs={})
role = stubs[:role].present? ? stubs[:role] : Role::ADMIN
@mock_auth_user ||= double(User, {
:name => 'Testing Userperson',
:email => 'tester@example.com',
:time_zone => "Central Time (US & Canada)"
}.merge(stubs.except(:role)))
# sets up the role methods like adm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_user\n user = create(:user)\n login_as(user, scope: :user)\n end",
"def login_as_cubeless_admin\n stub_current_user_and_profile( create_user_and_profile(:login => 'cubeless_admin', :roles => Role::CubelessAdmin) )\n end",
"def stub_user(features:)\n allow(User).to receive(:server_ti... | [
"0.7076573",
"0.6885118",
"0.68038684",
"0.67731345",
"0.67333186",
"0.6716603",
"0.6646071",
"0.6560606",
"0.65583646",
"0.65342426",
"0.6531607",
"0.6529559",
"0.6515307",
"0.65002567",
"0.6449717",
"0.6447282",
"0.64338017",
"0.64216626",
"0.6402439",
"0.64020073",
"0.6387... | 0.76024264 | 0 |
Check if record belongs to the same site | def same_site?(json)
return {"error" => "invalid input"} if json["assigned_site"].nil? or @current_npid.nil?
if json["assigned_site"] == @current_npid["site_code"]
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_should_be_in_same_site\n errors.add(:content, :should_be_in_same_site) if content && parent && !parent.containing_site.self_and_descendants.exists?(id: content_id)\n end",
"def site_membership_uniqueness\n return unless site && user\n\n existing_membership =\n user.site_memberships.whe... | [
"0.6527115",
"0.6299154",
"0.61451113",
"0.60652685",
"0.59549797",
"0.59098613",
"0.5908414",
"0.5880747",
"0.5855391",
"0.58425534",
"0.5784779",
"0.5735199",
"0.5724321",
"0.57009166",
"0.5675748",
"0.5635916",
"0.5630138",
"0.5621252",
"0.5619444",
"0.5610883",
"0.5561673... | 0.65876544 | 0 |
Updates a specific webhook configuration with custom headers | def put_webhooks_custom_headers_token_with_http_info(token, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: WebhooksApi.put_webhooks_custom_headers_token ...'
end
# verify the required parameter 'token' is set
if @api_client.config.client_side_val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n webhook.update(webhook_params)\n respond_with(webhook)\n end",
"def update\n webhook.update_attributes(webhook_params)\n respond_with(webhook)\n end",
"def update_headers(oauth_key: nil, fingerprint: nil, client_id: nil, client_secret: nil, ip_address: nil, idemopotency_key: nil)\n\t... | [
"0.63316566",
"0.6276843",
"0.60283124",
"0.59133303",
"0.5900118",
"0.582077",
"0.5780183",
"0.5766239",
"0.5726483",
"0.5633518",
"0.5598499",
"0.55877286",
"0.557147",
"0.5556891",
"0.55451566",
"0.5538591",
"0.5494673",
"0.5459882",
"0.54364026",
"0.54332864",
"0.5405973"... | 0.63720185 | 0 |
POST /project/phase/milestones or /project/phase/milestones.json | def create
@project_phase_milestone = Project::Phase::Milestone.new(project_phase_milestone_params)
@project_phase_milestone.project_phase = Project::Phase.find_by_id(params[:phase_id])
if can? :create, @project_phase_milestone
respond_to do |format|
if @project_phase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @milestone = @project.milestones.build(milestone_params)\n\n respond_to do |format|\n if @milestone.save\n format.html { redirect_to @project,\n notice: 'Milestone was successfully created.' }\n format.json { render :show, status: :created, location: @mile... | [
"0.7181753",
"0.69943786",
"0.69943786",
"0.69033766",
"0.6849185",
"0.6784999",
"0.65036625",
"0.6481027",
"0.6411532",
"0.63717735",
"0.632539",
"0.6314563",
"0.6314563",
"0.630595",
"0.630233",
"0.62860316",
"0.6172224",
"0.6172224",
"0.6166841",
"0.61524034",
"0.61508065"... | 0.7007879 | 1 |
PATCH/PUT /project/phase/milestones/1 or /project/phase/milestones/1.json | def update
if can? :update, @project_phase_milestone
respond_to do |format|
if @project_phase_milestone.update(project_phase_milestone_params)
format.html { redirect_to "/projects/#{@project_phase_milestone.project_phase.project.id}/phases/#{@project_phase_milesto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @milestone = Milestone.find(params[:id])\n @milestone.update_attributes(params[:milestone])\n respond_to do |format|\n if @milestone.save\n format.html { redirect_to goals_path, notice: 'Milestone was successfully created.' }\n format.json { respond_with_bip(@milestone) }\n... | [
"0.6922027",
"0.69103837",
"0.6642818",
"0.66148585",
"0.6514259",
"0.63626343",
"0.62953633",
"0.6291233",
"0.61869764",
"0.6153922",
"0.61335844",
"0.61277103",
"0.6112206",
"0.60521513",
"0.60434175",
"0.60364044",
"0.60364044",
"0.60364044",
"0.59892786",
"0.59878147",
"0... | 0.7047542 | 0 |
DELETE /project/phase/milestones/1 or /project/phase/milestones/1.json | def destroy
if can? :update, @project_phase_milestone
@project_phase_milestone.destroy
respond_to do |format|
format.html { redirect_to "/projects/#{@project_phase_milestone.project_phase.project.id}/phases/#{@project_phase_milestone.project_phase.id}/milestones/", notice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @milestone = Milestone.find(params[:id])\n @milestone.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end",
"def delete_milestone(id)\n record \"/milestones/delete/#{id}\"\n end",
"def delete_mileston... | [
"0.7719822",
"0.75272423",
"0.75272423",
"0.7450213",
"0.71866304",
"0.7136199",
"0.7049629",
"0.6874118",
"0.68490463",
"0.6762779",
"0.67487055",
"0.6703034",
"0.65603554",
"0.6558946",
"0.65270674",
"0.6526588",
"0.65196455",
"0.65169966",
"0.65161335",
"0.6513392",
"0.650... | 0.7567134 | 1 |
it will find a file, read it, validate it and import it to database as raw article data. Then mark the file as imported. | def perform(filename)
# checking if already imported
if dataset_marked? filename, 'imported'
puts "#{filename} is already imported, skipping."
return
end
articles_to_import = []
with_locked_file filename do
puts "Opening file at #{filename}"
file = File.open filename
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import\n Article.import(params[:file])\n flash[:success] = 'Articles were successfully imported'\n redirect_to article_admin_path \n end",
"def import_file(file)\n records = IO.readlines(file)\n Vocabulary::DB.transaction do\n records.each { |record| string_processing recor... | [
"0.68396413",
"0.6736999",
"0.6665444",
"0.6461503",
"0.64336395",
"0.64138234",
"0.6409195",
"0.63148683",
"0.62977064",
"0.62543446",
"0.6253745",
"0.6244175",
"0.6160069",
"0.615329",
"0.6151774",
"0.6150722",
"0.6137231",
"0.6110855",
"0.61046654",
"0.60946196",
"0.608115... | 0.71735454 | 0 |
GET /test_posts GET /test_posts.json | def index
@test_posts = TestPost.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response... | [
"0.7098948",
"0.708357",
"0.70613635",
"0.7037024",
"0.6979834",
"0.69751734",
"0.69751734",
"0.69354886",
"0.6910221",
"0.6803451",
"0.67985994",
"0.67947996",
"0.6791184",
"0.67363894",
"0.67363894",
"0.67363894",
"0.6725413",
"0.6722472",
"0.6700887",
"0.669249",
"0.668595... | 0.7269314 | 0 |
POST /test_posts POST /test_posts.json | def create
@test_post = TestPost.new(test_post_params)
respond_to do |format|
if @test_post.save
format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }
format.json { render :show, status: :created, location: @test_post }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n ... | [
"0.7359796",
"0.7006093",
"0.6869626",
"0.6713245",
"0.6532894",
"0.65279686",
"0.64846224",
"0.6454347",
"0.64450455",
"0.64225024",
"0.6422078",
"0.6389013",
"0.63569766",
"0.6350045",
"0.6338524",
"0.6338524",
"0.6310123",
"0.62151754",
"0.6199097",
"0.61973864",
"0.619007... | 0.7006391 | 1 |
GET /service_stations/1 GET /service_stations/1.json | def show
@service_station = ServiceStation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @service_station }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.79390407",
"0.7244834",
"0.7210701",
"0.72086954",
"0.71167034",
"0.6865584",
"0.6864164",
"0.67879665",
"0.67615455",
"0.67076665",
"0.6697165",
"0.6694353",
"0.6693868",
"0.6676118",
"0.66700846",
"0.6658692",
"0.6615282",
"0.66095006",
"0.6560501",
"0.6537209",
"0.64989... | 0.7499365 | 1 |
GET /service_stations/new GET /service_stations/new.json | def new
@service_station = ServiceStation.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @service_station }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end",
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n ... | [
"0.76064867",
"0.76064867",
"0.74441886",
"0.7391552",
"0.73080075",
"0.73080075",
"0.71965855",
"0.7117606",
"0.7108601",
"0.69882864",
"0.69882864",
"0.69882864",
"0.69882864",
"0.6987577",
"0.69563776",
"0.6909284",
"0.6906495",
"0.6880575",
"0.6861653",
"0.67927575",
"0.6... | 0.7802107 | 0 |
POST /service_stations POST /service_stations.json | def create
@service_station = ServiceStation.new(params[:service_station])
respond_to do |format|
if @service_station.save
format.html { redirect_to @service_station, notice: 'Service station was successfully created.' }
format.json { render json: @service_station, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @station = Station.new(station_params)\n\n if @station.save\n render json: @station, status: :created, location: @station\n else\n render json: @station.errors, status: :unprocessable_entity\n end\n end",
"def create\n @set_station = SetStation.new(set_station... | [
"0.7080494",
"0.69802344",
"0.6854372",
"0.6854372",
"0.67669255",
"0.66958284",
"0.6605232",
"0.64831144",
"0.6440765",
"0.643524",
"0.6424735",
"0.6394697",
"0.63347334",
"0.6318249",
"0.63016486",
"0.629514",
"0.6284603",
"0.62267673",
"0.6182744",
"0.6175668",
"0.61449",
... | 0.7250067 | 0 |
PUT /service_stations/1 PUT /service_stations/1.json | def update
@service_station = ServiceStation.find(params[:id])
respond_to do |format|
if @service_station.update_attributes(params[:service_station])
format.html { redirect_to @service_station, notice: 'Service station was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @set_station.update(set_station_params)\n format.html { redirect_to set_stations_path, notice: 'Set station was successfully updated.' }\n format.json { render :index, status: :ok, location: @set_stations }\n else\n format.html { render :ed... | [
"0.6840198",
"0.68206966",
"0.6635924",
"0.6635924",
"0.6423149",
"0.6410009",
"0.64058435",
"0.64055127",
"0.63977396",
"0.6388819",
"0.635784",
"0.63160414",
"0.62736034",
"0.62368184",
"0.62368184",
"0.62368184",
"0.623002",
"0.62183535",
"0.6203412",
"0.6124575",
"0.61093... | 0.70649 | 0 |
DELETE /service_stations/1 DELETE /service_stations/1.json | def destroy
@service_station = ServiceStation.find(params[:id])
@service_station.destroy
respond_to do |format|
format.html { redirect_to service_stations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @station = Station.find(params[:id])\n @station.destroy\n\n ... | [
"0.7244393",
"0.7174366",
"0.7107097",
"0.7073601",
"0.6929405",
"0.6922457",
"0.6875111",
"0.6874462",
"0.68634474",
"0.68606687",
"0.6858397",
"0.6858397",
"0.6858397",
"0.6836134",
"0.6819987",
"0.6807771",
"0.67878175",
"0.6745888",
"0.6697432",
"0.6691728",
"0.6689047",
... | 0.76950186 | 0 |
Shows username on the title | def show_username(str_name)
self.title = "#{APP_CUPERATIVA_NAME} - Utente: #{str_name}"
#@lbl_username.text = "#{@comment_init} - Utente: #{str_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_username_label_method\n username\n end",
"def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end",
"def display_name \n username\n en... | [
"0.76219606",
"0.75960207",
"0.7527362",
"0.74658734",
"0.7226022",
"0.70284224",
"0.7016863",
"0.6982719",
"0.69825494",
"0.69810885",
"0.6939618",
"0.6926185",
"0.69104177",
"0.69097394",
"0.6898652",
"0.68938416",
"0.68814373",
"0.6872082",
"0.68701446",
"0.6836679",
"0.67... | 0.81086457 | 0 |
Load all supported games | def load_supported_games
@supported_game_map = InfoAvailableGames.info_supported_games(@log)
#p @supported_game_map
SETTINGS_DEFAULT_APPGUI[:games_opt] = {}
@supported_game_map.each do |k, game_item|
if game_item[:enabled] == true
require game_item[:file_req]
@log.debug("Gam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_supported_games\n @supported_game_map = InfoAvilGames.info_supported_games(@log)\n #@supported_game_map.each{|k,v| p k}\n #p @supported_game_map\n # execute require 'mygame'\n @all_games_bots.each do |botgame|\n infogame = @supported_game_map[botgame[:key]]\n if infogame != nil a... | [
"0.8198236",
"0.6913211",
"0.67423296",
"0.672177",
"0.6558824",
"0.6548593",
"0.64926314",
"0.6431766",
"0.62482244",
"0.622949",
"0.6116344",
"0.611326",
"0.6108103",
"0.6103366",
"0.6096315",
"0.60781276",
"0.6075109",
"0.60734385",
"0.60694146",
"0.6025626",
"0.60131824",... | 0.82250977 | 0 |
Set an initial text on table | def initial_board_text
@lbl_table_title.text = "Gioco selezionato: "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_table_cell\n mixin({\n text_align: 'left',\n font_weight: 'normal',\n vertical_align: 'middle'\n })\n end",
"def textFieldStarted(tf)\n tf.text = \"\"\n end",
"def setrow(row,text)\n\t\told = @text[row]\n\t\t@text[row] = text\n\tend",
"def insert_text_before(text)\r\n ... | [
"0.60010326",
"0.5668697",
"0.5570226",
"0.55018544",
"0.5458126",
"0.54543006",
"0.54484767",
"0.54464686",
"0.5427506",
"0.5355289",
"0.5328428",
"0.5326296",
"0.5311903",
"0.5305426",
"0.5294564",
"0.529216",
"0.5291674",
"0.52820086",
"0.5269964",
"0.5261244",
"0.52335614... | 0.7165687 | 0 |
Load the named icon from a file | def loadIcon(filename)
begin
dirname = File.join(ResourceInfo.get_resource_path, "icons")
filename = File.join(dirname, filename)
icon = nil
File.open(filename, "rb") { |f|
if File.extname(filename) == ".png"
icon = FXPNGIcon.new(getApp(), f.read)
elsif File... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadIcon(filename)\r\n begin\r\n #dirname = File.join(File.dirname(__FILE__), \"/../res/icons\")\r\n dirname = File.join(get_resource_path, \"icons\")\r\n filename = File.join(dirname, filename)\r\n icon = nil\r\n File.open(filename, \"rb\") { |f|\r\n if File.extname(filename... | [
"0.79725677",
"0.79383177",
"0.777026",
"0.777026",
"0.7632427",
"0.7183258",
"0.7071044",
"0.70672715",
"0.6825126",
"0.66781497",
"0.6620088",
"0.6439031",
"0.6338914",
"0.6302272",
"0.62834173",
"0.62440497",
"0.6241351",
"0.62055576",
"0.6189634",
"0.61675364",
"0.6108101... | 0.7996078 | 0 |
Set a custom deck information. Used for testing code without changing source code | def set_custom_deck(deck_info)
@app_settings[:custom_deck] = { :deck => deck_info }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_settings\r\n @settings[\"deck_name\"] = @curr_deck_key if @curr_deck_key\r\n end",
"def set_deck\n if current_user.meta_type == \"Individual\"\n @person = Individual.find_by(id: current_user.meta_id)\n @decks = @person.decks.all\n @deck = @decks.find(params[:id])\n else... | [
"0.67508024",
"0.674459",
"0.6419507",
"0.6400197",
"0.6330606",
"0.6330606",
"0.6330606",
"0.6330606",
"0.6330606",
"0.6330606",
"0.6300384",
"0.629057",
"0.62396485",
"0.62396485",
"0.62396485",
"0.6196699",
"0.61565065",
"0.61294955",
"0.61117274",
"0.6100644",
"0.6093138"... | 0.8038217 | 0 |
Initialize current gfx selected. Current gfx is stored into application settings game_type: game type label (e.g :mariazza_game) | def initialize_current_gfx(game_type)
@last_selected_gametype = game_type
# reset the title
initial_board_text
##initialize a current local game
init_local_game(game_type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_current_gfx(nome_game)\n @log.debug \"**** bot: initialize current gfx #{nome_game}\"\n #p self.app_settings\n select_engine(nome_game)\n #@current_game_gfx = eval(@game_to_play[:class_name]).new()\n # override @game_bot_name only to use a test robot. For a game GameBasebot is enought... | [
"0.71716315",
"0.61962897",
"0.6072698",
"0.5986911",
"0.59240675",
"0.5830572",
"0.5784033",
"0.5780889",
"0.57717186",
"0.57662535",
"0.57344604",
"0.572395",
"0.5714327",
"0.56534374",
"0.56532",
"0.56258035",
"0.56215376",
"0.561099",
"0.5589707",
"0.5553912",
"0.55302227... | 0.8502762 | 0 |
Provides name of program and software version | def get_nameprog_swversion
nomeprog = APP_CUPERATIVA_NAME
ver_prog = CuperativaGui.sw_version_to_int
return nomeprog, ver_prog
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end",
"def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"def name_and_version\n [display_name, version].compact.join(' ')\n end",
"... | [
"0.80996144",
"0.73459",
"0.73226595",
"0.7263684",
"0.71004385",
"0.70779175",
"0.7067241",
"0.70378506",
"0.6961896",
"0.69299775",
"0.6901207",
"0.68991137",
"0.68991137",
"0.68990135",
"0.6897322",
"0.6896755",
"0.68958014",
"0.68518484",
"0.68357706",
"0.68252915",
"0.68... | 0.810751 | 0 |
Remove all servlet mappings for given (servlet) name. | def remove_servlet_mapping(context, name)
find_servlet_mapping(context, name).each do
|pattern| context.remove_servlet_mapping(pattern)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_alias(name)\n dname = clean_server_name(name)\n routes_file_path = server_routes_alias_path(dname)\n\n FileUtils.rm_f(routes_file_path) if File.exist?(routes_file_path)\n\n server_alias_search(dname, false).each do |path|\n FileUtils.rm_f(path)\n end\n\n reload_all\n... | [
"0.6584689",
"0.6346947",
"0.6099292",
"0.53534764",
"0.5245752",
"0.52165115",
"0.52165115",
"0.5203332",
"0.5201216",
"0.5201216",
"0.5196139",
"0.5135937",
"0.51337844",
"0.51170534",
"0.50817674",
"0.50738555",
"0.50729805",
"0.50605834",
"0.50605834",
"0.50605834",
"0.50... | 0.87920225 | 0 |
Find all servlet mappings for given (servlet) name. | def find_servlet_mapping(context, name)
name_mapping = []
context.find_servlet_mappings.each do |pattern|
mapping_for = context.find_servlet_mapping(pattern)
name_mapping << pattern if mapping_for == name
end
name_mapping
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_servlet_mapping(context, name)\n find_servlet_mapping(context, name).each do\n |pattern| context.remove_servlet_mapping(pattern)\n end\n end",
"def server_alias_search(name, all_gears=false)\n dname = clean_server_name(name)\n resp = []\n\n basedir = ... | [
"0.6374935",
"0.5246476",
"0.5246476",
"0.4912943",
"0.4869179",
"0.48571488",
"0.48571488",
"0.48354995",
"0.4832074",
"0.48136526",
"0.47248238",
"0.4705279",
"0.46614474",
"0.46522713",
"0.46420127",
"0.46291727",
"0.46289444",
"0.46015018",
"0.45777947",
"0.4565547",
"0.4... | 0.8368877 | 0 |
Obtain the next row from the cursor. If there are no more rows to be had, this will return +nil+. If type translation is active on the corresponding database, the values in the row will be translated according to their types. The returned value will be an array, unless Databaseresults_as_hash has been set to +true+, in... | def next
return nil if @eof
@stmt.must_be_open!
unless @first_row
result = @driver.step( @stmt.handle )
check result
end
@first_row = false
unless @eof
row = []
@driver.data_count( @stmt.handle ).times do |column|
case @driver.column_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n return nil if @eof\n\n if @current_row\n result, @current_row = @current_row, nil\n else\n result = API.step( @vm )\n check_eof( result )\n end\n\n unless @eof\n row = result[:row]\n\n if @db.type_translation\n row = @types.zip( row ).... | [
"0.742213",
"0.7363135",
"0.65010476",
"0.6435557",
"0.6004373",
"0.591731",
"0.58879155",
"0.5862748",
"0.5769449",
"0.5748652",
"0.57425463",
"0.5619267",
"0.56167907",
"0.5609047",
"0.5576357",
"0.5554066",
"0.5480066",
"0.54689467",
"0.545545",
"0.5452949",
"0.54502195",
... | 0.74108964 | 1 |
Closes the statement that spawned this result set. Use with caution! Closing a result set will automatically close any other result sets that were spawned from the same statement. | def close
@stmt.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @stmt.close\n end",
"def close\n statement = \"close #{@name}\"\n @connection.exec(statement)\n end",
"def close\n if open? then\n @stmt_api.close\n @open = false\n end\n end",
"def close_query\n invoke_unlimited_cross(:close_query)\n nil\... | [
"0.77783525",
"0.72383076",
"0.700023",
"0.67629224",
"0.6371919",
"0.6335304",
"0.622204",
"0.61029005",
"0.6079692",
"0.59451437",
"0.587945",
"0.58176225",
"0.5782939",
"0.57517415",
"0.5748485",
"0.574394",
"0.57189536",
"0.57005775",
"0.56538725",
"0.56429964",
"0.559087... | 0.7786841 | 0 |
Queries whether the underlying statement has been closed or not. | def closed?
@stmt.closed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closed?\n @stmt.closed?\n end",
"def closed?\n @db.closed?\n end",
"def closed?\n @cursor.nil?\n end",
"def closed?\n @connection.closed?\n end",
"def closed?\n @connection.nil?\n end",
"def closed?\n @connection_state == :closed\n end",
"def cl... | [
"0.8547321",
"0.7748528",
"0.75465095",
"0.73551655",
"0.72772956",
"0.72701144",
"0.7103033",
"0.7083684",
"0.70791817",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122",
"0.7074122"... | 0.8572157 | 0 |
GET /hours/new GET /hours/new.json | def new
@hour = Hour.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @hour }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @atom.hours = 24\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atom }\n end\n end",
"def new\n @officehour = Officehour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @officehour }\n ... | [
"0.7657252",
"0.7164526",
"0.71614826",
"0.7124727",
"0.70253885",
"0.70062536",
"0.70062536",
"0.70062536",
"0.6986582",
"0.6927525",
"0.69152236",
"0.691114",
"0.69050735",
"0.68712103",
"0.6774262",
"0.6761537",
"0.67517525",
"0.6740693",
"0.6723379",
"0.67167264",
"0.6660... | 0.7929542 | 1 |
return a hash of filename => file size given an s3 prefix | def file_sizes_for_prefix(prefix)
file_sizes_hash = {}
each_s3_metadata_for_prefix(prefix){ |metadata| file_sizes_hash[metadata['Key']] = metadata['Size'] }
file_sizes_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_update_storage_size_from_s3\n total_size = 0\n if self.final_file_key\n total_size += fetch_object_size(self.final_file_key)\n else\n total_size += fetch_object_size(self.original_file_key)\n end\n self.update_column(:storage_size, total_size)\n recalculate_storage_size\n e... | [
"0.6279371",
"0.6254685",
"0.6252173",
"0.6151803",
"0.61452305",
"0.6138714",
"0.6003673",
"0.59985155",
"0.5987969",
"0.59038603",
"0.58813703",
"0.58255917",
"0.58110636",
"0.57916826",
"0.57916826",
"0.5764914",
"0.5752811",
"0.57489765",
"0.57459885",
"0.5711956",
"0.570... | 0.83019626 | 0 |
returns a list no bigger than batch_size of files from s3 in a given directory (with a given prefix). does not currently support any sort of paging; it just returns the first [batch_size] files | def batch_directory_listing(prefix, batch_size = MAX_KEYS)
@directory.files.all('prefix' => prefix, 'max-keys' => batch_size)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_files_with_prefix bucket_name:, prefix:, delimiter: nil\n # Lists all the files in the bucket that begin with the prefix.\n #\n # This can be used to list all files in a \"folder\", e.g. \"public/\".\n #\n # The delimiter argument can be used to restrict the results to only the\n # \"files\" in the ... | [
"0.68879074",
"0.6836037",
"0.67699885",
"0.64740306",
"0.6329433",
"0.6190251",
"0.6145446",
"0.61223286",
"0.6091577",
"0.6074134",
"0.6053501",
"0.6043299",
"0.5991173",
"0.5963246",
"0.59508026",
"0.585928",
"0.56435394",
"0.5618942",
"0.56168854",
"0.56068903",
"0.559801... | 0.74610764 | 0 |
Get stats config from Octo | def statd_config
Octo.get_config :statsd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config\n overview[\"config\"]\n end",
"def config\n info['Config']\n end",
"def stats\n JSON.parse TCPSocket.new(@options[:stats_uri].host,@options[:stats_uri].port).read rescue {}\n end",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\"... | [
"0.64784545",
"0.6348463",
"0.6229914",
"0.6167243",
"0.6166764",
"0.6164246",
"0.60344195",
"0.60318655",
"0.5971172",
"0.5887171",
"0.5842019",
"0.5747489",
"0.5747489",
"0.5686059",
"0.56790185",
"0.5672652",
"0.56669164",
"0.5656141",
"0.56384516",
"0.5600204",
"0.5596218... | 0.7914849 | 0 |
Public: Click reports name and display add reports view Example navigate_to_add_report_section Returns nothing | def navigate_to_add_report_section(report_type)
find_link(report_type).click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goto\n navigate_application_to \"Report=>Custom Views\"\n end",
"def add\n frm.link(:text=>\"Add\").click\n AssignmentAdd.new(@browser)\n end",
"def click_reports_link\n wait_for_page_and_click reports_link\n end",
"def insert_general_sections(report)\n report.add_field(:client, 'mg')... | [
"0.6396427",
"0.5843774",
"0.58189577",
"0.5711895",
"0.5624502",
"0.5624502",
"0.5603249",
"0.55302346",
"0.54458404",
"0.535403",
"0.52594316",
"0.52563554",
"0.51992524",
"0.51919466",
"0.51839256",
"0.51676553",
"0.5166531",
"0.51430285",
"0.51200247",
"0.5110782",
"0.511... | 0.81283915 | 0 |
Public: Available reports and description table rows text (UI) Example report_builder_section.available_reports_table_rows => [["Billing Summary", "Gives a summary of resources and usage by partner and user group."]] Returns available reports table rows text | def available_reports_table_rows
available_reports_table.rows_text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supp_plan_table_rows\n wait_until_bus_section_load\n tables[2].rows_text\n end",
"def license_details_table_rows\n resources_details_tables[1].rows_text\n end",
"def internal_billing_table_rows\n expand(billing_information_icon)\n wait_until_ajax_finished(internal_billing_div... | [
"0.67450833",
"0.6083391",
"0.59593755",
"0.5929102",
"0.5800232",
"0.56744075",
"0.5609996",
"0.55991596",
"0.5467051",
"0.53843164",
"0.534103",
"0.53383553",
"0.53157955",
"0.52844644",
"0.526383",
"0.52260387",
"0.52159613",
"0.5197392",
"0.51753426",
"0.51459706",
"0.514... | 0.8053326 | 0 |
Accepts a SOAP +body+ to check if it was set. Also accepts a +block+ which receives the Savon::SOAP::Request to set up custom expectations. | def with(body = nil, &block)
Savon.config.hooks.define(:spec_body, :soap_request) do |_, request|
if block
block.call(request)
else
actual = request.soap.body
raise ExpectationError, "expected #{body.inspect} to be sent, got: #{actual.inspect}" unless actu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with(soap_body)\n Savon::SOAP::XML.any_instance.expects(:body=).with(soap_body) if mock_method == :expects\n self\n end",
"def send(body=nil, &block)\n\t\t\traise RuntimeError, 'Need to set request' if @request.nil?\n\t\t\t@body = condition.transform @xml if body.nil?\n\t\t\t@request.post(... | [
"0.69027764",
"0.5925529",
"0.5217396",
"0.52027285",
"0.51504314",
"0.51481044",
"0.514128",
"0.510175",
"0.5100207",
"0.50696856",
"0.5057588",
"0.50219613",
"0.5004726",
"0.5003798",
"0.4949925",
"0.4930498",
"0.4897218",
"0.48961025",
"0.4849969",
"0.4848229",
"0.4824046"... | 0.75046796 | 0 |
Classifies a reading and triggers the appropriate actions | def evaluateReading(reading)
if reading.class != FluksoReading
raise "Must provide a FluksoReading instance."
end
if reading.watts < $CONFIG[:LOW_MEDIUM_BARRIER]
@fsm.low_reading;
elsif reading.watts < $CONFIG[:MEDIUM_HIGH_BARRIER]
@fsm.medium_reading;
else
@fsm.high_reading;... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type = READ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 314:8: 'read'\n match( \"read\" )\n\n \n @state.type = t... | [
"0.6208898",
"0.61045605",
"0.6049566",
"0.6017139",
"0.5995886",
"0.5919935",
"0.5918869",
"0.59128845",
"0.59128845",
"0.59128845",
"0.59128845",
"0.588986",
"0.5845261",
"0.58317906",
"0.58144104",
"0.5776191",
"0.5775005",
"0.5767923",
"0.57458186",
"0.5655169",
"0.565009... | 0.6284716 | 0 |
add a 'f' method called with a method rather than a block | def _f(*args)
args.each {|meth|
module_eval <<-here
def #{meth}f(*args)
#{meth} {|obj| obj.send(*args)}
end
here
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f\n yield\n end",
"def f\n yield\n end",
"def f\n yield\n end",
"def f\n end",
"def bound_method(block); end",
"def g(&block) # If you want to know more,\n f(&block) # read './higher_method.rb'\nend",
"def add(f)\n @lambdas.push(f)\n end",
"de... | [
"0.6982827",
"0.6982827",
"0.6982827",
"0.6830312",
"0.66917694",
"0.65274704",
"0.64899784",
"0.63821423",
"0.62360346",
"0.6234282",
"0.6170194",
"0.616984",
"0.6105891",
"0.6069093",
"0.6047788",
"0.6047788",
"0.604415",
"0.6005645",
"0.5975724",
"0.5968239",
"0.59467036",... | 0.7052188 | 0 |
Iterates using a block if provided, otherwise returns an array of enums | def enums(&block)
values = get_enums
if block
values.each do |v|
yield v
end
else
values
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n if block\n to_enum.each(&block)\n return nil\n else\n return to_enum\n end\n end",
"def each(&block)\n \n if (!block_given?)\n to_enum\n else\n parse_with_block(&block)\n end\n \n end",
"def each &block\n if block_given?\n... | [
"0.7826448",
"0.77630013",
"0.75432587",
"0.7406089",
"0.7277445",
"0.7260299",
"0.7049842",
"0.697999",
"0.6968194",
"0.6939687",
"0.6918986",
"0.6883832",
"0.68675953",
"0.6852323",
"0.68170255",
"0.67997706",
"0.67288387",
"0.6681732",
"0.66632307",
"0.6656623",
"0.6586197... | 0.826259 | 0 |
Return enum class vars | def get_enums
# Find matching refs
v = self.class_variables.find_all { |e| e.to_s.include? '__enum__' }
# Lookup class variable from refs and return
v.map { |x| class_variable_get(x) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum_class\n self\n end",
"def enums\n inject_block(:name, :value)\n end",
"def enums\n\t\tselect {|x| x.class == Enum }\n\tend",
"def extend_enum_class_methods(options) #:nodoc:\n\n extend PowerEnum::Enumerated::EnumClassMethods\n\n class_eval do\n include PowerEnu... | [
"0.6748713",
"0.6279167",
"0.62250423",
"0.6183746",
"0.61632127",
"0.6161542",
"0.61382943",
"0.6116979",
"0.6116553",
"0.60546744",
"0.5954119",
"0.59244573",
"0.5858168",
"0.5800703",
"0.57839715",
"0.57781243",
"0.5752685",
"0.5700727",
"0.56840163",
"0.56683135",
"0.5653... | 0.7719667 | 0 |
Set the repository url and update on Hudson server | def repository_url=(repository_url)
return false if @repository_url.nil?
@repository_url = repository_url
@config_doc.elements["/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote"].text = repository_url
@config = @config_doc.to_s
update
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repository_url=(repository_url)\n return false if @repository_url.nil?\n @repository_url = repository_url\n @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text = repository_url\n @config = @config_doc.to_s\n update\n end",
"def con... | [
"0.7286176",
"0.6654539",
"0.66193664",
"0.6555229",
"0.64398754",
"0.64271075",
"0.6382642",
"0.6381714",
"0.6374833",
"0.63607055",
"0.63323325",
"0.6276618",
"0.61307764",
"0.6059681",
"0.6045753",
"0.6011997",
"0.59634537",
"0.5960024",
"0.59285426",
"0.5917978",
"0.59167... | 0.7389047 | 0 |
Set the repository browser location and update on Hudson server | def repository_browser_location=(repository_browser_location)
@repository_browser_location = repository_browser_location
@config_doc.elements["/project/scm/browser/location"].text = repository_browser_location
@config = @config_doc.to_s
update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repository_browser_location=(repository_browser_location)\n @repository_browser_location = repository_browser_location\n @config_doc.elements[\"/project/scm/browser/location\"].text = repository_browser_location\n @config = @config_doc.to_s\n update\n end",
"def repository_url=(reposit... | [
"0.69537747",
"0.62130314",
"0.60950625",
"0.6093241",
"0.60004646",
"0.5884865",
"0.5853719",
"0.5789533",
"0.57768697",
"0.5768625",
"0.56661123",
"0.5663747",
"0.5663294",
"0.5637452",
"0.56154716",
"0.5557394",
"0.5467983",
"0.54628974",
"0.5461593",
"0.5435002",
"0.53995... | 0.6945589 | 1 |
GET /snipets GET /snipets.json | def index
@snipets = Snipet.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n e... | [
"0.7275895",
"0.6665422",
"0.64346504",
"0.6254051",
"0.61663955",
"0.6139616",
"0.6139616",
"0.61200345",
"0.6081136",
"0.6081136",
"0.6075785",
"0.6069055",
"0.60379493",
"0.6004157",
"0.5989109",
"0.5947893",
"0.5942264",
"0.59183973",
"0.5895985",
"0.58723706",
"0.5839900... | 0.7560032 | 0 |
POST /snipets POST /snipets.json | def create
@snipet = Snipet.new(snipet_params)
@snipet.user_id = current_user.id
@snipet.username = current_user.username
respond_to do |format|
if @snipet.save
format.html { redirect_to @snipet, notice: 'Snipet was successfully created.' }
format.json { render :show, status: :crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @snippit = Snippit.new(snippit_params)\n\n respond_to do |format|\n if @snippit.save\n format.html { redirect_to edit_snippit_path(@snippit), notice: 'Snippit was successfully created.' }\n format.json { render :show, status: :created, location: @snippit }\n else\n ... | [
"0.64791256",
"0.6186867",
"0.59762424",
"0.5919434",
"0.5903464",
"0.5903464",
"0.5897454",
"0.5833726",
"0.5820081",
"0.57430977",
"0.57430977",
"0.5693478",
"0.56161916",
"0.5578768",
"0.54449564",
"0.5416762",
"0.54098547",
"0.5403203",
"0.5386081",
"0.5381064",
"0.534491... | 0.6427875 | 1 |
PATCH/PUT /snipets/1 PATCH/PUT /snipets/1.json | def update
respond_to do |format|
if @snipet.update(snipet_params)
format.html { redirect_to @snipet, notice: 'Snipet was successfully updated.' }
format.json { render :show, status: :ok, location: @snipet }
else
format.html { render :edit }
format.json { render json: @sn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @snippit.update(snippit_params)\n format.html { redirect_to edit_snippit_path(@snippit) }\n format.json { render :show, status: :ok, location: @snippit }\n format.js {}\n else\n format.html { render :edit }\n format.json { ren... | [
"0.61907846",
"0.6151757",
"0.60768056",
"0.6053209",
"0.6053209",
"0.6052682",
"0.6048319",
"0.5949231",
"0.59442765",
"0.5875524",
"0.5869686",
"0.58653426",
"0.5841796",
"0.58316237",
"0.58188933",
"0.5780651",
"0.5780651",
"0.5774425",
"0.57552063",
"0.57225215",
"0.57192... | 0.6928096 | 0 |
DELETE /snipets/1 DELETE /snipets/1.json | def destroy
@snipet.destroy
respond_to do |format|
format.html { redirect_to snipets_url, notice: 'Snipet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @snip = Snip.find(params[:id])\n @snip.destroy\n\n respond_to do |format|\n format.html { redirect_to snips_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @stone = Stone.find(params[:id])\n ... | [
"0.69598424",
"0.6839644",
"0.68342197",
"0.6676522",
"0.6674",
"0.6674",
"0.6671506",
"0.664461",
"0.6600372",
"0.65466875",
"0.6539722",
"0.6528592",
"0.6502035",
"0.64910597",
"0.6479669",
"0.6460064",
"0.64536667",
"0.64524597",
"0.64439803",
"0.64373606",
"0.6435348",
... | 0.72916263 | 0 |
GET /entree_journals/new GET /entree_journals/new.json | def new
@entree_journal = EntreeJournal.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @entree_journal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@journal }\n ... | [
"0.8022465",
"0.719376",
"0.7061659",
"0.7024414",
"0.7009758",
"0.6944073",
"0.6944073",
"0.6866543",
"0.6866543",
"0.685233",
"0.685233",
"0.685233",
"0.68233466",
"0.6813648",
"0.680419",
"0.6785191",
"0.67668974",
"0.6758122",
"0.6728488",
"0.6715694",
"0.6709938",
"0.6... | 0.7208673 | 1 |
DELETE /entree_journals/1 DELETE /entree_journals/1.json | def destroy
@entree_journal = EntreeJournal.find(params[:id])
@entree_journal.destroy
respond_to do |format|
format.html { redirect_to entree_journals_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @journal = @journals.find(params[:id])\n @journal.destroy\n\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal.destroy\n respond_to do |format|\n format.html { redirect_to jou... | [
"0.7347026",
"0.7137502",
"0.69152653",
"0.6841391",
"0.6841391",
"0.6828826",
"0.6816773",
"0.6801458",
"0.67645586",
"0.6745822",
"0.6744222",
"0.66843843",
"0.66843843",
"0.6652057",
"0.6641622",
"0.6640784",
"0.6638473",
"0.6637966",
"0.66197723",
"0.6610529",
"0.6603574"... | 0.74101645 | 0 |
POST /medios POST /medios.xml | def create
@medio = Medio.new(params[:medio])
respond_to do |format|
if @medio.save
flash[:notice] = 'Medio was successfully created.'
format.html { redirect_to(@medio) }
format.xml { render :xml => @medio, :status => :created, :location => @medio }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @media = Media.new(params[:media])\n\n respond_to do |format|\n if @media.save\n flash[:notice] = 'Media was successfully created.'\n format.html { redirect_to(@media) }\n format.xml { render :xml => @media, :status => :created, :location => @media }\n else\n ... | [
"0.6037906",
"0.6025891",
"0.5859099",
"0.5783008",
"0.5781451",
"0.5765274",
"0.57336354",
"0.57003254",
"0.5640378",
"0.5620634",
"0.54873365",
"0.54784214",
"0.54778564",
"0.54750454",
"0.5471705",
"0.5454029",
"0.54520077",
"0.545103",
"0.54478496",
"0.5443026",
"0.543797... | 0.61358255 | 0 |
PUT /medios/1 PUT /medios/1.xml | def update
@medio = Medio.find(params[:id])
respond_to do |format|
if @medio.update_attributes(params[:medio])
flash[:notice] = 'Medio was successfully updated.'
format.html { redirect_to(@medio) }
format.xml { head :ok }
else
format.html { render :action => "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def update\n @media = Media.find(params[:id])\n\n r... | [
"0.61920947",
"0.59739894",
"0.59649897",
"0.5826348",
"0.58060646",
"0.57023287",
"0.5697337",
"0.569068",
"0.5666099",
"0.5611669",
"0.56059045",
"0.5602709",
"0.55776376",
"0.5565541",
"0.553882",
"0.5501341",
"0.5398622",
"0.53982633",
"0.5393104",
"0.5377352",
"0.5377352... | 0.6045457 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.