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 |
|---|---|---|---|---|---|---|
callseq: lifetime() > Numeric Returns time in milliseconds since this Clock instance was created. | def lifetime
Clock.runtime() - @start
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n seconds.to_runtime\n end",
"def lifetime_in_minutes\n return @lifetime_in_minutes\n end",
"def lifetime\n if running?\n Time.now - start_time\n elsif finished?\n end_time - start_time\n end\n end",
... | [
"0.7161245",
"0.7108412",
"0.70091206",
"0.70091206",
"0.6760255",
"0.6725017",
"0.6669904",
"0.6669904",
"0.6669904",
"0.6669904",
"0.6669904",
"0.6669904",
"0.6669904",
"0.6669904",
"0.6669904",
"0.66186184",
"0.659012",
"0.65864587",
"0.6586233",
"0.6581402",
"0.6571587",
... | 0.78252715 | 0 |
callseq: framerate() > Numeric Return the actual framerate (frames per second) recorded by the Clock. See tick. TODO: sample only a few seconds in the past, instead of the entire lifetime of the Clock. | def framerate
# below is same as: return @ticks / (lifetime / 1000.0)
return 1000.0 * @ticks / lifetime()
rescue ZeroDivisionError
return 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def framerate(input)\n process(:framerate, input)\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n 1.0/@fps\n end",
"def fps\r\n @fps_counter.fps\r\n end",
"def fps\n @fps\n end",
"def frame_rate\n @cue_... | [
"0.7505094",
"0.74421257",
"0.74421257",
"0.74421257",
"0.70242864",
"0.69934696",
"0.6986008",
"0.6965169",
"0.692625",
"0.6842809",
"0.6791858",
"0.67755085",
"0.67642707",
"0.6596985",
"0.6487149",
"0.6428744",
"0.64041656",
"0.6389907",
"0.63779736",
"0.6289188",
"0.62507... | 0.8297467 | 0 |
get block header information. | def getblockheader(block_id, verbose)
block_hash = block_id.rhex
entry = node.chain.find_entry_by_hash(block_hash)
raise ArgumentError.new('Block not found') unless entry
if verbose
{
hash: block_id,
height: entry.height,
version: entry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_headers(options = {block_range: (0..0)}, &block)\n get_block_objects(options.merge(object: :block_header), block)\n end",
"def header\n return @header\n end",
"def getHeader() @header1 end",
"def read_block_header # :nodoc:\n unless header = rio.read(BLOCK_HEADER_SIZE)\n ... | [
"0.741483",
"0.7320797",
"0.7244565",
"0.71885586",
"0.711902",
"0.7043221",
"0.69760096",
"0.6791572",
"0.6784318",
"0.6771961",
"0.67525303",
"0.6741439",
"0.6725684",
"0.6715721",
"0.6711397",
"0.6611485",
"0.65868527",
"0.6580698",
"0.65793",
"0.6535806",
"0.652683",
"0... | 0.7377386 | 1 |
get current wallet information. | def getwalletinfo
node.wallet ? node.wallet.to_h : {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wallet_info\n client.make_request('/wallet-info', 'post', params: {})\n end",
"def getwalletinfo\n @api.request 'getwalletinfo'\n end",
"def wallet\n get 'wallet'\n end",
"def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'appl... | [
"0.84152645",
"0.7884375",
"0.7647404",
"0.725685",
"0.72041637",
"0.7085868",
"0.69463634",
"0.6891384",
"0.6499245",
"0.6471868",
"0.6412507",
"0.637937",
"0.62032247",
"0.6135825",
"0.61055845",
"0.6098647",
"0.6065132",
"0.6064917",
"0.60542965",
"0.6039482",
"0.60071117"... | 0.826012 | 1 |
get the list of current Wallet accounts. | def listaccounts
return {} unless node.wallet
accounts = {}
node.wallet.accounts.each do |a|
accounts[a.name] = node.wallet.get_balance(a)
end
accounts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end",
"def accounts\n account_data = request('listaccounts')\n ... | [
"0.7455087",
"0.73201716",
"0.73093945",
"0.72517806",
"0.72109795",
"0.7198059",
"0.7146572",
"0.7120139",
"0.70756197",
"0.70464563",
"0.7044432",
"0.7023931",
"0.70052165",
"0.698824",
"0.69784474",
"0.69708824",
"0.69318813",
"0.6929535",
"0.6919083",
"0.68674046",
"0.685... | 0.7909116 | 0 |
GET /api/v1/user_to_progresses GET /api/v1/user_to_progresses.json | def index
@api_v1_user_to_progresses = Api::V1::UserToProgress.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def index\n @api_v1_progresses = Api::V1::Progress.all\n end",
"def userrequests\n @requests = Reque... | [
"0.71781546",
"0.59070694",
"0.5542092",
"0.53976023",
"0.53976023",
"0.53424305",
"0.5280096",
"0.52716476",
"0.52421373",
"0.5179127",
"0.51781964",
"0.51571774",
"0.50834745",
"0.5074525",
"0.505837",
"0.5054464",
"0.5050817",
"0.5050817",
"0.5035786",
"0.5027724",
"0.5023... | 0.7613742 | 0 |
DELETE /api/v1/user_to_progresses/1 DELETE /api/v1/user_to_progresses/1.json | def destroy
@api_v1_user_to_progress.destroy
respond_to do |format|
format.html { redirect_to api_v1_user_to_progresses_url, notice: 'User to progress was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_url }\n format.js... | [
"0.6321449",
"0.6306389",
"0.628742",
"0.62230974",
"0.61828655",
"0.6179564",
"0.6164015",
"0.60934246",
"0.6070472",
"0.6069447",
"0.6050719",
"0.6045418",
"0.60361326",
"0.60293937",
"0.60189223",
"0.6017308",
"0.6013181",
"0.5992445",
"0.5972203",
"0.5961343",
"0.5949925"... | 0.7023359 | 0 |
GET /supports GET /supports.json | def index
@supports = Support.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index \n @supports = Support.all\n end",
"def supports?\n raise \"Method 'supports?' must be defined\"\n end",
"def supports_json?\n false\n end",
"def supports_json?\n false\n end",
"def supports?\n fail \"Method 'supports?' must be defined\"\n end... | [
"0.65853333",
"0.6422839",
"0.63477075",
"0.63477075",
"0.6326838",
"0.609027",
"0.58829504",
"0.5830267",
"0.5814108",
"0.5788244",
"0.5697201",
"0.5682357",
"0.5648367",
"0.5647686",
"0.56413645",
"0.563323",
"0.563323",
"0.563323",
"0.563323",
"0.563323",
"0.56207055",
"... | 0.67538 | 0 |
Wait for a request, process it, publish the response and exit | def process_request!
job = Thread.current[:redis_blocking].brpop(Scales::Storage::REQUEST_QUEUE, 0).last
id, response = nil, nil
Thread.current[:post_process_queue] = []
id, response = process!(job)
post_process!(job)
@status.put_response_in_queue!(response)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response\n parse_request\n do_something\n put_response\n end",
"def finalize(env)\n # closing the write end of the pipe will mark EOF on the read end\n env[\"tus.input-writer\"].close unless env[\"tus.input-writer\"].closed?\n # wait for the request to finish\n result = env[\"tus.reques... | [
"0.6529517",
"0.6393831",
"0.63797176",
"0.63797176",
"0.63562065",
"0.6333659",
"0.6293019",
"0.61389834",
"0.61286837",
"0.6056373",
"0.6052501",
"0.60214144",
"0.60179335",
"0.59543693",
"0.595228",
"0.59519786",
"0.59297657",
"0.5928587",
"0.59216446",
"0.5905827",
"0.590... | 0.6594524 | 0 |
Allows adding a new message to the Flash hash in controllers by providing a single type argument which will use translations to build the message. There are 2 ways of storing flash messages in translations : The first is to place translations under : flash... Ex: flash.tasks.create.success The second is to use a shared... | def flash_message(type, options = {})
controller_path = "flash.#{ params[:controller] }.#{ params[:action] }.#{ type }"
shared_path = "flash.shared.#{ params[:action] }.#{ type }"
options[:model] = options[:model].class.model_name.human if options[:model]
options[:default] = I18n.t(shared_path, options... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flash_message(type, text)\n flash[type.to_sym] ||= []\n flash[type.to_sym] << text\n end",
"def flash_message(type, message)\n flash[type] ||= []\n flash[type] << message\n end",
"def build_flash_message(type, options = {})\n final_action_name = action_name.dup\n ... | [
"0.7867448",
"0.77774805",
"0.7757049",
"0.76084095",
"0.7047072",
"0.6988701",
"0.6948092",
"0.69285655",
"0.67685914",
"0.67046475",
"0.6692215",
"0.6640412",
"0.65609044",
"0.65609044",
"0.6502587",
"0.6502587",
"0.65002507",
"0.64999104",
"0.64902973",
"0.6483529",
"0.646... | 0.8403498 | 0 |
Public: Defines the conditions for a document to be Lazyable. doc the Jekyll::Document or Jekyll::Page Returns true if the doc is written & is HTML. | def Lazyable?(doc)
(doc.is_a?(Jekyll::Page) || doc.write?) &&
doc.output_ext == ".html" || (doc.permalink && doc.permalink.end_with?("/"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_processable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n doc.output_ext == \".html\" || (doc.permalink&.end_with?(\"/\"))\n end",
"def doc?\n (doc && !doc.empty?)\n end",
"def doc?\n (doc && !doc.empty?)\n end",
"def document?\n ... | [
"0.676577",
"0.6468816",
"0.6468816",
"0.64517033",
"0.6122326",
"0.61153936",
"0.6078838",
"0.59953517",
"0.59603065",
"0.5815682",
"0.58019066",
"0.57814705",
"0.5770814",
"0.5735419",
"0.5729897",
"0.5729897",
"0.56717545",
"0.5662838",
"0.5657163",
"0.56318414",
"0.559289... | 0.76906896 | 0 |
GET /admin/shirt_colors/new GET /admin/shirt_colors/new.json | def new
@shirt_color = ShirtColor.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @shirt_color }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @shirt_color = ShirtColor.new(params[:shirt_color])\n\n respond_to do |format|\n if @shirt_color.save\n format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }\n format.json { render json: @shirt_color, status: :created, location: @... | [
"0.77584344",
"0.7582571",
"0.7562297",
"0.75208503",
"0.73672837",
"0.73672837",
"0.73396665",
"0.7132455",
"0.70843923",
"0.70398074",
"0.7018187",
"0.6976214",
"0.6909768",
"0.6902758",
"0.6843193",
"0.6803663",
"0.68021286",
"0.6784806",
"0.6783694",
"0.675867",
"0.672147... | 0.7623322 | 1 |
POST /admin/shirt_colors POST /admin/shirt_colors.json | def create
@shirt_color = ShirtColor.new(params[:shirt_color])
respond_to do |format|
if @shirt_color.save
format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }
format.json { render json: @shirt_color, status: :created, location: @shirt_color... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to ... | [
"0.72730416",
"0.69259435",
"0.66636676",
"0.6632885",
"0.64424765",
"0.640716",
"0.63633823",
"0.63038796",
"0.62913734",
"0.6279191",
"0.62573063",
"0.6252593",
"0.6213767",
"0.619297",
"0.6181122",
"0.61311877",
"0.60835236",
"0.60806257",
"0.607118",
"0.60634327",
"0.6062... | 0.7479431 | 0 |
PUT /admin/shirt_colors/1 PUT /admin/shirt_colors/1.json | def update
@shirt_color = ShirtColor.find(params[:id])
respond_to do |format|
if @shirt_color.update_attributes(params[:shirt_color])
format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully updated.' }
format.json { head :no_content }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.htm... | [
"0.7418968",
"0.66204554",
"0.65830916",
"0.6535938",
"0.6498077",
"0.64291906",
"0.6320395",
"0.63089687",
"0.62797195",
"0.62597305",
"0.62443966",
"0.6231157",
"0.6229021",
"0.6221083",
"0.6210442",
"0.62048304",
"0.62031114",
"0.62004775",
"0.6181998",
"0.614203",
"0.6109... | 0.73742723 | 1 |
DELETE /admin/shirt_colors/1 DELETE /admin/shirt_colors/1.json | def destroy
@shirt_color = ShirtColor.find(params[:id])
@shirt_color.destroy
respond_to do |format|
format.html { redirect_to admins_shirt_colors_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end"... | [
"0.7895721",
"0.7253408",
"0.72148347",
"0.7204698",
"0.7060551",
"0.7060551",
"0.7053655",
"0.7036212",
"0.69999903",
"0.6959335",
"0.69069874",
"0.6879896",
"0.6866158",
"0.6802698",
"0.67977387",
"0.6795793",
"0.6755527",
"0.67211616",
"0.6720177",
"0.6711934",
"0.6702769"... | 0.78010786 | 1 |
before_action :new, :check_if_student GET /books GET /books.json | def index
check_if_student
@books = Book.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @student = Student.find(params[:student_id])\n @student_book = @student.student_books.new(student_book_params)\n authorize! :create, @student_book\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to student_student_books_path(@student), notice: 'Student bo... | [
"0.68464494",
"0.65687937",
"0.6554601",
"0.6502732",
"0.6370361",
"0.6274324",
"0.62663233",
"0.61579055",
"0.6149347",
"0.61476344",
"0.61146224",
"0.61006683",
"0.60970044",
"0.60884786",
"0.60394114",
"0.6039122",
"0.6036817",
"0.60239",
"0.60199237",
"0.59859014",
"0.597... | 0.701106 | 0 |
Returns the next HttpUrl that is neither invalid nor already fetched. If there are no more URLs, it returns +nil+. | def get_next_url
while true
unless url = @node_manager.dequeue_url
# there are currently no further URLs in the queue
return nil
end
unless http_url = HttpUrl.parse(url)
@node_manager.log_error :invalid_url, url.inspect
next
end
if @node_manager.has_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_url\n while true\n unless url = dequeue_url()\n # there are currently no further URLs in the queue\n return nil\n end\n\n unless http_url = HttpUrl.parse(url)\n log_error :invalid_url, url.inspect \n next\n end\n\n if has_file?(http_url.to_filena... | [
"0.8423655",
"0.6022834",
"0.59125125",
"0.58111787",
"0.577472",
"0.577472",
"0.57190794",
"0.5705838",
"0.5705838",
"0.5705838",
"0.5705838",
"0.5698161",
"0.56560874",
"0.5654704",
"0.5654704",
"0.5654704",
"0.5639774",
"0.5629583",
"0.5570565",
"0.5570565",
"0.55143726",
... | 0.82380056 | 1 |
Find the group with the most actions and return an int h where: h = (max_actions + pad) factor the pad represents the top two header lines in the rendered post it the factor represents the line height of the action list | def compute_height(pad = 2, factor = 13)
(max_actions + pad) * factor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|... | [
"0.5806632",
"0.5806632",
"0.57885504",
"0.5447509",
"0.5403133",
"0.5402194",
"0.51390976",
"0.5093184",
"0.5090375",
"0.5083449",
"0.508129",
"0.50665444",
"0.50417334",
"0.5037443",
"0.5007906",
"0.500024",
"0.4975096",
"0.49619475",
"0.49557513",
"0.49306992",
"0.49247235... | 0.62843657 | 0 |
method to find edge from 2 vertices | def findEdge(vertex1, vertex2)
visualedges = @visualGraph.visual_edges
visualedges.each do |edge|
if edge.v1.id == vertex1 && edge.v2.id == vertex2
# edge from vertex1 to vertex2
return edge
elsif edge.v2.id == vertex1 && edge.v1.id == vertex2
# edge from vertex2 to vertex1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_edge?(vertex1, vertex2)\n\tend",
"def find_edge(node_1, node_2)\n @edges[node_1][node_2] if @edges[node_1]\n end",
"def find_edge(one, two)\n edges.find do |e|\n (e.one == one && e.two == two) || (e.two == one && e.one == two)\n end\n end",
"def end_vertice... | [
"0.7394766",
"0.7323445",
"0.73078275",
"0.72541255",
"0.7220407",
"0.70989025",
"0.70989025",
"0.6944398",
"0.6875293",
"0.6861289",
"0.68169624",
"0.6740854",
"0.6740854",
"0.6718185",
"0.66641533",
"0.66641533",
"0.65968657",
"0.65937185",
"0.6589447",
"0.65610266",
"0.654... | 0.79551625 | 0 |
Stretch the children layouts to fill the gaps, remove redundant spaces inside the parent layout | def stretch_children_layouts(parent_template, parent_width, parent_height, lines)
total_height = 0
lines.each_with_index do |line, line_index|
desired_height =
if line_index == lines.length - 1
parent_height - total_height
else
line.map { |_child_template,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout()\n layout_children()\n end",
"def do_layout\n _init_layout\n r = @top_margin\n c = @left_margin\n #\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fi... | [
"0.59840864",
"0.58018905",
"0.5796675",
"0.5727341",
"0.564793",
"0.5540127",
"0.5504066",
"0.5488912",
"0.5418825",
"0.5327344",
"0.5260132",
"0.5251093",
"0.5246008",
"0.51668864",
"0.51428837",
"0.51121426",
"0.5075789",
"0.5033938",
"0.49686903",
"0.49675438",
"0.4962577... | 0.703636 | 0 |
POST /sections or /sections.json | def create
@section = Section.new(section_params)
if @section.save
render json: SectionSerializer.new(@section)
else
render json: @section.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n @section = Section.new(params[:section])\n @section.page = @p... | [
"0.67786705",
"0.659407",
"0.6583568",
"0.6568496",
"0.6561841",
"0.6520435",
"0.6520435",
"0.65132475",
"0.6494207",
"0.64769095",
"0.64499754",
"0.64323574",
"0.64323574",
"0.64323574",
"0.64323574",
"0.64296603",
"0.6390424",
"0.6380877",
"0.6375676",
"0.63738686",
"0.6359... | 0.6856197 | 0 |
GET /commodities GET /commodities.json | def index
@commodities = Commodity.all
if params[:search].present?
@commodities = @commodities.query(params[:search].to_s)
end
@commodities = @commodities.page(params[:page])
respond_to do |format|
format.html
format.js {}
format.json {
render json: {:commodities =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # ... | [
"0.71912295",
"0.71552944",
"0.7022852",
"0.7022852",
"0.62883896",
"0.6219341",
"0.6219341",
"0.6196894",
"0.61902994",
"0.6051019",
"0.60480565",
"0.60461265",
"0.6030203",
"0.60208625",
"0.60200393",
"0.6002363",
"0.59913033",
"0.5915414",
"0.5910676",
"0.58964765",
"0.587... | 0.74435806 | 0 |
Convert compressed range proof using inner product. | def to_compress
a = lx.dup
b = rx.dup
ts = transcript.dup
w = ts.challenge_scalar("w")
q = GENERATOR_BJ * w
a_sum = a.dup
b_sum = b.dup
g_sum = vec_g.dup
h_sum = vec_h2.dup
terms = []
until a_sum.length == 1
a_lo = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mult(other_range)\n xlo = first\n xhi = last\n ylo = other_range.first\n yhi = other_range.last\n pos = ->(x) { x >= 0 }\n neg = ->(x) { x <= 0 }\n return (xlo * ylo)..(xhi * yhi) if [xlo, xhi, ylo, yhi].all?(&pos)\n return (xhi * ylo)..(xhi * yhi) if [xlo, xhi, yhi].all?(&pos) and [ylo... | [
"0.53129953",
"0.51936966",
"0.5123207",
"0.5123207",
"0.5113586",
"0.50973785",
"0.50620395",
"0.5046364",
"0.50194764",
"0.5015838",
"0.5008503",
"0.5004842",
"0.49989852",
"0.4994211",
"0.49884263",
"0.497221",
"0.4961087",
"0.49530277",
"0.49439105",
"0.4938097",
"0.49367... | 0.5961378 | 0 |
GET /shipping_options/1 GET /shipping_options/1.json | def show
@shipping_option = ShippingOption.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @shipping_option }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipping_options\n Hash.new\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def shipping_fee\n @admin_options = Admin::Option.where(\"id = ?\" , 4... | [
"0.72764933",
"0.7117327",
"0.6745459",
"0.6532361",
"0.64822257",
"0.63974637",
"0.6379292",
"0.6358732",
"0.6284373",
"0.6206988",
"0.6145065",
"0.61441195",
"0.61408645",
"0.61267304",
"0.6120737",
"0.6118218",
"0.6104784",
"0.6083203",
"0.6074076",
"0.6053882",
"0.6050322... | 0.76127625 | 0 |
GET /shipping_options/new GET /shipping_options/new.json | def new
@shipping_option = ShippingOption.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @shipping_option }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :cre... | [
"0.75195396",
"0.7092113",
"0.7014411",
"0.68997157",
"0.6854294",
"0.6833646",
"0.6670023",
"0.6609017",
"0.65135556",
"0.648711",
"0.648711",
"0.643037",
"0.64238375",
"0.63948464",
"0.6372058",
"0.6372058",
"0.63628006",
"0.63560814",
"0.6337575",
"0.6335904",
"0.6334768",... | 0.8196601 | 0 |
POST /shipping_options POST /shipping_options.json | def create
@shipping_option = ShippingOption.new(params[:shipping_option])
respond_to do |format|
if @shipping_option.save
format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }
format.json { render json: @shipping_option, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipping_options\n Hash.new\n end",
"def shipping_method_params\n # params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_categories)\n params.require(:shipping_method).permit(:name, :admin_name, :display_on, :shipping_category_ids => [])\n end",
"def add_s... | [
"0.6891033",
"0.66590875",
"0.64115906",
"0.641141",
"0.6390521",
"0.63499707",
"0.63313067",
"0.63216096",
"0.63127196",
"0.6252297",
"0.62448317",
"0.62297773",
"0.6093281",
"0.6087907",
"0.60523325",
"0.60504204",
"0.60492456",
"0.6045949",
"0.6006122",
"0.5944607",
"0.594... | 0.7298239 | 0 |
PUT /shipping_options/1 PUT /shipping_options/1.json | def update
@shipping_option = ShippingOption.find(params[:id])
respond_to do |format|
if @shipping_option.update_attributes(params[:shipping_option])
format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :cre... | [
"0.6716322",
"0.65077084",
"0.64580584",
"0.6420317",
"0.6414997",
"0.63914895",
"0.6363216",
"0.6355999",
"0.63348055",
"0.62984604",
"0.62516844",
"0.6240664",
"0.623425",
"0.6220395",
"0.61370414",
"0.61319315",
"0.6125961",
"0.61213094",
"0.61127245",
"0.610799",
"0.61030... | 0.74950427 | 0 |
DELETE /shipping_options/1 DELETE /shipping_options/1.json | def destroy
@shipping_option = ShippingOption.find(params[:id])
@shipping_option.destroy
respond_to do |format|
format.html { redirect_to shipping_options_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @shipping_method.destroy\n respond_to do |format|\n format.html { redirect_to admin_shipping_methods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_detail.destroy\n respond_to do |format|\n format.html { redirect_to shipping_details_ur... | [
"0.7427041",
"0.7112162",
"0.70128614",
"0.69396985",
"0.688937",
"0.68504006",
"0.68322504",
"0.6824092",
"0.6779067",
"0.677389",
"0.67732257",
"0.6763765",
"0.6734603",
"0.67255276",
"0.6657145",
"0.6647442",
"0.6646464",
"0.66054416",
"0.6589272",
"0.656056",
"0.65575373"... | 0.80193347 | 0 |
order the rectangles as per assumptions | def order_rectangles(rec1, rec2)
r1 = Rectangle.new(rec1)
r2 = Rectangle.new(rec2)
r1 = order_coord_of_rectangles(r1)
r2 = order_coord_of_rectangles(r2)
if r2.A.X < r1.A.X
temp = r1
r1 = r2
r2 = temp
end
ret = [r1, r2]
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect... | [
"0.6826875",
"0.6623872",
"0.6600286",
"0.648778",
"0.648778",
"0.64299035",
"0.6417485",
"0.6112955",
"0.5999371",
"0.5987383",
"0.5915914",
"0.59156555",
"0.58682764",
"0.58656216",
"0.58424985",
"0.5837189",
"0.5820636",
"0.5820636",
"0.5787926",
"0.5780684",
"0.57240295",... | 0.74052614 | 0 |
get a script session id | def get_session_id
@agent.get( @root_url + '/dwr/engine.js') do |page|
@session_id = extract_session_id(page.body)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n @id ||= scgi.session_id\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addr... | [
"0.72828907",
"0.7209385",
"0.7209385",
"0.7209385",
"0.72038054",
"0.7065345",
"0.70478994",
"0.7008191",
"0.6987341",
"0.69795215",
"0.69387335",
"0.6931841",
"0.6925708",
"0.6917141",
"0.6916633",
"0.6915339",
"0.6912884",
"0.6894368",
"0.6856121",
"0.6816429",
"0.67322457... | 0.78841764 | 0 |
find the ID of the top headlines element, which is in a script element that looks like this: DM.has("r0c1p15", "headlines"); | def get_headline_div_id(page)
script = page.parser.css('script').select { |script| script.text =~ /DM\.has\(\".*\"\,\ \"headlines\"\)/ }
/DM\.has\(\"(.*)\"\,\ \"headlines\"\)/.match(script[0].to_s)[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head\n @head ||= node.attr(:head).to_i\n end",
"def headliner\n @headliner ||= artists.detect {|a| a.name == headliner_raw }\n end",
"def read_head_id\n File.read(head_path).strip if File.exists?(head_path)\n end",
"def id\n return @doc.xpath('//mets:metsHdr/@ID').to_s\... | [
"0.5985805",
"0.59420973",
"0.5580789",
"0.548702",
"0.54617065",
"0.54027736",
"0.539868",
"0.53349596",
"0.53338015",
"0.530045",
"0.5147233",
"0.51387066",
"0.5123056",
"0.5123056",
"0.5123056",
"0.51198745",
"0.5116149",
"0.51076233",
"0.5077348",
"0.50618815",
"0.5049796... | 0.76688844 | 0 |
extract article id from the uri | def get_article_id(urn)
/\/(.*)\/article\-(.*)\/.*/.match(urn)[2].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_id(uri)\n Addressable::URI.parse(uri).basename\n end",
"def extract_id_uri\n @id_uri = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRuri', a: NS)['value']\n empty, @country, @nature, date, @num = @id_uri.split('/')\n\n # yyyy-mm-dd\n @year = date.split('-', 2)[0]\n end",... | [
"0.74195385",
"0.72079074",
"0.71480155",
"0.7111334",
"0.69423306",
"0.68857217",
"0.68857217",
"0.6804149",
"0.67912287",
"0.6776286",
"0.66437405",
"0.6629898",
"0.66148144",
"0.655658",
"0.6547822",
"0.64951754",
"0.6484113",
"0.64748013",
"0.64595467",
"0.6423391",
"0.64... | 0.82634616 | 0 |
extract a meta tag value from the page | def get_metatag(page, tag)
page.parser.css("meta[name='#{tag}']").first['content']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_for_meta_tag(attribute_selector, html)\n html.xpath(\"//head/meta[@#{attribute_selector}]/@content\").first.try(:content)\n end",
"def extract_meta\n end",
"def get_tag(meta)\n sanitize_tag parse_tag_metadata_vars(meta)\n end",
"def get_meta(property, prptfile)\n meta_doc = ge... | [
"0.7258221",
"0.6716201",
"0.66033334",
"0.6501697",
"0.6474944",
"0.6412844",
"0.6277703",
"0.62498915",
"0.6245625",
"0.6232757",
"0.6206824",
"0.6184546",
"0.6146254",
"0.61297274",
"0.61200905",
"0.61134243",
"0.6070692",
"0.6048937",
"0.60113454",
"0.60113454",
"0.599297... | 0.76771367 | 0 |
PATCH/PUT /ad_domains/1 PATCH/PUT /ad_domains/1.json | def update
authorize! :update, @ad_domain
respond_to do |format|
if @ad_domain.update(ad_domain_params)
format.html { redirect_to @ad_domain, notice: 'Active Directory domain was successfully updated.' }
format.json { render :show, status: :ok, location: @ad_domain }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @domain = Domain.find(params[:id])\n\n if @domain.update(domain_params)\n head :no_content\n else\n render json: @domain.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @domain.update(domain_params)\n format.html { r... | [
"0.71034247",
"0.6570461",
"0.6513877",
"0.6490646",
"0.6346449",
"0.6333242",
"0.6294404",
"0.6265997",
"0.61892194",
"0.6174989",
"0.6146322",
"0.61300796",
"0.608417",
"0.6057645",
"0.604849",
"0.60423124",
"0.60218257",
"0.5990034",
"0.5987713",
"0.592205",
"0.59196925",
... | 0.6770255 | 1 |
If key is absent, save the result of calling the block. If key is present, block is never called. Ex: rt_store.set(url) do fetcher.get url will only be called if url isn't in rt_store end | def set key, force=nil, &block
return if (!force) && cache.include?(key)
cache_val, store_val = block.call()
return unless cache_val
cache.set_nr key, cache_val # update cache
store << store_val # save value
self.misses += 1 # track the cache miss
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(key, &block)\n store.compute_if_absent(key, &block)\n end",
"def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value... | [
"0.68902004",
"0.65900046",
"0.65330905",
"0.6531008",
"0.6495434",
"0.64840317",
"0.6365966",
"0.63627434",
"0.6342997",
"0.6243094",
"0.61999434",
"0.6132791",
"0.6023812",
"0.6022675",
"0.60095876",
"0.600445",
"0.5999143",
"0.59828645",
"0.5979067",
"0.59119284",
"0.59112... | 0.6650979 | 1 |
================== sending invoices ============================= | def send_invoices
change_date
@options = session[:invoice_options] || {}
[
:s_username, :s_first_name, :s_last_name, :s_number, :s_period_start, :s_period_end,
:s_issue_date, :s_sent_email, :s_sent_manually, :s_paid, :s_invoice_type
].each do |key|
@options[key] = params[key].try(:to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoice\n NotificationsMailer.invoice\n end",
"def send_freshbooks_invoice!\n raise SignalCloud::ClientInvoiceNotCreatedError.new unless self.has_invoice?\n \n response = FreshBooks.account.invoice.sendByEmail( invoice_id: self.freshbooks_invoice_id )\n raise SignalCloud::FreshBooksError.new(... | [
"0.7500561",
"0.7233134",
"0.7184405",
"0.7183869",
"0.71239305",
"0.7119951",
"0.70375514",
"0.70187014",
"0.6966581",
"0.6958223",
"0.6949742",
"0.6936296",
"0.6897574",
"0.68448067",
"0.68393326",
"0.6816709",
"0.6802644",
"0.6801469",
"0.6792376",
"0.6742171",
"0.6741441"... | 0.82193315 | 0 |
Based on what params user selected or if they were not passed based on params saved in session return user_id, that should be filtered for financial statements. if user passed clear as param return nil Params +session_options+ hash including :user_id, might be nil Return +user_id+ integer or nil | def financial_statements_user_id(session_options)
not_params_clear = !params[:clear]
params_user_id, session_user_id = [params[:s_user_id], session_options.try(:[], :s_user_id)]
if current_user.usertype == 'user'
user_id = current_user_id
elsif params_user_id && not_params_clear
user_id = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user_id\n if (params[:user_id])\n return params[:user_id].to_i\n else\n return params[:id].to_i\n end\n end",
"def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end",
"def get_user_from_session\r\n return User.find(s... | [
"0.6422591",
"0.62700105",
"0.62198734",
"0.6164427",
"0.6103503",
"0.60974437",
"0.6082344",
"0.6071978",
"0.6061947",
"0.60134",
"0.60076153",
"0.5993115",
"0.59782684",
"0.59635365",
"0.5921999",
"0.5921999",
"0.58947784",
"0.58933336",
"0.5872266",
"0.58480287",
"0.584386... | 0.8250601 | 0 |
=begin Based on what params user selected or if they were not passed based params saved in session return status, that should be filtered for financial statements. Params +session_options+ hash including :status, might be nil Returns +status+ string, one of valid_status_values, by default 'all' =end | def financial_statements_status(session_options)
not_params_clear = !params[:clear]
params_status, session_options_status = [params[:status], session_options.try(:[], [:status])]
if (@valid_status_values.include? params_status) && not_params_clear
params_status
elsif session_options && (@valid_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sessionStatus(options = {})\n assert_valid_keys(options, :sessionId, :transactionId, :date, :type, :amount, :description)\n assert_keys_exists(options, :sessionId, :transactionId, :date, :type, :amount, :description)\n #type => [ \"BOOKING\", \"REVERSAL\", \"BACKPAY\", \"EXTERNAL\", \"REFU... | [
"0.67327684",
"0.6095276",
"0.6050061",
"0.5843157",
"0.57345873",
"0.5653833",
"0.5494783",
"0.54440266",
"0.536635",
"0.5289625",
"0.52812344",
"0.5276167",
"0.5262529",
"0.52620155",
"0.5231291",
"0.5221503",
"0.5203766",
"0.5185905",
"0.51485497",
"0.51177555",
"0.5104264... | 0.803171 | 0 |
=begin convert prices in statements from default system currency to currency that is set in session Params +statement+ iterable of financial stement data(they rices should be in system currency) Returns +statement+ same object that was passed only it's prices recalculated in user selected currency =end | def convert_to_user_currency(statements)
exchange_rate = Currency.count_exchange_rate(session[:default_currency], session[:show_currency])
statements.each { |statement|
statement.price = statement.price.to_d * exchange_rate
statement.price_with_vat = statement.price_with_vat.to_d * exchange_rate
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def convert_curr\n curr = {\"USD\" => 1.0, \"CAN\" => 1.9, \"CHF\" => 0.91, \"EUR\" => 0.74, \"HKD\" => 7.75}\n curr.each do |key, value|\n if key == @currency\n @con = @price * value\n end\n end\n end"... | [
"0.6251829",
"0.62362576",
"0.6193996",
"0.60850334",
"0.60850334",
"0.5972156",
"0.59646547",
"0.5933741",
"0.587779",
"0.5779791",
"0.5758355",
"0.5719037",
"0.5708182",
"0.5656747",
"0.56557554",
"0.5612184",
"0.5584094",
"0.55549437",
"0.5552312",
"0.55353147",
"0.5524599... | 0.7560532 | 0 |
=begin financial data returned by invoice, credit notes or payments may lack some information, this method's purpose is to retrieve information from part of financial statement(let's say financial stetement is devided in three parts: credit note, invoice and payments) about paid/unpaid financial data. if there is no su... | def get_financial_statement(statements, status)
statements.each { |statement|
if statement.status == status
return statement
end
}
#Return default financial data if required stetement was not found
Struct.new('We', :count, :price, :price_with_vat, :status)
return Struct::We.new(0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_value(attendance, payment_type)\n quota = find_quota\n if payment_type == 'statement_agreement'\n full_price\n elsif attendance.price_band?\n attendance.band_value * attendance.discount\n elsif period_for.present?\n period_for.price * attendance.discount\n elsif quota.firs... | [
"0.6476749",
"0.58315426",
"0.5766122",
"0.57264704",
"0.5682658",
"0.564321",
"0.5589904",
"0.5571895",
"0.5559602",
"0.5557696",
"0.55138016",
"0.5460454",
"0.5450075",
"0.5446995",
"0.5440988",
"0.54402226",
"0.54148614",
"0.5411447",
"0.540227",
"0.5397451",
"0.5397199",
... | 0.71730596 | 0 |
=begin Only one who may not have permissions to view financial statements is accountant. If he does not have 'can see finances', 'invoices manage' and 'manage payments' permissions to read he cannot view financial statements. In any other case everyone can view treyr user's invoices, credit notes and payments. =end | def can_view_financial_statements?
if accountant? and (not current_user.accountant_allow_read('can_see_finances') or not current_user.accountant_allow_read('payments_manage') or not current_user.acoutnant_alllow_read('invoices_manage'))
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_see_finances?\n accountant_allow_read('see_financial_data')\n end",
"def account_not_owner_or_deputy\n errors.add( :account_id, I18n.t( 'sir_members.msg.own_account_id' )) \\\n if sir_log_id && account_id && sir_log.user_is_owner_or_deputy?( account_id )\n end",
"def ensure_is_authorized_t... | [
"0.6406249",
"0.6271701",
"0.622199",
"0.6074152",
"0.6052165",
"0.60480934",
"0.59924597",
"0.59908026",
"0.5982115",
"0.59774834",
"0.59516144",
"0.5915345",
"0.58944535",
"0.5889123",
"0.58816105",
"0.5878048",
"0.5851751",
"0.5850404",
"0.5848907",
"0.5847218",
"0.5831487... | 0.7303169 | 0 |
Argument: integer, num Side effects: None Return: String. Alterating 1's and 0's. A total of num 1's and 0's Edge cases: i/p: 0 Algorithm: str = '' Do the folllowing num times to index = 1, 2, 3, ..., num if index is odd str << '1' otherwise str << '0' Return str | def stringy(num)
str = ''
1.upto(num) do |index|
if index.odd?
str << '1'
else
str << '0'
end
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringy(num)\n str = ''\n num.times do |indx|\n indx % 2 == 0 ? str += '1' : str += '0'\n end\n return str\nend",
"def stringy(number)\n result = ''\n number.times do |idx|\n result << (idx.even? ? '1' : '0')\n end\n result\nend",
"def stringy(num)\n (1..num).map { |idx| idx.odd? ? '1' : '0'... | [
"0.8219545",
"0.8055982",
"0.8000005",
"0.78760594",
"0.78541046",
"0.7704706",
"0.76879984",
"0.76773953",
"0.7644177",
"0.7641257",
"0.76312363",
"0.76232964",
"0.76101303",
"0.7602515",
"0.7578583",
"0.7576514",
"0.7554433",
"0.75305223",
"0.7511593",
"0.74953",
"0.7494292... | 0.8182242 | 1 |
returns htmls of kiwix answer searches | def kiwixAnswerSearch(aA, aB, aC, aD)
htmls = []
begin
address1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aA) + '.html'
rescue
puts "address1 not encoded"
end
begin
address2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aB) + '.html'
rescue
puts "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kitties_search( q )\r\n \"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}\"\r\nend",
"def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end",
"def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).... | [
"0.6179074",
"0.59999126",
"0.59540224",
"0.58022946",
"0.5747085",
"0.5736522",
"0.5724279",
"0.56304294",
"0.5622335",
"0.5519854",
"0.5513782",
"0.5509408",
"0.5470092",
"0.5463009",
"0.5447612",
"0.5445428",
"0.5422556",
"0.5419947",
"0.5419365",
"0.5395516",
"0.5390178",... | 0.62700886 | 0 |
returns list of uris from a google search | def googleSearch(q, n = 5)
search = Google::Search::Web.new do |search|
search.query = q
search.size = :small
end
begin
uris = search.first(n).map(&:uri)
rescue
"uri fault"
end
return uris
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_urls(search_results)\n # A Google search_result looks like:\n # <a href=\"/url?q=https://www.scienceexchange.com/\">Science Exchange<b>...</b></a>\n # To get the actual page URL, use the 'href' and get the query param 'q' term.\n urls = []\n search_results.each do |result|\n ... | [
"0.7798854",
"0.7328244",
"0.710184",
"0.68942004",
"0.68099004",
"0.66551125",
"0.6574467",
"0.6551397",
"0.64066684",
"0.6397626",
"0.6377852",
"0.6367629",
"0.63197404",
"0.6306135",
"0.6273118",
"0.6234024",
"0.62063926",
"0.62023795",
"0.61490846",
"0.610605",
"0.6058003... | 0.7487712 | 1 |
iterably counts number of hits of each answer in a list of uris | def hitCount(uris, aA, aB, aC, aD)
hitCountStart = Time.now
aAll = []
aAll << aA << aB << aC << aD
countA = 0
countB = 0
countC = 0
countD = 0
aA = aA.downcase
aB = aB.downcase
aC = aC.downcase
aD = aD.downcase
aTotal = []
bTotal = []
cTotal = []
dTotal = []
plaintexts=[]
n = uris.size
n.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end",
"def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end",
"def popular_links\n result = {}\n urls[0...5].e... | [
"0.65483403",
"0.6428427",
"0.6323355",
"0.62579435",
"0.6139667",
"0.6139667",
"0.6139667",
"0.61366606",
"0.6043841",
"0.58811486",
"0.58738434",
"0.5853516",
"0.5851835",
"0.5850476",
"0.5849726",
"0.58431166",
"0.58113873",
"0.58081096",
"0.58022124",
"0.58003354",
"0.579... | 0.67984104 | 0 |
verifica se ha um medico na equipe | def is_medico_membro(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_medico = false
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'medico'
val_is_medico = true
end
end
val_is_medico
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n ... | [
"0.71335375",
"0.63187194",
"0.6280906",
"0.6140651",
"0.6104769",
"0.6053609",
"0.599745",
"0.5810091",
"0.57612264",
"0.57186514",
"0.565802",
"0.5656227",
"0.5632812",
"0.556337",
"0.55513775",
"0.5518658",
"0.5488609",
"0.54824775",
"0.5458807",
"0.54491657",
"0.54483855"... | 0.6813841 | 1 |
verifica se a equipe e uma equipe com 3 medicos e um Chunnin ou Jounin | def is_medico_equipe(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
count_medicos = 0
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'medico'
count_medicos += 1
elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and
Pessoa.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def three_of_a_kind?\n repeat_counts.include? 3\n end",
"def pbIsMedicine?(item)\n return [1, 2, 6, 7].include?(GameData::Item.get(item).battle_use) && !GameData::Item.get(item).is_berry?\nend",
"def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]... | [
"0.5887564",
"0.5872823",
"0.58314246",
"0.57727623",
"0.57575995",
"0.56924975",
"0.56728464",
"0.56701833",
"0.56420714",
"0.5625229",
"0.559234",
"0.5590583",
"0.55346924",
"0.5525686",
"0.55248404",
"0.55190116",
"0.5514819",
"0.5493433",
"0.54716146",
"0.54691833",
"0.54... | 0.6530351 | 0 |
Verifica se a equipe e formada por anbus | def is_anbu_equipe(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_anbu = true
for i in 0..3
val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end",
"def in_us1?\n self.nro_remision.to_s == \"... | [
"0.61227363",
"0.61119676",
"0.5956062",
"0.5900061",
"0.58191097",
"0.57942384",
"0.5776025",
"0.5761631",
"0.57422954",
"0.57241946",
"0.57154757",
"0.571249",
"0.56876665",
"0.56815845",
"0.56770325",
"0.56759876",
"0.5651228",
"0.56451845",
"0.56422955",
"0.56384426",
"0.... | 0.64007896 | 0 |
verifica se o raikage e um membro da equipe | def is_raikage_membro(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_raikage = false
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'raikage'
val_is_raikage = true
end
end
val_is_raikage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_medico_membro(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_medico = false\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n val_is_medico = true\n end\n end\n\n val_is_medico\n end",
"def is_anbu_equ... | [
"0.63769585",
"0.6215567",
"0.59823006",
"0.59507364",
"0.57318103",
"0.5691622",
"0.56687886",
"0.5649539",
"0.5636041",
"0.5622538",
"0.5571581",
"0.55539227",
"0.5516401",
"0.55153126",
"0.5459029",
"0.54582447",
"0.54577106",
"0.5439558",
"0.54235655",
"0.5363398",
"0.536... | 0.6939452 | 0 |
GET /outsides GET /outsides.json | def index
@outsides = Outside.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def show\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n format.html # sho... | [
"0.7206014",
"0.6473625",
"0.62521267",
"0.604241",
"0.58839136",
"0.5812773",
"0.5803857",
"0.5749467",
"0.5746146",
"0.57460946",
"0.5731855",
"0.5710762",
"0.568336",
"0.56589067",
"0.56425095",
"0.56366575",
"0.5617454",
"0.5603409",
"0.55973506",
"0.55856144",
"0.5579769... | 0.7273749 | 0 |
POST /outsides POST /outsides.json | def create
@outside = Outside.new(outside_params)
respond_to do |format|
if @outside.save
format.html { redirect_to @outside, notice: 'Outside was successfully created.' }
format.json { render :show, status: :created, location: @outside }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @outside_request = OutsideRequest.new(params[:outside_request])\n\n respond_to do |format|\n if @outside_request.save\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully created.' }\n format.json { render json: @outside_request, status: :cre... | [
"0.66772705",
"0.59353036",
"0.58822435",
"0.58407235",
"0.58234125",
"0.57617736",
"0.5621812",
"0.56048375",
"0.5383108",
"0.5230245",
"0.522127",
"0.5192642",
"0.51777333",
"0.5142969",
"0.51319873",
"0.51284647",
"0.506584",
"0.50647056",
"0.5045443",
"0.50443745",
"0.502... | 0.73897415 | 0 |
PATCH/PUT /outsides/1 PATCH/PUT /outsides/1.json | def update
respond_to do |format|
if @outside.update(outside_params)
format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }
format.json { render :show, status: :ok, location: @outside }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content... | [
"0.71002495",
"0.66152906",
"0.6301283",
"0.60681796",
"0.5881588",
"0.5788512",
"0.5781755",
"0.57469463",
"0.5740863",
"0.5698779",
"0.56936884",
"0.5679568",
"0.56731504",
"0.5628998",
"0.56122684",
"0.5594861",
"0.55859846",
"0.5583535",
"0.5559398",
"0.5559398",
"0.55008... | 0.71156347 | 0 |
DELETE /outsides/1 DELETE /outsides/1.json | def destroy
@outside.destroy
respond_to do |format|
format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @outside_request = OutsideRequest.find(params[:id])\n @outside_request.destroy\n\n respond_to do |format|\n format.html { redirect_to outside_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inside.destroy\n respond_to do |format|\n f... | [
"0.72267324",
"0.71534765",
"0.69241786",
"0.6888711",
"0.68458116",
"0.66099954",
"0.66034967",
"0.659944",
"0.659944",
"0.659944",
"0.659944",
"0.6529414",
"0.6503784",
"0.65024984",
"0.6438971",
"0.63768625",
"0.637046",
"0.63635933",
"0.6345375",
"0.63303816",
"0.633015",... | 0.7406521 | 0 |
create a uri with prefix and hash of the address | def uri
uri_prefix + Digest::MD5.hexdigest(self.address)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_uri\n end",
"def build_uri(uri)\n return uri if @region.nil? && @edge.nil?\n\n parsed_url = URI(uri)\n pieces = parsed_url.host.split('.')\n product = pieces[0]\n domain = pieces[-2, 2]\n new_edge = @edge\n new_region = @region\n\n case pieces... | [
"0.7466742",
"0.72674334",
"0.7150649",
"0.7096401",
"0.70315844",
"0.68572295",
"0.6830236",
"0.67291194",
"0.6698104",
"0.6697446",
"0.66700625",
"0.66591734",
"0.66591734",
"0.662171",
"0.6602459",
"0.6564329",
"0.648367",
"0.64670515",
"0.64364815",
"0.64042497",
"0.63900... | 0.75669867 | 0 |
Returns prefixes split on the namespace pattern. | def prefixes
prefix.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end",
"def parts\n namespace.split(SEPARATOR)\n end",
"def prefixes\n @prefix... | [
"0.7407533",
"0.7407533",
"0.72848666",
"0.6980872",
"0.6971747",
"0.6595333",
"0.6568921",
"0.624414",
"0.624414",
"0.6192974",
"0.60950315",
"0.5989826",
"0.5929457",
"0.59197074",
"0.5910274",
"0.5889009",
"0.5793063",
"0.5739296",
"0.5739296",
"0.5708575",
"0.57040274",
... | 0.84440666 | 1 |
Returns namespaces split on the namespace pattern. | def namespaces
namespace.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parts\n namespace.split(SEPARATOR)\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end",
"def list_name... | [
"0.70319545",
"0.6985385",
"0.6985385",
"0.6575446",
"0.6484162",
"0.6256091",
"0.61773086",
"0.6169401",
"0.60568917",
"0.6001959",
"0.5954219",
"0.5883592",
"0.5760462",
"0.57480645",
"0.57124037",
"0.57095504",
"0.56629884",
"0.5641671",
"0.5640766",
"0.5631009",
"0.559781... | 0.81508726 | 1 |
Returns targets split on the namespace pattern. | def targets
target.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets\n name.split(\"_\")\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def all_targets\n targets = []\n find('').sort.each do |file|\n targets << File.basename(file)\... | [
"0.6638572",
"0.65504056",
"0.65504056",
"0.58468294",
"0.5797391",
"0.5797391",
"0.56284827",
"0.5456567",
"0.5355485",
"0.5295086",
"0.52468276",
"0.5243942",
"0.52298576",
"0.5226278",
"0.52173454",
"0.52150553",
"0.516638",
"0.5159453",
"0.5114256",
"0.5112964",
"0.511296... | 0.8098817 | 1 |
Note that we always have a cascaded event join for the model that the event actually belongs to, even if it's not cascadable. I know this is bad terminology, but it seems better to do this way so that we can get all events for an object directly from the cascaded events join table. | def maybe_cascade
CascadedEventJoin.find_or_create_by(cascaded_eventable: self.eventable, event_id: self.id)
if self.cascadable and self.eventable.respond_to?(:cascade_event)
self.eventable.cascade_event(self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end",
"def related_events\n find_related_frbr_objects( :is_related_to,... | [
"0.64219326",
"0.6222262",
"0.60331595",
"0.5831709",
"0.58291835",
"0.577701",
"0.5764571",
"0.5707574",
"0.5642834",
"0.56223303",
"0.55735326",
"0.550983",
"0.5488459",
"0.54418063",
"0.54418063",
"0.54395103",
"0.5420702",
"0.53794605",
"0.5376009",
"0.5334593",
"0.533122... | 0.6757708 | 0 |
Convenience for getting element blueprints | def element_blueprints(composite_object = nil)
adapter.element_blueprints(composite_object)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMethodsInElement(element)\n\treturn element.inspect;\nend",
"def element_render_naming\n OBJ_ELEMENT_RENDER_NAMING\n end",
"def blueprint_value\n Blueprints::RootNamespace.root.build @name => @options\n @registry.inject(Blueprints::RootNamespace.root.context.instance_variable_get(:\"@#{@iv_nam... | [
"0.5650715",
"0.5597755",
"0.5554425",
"0.5522174",
"0.54490626",
"0.5446046",
"0.54126674",
"0.5401665",
"0.53939074",
"0.53799003",
"0.5357485",
"0.5303517",
"0.5283296",
"0.5280536",
"0.52704984",
"0.5252942",
"0.5252942",
"0.5252942",
"0.5252942",
"0.5247162",
"0.52180487... | 0.6912869 | 0 |
Gets the mode from the data and calls the API. Returns the response from the API. | def checkModes(data)
mode = data['mode']
call_features=Array.new(1) { Hash.new }
if mode=="labels"
call_features<<{
type:"LABEL_DETECTION",
maxResults:1
}
end
return apiRequest(data['image'],call_features)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mode\n send_request(FUNCTION_GET_MODE, [], '', 1, 'C')\n end",
"def get_node_mode_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNsxComponentAdministrationApplianceApi.get_node_mode ...'\n end\n #... | [
"0.6840591",
"0.6233038",
"0.61994016",
"0.6002883",
"0.5982736",
"0.5899628",
"0.58765423",
"0.58264744",
"0.57625484",
"0.5727748",
"0.5701499",
"0.5638133",
"0.5566128",
"0.5559126",
"0.55128413",
"0.54956806",
"0.54717624",
"0.5466703",
"0.5466703",
"0.5448566",
"0.541934... | 0.64006984 | 1 |
Starts the webserver that takes images and sends them to the API. html server runs on | def start_webserver()
server = TCPServer.new('localhost', DEFAULT_PORT)
puts "Vision server running on http://localhost:#{DEFAULT_PORT}/"
while session = server.accept
time = Time.new
puts "New connection #{time.inspect}"
if File.exist?(DEFAULT_HTML_PATH) && !File.directory?(DEFAULT_HTML_PATH)
F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_webserver\n stop_webserver\n Webserver.run!\n end",
"def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end",
"def start()\n mime_types... | [
"0.70235085",
"0.686838",
"0.6537886",
"0.6487472",
"0.6483164",
"0.6259526",
"0.6257935",
"0.6135462",
"0.61339027",
"0.6118243",
"0.6113428",
"0.6106488",
"0.6095311",
"0.6076044",
"0.6068171",
"0.5976807",
"0.5968253",
"0.5954785",
"0.59322405",
"0.5920989",
"0.5916576",
... | 0.6983412 | 1 |
This is called once an outputter has been created. It sets the default formatter and level, if these have been already set. | def created_outputter(outputter)
#
# Set the formatter and level for any newly created outputters
#
if @default_formatter
outputter.formatter = @default_formatter if outputter.formatter.is_a?(Log4r::DefaultFormatter)
end
if @default_level
outputter.le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputter(value = nil)\n setget(:@formatter, value)\n end",
"def initialize\n @formatter = method(:default_formatter)\n end",
"def configure\n yield self\n\n # Ensure every appender has a formatter and a level configuration.\n #\n appenders.each do |appender|\n append... | [
"0.7170814",
"0.69238234",
"0.68924767",
"0.64659834",
"0.6427268",
"0.6384431",
"0.6359677",
"0.6338683",
"0.6313853",
"0.62974",
"0.62230897",
"0.6218285",
"0.6173541",
"0.61664784",
"0.6150814",
"0.6150814",
"0.6116878",
"0.60889846",
"0.6086099",
"0.6086099",
"0.6086099",... | 0.7372929 | 0 |
Defines a Hash where the settings shall be stored. | def initialize
@settings = Hash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_settings_hash\n fail 'sub class to implement'\n end",
"def get_hash()\n\t\t\treturn @config.clone()\n\t\tend",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def hash\n {... | [
"0.6881182",
"0.6396867",
"0.6324798",
"0.6324722",
"0.6324722",
"0.62126184",
"0.6186993",
"0.61590725",
"0.6141547",
"0.61076856",
"0.61076856",
"0.6092059",
"0.6077155",
"0.6067312",
"0.60390234",
"0.6017331",
"0.6014908",
"0.6010474",
"0.6008598",
"0.5987738",
"0.59783596... | 0.70030916 | 0 |
GET /massive_loads/1 GET /massive_loads/1.json | def show
@massive_load = MassiveLoad.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @massive_load }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def index\n @loads = Load.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json... | [
"0.6614423",
"0.63849837",
"0.5849659",
"0.5806505",
"0.5799708",
"0.5758163",
"0.57466066",
"0.5668211",
"0.5652232",
"0.5619108",
"0.56074744",
"0.55833936",
"0.556982",
"0.55687624",
"0.5548165",
"0.5544466",
"0.55070823",
"0.54761946",
"0.547418",
"0.5439974",
"0.54199725... | 0.73428476 | 0 |
GET /massive_loads/new GET /massive_loads/new.json | def new
@massive_load = MassiveLoad.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @massive_load }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end",
"def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n ... | [
"0.6653466",
"0.661421",
"0.661421",
"0.6576677",
"0.6502705",
"0.6500868",
"0.6484898",
"0.647852",
"0.6468913",
"0.6437501",
"0.64248705",
"0.64048356",
"0.6403324",
"0.64030945",
"0.63934",
"0.63902986",
"0.63883716",
"0.63881004",
"0.63863873",
"0.63793063",
"0.6378045",
... | 0.7823574 | 0 |
POST /massive_loads POST /massive_loads.json | def create
@massive_load = MassiveLoad.new(params[:massive_load])
respond_to do |format|
if @massive_load.save
read_excel
format.html { redirect_to @massive_load, notice: t(:successfully_created) }
format.json { render json: @massive_load, status: :created, location: @massive_load... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def price_bulk_load\n logger.info 'PRICE BULK LOAD REQUESTED.'\n FeedWorker.perform_async('price_bulk_load')\n head :accepted\... | [
"0.61830246",
"0.584981",
"0.5474589",
"0.546201",
"0.5459581",
"0.5434217",
"0.52626705",
"0.5225691",
"0.5123715",
"0.51197374",
"0.5107366",
"0.51032346",
"0.50720054",
"0.5051213",
"0.5042481",
"0.50387454",
"0.5034641",
"0.5022982",
"0.50104886",
"0.49985647",
"0.4961837... | 0.62794626 | 0 |
DELETE /massive_loads/1 DELETE /massive_loads/1.json | def destroy
@massive_load = MassiveLoad.find(params[:id])
@massive_load.destroy
respond_to do |format|
format.html { redirect_to massive_loads_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @load.destroy\n respond_to do |format|\n format.html { redirect_to loads_url, notice: 'Load was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_... | [
"0.6751452",
"0.66983056",
"0.6636599",
"0.65260077",
"0.64616525",
"0.6438764",
"0.64364034",
"0.6380624",
"0.6367704",
"0.6367389",
"0.6344745",
"0.6316303",
"0.62940687",
"0.62778735",
"0.62730956",
"0.62583184",
"0.62558186",
"0.6249699",
"0.62424827",
"0.621869",
"0.6210... | 0.7864766 | 0 |
GET /audit_trails or /audit_trails.json | def index
@audit_trails = AuditTrail.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend",
"def index\n @audits = Audit.all\n end",
"def index\n @audits = Audit.all\n end",
"def index\n @audits = Audit.all\n respond_with @audits\n end",
"def audit\n render... | [
"0.66580135",
"0.6385138",
"0.6385138",
"0.63822293",
"0.63697207",
"0.6366581",
"0.6263181",
"0.62566763",
"0.6154855",
"0.6138832",
"0.612162",
"0.6113776",
"0.60886186",
"0.60850495",
"0.60850495",
"0.60813457",
"0.5997738",
"0.5952176",
"0.59378254",
"0.592521",
"0.591977... | 0.7250993 | 0 |
POST /audit_trails or /audit_trails.json | def create
@audit_trail = AuditTrail.new(audit_trail_params)
respond_to do |format|
if @audit_trail.save
format.html { redirect_to @audit_trail, notice: "Audit trail was successfully created." }
format.json { render :show, status: :created, location: @audit_trail }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n ... | [
"0.6490603",
"0.6252091",
"0.62465477",
"0.6207349",
"0.60456467",
"0.5947956",
"0.5947367",
"0.5907201",
"0.5907201",
"0.5906645",
"0.588364",
"0.5812184",
"0.5754486",
"0.56969583",
"0.56921333",
"0.56430846",
"0.56300545",
"0.56103617",
"0.55918",
"0.5553551",
"0.55512244"... | 0.65162694 | 0 |
GET /moto_registration_numbers/1 GET /moto_registration_numbers/1.xml | def show
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @moto_registration_number }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format... | [
"0.63621014",
"0.6296374",
"0.61198634",
"0.6035799",
"0.5863261",
"0.5816839",
"0.58105224",
"0.5703169",
"0.5699908",
"0.56630635",
"0.565772",
"0.565772",
"0.55978006",
"0.558874",
"0.558034",
"0.55021095",
"0.55021095",
"0.55021095",
"0.55021095",
"0.55021095",
"0.5494253... | 0.6877038 | 0 |
GET /moto_registration_numbers/new GET /moto_registration_numbers/new.xml | def new
@moto_registration_number = MotoRegistrationNumber.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @moto_registration_number }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n ... | [
"0.7343106",
"0.71727914",
"0.68572235",
"0.67511237",
"0.6723272",
"0.6723272",
"0.6723272",
"0.66050434",
"0.65170324",
"0.64593613",
"0.64371705",
"0.642602",
"0.63808715",
"0.6379689",
"0.63650733",
"0.6320624",
"0.6313821",
"0.629728",
"0.6294342",
"0.6283128",
"0.625822... | 0.754073 | 0 |
POST /moto_registration_numbers POST /moto_registration_numbers.xml | def create
@moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])
respond_to do |format|
if @moto_registration_number.save
format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }
format.xml ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => ... | [
"0.6318721",
"0.61666036",
"0.58160335",
"0.5770177",
"0.568772",
"0.5672143",
"0.56667924",
"0.55571985",
"0.5534425",
"0.55306256",
"0.5525559",
"0.549139",
"0.5455797",
"0.5386861",
"0.53574884",
"0.5356498",
"0.532488",
"0.5319848",
"0.5310284",
"0.52507955",
"0.52374285"... | 0.6672994 | 0 |
PUT /moto_registration_numbers/1 PUT /moto_registration_numbers/1.xml | def update
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
respond_to do |format|
if @moto_registration_number.update_attributes(params[:moto_registration_number])
format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @registration_number.update_attributes(params[:registration_number])\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully updated.') }\n fo... | [
"0.62140137",
"0.6025058",
"0.5943858",
"0.5885716",
"0.5861695",
"0.56930923",
"0.56733656",
"0.5445109",
"0.5432394",
"0.53746146",
"0.5352155",
"0.5300324",
"0.5295653",
"0.52790403",
"0.5226414",
"0.52107775",
"0.5176867",
"0.5154576",
"0.5083715",
"0.5061558",
"0.5055035... | 0.6782747 | 0 |
DELETE /moto_registration_numbers/1 DELETE /moto_registration_numbers/1.xml | def destroy
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
@moto_registration_number.destroy
respond_to do |format|
format.html { redirect_to(moto_registration_numbers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/content... | [
"0.6785442",
"0.6525029",
"0.63755083",
"0.63554126",
"0.6328032",
"0.6322757",
"0.6310833",
"0.6310833",
"0.6310833",
"0.6310833",
"0.6310833",
"0.6248103",
"0.6242309",
"0.6198912",
"0.61402214",
"0.6101365",
"0.60624576",
"0.60268134",
"0.60031545",
"0.59856653",
"0.597231... | 0.72625786 | 0 |
Returns the last because clause | def __last_because
__stack.last || @scenario.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_last\n select($game_cooking.recipes.index($game_cooking.recipe) || 0)\n end",
"def remaining_sql\n @stmt_api.remaining_sql\n end",
"def select_last\n select($game_party.members.index($game_cooking.cook) || 0)\n end",
"def last_results\n $sql_multi ? $sql_results.last : $sql_result... | [
"0.55473876",
"0.551409",
"0.54015404",
"0.5291644",
"0.5284842",
"0.5213991",
"0.51791143",
"0.5145713",
"0.51230544",
"0.5112969",
"0.50898117",
"0.5031334",
"0.49881768",
"0.49668208",
"0.49495912",
"0.49472678",
"0.49396676",
"0.49339023",
"0.49238932",
"0.49217942",
"0.4... | 0.57852954 | 0 |
About browser Returns the current browser instance | def browser
@browser
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browser\n BrowserInst.browser\n end",
"def browser\n BrowserInst.browser\n end",
"def browser\n @web_browser\n end",
"def browser\r\n @web_browser\r\n end",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def browser\n if @browser.ni... | [
"0.8857251",
"0.85572404",
"0.8423291",
"0.8390459",
"0.8097408",
"0.7919255",
"0.7904366",
"0.77523535",
"0.7618304",
"0.737277",
"0.7299733",
"0.7289403",
"0.7288935",
"0.72253805",
"0.72228724",
"0.7216117",
"0.7121903",
"0.7068331",
"0.70648044",
"0.7026999",
"0.7024905",... | 0.8708791 | 1 |
Returns current browser contents (used by HTMLAnalysis) | def browser_contents
browser.contents
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html\n @browser.html()\n end",
"def page_source\n @web_browser.page_source\n end",
"def page_source\r\n @web_browser.page_source\r\n end",
"def page_source\r\n @browser.page_source\r\n end",
"def page_text\n @web_browser.text\n end",
"def page_text\r\n @we... | [
"0.7415785",
"0.73982435",
"0.7389971",
"0.7362739",
"0.7320327",
"0.7306944",
"0.7032243",
"0.6924672",
"0.6915532",
"0.67538255",
"0.6713682",
"0.6677867",
"0.6613712",
"0.6601149",
"0.65201885",
"0.6517126",
"0.65090144",
"0.63786966",
"0.6308013",
"0.61830354",
"0.6159587... | 0.8520767 | 0 |
Returns the URL of the index page (the web_base actually) This method returns nil unless the Waw application has been loaded | def index_page
config && config.web_base
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end",
"def url\n File.join(environment.config.url, @logical_path).sub /(index)?\\.html?$/, ''\n end",
"def base_web_u... | [
"0.6724639",
"0.6653207",
"0.64598393",
"0.6378341",
"0.6378341",
"0.6378341",
"0.6232984",
"0.6219353",
"0.61208874",
"0.60584456",
"0.60562205",
"0.60562205",
"0.60562205",
"0.6021297",
"0.58808696",
"0.5865468",
"0.586272",
"0.5845733",
"0.58402205",
"0.5838838",
"0.582754... | 0.7930575 | 0 |
About reaching pages Asserts that a page can be reached, leading to a Net::HTTPSuccess result | def i_reach(which_page)
result = go(which_page)
assert Net::HTTPSuccess===result, __last_because + " (cannot actually reach #{which_page}: #{result})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_page(base, page, severity=:E, expectedStatus=\"200\", log=true)\n path = base + page\n response = getHTTP(path)\n code = response.code || '?'\n if code != expectedStatus\n test(severity, \"Fetched #{path} - HTTP status: #{code} expected: #{expectedStatus}\") unless severity == nil\n return nil... | [
"0.72206855",
"0.674044",
"0.6577114",
"0.6558375",
"0.6494465",
"0.644917",
"0.6429458",
"0.6426055",
"0.6384194",
"0.63343143",
"0.6331706",
"0.6258108",
"0.624846",
"0.6190442",
"0.61850494",
"0.61820865",
"0.61788094",
"0.6175449",
"0.61469823",
"0.6137762",
"0.61120224",... | 0.69959426 | 1 |
Asserts that a page cannot be reached, leading to a Net::HTTPNotFound or a Net::HTTPForbidden (403) result | def i_dont_reach(which_page)
result = go(which_page)
assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + " (can reach #{which_page}: #{result})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end",
"def check_url(path, url)\n res = http_client.get(url, follow_redirect: true)\n return... | [
"0.7737149",
"0.72584164",
"0.7084957",
"0.707849",
"0.69714546",
"0.69306064",
"0.6772716",
"0.672265",
"0.67165005",
"0.66754",
"0.66626287",
"0.6621195",
"0.6571661",
"0.65649056",
"0.6533863",
"0.65250134",
"0.650281",
"0.64729524",
"0.642314",
"0.64007586",
"0.6384376",
... | 0.7498706 | 1 |
Asserts that a page may not be reached, leading to a Net::HTTPForbidden (403) result. | def i_may_not_reach(which_page)
result = go(which_page)
assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + " (may actually reach #{which_page}: #{result})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i_dont_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + \" (can reach #{which_page}: #{result})\"\n end",
"def bots_not_allowed\n render_403('page') if visitor_is_bot?\n end",
"def assert_forbidden\n ... | [
"0.77923113",
"0.7196156",
"0.7086012",
"0.7011919",
"0.6874228",
"0.6870177",
"0.6847909",
"0.6718713",
"0.6517071",
"0.6511993",
"0.6406746",
"0.6373354",
"0.63517374",
"0.6351584",
"0.6351584",
"0.6340072",
"0.6335313",
"0.6332222",
"0.63061833",
"0.62902474",
"0.62892973"... | 0.8168092 | 0 |
GET /classifieds/new GET /classifieds/new.json | def new
@classified = Classified.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @classified }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end",
"def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.htm... | [
"0.7290924",
"0.7123625",
"0.69955546",
"0.679667",
"0.675727",
"0.6642035",
"0.66077185",
"0.6570642",
"0.6570221",
"0.6568146",
"0.6467695",
"0.64505446",
"0.6449248",
"0.6428555",
"0.64233875",
"0.63973665",
"0.6378445",
"0.63398683",
"0.6321351",
"0.6318048",
"0.63082737"... | 0.8099734 | 0 |
PUT /classifieds/1 PUT /classifieds/1.json | def update
@classified = @user.classifieds.find(params[:id])
respond_to do |format|
if @classified.update_attributes(params[:classified])
format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }
format.json { head :no_content }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n ... | [
"0.6790866",
"0.6790866",
"0.6443071",
"0.6443071",
"0.6332666",
"0.60775906",
"0.6046845",
"0.5942756",
"0.5915898",
"0.58568054",
"0.58161974",
"0.57492745",
"0.57295406",
"0.5697634",
"0.56951195",
"0.5639165",
"0.5630543",
"0.56200415",
"0.56196827",
"0.55982274",
"0.5589... | 0.7026347 | 0 |
DELETE /classifieds/1 DELETE /classifieds/1.json | def destroy
@classified = @user.classifieds.find(params[:id])
@classified.destroy
respond_to do |format|
format.html { redirect_to classifieds_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { re... | [
"0.735492",
"0.735492",
"0.73449916",
"0.7194511",
"0.70238125",
"0.6886442",
"0.68384784",
"0.67592686",
"0.67164856",
"0.66575056",
"0.66549844",
"0.66458607",
"0.6619374",
"0.66177684",
"0.6577693",
"0.6549269",
"0.6535986",
"0.65257215",
"0.65209186",
"0.6513518",
"0.6512... | 0.7414375 | 0 |
FIXME: (cmhobbs) this is pretty heavy handed. User shouldn't know this much about related objects. Public: Aggregate all users in associated groups Examples User.first.related_groups_users => [ , ] Returns an Array representing the related User objects. | def related_groups_users
[].tap do |related_users|
all_groups.each do |group|
related_users << group.all_users.reject { |group_user| group_user == self }
end
end.flatten.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException, \"While retrieving users from a user group (#{self}), found a member that was not a User or U... | [
"0.6788714",
"0.66747075",
"0.64734405",
"0.63823956",
"0.60214233",
"0.5985585",
"0.5972596",
"0.59077686",
"0.58903253",
"0.5865416",
"0.5822525",
"0.57893354",
"0.5760975",
"0.5745023",
"0.5733774",
"0.57257736",
"0.57074296",
"0.5695067",
"0.56680304",
"0.5631721",
"0.563... | 0.78119546 | 0 |
NOTE: (cmhobbs) we don't check to see if a BadgeType is awardable. this may prove troublesome in the future. FIXME (cmhobbs) we're passing badge_type_id around quite a bit... this may require a separate class at some point. | def award_badge(badge_type_id)
if badges.where(badge_type_id: badge_type_id).exists?
false
else
badge = badges.create(badge_type_id: badge_type_id, year: Time.now.year)
Notifier.delay.new_badge_email(self, badge)
# NOTE: (cmhobbs) spam all the users! \o/
# BadgeWorker.perform_async... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def award_badge(participant_id, badge_name)\n badge_id = Badge.get_id_from_name(badge_name: badge_name)\n AwardedBadge.where(participant_id: participant_id, badge_id: badge_id, approval_status: 0).first_or_create\n end",
"def has_badge?(badge)\n case badge\n when Badge\n badges.find_by_id(badge... | [
"0.6292739",
"0.61310035",
"0.6009031",
"0.5941763",
"0.5928707",
"0.59059054",
"0.583447",
"0.5803822",
"0.5802567",
"0.5726422",
"0.5684858",
"0.5675342",
"0.5619803",
"0.5567785",
"0.55570734",
"0.5527625",
"0.5522571",
"0.5483815",
"0.5443195",
"0.5434529",
"0.54320854",
... | 0.70889163 | 0 |
Configure the connection instance in a generic manner. Each client can modify the connection in a specific way, when the application requires special handling. Just overwrite the +configure+ method, and call +super(con)+. Here is a full example: def configure(con) super(con) con.request :url_encoded con.response :logge... | def configure(con)
con.use :instrumentation
# The definition order is execution order
con.request :ph_data_sanitization
con.request :ph_default_headers
con.request :json
con.request :multipart
con.request :url_encoded
# The definition order is reverse to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_connection\n end",
"def configure_connection\n end",
"def configure(conf)\n super\n end",
"def configure(settings = {})\n abstract_method\n end",
"def configure(&block)\n @config = Logger::Config.new\n\n yield @config\n\n ensure_required_options_... | [
"0.69118875",
"0.6892308",
"0.6635147",
"0.6527062",
"0.64633083",
"0.6451594",
"0.6320453",
"0.62772256",
"0.6216108",
"0.6192429",
"0.6178731",
"0.61609817",
"0.6159202",
"0.61010367",
"0.6091954",
"0.6083834",
"0.60795146",
"0.6059017",
"0.60533184",
"0.60489523",
"0.60481... | 0.7414548 | 0 |
PATCH/PUT /paperitems/1 PATCH/PUT /paperitems/1.json | def update
respond_to do |format|
if @paperitem.update(paperitem_params)
format.html { redirect_to @paperitem, notice: 'Paperitem was successfully updated.' }
format.json { render :show, status: :ok, location: @paperitem }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @paper_item.update(paper_item_params)\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render ... | [
"0.7298528",
"0.68244535",
"0.65368",
"0.65147763",
"0.6473924",
"0.6460453",
"0.6457427",
"0.6450522",
"0.6409075",
"0.639189",
"0.63773245",
"0.63773245",
"0.63341373",
"0.63212675",
"0.6317687",
"0.63074917",
"0.63025326",
"0.63017166",
"0.630061",
"0.62975484",
"0.6291182... | 0.7192861 | 1 |
DELETE /paperitems/1 DELETE /paperitems/1.json | def destroy
@paperitem.destroy
respond_to do |format|
format.html { redirect_to paperitems_url, notice: 'Paperitem was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @paper_item.destroy\n respond_to do |format|\n format.html { redirect_to paper_items_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete_item\n item_id = params[\"item_id\"]\n\n item = Text... | [
"0.7619962",
"0.7118266",
"0.70054746",
"0.6773249",
"0.67275685",
"0.6701529",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
"0.6701408",
... | 0.73722816 | 1 |
give me a block that describes how to display a potential value for the named field. If you call me without a block, I will return either the last block you sent me, or the default display_proc. Block should take 1 arg (being the value to format) and return the value, formatted. default proc just runs to_s on the value... | def display_proc(&block)
#defined by default_for_proc_type in initialize!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format!\n if block\n captured_value\n else\n to_s\n end\n end",
"def format(value = nil, &block)\n __define__(:format, value, block)\n end",
"def format_submission_field(field, value, &block)\n FormSubmissionFieldDisplay.new(self, field, value, &block)\n end",
... | [
"0.67699414",
"0.6548284",
"0.64155734",
"0.6355904",
"0.6308477",
"0.6200092",
"0.61819214",
"0.60970324",
"0.6069356",
"0.5991577",
"0.5970047",
"0.59550935",
"0.59262466",
"0.5898025",
"0.57645",
"0.5736172",
"0.5714861",
"0.5695842",
"0.56460404",
"0.56246173",
"0.5588536... | 0.7153447 | 0 |
Convenience method for chaining FieldDefs::Field.display_proc and FieldDefs::Field.reader_proc as intended i.e. instead of: field = field_defs.field_called(:name) field.display_proc.call(field.reader_proc.call(user)) you can do: field_defs.display_for(user, :name) | def display_for(object, field_name)
fdef = field_called(field_name)
fdef.display_proc.call(fdef.reader_proc.call(object))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_and_show_as(arg = nil, &proc) # :yields: field_def or nil\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end",
"def display_proc(&block)\n #defined by default_for_proc_type in initialize!\n end",
"def show_as(*args, &proc) # :yields: field_def or nil\n @view_control.show_as(*args, &pr... | [
"0.67662483",
"0.6171107",
"0.6156245",
"0.6135175",
"0.5839443",
"0.5765052",
"0.57484514",
"0.5679762",
"0.5616974",
"0.5616675",
"0.5557382",
"0.55462784",
"0.55382544",
"0.5517704",
"0.5498199",
"0.54641896",
"0.54518807",
"0.5446169",
"0.5443193",
"0.5429538",
"0.5385006... | 0.77835965 | 0 |
Get a hash of all fields of the form: field name => human name Include only those fields that have the given label | def all_attributes_labeled(label_name)
to_return = {}
@fields.each do |key, field|
if field.has_label?(label_name.to_sym)
to_return[key] = field.human_name
end
end
to_return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_names\n label_fields.to_h\n end",
"def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end",
"def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterato... | [
"0.7511716",
"0.7379545",
"0.7066162",
"0.6679022",
"0.66658986",
"0.6416762",
"0.63890654",
"0.62618876",
"0.62233377",
"0.61832553",
"0.61760795",
"0.6132272",
"0.606464",
"0.6047817",
"0.6040522",
"0.60270554",
"0.5990106",
"0.5962807",
"0.5946538",
"0.5916742",
"0.5914366... | 0.7639816 | 0 |
Get an array of all fields thate have the given label | def all_fields_labeled(label_name)
@fields.values.reject do |field|
!field.has_label?(label_name.to_sym)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_names\n label_fields.to_h\n end",
"def labels\n fields[\"labels\"]\n end",
"def label_fields\n @label_fields ||= LabelFields.new do |lf|\n labels.each { |label| lf.add(label) }\n end\n end",
"def all_attributes_labeled(label_name)\n to_return = {}\n @fields.each do |ke... | [
"0.75214005",
"0.7258704",
"0.6793908",
"0.67801625",
"0.6606448",
"0.6520151",
"0.63650584",
"0.6353497",
"0.6348224",
"0.6230569",
"0.5949403",
"0.58672667",
"0.58672667",
"0.58545065",
"0.58101046",
"0.5802713",
"0.57898027",
"0.5760543",
"0.57258147",
"0.5722296",
"0.5719... | 0.7786056 | 0 |
Puts the data to uri resource and caches it in local. | def put(src, uri)
# prepare cache path
path = prepare_cache_path
# move the file from the working directory to cache
FileUtils.mv(src, path)
# make a symbolic link from original location to the cache
FileUtils.symlink(path, src)
# copy from cache ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update (uri, data)\n return nil unless @enabled\n\n cache_name = translate_uri(uri)\n mkdir # FIXME include cache_name to build all necessary directories \n\n File.open(File.join(@directory, cache_name), 'w') do |f|\n f << data\n end\n end",
"def cache(uri, obj)\n filename... | [
"0.73367345",
"0.6583097",
"0.6364916",
"0.6362433",
"0.6337253",
"0.6242172",
"0.62378186",
"0.62011737",
"0.6126663",
"0.6065884",
"0.6065884",
"0.6065884",
"0.6065884",
"0.59127784",
"0.59109694",
"0.59077907",
"0.5884891",
"0.5883963",
"0.5842657",
"0.5835551",
"0.5835551... | 0.6736703 | 1 |
common cache : load_notetags_bubs_dismantle | def load_notetags_bubs_dismantle
@dismantle_items = []
@dismantle_gold_fee = Bubs::Dismantle::DEFAULT_DISMANTLE_FEE
@dismantle_reagents = {}
@dismantle_counter = 0
dismantle_tag = false
self.note.split(/[\r\n]+/).each { |line|
case line
when /<dismantle>/i
dismantle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_notetags_bubs_tocrafting\n @recipe_list = []\n @ingredient_list = []\n @tocrafting_tools = []\n @tocrafting_actors = []\n @tocrafting_skills = []\n @tocrafting_gold_fee = self.price\n @tocrafting_bookcover = \"\"\n @tocrafting_se = []\n @tocrafting_category = :none\n @tocraft... | [
"0.6404823",
"0.6006554",
"0.58851457",
"0.56934065",
"0.5693365",
"0.56367594",
"0.5615738",
"0.5562807",
"0.5562807",
"0.55256224",
"0.55125296",
"0.5498459",
"0.54863095",
"0.5467426",
"0.5456634",
"0.5355182",
"0.5286759",
"0.52649176",
"0.52649176",
"0.52496904",
"0.5218... | 0.69911176 | 0 |
new method : set_dismantle_mask_flags | def set_dismantle_mask_flags(flag = true)
return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
@dismantle_items.each do |obj| obj.mask = flag end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n when :weapon\n $data_weapons[id].set_dismantle_mask_flags(true)\n end\n end",
"def set_mask(opts)\n opt... | [
"0.7003532",
"0.6814202",
"0.66662574",
"0.6605281",
"0.6500882",
"0.64192605",
"0.64068455",
"0.6384925",
"0.6317895",
"0.6238115",
"0.6238115",
"0.62272185",
"0.62259436",
"0.6225939",
"0.6206085",
"0.6175929",
"0.6127259",
"0.6078628",
"0.6033596",
"0.59747803",
"0.5968044... | 0.8143703 | 0 |
status_window= Set Status Window | def status_window=(status_window)
@status_window = status_window
call_update_help
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_window\r\n super\r\n # Make status window\r\n @status_window = Window_Status.new(@actor)\r\n end",
"def status_window aconfig={}, &block\n sw = StatusWindow.new aconfig\n sw.win.name = \"WINDOW::status_window\"\n return sw unless block_given?\n begin\n yield sw\n ensure\n sw.destroy... | [
"0.75381744",
"0.7533768",
"0.7349331",
"0.7293328",
"0.7165387",
"0.70072675",
"0.68058324",
"0.67529106",
"0.67412716",
"0.6699734",
"0.66870475",
"0.66507846",
"0.6604116",
"0.65468305",
"0.65257317",
"0.6495793",
"0.6488882",
"0.64444166",
"0.6436358",
"0.64126533",
"0.64... | 0.8316029 | 0 |
new method : remove_dismantle_mask | def remove_dismantle_mask(key, id)
case key
when :item
$data_items[id].set_dismantle_mask_flags(true)
when :armor
$data_armors[id].set_dismantle_mask_flags(true)
when :weapon
$data_weapons[id].set_dismantle_mask_flags(true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unset_mask\n @masking_key = nil\n end",
"def unset_mask\n @masking_key = nil\n end",
"def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_fl... | [
"0.72729516",
"0.72729516",
"0.6729544",
"0.6561492",
"0.65048856",
"0.6470863",
"0.63681674",
"0.6323612",
"0.6202933",
"0.6117511",
"0.6115914",
"0.610217",
"0.60555184",
"0.5968678",
"0.58524173",
"0.5797469",
"0.5691447",
"0.5676621",
"0.5667922",
"0.5658228",
"0.56496507... | 0.73759496 | 0 |
new method : remove_all_dismantle_masks | def remove_all_dismantle_masks
groups = [$data_items, $data_armors, $data_weapons]
for group in groups
for obj in group
next if obj.nil?
obj.set_dismantle_mask_flags(true)
end # for
end # for
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unset_mask\n @masking_key = nil\n end",
"def unset_mask\n @masking_key = nil\n end",
"def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n w... | [
"0.6793357",
"0.6793357",
"0.6572579",
"0.6498804",
"0.6329656",
"0.6117755",
"0.60109484",
"0.600906",
"0.5995232",
"0.59944004",
"0.5984359",
"0.5957172",
"0.5935121",
"0.5907152",
"0.5898249",
"0.5873984",
"0.58672345",
"0.57989764",
"0.5792419",
"0.5790591",
"0.5766319",
... | 0.81315804 | 0 |
def new method : get_dismantle_count | def get_dismantle_count(key, id)
case key
when :item
$data_items[id].dismantle_counter
when :armor
$data_armors[id].dismantle_counter
when :weapon
$data_weapons[id].dismantle_counter
end # case
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n end",
"def count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n en... | [
"0.7293059",
"0.7293059",
"0.7293059",
"0.7204344",
"0.7204344",
"0.70775926",
"0.70653343",
"0.70653343",
"0.70653343",
"0.7001986",
"0.698729",
"0.6959307",
"0.6959307",
"0.6935823",
"0.69139975",
"0.6845829",
"0.6845829",
"0.6845829",
"0.6833355",
"0.6786442",
"0.6763345",... | 0.74452114 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.