query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
POST /ticketrezs POST /ticketrezs.xml
def create respond_to do |format| if @ticketrez.save flash[:notice] = 'Ticketrez was successfully created.' format.html { redirect_to(@ticketrez) } format.xml { render :xml => @ticketrez, :status => :created, :location => @ticketrez } else format.html { render :action => "new" } format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketrezs }\n end\n end", "def test_solveticket\n\n # create ticket\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', \"alphabar@foobar5.com\")\n assert_equal(201, @zen...
[ "0.60093135", "0.59274554", "0.5926637", "0.57634854", "0.5671913", "0.56365573", "0.56182146", "0.55800855", "0.55708873", "0.55073446", "0.5494406", "0.5487749", "0.5470839", "0.5443514", "0.54287803", "0.54252005", "0.5411759", "0.5361338", "0.5320741", "0.53139126", "0.53...
0.63700604
0
PUT /ticketrezs/1 PUT /ticketrezs/1.xml
def update respond_to do |format| if @ticketrez.update_attributes(params[:ticketrez]) flash[:notice] = 'Ticketrez was successfully updated.' format.html { redirect_to(@ticketrez) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new ...
[ "0.6946197", "0.6153371", "0.6102849", "0.6035696", "0.58849657", "0.5875967", "0.5807095", "0.5770786", "0.5766481", "0.5742938", "0.5742938", "0.57326156", "0.57266366", "0.57189256", "0.5598665", "0.55845714", "0.5573273", "0.55574924", "0.552886", "0.5515418", "0.5451395"...
0.6567704
1
DELETE /ticketrezs/1 DELETE /ticketrezs/1.xml
def destroy authorize! :destroy, Rezlineitem @show = @ticketrez.show @ticketrez.destroy respond_to do |format| format.html { redirect_to(@show) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { ...
[ "0.69883704", "0.6761964", "0.6597504", "0.6515955", "0.6514402", "0.6498467", "0.6492914", "0.6492914", "0.6492914", "0.6492914", "0.6492914", "0.6492914", "0.6492914", "0.64713323", "0.64342463", "0.64265966", "0.6413221", "0.64097005", "0.64054596", "0.63927865", "0.638541...
0.6501533
5
A locale corresponds to a YAML file. We load each YAML file individually then merge then into a global hash.
def load_all_metas Thread.current[:metas] = I18n.available_locales.inject({}) do |acc, locale| acc.merge!(load_metas_for_locale(locale)) acc end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n result = {}\n \n Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|\n yml = YAML::load(IO.read(file))\n hash = @locale ? yml.to_hash[@locale] : yml.to_hash\n result.deep_merge! hash unless hash.nil?\n end\n\n ...
[ "0.76829284", "0.706411", "0.7061746", "0.7052909", "0.6974177", "0.68951815", "0.6659456", "0.6575945", "0.65721893", "0.65327257", "0.64131576", "0.6361158", "0.63542837", "0.6340097", "0.6311979", "0.62705505", "0.62437814", "0.61771476", "0.61595815", "0.6146397", "0.6145...
0.5905777
40
Load a YAML file corresponding to a locale after ensuring it exists.
def load_metas_for_locale(locale) path = metas_path(locale) if File.exists?(path) YAML.load(File.open(path)) else logger.error "[Metaslug] #{path} not found." {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yml(filename); end", "def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end", "def load_yaml(filename); end", "def load_yml(filename)\n require 'yaml' unless defined? YAML\n data = YAML::load(IO.read(filename))\n...
[ "0.70696205", "0.6927992", "0.68718296", "0.682647", "0.67515993", "0.6488977", "0.6488071", "0.64689696", "0.64623284", "0.64623284", "0.63950026", "0.63930863", "0.63771236", "0.6370306", "0.63469297", "0.6322159", "0.6305526", "0.62961453", "0.62848324", "0.62690824", "0.6...
0.68223417
4
Search and load metas of the current path.
def set_metas_for_current_path locale_metas_storage.keys.each do |k| if request.path.match(translate_key_into_regexp(k)) set_metas_from_hash(locale_metas_storage[k].dup) return end end # if no key match the current path, load default metas if present. if locale_metas_storage.has_key?('default') set_metas_from_hash(locale_metas_storage['default'].dup) else set_metas_from_hash({}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadir\n @metadir ||= Dir[File.join(root, '{meta,.meta}/')].first || 'meta/'\n end", "def load_metadata\n begin\n load RAILS_ROOT + '/app/metadata/' + self.name.to_s.underscore + '.rb'\n rescue MissingSourceFile\n end\n end", "def paths\n @paths ||= fetch('cloudkit-meta')...
[ "0.6425646", "0.60551155", "0.60129404", "0.58988863", "0.57923436", "0.57884824", "0.57586575", "0.574161", "0.5679713", "0.56534654", "0.5588619", "0.5571847", "0.5553067", "0.5502698", "0.5482064", "0.54742455", "0.54493475", "0.53832126", "0.538297", "0.537925", "0.534395...
0.70856905
0
Load metas into an instance variable to have access to them in the helper. Get the instance variables mark as accessible in the before_filter to interpolate values in the liquid template.
def set_metas_from_hash(values) @metaslug_vars ||= [] # For each meta we need to interpole the value if it use a dynamic content. values.each do |k ,v| if v.is_a?(Hash) # recursive call for nested hash like { 'og' => { 'locale' => { 'alternate' => 'fr_FR' } } } set_metas_from_hash(v) else # Looks like a liquid template if v =~ /{{.*}}/ if @metaslug_vars.empty? Rails.logger.debug "You provide a template but don't set access to your vars in the associated controller." values[k] = v else template = Liquid::Template.parse(v) h = @metaslug_vars.inject({}) do |acc, v| acc[v.to_s] = instance_variable_get("@#{v}") acc end values[k] = template.render(h) end end end end @metaslug = values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_page_meta_vars\n # Interpolate and set @meta_data\n raw_meta = get_meta_config\n second_level_keys = []\n raw_meta.each do |k, v|\n if v.is_a?(Hash)\n second_level_keys << k\n next\n end\n\n if v.is_a?(Array)\n v = @custom_meta[k.to_s]\n else\n ...
[ "0.64363265", "0.6032025", "0.58311236", "0.57462305", "0.572849", "0.56935346", "0.5650569", "0.564416", "0.5608824", "0.56021845", "0.5574766", "0.556561", "0.5530082", "0.5524937", "0.5383627", "0.5383627", "0.53734446", "0.5367578", "0.5353563", "0.5329479", "0.5299358", ...
0.61863166
1
Return path of the YAML file of this locale.
def metas_path(locale) # TODO: Let user configure it. Rails.root.join('config', 'metaslug', "#{locale}.yml") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locale_file_path(locale)\n \"config/locales/#{locale}.yml\"\n end", "def application_mode_file_path locale = locale\n File.join(Translate::Storage.root_dir, \"config\", \"locales\", \"#{locale}.yml\")\n end", "def yaml_path\n File.join(base_path, \"resource_map.yml\")\n end", "def...
[ "0.77636963", "0.7496513", "0.7438795", "0.73593897", "0.71344894", "0.7126523", "0.68006086", "0.67485815", "0.6747184", "0.6680013", "0.6625028", "0.64457786", "0.6444873", "0.64063424", "0.6385411", "0.6336624", "0.6317528", "0.62388545", "0.62371975", "0.6195002", "0.6180...
0.66678846
10
Metas of the given locale
def locale_metas_storage(locale = I18n.locale) metas_storage[I18n.locale.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locales\n locale_counts.keys\n end", "def locale\r\n read_attribute(:locale).to_sym\r\n end", "def locales\n map(&:locale)\n end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", ...
[ "0.6762398", "0.630437", "0.61255014", "0.6099199", "0.6099199", "0.6099199", "0.6099199", "0.6099199", "0.6099199", "0.6099199", "0.5858758", "0.5853041", "0.58147156", "0.58147156", "0.58127326", "0.5806751", "0.58064115", "0.57754076", "0.57625", "0.57624805", "0.5739212",...
0.71579176
0
Backend storage of the metas. We store it in the current thread to avoid reloading it.
def metas_storage Thread.current[:metas] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_metas_storage\n Thread.current[:metas] ||= {}\n end", "def storage() @storage; end", "def storage; end", "def storage\n @_storage ||= in_memory\n end", "def metafeta_store\n self.class.metafeta_store\n end", "def storage\n @storage ||= in_memory\n end", ...
[ "0.7445612", "0.6451159", "0.634262", "0.6338842", "0.62993634", "0.6244727", "0.6244727", "0.62022495", "0.61906624", "0.61906624", "0.61906624", "0.61616457", "0.6048777", "0.6037523", "0.6034586", "0.60277295", "0.601253", "0.6003893", "0.6003893", "0.59164345", "0.5868617...
0.81592125
0
Initialize storage to an empty hash, unless already set.
def initialize_metas_storage Thread.current[:metas] ||= {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_data_store\n @data = empty_data_store\n end", "def initialize_set(h)\n set(h) unless h.empty?\n end", "def initialize_set(h)\n set(h) unless h.empty?\n end", "def createEmptyStorage(data_hash, data_source, runId)\r\n data_hash[data_source.to_sym] = {:metrics ...
[ "0.68052244", "0.6501761", "0.6501761", "0.6500929", "0.6499756", "0.6346581", "0.6072689", "0.6072689", "0.60171896", "0.6012453", "0.5941281", "0.5935431", "0.59278864", "0.59224373", "0.5916707", "0.5892271", "0.586267", "0.58485067", "0.5829325", "0.5808723", "0.5808723",...
0.56249
32
YAML entries may looks like routes, like /categories/:id/edit. To be able to test these entries, we convert them to regexp, replacing :id (and others sym)
def translate_key_into_regexp(k) # replace :id with regular expression %r{^#{k.gsub /\:\w+/, '[a-z0-9_.-]+'}$}i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def routes(context={})\n \n routes = [{:path => '/admin/cms',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/cms/,\n :title => 'Gestor contenidos',\n :description => 'Gestiona los contenidos',\n :fit => 2,\n ...
[ "0.5212154", "0.51716906", "0.50567716", "0.50140834", "0.49227315", "0.48592606", "0.48545387", "0.48118857", "0.47876295", "0.47670358", "0.47604144", "0.47178108", "0.47089228", "0.46956918", "0.4693937", "0.4648021", "0.4606323", "0.45692265", "0.45577756", "0.4557704", "...
0.5207661
1
Overriding the default render method because we need to use the action variables to render the liquid template. This had to be done after the action and before the render.
def render(*args) load_metas_for_current_slug super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_with_liquid?; end", "def render_with_liquid?; end", "def render_liquid(content, payload, info, path); end", "def render\n Log.dev(\"Action: #{self}\")\n stack do\n if should_cache?\n # Ignore cache if there is flash session data as the response probably\n # expec...
[ "0.6769935", "0.6769935", "0.67138946", "0.6686915", "0.664009", "0.6449126", "0.64433473", "0.631799", "0.6242777", "0.6238381", "0.61811996", "0.61691487", "0.61691487", "0.6164078", "0.6134422", "0.6127781", "0.61245626", "0.6100144", "0.606414", "0.606414", "0.606414", ...
0.55553126
83
summon_captain_planet notes use .map because it returns a new array and returns that while .each prints the changes but returns the original arrya
def long_planeteer_calls(calls)# code an argument here # Your code here calls.any? {|x| x.chars.length>4} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summon_captain_planet(elements)\n p elements.map {|summon_elements| \"#{summon_elements}!\".capitalize}\nend", "def summon_captain_planet(planateer_calls)\n planateer_calls.collect {|call| call.capitalize + \"!\"}\n #planateer_calls.map {|call| call.capitalize + \"!\"}\nend", "def \n \n summon_captain...
[ "0.7219786", "0.6943852", "0.69017935", "0.6859292", "0.6842859", "0.68212456", "0.68094546", "0.68043786", "0.6695848", "0.6688182", "0.6638588", "0.6623251", "0.66096294", "0.6589065", "0.655674", "0.6556649", "0.6554864", "0.6512446", "0.6475842", "0.6453566", "0.63496584"...
0.0
-1
Sjaak van den Berg
def score_throws(radiuses) score = radiuses.map do |radius| if radius > 10 # for a radius above 10, award 0 points 0 elsif radius < 5 # for a radius less than 5, award 10 points 10 else # for a radius between 5 and 10 inclusive, award 5 points 5 end end # if all radiuses are under 5 (10 points), award an extra 100 points score.count(10) >= radiuses.length ? score.reduce(:+) + 100 : score.reduce(:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schubert; end", "def schumann; end", "def zuruecksetzen()\n end", "def berlioz; end", "def bellini; end", "def berg; end", "def suivre; end", "def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end", ...
[ "0.7576614", "0.70595306", "0.6850953", "0.68300265", "0.6652317", "0.6635704", "0.64665234", "0.63879704", "0.6330819", "0.6307666", "0.62543666", "0.6253937", "0.624926", "0.6169856", "0.61295396", "0.6115479", "0.6113548", "0.6109211", "0.6101353", "0.60676706", "0.6044888...
0.0
-1
alternative with nested ternary operator
def score_throws2(radiuses) # iterate through the radiuses and award points: # - 0 points for a radius of 10 or more # - 5 points for a radius between 5 and 10 # - 10 points for a radius under 5 score = radiuses.map { |x| x < 5 ? 10 : x > 10 ? 0 : 5 } # if all radiuses are under 5 (10 points), award an extra 100 points score.count(10) >= radiuses.length ? score.reduce(:+) + 100 : score.reduce(:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend", "def render_output_of_ternary(ternary_arr, df_data)\n value_for_field_name(ternary_arr[0], df_data).present? ? ternary_arr[1] : ternary_arr[2]\n end", "def ternary_condition(value)\n\t\tis_strike?(value...
[ "0.74793935", "0.6314791", "0.6291511", "0.6205085", "0.6082724", "0.6082724", "0.6052779", "0.5970924", "0.5928399", "0.59050435", "0.5882791", "0.58359045", "0.5814862", "0.5783756", "0.57529527", "0.5725366", "0.567018", "0.56652635", "0.5652926", "0.5634376", "0.5634376",...
0.0
-1
next if i == 0
def fizz_buzz(i) if i % 3 == 0 && i % 5 == 0 "fizzbuzz" elsif i % 3 == 0 "fizz" elsif i % 5 == 0 "buzz" else i end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next\n last? ? nil : locate + 1\n end", "def next\n last? ? nil : @collection[index + 1]\n end", "def _skip_next\n @index += 1\n\n self\n end", "def next\n next? ? @current + 1 : nil\n end", "def next_element\n validates_possibility_of :next\n self.index += 1\n sel...
[ "0.6729079", "0.6721046", "0.67178303", "0.6406716", "0.6356957", "0.6330086", "0.632083", "0.6305282", "0.63043344", "0.62911993", "0.62590045", "0.62574613", "0.6242473", "0.6237886", "0.6227054", "0.6193385", "0.6176517", "0.6135584", "0.6135584", "0.6121829", "0.6104131",...
0.0
-1
4. Write a method that counts down to zero using recursion.
def countdown(num) if num <= 0 puts num else puts num countdown(num-1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend", "def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend", "def count_to_zero(number)\n if number <= 0\n pu...
[ "0.81870455", "0.81870455", "0.81870455", "0.81870455", "0.81870455", "0.81870455", "0.81268746", "0.78934944", "0.7727996", "0.7626371", "0.7538814", "0.74868375", "0.74338186", "0.7396636", "0.73881465", "0.72799397", "0.7129322", "0.7128008", "0.7058029", "0.7024019", "0.6...
0.68926483
25
Previous to which includes this backfill, the stream_docket_number and stream_type fields were not used. Therefore, nothing needs to happen in order to rollback the migration.
def down; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback\n # implement in subclasses\n end", "def rollback\n sanity_check\n @handle.rollback\n end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback\n end", "def rollback_db_transaction() \n log(...
[ "0.5815248", "0.5786877", "0.57542306", "0.57542306", "0.57542306", "0.57542306", "0.57542306", "0.57022387", "0.56881833", "0.5636266", "0.5596204", "0.5565521", "0.54744583", "0.54385257", "0.5401416", "0.53434366", "0.53434366", "0.5139939", "0.512766", "0.51097804", "0.51...
0.0
-1
GET /closedcashes GET /closedcashes.json
def index @closedcashes = Closedcash.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @coches = Coche.all\n end", "def index\n @chests = Chest.all\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def index\n ...
[ "0.5741302", "0.55803186", "0.5531151", "0.5511623", "0.54670066", "0.5443565", "0.54336494", "0.53780437", "0.5341276", "0.5333986", "0.53330994", "0.5326586", "0.53065556", "0.5298249", "0.5252971", "0.52351236", "0.5230586", "0.52280295", "0.5227345", "0.5222473", "0.52195...
0.7033928
0
GET /closedcashes/1 GET /closedcashes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @closedcashes = Closedcash.all\n end", "def index\n @coches = Coche.all\n end", "def new\n @cash = @organism.cashes.new\n @cash.sector_id = @organism.sectors.first.id unless @organism.sectored?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render...
[ "0.695236", "0.58905417", "0.5885187", "0.5879806", "0.5788413", "0.573673", "0.5724047", "0.56487846", "0.56402886", "0.5605486", "0.55878794", "0.5578086", "0.55562705", "0.550434", "0.54925424", "0.54818404", "0.54640764", "0.5457379", "0.5454219", "0.5450022", "0.5441552"...
0.0
-1
POST /closedcashes POST /closedcashes.json
def create @closedcash = Closedcash.new(closedcash_params) respond_to do |format| if @closedcash.save format.html { redirect_to @closedcash, notice: 'Closedcash was successfully created.' } format.json { render :show, status: :created, location: @closedcash } else format.html { render :new } format.json { render json: @closedcash.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @closedcashes = Closedcash.all\n end", "def destroy\n @closedcash.destroy\n respond_to do |format|\n format.html { redirect_to closedcashes_url, notice: 'Closedcash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n @cash = @organis...
[ "0.59366107", "0.5625707", "0.54568887", "0.5336653", "0.5164702", "0.50557494", "0.49656606", "0.49523142", "0.4887954", "0.48670718", "0.48529908", "0.48406962", "0.4782424", "0.47802147", "0.4777653", "0.47656786", "0.4758427", "0.47494102", "0.4748986", "0.47237813", "0.4...
0.5829651
1
PATCH/PUT /closedcashes/1 PATCH/PUT /closedcashes/1.json
def update respond_to do |format| if @closedcash.update(closedcash_params) format.html { redirect_to @closedcash, notice: 'Closedcash was successfully updated.' } format.json { render :show, status: :ok, location: @closedcash } else format.html { render :edit } format.json { render json: @closedcash.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\...
[ "0.6029147", "0.60200167", "0.5949371", "0.5945262", "0.59298706", "0.5880457", "0.5873083", "0.5853828", "0.5849161", "0.58354336", "0.5777488", "0.57609683", "0.5758076", "0.5754664", "0.5739763", "0.57173723", "0.56886303", "0.5682519", "0.5682519", "0.5680539", "0.5679551...
0.6060354
0
DELETE /closedcashes/1 DELETE /closedcashes/1.json
def destroy @closedcash.destroy respond_to do |format| format.html { redirect_to closedcashes_url, notice: 'Closedcash was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @closing_cash.destroy\n respond_to do |format|\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was su...
[ "0.69045836", "0.6696428", "0.6682799", "0.66439885", "0.6625885", "0.6609741", "0.6591088", "0.65908885", "0.65521854", "0.65512544", "0.6545576", "0.6540615", "0.65259933", "0.651811", "0.6503395", "0.6501543", "0.6494892", "0.648981", "0.64868647", "0.6485921", "0.64812285...
0.70740277
0
Use callbacks to share common setup or constraints between actions.
def set_closedcash @closedcash = Closedcash.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def closedcash_params params.require(:closedcash).permit(:money, :host, :hostsequence) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Create a new retriever for the given repository. This class recognizes several options, and subclasses may recognize additional options. Options may never be required. === Options :basedir:: Required, base directory where all files should be retrieved :max_bytes:: Maximum number of bytes to read :max_seconds:: Maximum number of seconds to spend reading :logger:: Logger to use === Parameters repository(RightScraper::Repositories::Base):: repository to scrape options(Hash):: retriever options === Raise 'Missing base directory':: if :basedir option is missing
def initialize(repository, options={}) raise 'Missing base directory' unless options[:basedir] @repository = repository @max_bytes = options[:max_bytes] || nil @max_seconds = options[:max_seconds] || nil @basedir = options[:basedir] @repo_dir = RightScraper::Retrievers::Base.repo_dir(@basedir, repository) unless @logger = options[:logger] raise ::ArgumentError, ':logger is required' end @logger.operation(:initialize, "setting up in #{@repo_dir}") do ::FileUtils.mkdir_p(@repo_dir) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(uri, options = {})\n raise Errors::InvalidURI if invalid_uri?(uri)\n @uri = uri\n @options = DEFAULTS.merge(options)\n raise Errors::InvalidFormat if invalid_format?(@options[:format])\n @repo = nil\n @data = {}\n fetch_repo\n setup_data_hash\n...
[ "0.60007846", "0.59225047", "0.5810175", "0.57941556", "0.57857066", "0.56690556", "0.56603605", "0.55891526", "0.5570333", "0.5541875", "0.5427734", "0.54188174", "0.54188174", "0.54170644", "0.53255606", "0.5310664", "0.5272521", "0.5267841", "0.5257171", "0.52560174", "0.5...
0.7508474
0
Determines if retriever is available (has required CLI tools, etc.)
def available? raise ::NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available?\n unless @@available\n begin\n # FIX: we might want to parse the result and require a minimum curl\n # version.\n cmd = \"curl --version\"\n `#{cmd}`\n if $?.success?\n @@available = true\n else\n raise Retriever...
[ "0.74351376", "0.7418762", "0.73860985", "0.69866234", "0.6773988", "0.672853", "0.6643747", "0.6522838", "0.63707566", "0.6365694", "0.6263562", "0.6247108", "0.624292", "0.62037903", "0.61974204", "0.61874723", "0.61702406", "0.61671", "0.616553", "0.6155299", "0.61328405",...
0.56945366
83
Paths to ignore when traversing the filesystem. Mostly used for things like Git and Subversion version control directories. === Return list(Array):: list of filenames to ignore.
def ignorable_paths [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignored\n [\n '.agignore',\n '.cvsignore',\n '.gitignore',\n '.hgignore',\n ].map do |file_with_ignore_patterns|\n if File.exist? file_with_ignore_patterns\n patterns = File.read(file_with_ignore_patterns).split(\"\\n\")\n patterns.map do |pattern|\n next if pattern =~ /^#/\n ...
[ "0.74126047", "0.7255528", "0.7213519", "0.7160678", "0.70518106", "0.69938236", "0.6993137", "0.68540394", "0.68513554", "0.6838619", "0.6829588", "0.67924213", "0.67881244", "0.67821544", "0.67484546", "0.6699798", "0.6698935", "0.66709304", "0.6662678", "0.6628609", "0.662...
0.71669126
3
Retrieve repository, overridden in heirs
def retrieve raise ::NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo\n @repository\n end", "def repo\n @repo\n end", "def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend", "def get_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}\")\n\tend", "def repo\n if @repo == NRSER::NO_ARG\n @repo = QB::Repo....
[ "0.7654918", "0.7592961", "0.7547123", "0.7491363", "0.7395462", "0.73763555", "0.73217225", "0.72534597", "0.7244503", "0.71883225", "0.71850014", "0.7154713", "0.71432525", "0.71432525", "0.71432525", "0.71432525", "0.7119365", "0.71095735", "0.71021867", "0.7088122", "0.70...
0.0
-1
Because the edit action need to be done also without authorization.
def new @user = current_user_obj authorize! :update, @user @user.send_email_confirmation(current_area_translated, current_website_translated) redirect_to root_path, :notice => t(:new_email_confirmation_sent) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n require_user\n end", "def edit\n authorize! :update, @user\n end", "def edit\n enforce_update_permission(@user)\n end", "def edit\n\t\t# must have admin access or be in the course\n\tend", "def edit\n authorize @user_information\n end", "def edit\n authorize! :edit, @user, :...
[ "0.8098426", "0.7918531", "0.78296614", "0.78225213", "0.7739271", "0.77195287", "0.7682463", "0.767167", "0.7661527", "0.7632697", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.75883645", "0.7...
0.0
-1
+options[:result]+ can be a result from Trackerfind_call. Otherwise, it can be +nil+.
def initialize options = {} @view_name = nil OPTIONS.each do |key, var| self.instance_variable_set(var, options[key]) end self.confidence = options[:confidence] result = options[:result] if result @code ||= result[:call] @file ||= result[:location][:file] if result[:location][:type] == :template # template result @template ||= result[:location][:template] else @class ||= result[:location][:class] @method ||= result[:location][:method] end end if @method.to_s =~ /^fake_filter\d+/ @method = :before_filter end if @user_input.is_a? Railroader::BaseCheck::Match @user_input_type = @user_input.type @user_input = @user_input.match elsif @user_input == false @user_input = nil end if not @line if @user_input and @user_input.respond_to? :line @line = @user_input.line elsif @code and @code.respond_to? :line @line = @code.line end end if @gem_info if @gem_info.is_a? Hash @line ||= @gem_info[:line] @file ||= @gem_info[:file] else # Fallback behavior returns just a string for the file name @file ||= @gem_info end end unless @warning_set if self.model @warning_set = :model elsif self.template @warning_set = :template @called_from = self.template.render_path elsif self.controller @warning_set = :controller else @warning_set = :warning end end if options[:warning_code] @warning_code = Railroader::WarningCodes.code options[:warning_code] end Railroader.debug("Warning created without warning code: #{options[:warning_code]}") unless @warning_code @format_message = nil @row = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_set_options(result, options)\n result = api_added(result, options[:added]) if options[:added]\n return result\n end", "def set_result\n results = result_params\n unless results.nil?\n if results.is_a?(String)\n parts = results.split(\"#\")\n @result = @meas...
[ "0.6277903", "0.60746485", "0.59010714", "0.5773727", "0.57560915", "0.55166936", "0.54389775", "0.5437488", "0.5430641", "0.5425937", "0.5425937", "0.5425937", "0.5425937", "0.5425937", "0.5425937", "0.5425937", "0.5425937", "0.5425937", "0.542587", "0.5402812", "0.53893906"...
0.0
-1
Returns name of a view, including where it was rendered from
def view_name(include_renderer = true) if called_from and include_renderer @view_name = "#{template.name} (#{called_from.last})" else @view_name = template.name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_name\n @view.virtual_path.split('/').last\n end", "def view_name\n self.class.view_name\n end", "def view\n self.class.name.underscore\n end", "def get_name(task_name)\n @view.get_name(task_name)\n end", "def view_path\n @@view_path\n end", "def view_path\...
[ "0.8556762", "0.8034159", "0.77579397", "0.7067324", "0.6973917", "0.69542015", "0.68275934", "0.67131346", "0.67075026", "0.6536749", "0.65072817", "0.64933485", "0.6474512", "0.64628327", "0.6385131", "0.6329606", "0.6246094", "0.6246094", "0.6239353", "0.6233065", "0.62258...
0.79045063
2
Return String of the code output from the OutputProcessor and stripped of newlines and tabs.
def format_code strip = true format_ruby self.code, strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n output || content || \"\"\n end", "def output\n @output.map(&:to_s)\n end", "def to_s\n @code.to_s\n end", "def output\n @outputbuffer.string\n end", "def raw_output(s)\n s\n end", "def dump_compiled code\n\t\t\tbuf = do_compile code,false\n\t\t\tprint b...
[ "0.6610772", "0.6386455", "0.6257439", "0.6250993", "0.62473464", "0.6171179", "0.6165731", "0.61647725", "0.6154194", "0.6153678", "0.6151913", "0.60750735", "0.60585445", "0.60541433", "0.60514724", "0.60514724", "0.6046068", "0.6039563", "0.6033661", "0.60320026", "0.60316...
0.5726081
46
Return String of the user input formatted and stripped of newlines and tabs.
def format_user_input strip = true format_ruby self.user_input, strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeInput(s)\r\n if s == nil\r\n return \"\"\r\n else\r\n return s.gsub(/\\\\n/, \"\\n\")\r\n end\r\n end", "def clean_input(input)\n input.strip\n end", "def format_input(input)\n raise \"No content in entry\" if input.nil? || input.strip.length == 0\n input_lines = ...
[ "0.66765386", "0.66641724", "0.65570074", "0.65425307", "0.6505871", "0.63928354", "0.6312676", "0.6299677", "0.6281733", "0.62067086", "0.61736125", "0.61420995", "0.6078183", "0.60463846", "0.59712166", "0.58803535", "0.5863453", "0.5840228", "0.58344245", "0.57712466", "0....
0.70295596
0
Return formatted warning message
def format_message return @format_message if @format_message @format_message = self.message.dup if self.line @format_message << " near line #{self.line}" end if self.code @format_message << ": #{format_code}" end @format_message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_warning_text\n @warnings\n end", "def warning\n return @warning\n end", "def warning text\n print_red(\"WARNING: #{text}\") \n end", "def warning text\n print_red(\"WARNING: #{text}\") \n end", "def bold_warning(*args); end", "def format_severity...
[ "0.77053744", "0.74953747", "0.7404663", "0.7404663", "0.7391339", "0.7364305", "0.7326834", "0.7296612", "0.7285692", "0.7285692", "0.72714883", "0.7265686", "0.7265686", "0.72126067", "0.72025603", "0.71862197", "0.70827925", "0.7061496", "0.6943915", "0.69236934", "0.69235...
0.0
-1
Generates a hash suitable for inserting into a table
def to_row type = :warning @row = { "Confidence" => self.confidence, "Warning Type" => self.warning_type.to_s, "Message" => self.format_message } case type when :template @row["Template"] = self.view_name.to_s when :model @row["Model"] = self.model.to_s when :controller @row["Controller"] = self.controller.to_s when :warning @row["Class"] = self.class.to_s @row["Method"] = self.method.to_s end @row end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def generate_row_key link\n # rowkey is 'md5_hashed_link'\n d = Digest::MD5.new\n d.hexdigest link\nend", "def hash(*) end", "def hash\n raw = [name, type, values....
[ "0.7232455", "0.7232455", "0.7232455", "0.7232455", "0.7232455", "0.7232455", "0.7232455", "0.672066", "0.66973644", "0.6657042", "0.66339666", "0.65941423", "0.65863746", "0.651638", "0.6490185", "0.6483761", "0.64712316", "0.6425764", "0.6409383", "0.6315767", "0.6313063", ...
0.0
-1
Functions to determine install status and version for IHS
def ihs_installed? get_version = node['ihs']['install_dir'] + '/bin/versionInfo.sh' begin !/^IHS\s+installed$/.match(shell_out(get_version).stdout).to_s.empty? rescue Errno::ENOENT => e Chef::Log.info "File not found: #{get_version}, error: #{e}" return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_info\n if defined?(Sensu::Enterprise::VERSION)\n [\"enterprise\", Sensu::Enterprise::VERSION]\n else\n [\"core\", Sensu::VERSION]\n end\n end", "def software_status(opts)\n opts = check_params(opts,[:installation_ids])\n super(opts)\n end",...
[ "0.65920764", "0.6492375", "0.6228614", "0.6226467", "0.62157106", "0.6153386", "0.60666376", "0.6062232", "0.59915894", "0.5972858", "0.59472924", "0.5882265", "0.5882265", "0.58814156", "0.58716506", "0.58619106", "0.5793718", "0.57850903", "0.5761583", "0.5761583", "0.5750...
0.6841805
0
Functions to determine install status and version for the WAS plugin
def ihs_plg_installed? get_version = node['ihs']['plugin']['install_dir'] + '/bin/versionInfo.sh' begin !/^PLG\s+installed$/.match(shell_out(get_version).stdout).to_s.empty? rescue Errno::ENOENT => e Chef::Log.info "File not found: #{get_version}, error: #{e}" return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def installed_version\n logger.trace(\"#{new_resource} checking package version\")\n current_installed_version\n end", "def wp_install_version_check(site=@site, verbose=true)\n @wp_paths.each do |p|\n installer = site.sub(/\\/$/, '') + p + '/INSTALL.html'\n res = @http...
[ "0.67553914", "0.6603389", "0.65836024", "0.65639526", "0.64073455", "0.6386622", "0.6357007", "0.62495327", "0.62340003", "0.62054306", "0.62054306", "0.6158589", "0.6129734", "0.60807186", "0.5972702", "0.5934518", "0.5908741", "0.59062755", "0.59062374", "0.5883202", "0.58...
0.0
-1
Functions to check/create prescribed installation path
def subdirs_to_create(dir, user) Chef::Log.info("Dir to create: #{dir}, user: #{user}") existing_subdirs = [] remaining_subdirs = dir.split('/') remaining_subdirs.shift # get rid of '/' until remaining_subdirs.empty? Chef::Log.debug("remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}") path = existing_subdirs.push('/' + remaining_subdirs.shift).join break unless File.exist?(path) raise "Path #{path} exists and is a file, expecting directory." unless File.directory?(path) raise "Directory #{path} exists but is not traversable by #{user}." unless can_traverse?(user, path) end new_dirs = [existing_subdirs.join] new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty? new_dirs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_exists?\n path_exists? install_dir\nend", "def install_path(val = NULL_ARG)\n unless val.equal?(NULL_ARG)\n @install_path = windows_safe_path(val)\n end\n @install_path || raise(MissingProjectConfiguration.new('install_path', '/opt/chef'))\n end", "def path_check!\n ...
[ "0.67858887", "0.6622233", "0.66025555", "0.65714014", "0.65709126", "0.65055615", "0.64921814", "0.63616234", "0.6309477", "0.6296023", "0.62916154", "0.6271961", "0.62543106", "0.62440795", "0.62233955", "0.61894405", "0.6183282", "0.61554354", "0.61161435", "0.60941195", "...
0.0
-1
GET /families GET /families.json
def index @families = Family.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end...
[ "0.74112016", "0.73993015", "0.70999295", "0.6936259", "0.69057566", "0.6888429", "0.68346846", "0.67850256", "0.66525924", "0.6604628", "0.65405196", "0.637672", "0.6308998", "0.62533224", "0.6244051", "0.62438947", "0.6134215", "0.60910314", "0.6059278", "0.6035607", "0.602...
0.7089507
5
GET /families/1 GET /families/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end", "def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.h...
[ "0.73359054", "0.724417", "0.7214146", "0.7206399", "0.7167201", "0.7093841", "0.7093841", "0.7093841", "0.6945207", "0.6817828", "0.67575496", "0.66471833", "0.6474473", "0.6474473", "0.6456767", "0.64294004", "0.6424024", "0.63775104", "0.626056", "0.62563133", "0.6234184",...
0.0
-1
POST /families POST /families.json
def create @family = Family.new(family_params) if session[:type_user]=="Miembro" @family.comunity = current_user.profile.member.comunity end respond_to do |format| if @family.save format.html { redirect_to @family, notice: 'La familia fue creada exitosamente.' } format.json { render :show, status: :created, location: @family } else format.html { render :new } format.json { render json: @family.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end", "def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\...
[ "0.69394344", "0.6557405", "0.6539632", "0.62348044", "0.6194535", "0.6145975", "0.6061082", "0.60608697", "0.6032527", "0.5941302", "0.5921364", "0.5920388", "0.5912198", "0.5904324", "0.58811975", "0.5864885", "0.5859784", "0.5856368", "0.5819247", "0.580773", "0.580773", ...
0.0
-1
PATCH/PUT /families/1 PATCH/PUT /families/1.json
def update respond_to do |format| @family.slug=nil if @family.update(family_params) format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' } format.json { render :show, status: :ok, location: @family } else format.html { render :edit } format.json { render json: @family.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.er...
[ "0.6766356", "0.6752083", "0.67093277", "0.6607182", "0.65421635", "0.6374736", "0.6369962", "0.63593566", "0.63144934", "0.63023", "0.62908006", "0.62390554", "0.6202691", "0.61117816", "0.6012359", "0.59905547", "0.5990456", "0.59778", "0.5957144", "0.5915357", "0.59107053"...
0.6303013
9
DELETE /families/1 DELETE /families/1.json
def destroy @family.destroy respond_to do |format| format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_...
[ "0.7309996", "0.73002434", "0.7138071", "0.7109038", "0.70249385", "0.7000798", "0.69814944", "0.69413674", "0.67451394", "0.6730755", "0.6714874", "0.6634114", "0.66101265", "0.6605488", "0.6605488", "0.66020864", "0.6600027", "0.65869814", "0.65752846", "0.6566904", "0.6566...
0.7022638
5
Use callbacks to share common setup or constraints between actions.
def set_family @family = Family.friendly.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def family_params params.require(:family).permit(:nombre_casa, :numero_casa, :telefono, :comunity_id,:direccion) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
There's no obviously easy way to get NArray to mul_accum on a slice without making a temporary object. So we make them all and store them in a regular Ruby array.
def preslice_filter filter slices = [] steps = filter.shape[0] / 2 steps.times do |i| f_start = steps-i f_end = -1-i if filter.rank == 2 slices << filter[f_start..f_end, true] else slices << filter[f_start..f_end] end end slices end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_total_with_reduce_2(array)\n array.map.with_index do |el, idx|\n array[0..idx].reduce(:+)\n end\nend", "def reduction(new_array)\n arr = []\n new_array.each do |x|\n arr << x.reduce(:+)\n end\n return arr\n end", "def parts_sums(input_array)\n total = input_array.sum\n out...
[ "0.6123777", "0.60949636", "0.59567857", "0.58957595", "0.5883685", "0.5866686", "0.5840751", "0.58107334", "0.5785157", "0.57754123", "0.5772103", "0.57472354", "0.57442343", "0.57363856", "0.57333004", "0.56877446", "0.56826687", "0.56798124", "0.5676726", "0.5662563", "0.5...
0.0
-1
We build filters with two copies of data so a circular buffer can mul_accum on a slice.
def double_filter coef coef = coef.to_a if Complex === coef[0] new_coef = NArray.scomplex coef.size * 2 else new_coef = NArray.sfloat coef.size * 2 end # reverse into position new_coef[coef.size-1..0] = coef new_coef[-1..coef.size] = coef new_coef end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_filters(filters, op)\n filters = filters.compact\n if filters.length == 0\n nil\n elsif filters.length == 1\n filters.first\n else\n {op => filters}\n end\n end", "def reduce_blocks(blks, filter = writable_mifare_blocks)\n if identify_2d_array(b...
[ "0.60112584", "0.5815165", "0.5615223", "0.55344373", "0.55100226", "0.5499482", "0.54939103", "0.54939103", "0.53486264", "0.5314544", "0.5311366", "0.5225281", "0.5190498", "0.5177989", "0.5154586", "0.5133524", "0.510491", "0.50550777", "0.5044201", "0.5042721", "0.4996600...
0.0
-1
The signal is premixed into the filter. We adjust the master phase every time we filter. mix_phase = mix_phase_inc faster than sin+cos Take out the rounding errors once in a while with: mix_phase /= mix_phase.abs
def premix_filter coef, mix return coef unless mix and mix != 0 rate = PI2 * mix i = coef.size coef.collect do |coef| i -= 1 coef * Math.exp(Complex(0.0,rate*i)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FFT2(in_signal, in_step, in_prev_sum)\n sum = 0\n the_start_index = in_step - 1\n# add the next in_step numbers\n end_add_indices = the_start_index + in_step\n if end_add_indices > in_signal.size # we only need to add 'shortcut'\n end_add_indices = in_signal.size\n if in_prev_sum > 0 && the_start_ind...
[ "0.49873173", "0.4956558", "0.47255263", "0.46772194", "0.46274573", "0.4621342", "0.46030945", "0.4516759", "0.44645998", "0.44560558", "0.445119", "0.44385594", "0.44078064", "0.44070783", "0.43946102", "0.43938574", "0.43903756", "0.43463436", "0.43460736", "0.43409693", "...
0.6332244
0
GET /rounds GET /rounds.json
def index @rounds = Round.all.order("month DESC") @rounds = @rounds - [@round] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def index\n @rounds = Round.all\n end", "def index\n @rounds = Round.all\n end", "def index\n @rounds = Round.all\n end", "def index\n @rounds = Round.all\n end", "def index\n @rounds = Round.all\n ...
[ "0.8179578", "0.7259982", "0.7259982", "0.7259982", "0.7259982", "0.7259982", "0.7259982", "0.7259982", "0.7138636", "0.7110566", "0.69381267", "0.69308823", "0.69218105", "0.6695108", "0.6681436", "0.66559047", "0.6504946", "0.6480924", "0.6423685", "0.64184344", "0.6388241"...
0.0
-1
GET /rounds/1 GET /rounds/1.json
def show @gmaps_links = [] @round.albums.each do |album| album.places.each do |place| gmaps_link = place.address + ' ' + place.city + ' ' + place.state gmaps_link.gsub!(' ', '+') @gmaps_links << gmaps_link end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def show\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: ...
[ "0.77348197", "0.7122272", "0.6969947", "0.6969947", "0.6969947", "0.6969947", "0.6969947", "0.6969947", "0.6969947", "0.6902254", "0.6894596", "0.68345076", "0.6825466", "0.6753058", "0.67452794", "0.66507864", "0.66320896", "0.6569826", "0.65155756", "0.6459604", "0.6414091...
0.0
-1
POST /rounds POST /rounds.json
def create @round = Round.new(round_params) respond_to do |format| if @round.save format.html { redirect_to @round } format.json { render :show, status: :created, location: @round } else format.html { render :new } format.json { render json: @round.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rounds\n Round.create_rounds(id)\n\n\n end", "def create_rounds\n Round.create_rounds(id)\n\n\n end", "def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successful...
[ "0.7104489", "0.7104489", "0.70039594", "0.6991256", "0.6908583", "0.6889093", "0.68323505", "0.6823776", "0.68040234", "0.6674662", "0.66656566", "0.65715724", "0.6561143", "0.65382886", "0.64882076", "0.6380548", "0.63772136", "0.63772136", "0.63759726", "0.6367244", "0.635...
0.6803231
9
PATCH/PUT /rounds/1 PATCH/PUT /rounds/1.json
def update respond_to do |format| if @round.update(round_params) format.html { redirect_to :root } format.json { render :show, status: :ok, location: @round } else format.html { render :edit } format.json { render json: @round.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.js...
[ "0.7072058", "0.703137", "0.68880683", "0.68509346", "0.6767903", "0.6767903", "0.6712788", "0.66683185", "0.6655102", "0.6655102", "0.6627183", "0.66132647", "0.65992844", "0.6535786", "0.63719124", "0.6328629", "0.6312666", "0.61335635", "0.61317116", "0.61029226", "0.60575...
0.6678458
7
DELETE /rounds/1 DELETE /rounds/1.json
def destroy @round.destroy respond_to do |format| format.html { redirect_to root_url, notice: 'Round was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n f...
[ "0.76205236", "0.76205236", "0.76205236", "0.7431568", "0.7431568", "0.7430822", "0.7422256", "0.72982204", "0.72982204", "0.72982204", "0.72982204", "0.7291912", "0.72501194", "0.7098678", "0.69999164", "0.6967715", "0.6926577", "0.69074655", "0.68914616", "0.68591595", "0.6...
0.72139317
13
Use callbacks to share common setup or constraints between actions.
def set_round if params[:id] @round = Round.find(params[:id]) else current_round_finished = false finds = [] upcoming_round = Round.where(month: (Time.zone.now.beginning_of_month + 1.month)).first current_round = Round.where(month: Time.zone.now.beginning_of_month).first if current_round != nil current_round.albums.each do |album| if album.find != nil finds << album end end end if finds.count == 3 current_round_finished = true end if upcoming_round != nil && current_round_finished == false @round = upcoming_round @current_round = false else @round = current_round @current_round = true end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def round_params params.require(:round).permit(:month, albums_attributes: [:id, :title, :band, :cover, :rdio_link, :found, :link, :link_text, :round_id, :review, :finder, :finder_photo, places_attributes: [:id, :teaser, :name, :link, :address, :city, :state, :description, :link_text, :album_id], hints_attributes: [:id, :name, :description, :photo, :thumbnail, :album_id], find_attributes: [:id, :user_id, :album_id, :photo] ]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
returns the word of the sentence that contains the most vowels.
def most_vowels(sentence) vowels = "aeiou" vowelCount = Hash.new(0); sentence.split(" ").each do |word| word.each_char do |char| if vowels.include?(char) vowelCount[word] += 1 end end end sortedArr = vowelCount.sort_by { |k, v| v} return sortedArr[-1][0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_vowels(sentence)\n \tcountMost = 0\n \tmostVowelWord = \"\"\n \tsentence.split.each do |word|\n \tcurrent = countVowels(word)\n \tif current > countMost\n countMost = current\n mostVowelWord = word\n end\n end\n \treturn mostVowelWord\nend", "def most_vowels(sente...
[ "0.8664968", "0.8269816", "0.82411313", "0.8125318", "0.8087403", "0.7851711", "0.78452533", "0.77639204", "0.7598772", "0.7574426", "0.7509496", "0.74968374", "0.74751735", "0.7403814", "0.7321625", "0.7232883", "0.7216693", "0.71875465", "0.71827126", "0.71494734", "0.70960...
0.80791146
5
Instance Methods Formats a nice string version of the skill object. For a regular html app this would be handled at the display layer but when building up JSON/XML strings I usually prefer skipping the view layer and rendering json straight from the controller This method is not currently used
def to_s (name.blank?) ? description : "#{name}: #{description}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_skill_name\n \"#{skill_category} > #{skill_subcategory} > #{skill_description}\"\n end", "def name\n\t\t@skill.to_s\n\tend", "def categorized_specific_skill\n return \"#{skill_category.description} : #{specific_skill}\"\n end", "def show\n @skill = Skill.find(params[:id])\n\n respond_t...
[ "0.6501851", "0.64252216", "0.6241398", "0.6191012", "0.6161062", "0.600174", "0.59452826", "0.58862793", "0.5874406", "0.5873727", "0.58656365", "0.58524984", "0.5837649", "0.5823346", "0.5822854", "0.5822854", "0.58112293", "0.57857156", "0.5785015", "0.5781118", "0.5778407...
0.0
-1
Is everything good to go? Implemented by subclasses.
def ok? raise "Subclasses must implement this method." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usable?; end", "def valid?\n raise NotImplementedError\n end", "def checks; end", "def valid?\n raise NotImplementedError\n end", "def check ; true ; end", "def check\n \n end", "def check\n \n end", "def valid?\n raise ...
[ "0.6997373", "0.66970676", "0.6675866", "0.6625843", "0.66135323", "0.6578524", "0.6578524", "0.6531431", "0.6449139", "0.64490074", "0.6425337", "0.6421146", "0.6421146", "0.6418683", "0.64101654", "0.6405182", "0.63839775", "0.636873", "0.6362219", "0.6357812", "0.63154584"...
0.7621948
0
Warn, fix, or abort. Implemented by subclasses.
def run raise "Subclasses must implement this method." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning?; end", "def warning?; end", "def warning?; end", "def warned; end", "def warn\n\n end", "def warning(*args); end", "def warning(text); end", "def warning(text); end", "def warn(*args); end", "def warn(*args); end", "def warn(msg)\n #This is a stub, used for indexing\n en...
[ "0.6760447", "0.6760447", "0.6760447", "0.66977006", "0.66387033", "0.66124356", "0.65121037", "0.65121037", "0.6505365", "0.6505365", "0.64948213", "0.64658535", "0.6462581", "0.6450131", "0.64484215", "0.6443852", "0.6443852", "0.62847024", "0.6256926", "0.6215372", "0.6215...
0.0
-1
A fancier `abort` and `warn`. This will probably really annoy someone at some point because it's overriding a Kernel method, but it's limited to checks.
def abort(message, *extras) extras << { :color => :red } warn message, *extras exit 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abort(message)\n warn message\n exit 1\nend", "def abort(message)\n warn message\n exit 1\nend", "def run_warned; end", "def abortWithUsage( msg = \"Aborted.\" )\n\tmsg = msg + Usage\n\tabortRun( msg )\nend", "def lwarn; end", "def warn(*args); end", "def warn(*args); end", "def warn\n\n end...
[ "0.7133231", "0.7133231", "0.65792763", "0.65417916", "0.65364456", "0.6531234", "0.6531234", "0.6527851", "0.64975965", "0.6474415", "0.64583933", "0.6394808", "0.63805366", "0.6338931", "0.6338931", "0.6338931", "0.63114274", "0.63012695", "0.62852293", "0.62813866", "0.625...
0.62405723
24
Helper method creating a link calling a Javascript function adding a file field for file association
def link_to_new_file(name) link_to_function name, js_add_new_file(ArticleFile.new) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_iform_link(name, id, obj, locals={})\n link_to_function name do |page|\n page.insert_html :bottom, id, :partial => 'iform', :object => obj, :locals => locals\n end\n end", "def js_add_new_file(object)\n update_page do |p|\n p.insert_html :bottom, 'files', :partial => 'file', :object =...
[ "0.6931073", "0.6861027", "0.6761558", "0.6435387", "0.6432908", "0.6403012", "0.63479257", "0.6327371", "0.6269697", "0.62553555", "0.62317175", "0.6195633", "0.6183239", "0.6180162", "0.6180162", "0.6162712", "0.6154648", "0.6151103", "0.6151103", "0.61375785", "0.60609525"...
0.77595353
0
Helper method inserting the famous file field for file association
def js_add_new_file(object) update_page do |p| p.insert_html :bottom, 'files', :partial => 'file', :object => object end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_field; end", "def file_custom_fields\n group_custom_fields 'file'\n end", "def file_custom_fields\n group_custom_fields 'file'\n end", "def set_the_field_values\n fn = self.file_name\n unless self.file_ext && !self.file_ext.blank?\n self.file_ext = fn.split('.').last...
[ "0.62875324", "0.6254998", "0.6254998", "0.61806726", "0.6112793", "0.5840082", "0.58370537", "0.5835645", "0.583331", "0.572393", "0.57183", "0.55866265", "0.55843925", "0.5563924", "0.55342466", "0.5517048", "0.55154103", "0.5514412", "0.55128026", "0.5508875", "0.5505749",...
0.55570686
14
No default implementation def set_default_payment_method(kb_account_id, kb_payment_method_id, properties, context) end
def get_payment_methods(kb_account_id, refresh_from_gateway = false, properties, context) options = properties_to_hash(properties) @payment_method_model.from_kb_account_id(kb_account_id, context.tenant_id).collect { |pm| pm.to_payment_method_info_plugin } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_payment_method(account_id, payment_method_id, opts = {})\n set_default_payment_method_with_http_info(account_id, payment_method_id, opts)\n return nil\n end", "def default_payment_method\n payment_methods.find { |payment_instrument| payment_instrument.default? }\n end", "de...
[ "0.7330419", "0.7126369", "0.6978139", "0.6938346", "0.68741685", "0.67230844", "0.67230844", "0.6504771", "0.6471968", "0.644956", "0.6426105", "0.6388055", "0.6384869", "0.635832", "0.6334527", "0.6278095", "0.62151194", "0.62001175", "0.62001175", "0.61107385", "0.61107385...
0.53484184
62
Utilities TODO Split settlements is partially implemented. Left to be done: payment_source should probably be retrieved per gateway amount per gateway should be retrieved from the options
def dispatch_to_gateways(operation, kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context, gateway_call_proc, linked_transaction_proc=nil, extra_params={}) kb_transaction = Utils::LazyEvaluator.new { get_kb_transaction(kb_payment_id, kb_payment_transaction_id, context.tenant_id) } amount_in_cents = amount.nil? ? nil : to_cents(amount, currency) # Setup options for ActiveMerchant options = properties_to_hash(properties) options[:order_id] ||= (Utils.normalized(options, :external_key_as_order_id) ? kb_transaction.external_key : kb_payment_transaction_id) options[:currency] ||= currency.to_s.upcase unless currency.nil? options[:description] ||= "Kill Bill #{operation.to_s} for #{kb_payment_transaction_id}" # Retrieve the payment method payment_source = get_payment_source(kb_payment_method_id, properties, options, context) # Sanity checks if [:authorize, :purchase, :credit].include?(operation) raise "Unable to retrieve payment source for operation=#{operation}, kb_payment_id=#{kb_payment_id}, kb_payment_transaction_id=#{kb_payment_transaction_id}, kb_payment_method_id=#{kb_payment_method_id}" if payment_source.nil? end # Retrieve the previous transaction for the same operation and payment id - this is useful to detect dups for example last_transaction = Utils::LazyEvaluator.new { @transaction_model.send("#{operation.to_s}s_from_kb_payment_id", kb_payment_id, context.tenant_id).last } # Retrieve the linked transaction (authorization to capture, purchase to refund, etc.) linked_transaction = nil unless linked_transaction_proc.nil? linked_transaction = linked_transaction_proc.call(amount_in_cents, options) options[:payment_processor_account_id] ||= linked_transaction.payment_processor_account_id end # Filter before all gateways call before_gateways(kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context) # Dispatch to the gateways. In most cases (non split settlements), we only dispatch to a single gateway account gw_responses = [] responses = [] transactions = [] payment_processor_account_ids = Utils.normalized(options, :payment_processor_account_ids) if !payment_processor_account_ids payment_processor_account_ids = [Utils.normalized(options, :payment_processor_account_id) || :default] else payment_processor_account_ids = payment_processor_account_ids.split(',') end payment_processor_account_ids.each do |payment_processor_account_id| # Find the gateway gateway = lookup_gateway(payment_processor_account_id, context.tenant_id) # Filter before each gateway call before_gateway(gateway, kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context) # Perform the operation in the gateway gw_response = gateway_call_proc.call(gateway, linked_transaction, payment_source, amount_in_cents, options) response, transaction = save_response_and_transaction(gw_response, operation, kb_account_id, context.tenant_id, payment_processor_account_id, kb_payment_id, kb_payment_transaction_id, operation.upcase, amount_in_cents, currency, extra_params) # Filter after each gateway call after_gateway(response, transaction, gw_response, context) gw_responses << gw_response responses << response transactions << transaction end # Filter after all gateways call after_gateways(responses, transactions, gw_responses, context) # Merge data merge_transaction_info_plugins(payment_processor_account_ids, responses, transactions) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_opts(order, payment_method, stage)\n items = order.line_items.map do |item|\n price = (item.price * 100).to_i # convert for gateway\n { :name => item.variant.product.name,\n :description => (item.variant.product.description[0..120] if item.variant.product.description),\...
[ "0.6088275", "0.6040698", "0.5840004", "0.57415533", "0.5605391", "0.5583048", "0.5579271", "0.5543433", "0.5529068", "0.5448396", "0.5434311", "0.5377675", "0.5374703", "0.5373312", "0.5359347", "0.5336463", "0.5312228", "0.53047246", "0.53000236", "0.5298056", "0.5296034", ...
0.0
-1
Default nil value for context only for backward compatibility (Kill Bill 0.14.0)
def before_gateways(kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n nil\n end", "def context\n {}\n end", "def context\n {}\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def cont...
[ "0.76814955", "0.724568", "0.724568", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700...
0.0
-1
Default nil value for context only for backward compatibility (Kill Bill 0.14.0)
def after_gateways(response, transaction, gw_response, context = nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n nil\n end", "def context\n {}\n end", "def context\n {}\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def cont...
[ "0.76803505", "0.72448766", "0.72448766", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795"...
0.0
-1
Default nil value for context only for backward compatibility (Kill Bill 0.14.0)
def before_gateway(gateway, kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil) # Can be used to implement idempotency for example: lookup the payment in the gateway # and pass options[:skip_gw] if the payment has already been through end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n nil\n end", "def context\n {}\n end", "def context\n {}\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def cont...
[ "0.76803505", "0.72448766", "0.72448766", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795", "0.70064795"...
0.0
-1
Default nil value for context only for backward compatibility (Kill Bill 0.14.0)
def after_gateway(response, transaction, gw_response, context = nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n nil\n end", "def context\n {}\n end", "def context\n {}\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def cont...
[ "0.76814955", "0.724568", "0.724568", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700716", "0.700...
0.0
-1
set up for testing to load files for tests
def set_files(input = "./sample1.txt",output = './dest1.txt') @input_file = input @output_file = output @extract = load_file(@input_file,PATTERNS) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_load(test_files); end", "def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end", "def setup\n Inspec::Plugin::V2::Loader.new.load_all\n end", "def setup\n @gbif = Pathname.new(__FILE__).dirname.join('gbif_genbank_linke...
[ "0.7965068", "0.7254508", "0.70111597", "0.69642407", "0.6937427", "0.69242495", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", "0.68819416", ...
0.0
-1
reads given data and converts it into hash/dictionary
def convert_to_hash(symbol,array_num,keys,conv) result = {} @extract[symbol][array_num].split(' ').each_with_index do |el,ix| converted_el = el.send(conv[ix]) result[keys[ix]] = (converted_el == 'true' || converted_el == 'false')? eval(converted_el) : converted_el #eval has to be performed on 'false'/'true' end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data stream=STDIN\n\tdata = {}\n\tstream.each do |line|\n\t\tline =~ /^([0-9]*)\\|(.*)/;\n\t\tid, name_addr = $1.to_i, $2\n\t\traise \"duplicate id #{id}?\" if data[id]\n\t\tdata[id] = name_addr\n\tend\n\tdata\nend", "def parse_hash_packet(data)\n hashes = []\n\n algo = data.read_string\n ...
[ "0.6626663", "0.661975", "0.65698576", "0.6552171", "0.65259594", "0.64041775", "0.6398365", "0.6392176", "0.6370021", "0.6370021", "0.6367444", "0.63283986", "0.6327749", "0.62052035", "0.62016857", "0.61756444", "0.61227816", "0.6105781", "0.60416776", "0.60343856", "0.5990...
0.0
-1
Why is this necessary? Perhaps just to initialize form, does not save... Would it work with required params? How to do req'd params?
def new @photo = Photo.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_form_data(params = {})\n from_params(params, false)\n end", "def form_setup\n\tend", "def initialize\n @params = {} # Mimics params hash available within controllers in rails app\n end", "def valid_params?; end", "def valid_params_request?; end", "def form_params\n ...
[ "0.64748764", "0.6414771", "0.63863987", "0.63350594", "0.6161817", "0.61546624", "0.6150104", "0.60950994", "0.6082215", "0.6055543", "0.60401106", "0.599685", "0.59786904", "0.59725475", "0.5954255", "0.59137285", "0.5891296", "0.58832115", "0.585872", "0.58354104", "0.5812...
0.0
-1
Initialize with the password
def initialize(password, size=256, mode="cbc") @password = password @size = size @mode = mode @cipher = OpenSSL::Cipher::Cipher.new("aes-#{size}-#{mode}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(password)\n @password = password\n end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def passwd\r\n @password = \"12345\"\r\n end", "def initialize(args)\n if args.respond_to?(:keys)\n @pas...
[ "0.84076387", "0.75638866", "0.75638866", "0.75638866", "0.75638866", "0.7420939", "0.73517483", "0.7315896", "0.73049206", "0.7219563", "0.72090065", "0.7203744", "0.719083", "0.71710145", "0.71501815", "0.71501815", "0.71437067", "0.7128355", "0.7128355", "0.7128355", "0.71...
0.0
-1
GET /organization_members/1 GET /organization_members/1.xml
def show @organization_member = OrganizationMember.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @organization_member } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization_members(org)\n get \"/orgs/#{org}/members\"\n end", "def show\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization_membershipshi...
[ "0.7295145", "0.687698", "0.6818822", "0.66467535", "0.65676236", "0.65206504", "0.6487884", "0.64422154", "0.6428098", "0.6428098", "0.641447", "0.6376002", "0.6356502", "0.63134", "0.6310896", "0.62411803", "0.6232414", "0.6210289", "0.6210289", "0.62077457", "0.61892927", ...
0.7271967
1
GET /organization_members/new GET /organization_members/new.xml
def new @organization_member = OrganizationMember.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @organization_member } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @organizations = Organization.find(:all)\n @organization_user = OrganizationUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_user }\n end\n end", "def new\n @organization = Organization.new\n\n respond_to do |form...
[ "0.7509134", "0.73715734", "0.73713", "0.73713", "0.7358503", "0.7248141", "0.72430134", "0.71214586", "0.71153355", "0.71034074", "0.71034074", "0.71034074", "0.7038471", "0.7033218", "0.70084536", "0.70000273", "0.6998842", "0.6946194", "0.6883773", "0.6874757", "0.68259585...
0.7959692
0
POST /organization_members POST /organization_members.xml
def create @organization_member = OrganizationMember.new(params[:organization_member]) respond_to do |format| if @organization_member.save format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully created.') } format.xml { render :xml => @organization_member, :status => :created, :location => @organization_member } else format.html { render :action => "new" } format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @member = @organization.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n logger.info(\"User #{current_user.email} created Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@o...
[ "0.65905035", "0.646108", "0.61698675", "0.6169194", "0.6134789", "0.61309856", "0.60435045", "0.59900796", "0.5956035", "0.591098", "0.59048945", "0.5894511", "0.586154", "0.58457935", "0.5812234", "0.57767683", "0.5769082", "0.57649314", "0.5759263", "0.57346636", "0.568910...
0.69179714
0
PUT /organization_members/1 PUT /organization_members/1.xml
def update @organization_member = OrganizationMember.find(params[:id]) respond_to do |format| if @organization_member.update_attributes(params[:organization_member]) format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @organization.remove_members(params[:organization][:user_ids])\n\n if @organization.update_attributes(check_owner(organization_params))\n\n ...
[ "0.6608563", "0.65917176", "0.6518058", "0.6511707", "0.6467627", "0.6453962", "0.6432147", "0.642786", "0.63439393", "0.63212264", "0.6280427", "0.62447184", "0.61718386", "0.6122993", "0.6117347", "0.6117119", "0.6045175", "0.60414755", "0.6035834", "0.60353965", "0.6035396...
0.71433866
0
DELETE /organization_members/1 DELETE /organization_members/1.xml
def destroy @organization_member = OrganizationMember.find(params[:id]) @organization_member.destroy respond_to do |format| format.html { redirect_to(organization_members_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @organization_user = OrganizationUser.find(params[:id])\n @organization_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @organization = Organization.find(params[:id])\n ...
[ "0.6949872", "0.6871764", "0.6822603", "0.6811967", "0.6749267", "0.67403114", "0.6714289", "0.66457415", "0.6617163", "0.65640503", "0.6556841", "0.65170145", "0.64911973", "0.64828926", "0.6474834", "0.6467789", "0.6467635", "0.6449576", "0.6449576", "0.6449576", "0.6449576...
0.75160503
0
def authorize_admin! moved to the application_controller.rb
def find_category @category = Category.find(params[:id]) rescue ActiveRecord::RecordNotFound flash[:alert] = "The category you were looking for could not be found." redirect_to categories_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_admin!\n authorize! :manage, :all\n end", "def authorize_admin!\n\t\tredirect_to new_admin_session_path unless current_admin\n\tend", "def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n ...
[ "0.8515709", "0.8243337", "0.8220527", "0.8193776", "0.81304234", "0.81297755", "0.8115923", "0.81037736", "0.8059716", "0.80376774", "0.80376774", "0.8033159", "0.80266744", "0.800083", "0.800083", "0.79551643", "0.7944633", "0.790711", "0.78918475", "0.7884879", "0.78638023...
0.0
-1
Check how many customers are going to watch a certain film
def find_number_of_customers sql = "SELECT customers.* FROM customers INNER JOIN tickets ON tickets.customer_id = customers.id WHERE film_id = $1" values = [@id] customers_array = SqlRunner.run(sql, values) customer_objects = customers_array.count return customer_objects end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_of_customers_watching_film()\n sql = \"SELECT COUNT(*) FROM customers INNER JOIN tickets ON customers.id = tickets.cust_id WHERE tickets.film_id = $1\"\n # sql = \"SELECT COUNT(*) FROM tickets where film_id = $1\"\n values = [@id]\n cust_count = SqlRunner.run(sql, values)\n return cust_cou...
[ "0.7794894", "0.70957434", "0.70247567", "0.67497456", "0.6717541", "0.67093766", "0.6619023", "0.6522943", "0.64883494", "0.6468304", "0.6445455", "0.63128936", "0.63000375", "0.6277315", "0.62704754", "0.6237113", "0.6143318", "0.610342", "0.6099987", "0.6081092", "0.603186...
0.67893517
3
speak method that will print "Ho, ho, ho! Haaaappy holidays!"
def speak puts "Ho, ho, ho! Haaaappy holidays!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak\n\t\t\tputs \"#{@name} said Ho, ho, ho! Haaaappy holidays!\"\n\t\tend", "def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\t\tputs \"\"\n\tend", "def speak\r\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\r\n\tend", "def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end", "def speak\...
[ "0.8913485", "0.88735366", "0.886438", "0.88444173", "0.88444173", "0.88426083", "0.88049465", "0.8800241", "0.8755356", "0.8687648", "0.8672491", "0.8610019", "0.8605874", "0.85283035", "0.8523174", "0.84836096", "0.8398543", "0.826154", "0.72503704", "0.7047539", "0.7021355...
0.89317626
2
eat_milk_and_cookies methodtakes a cookie type (example: "snickerdoodle") as a parameter and prints "That was a good !"
def eat_milk_and_cookies(cookie) puts "That was a good #{cookie} cookie!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eat_milk_and_cookies(cookie_type)\n puts \"that was a good #{cookie_type}!\"\n end", "def eat_milk_and_cookies(cookie_type)\n puts \"That was a good #{cookie_type} cookie!\"\n end", "def eat_milk_and_cookies(cookie_type)\r\n\t\tputs \"That was a good #{cookie_type}\"\r\n\tend", "def eat_milk_an...
[ "0.90104645", "0.8914423", "0.88889974", "0.8843581", "0.8667706", "0.8539303", "0.82648027", "0.81688815", "0.81081903", "0.8104923", "0.80679584", "0.7929066", "0.78308177", "0.7790069", "0.77713144", "0.77375907", "0.76591617", "0.7638699", "0.75196546", "0.7192431", "0.70...
0.8083686
10
GET /help_offers GET /help_offers.xml
def index @help_offers = @job_request.help_offers respond_to do |format| format.html # index.html.erb format.xml { render :xml => @help_offers } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @help_offer = HelpOffer.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_offer }\n end\n end", "def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticat...
[ "0.7353507", "0.71887404", "0.6827243", "0.6684004", "0.6613176", "0.6536255", "0.65061235", "0.6483202", "0.6443958", "0.6406321", "0.63508016", "0.62746173", "0.62746173", "0.62746173", "0.62746173", "0.6256585", "0.6256156", "0.62473404", "0.6231579", "0.6227351", "0.62242...
0.75306696
0
GET /help_offers/1 GET /help_offers/1.xml
def show @help_offer = HelpOffer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @help_offer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end", "def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.74026746", "0.6734518", "0.6648982", "0.65405214", "0.6539314", "0.6514852", "0.6514299", "0.6409339", "0.6353402", "0.63334846", "0.63303894", "0.6276926", "0.62537545", "0.6221384", "0.6220917", "0.6216229", "0.61455727", "0.6140602", "0.6137569", "0.6134753", "0.6124620...
0.7505168
0
GET /help_offers/new GET /help_offers/new.xml
def new @help_offer = @job_request.help_offers.build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @help_offer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n e...
[ "0.74450016", "0.72475255", "0.71911746", "0.7179016", "0.7130969", "0.7118919", "0.7101198", "0.7072075", "0.70415676", "0.69157916", "0.68849903", "0.68829316", "0.68829316", "0.68829316", "0.6875253", "0.6873888", "0.68587524", "0.68372023", "0.68245935", "0.6821307", "0.6...
0.72620726
1
POST /help_offers POST /help_offers.xml
def create @help_offer = @job_request.help_offers.build(params[:help_offer]) @help_offer.user = current_user respond_to do |format| if @help_offer.save flash[:notice] = 'Help Offer was submitted.' format.html { redirect_to(job_request_url(@job_request)) } format.xml { render :xml => @help_offer, :status => :created, :location => @help_offer } else format.html { render :action => "new" } format.xml { render :xml => @help_offer.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end", "def new\n @help_offer = @job_request.help_offers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @help_offer }\n end\n end", "def create_...
[ "0.68153745", "0.65514785", "0.63898456", "0.6315262", "0.6294513", "0.61922425", "0.6176346", "0.6169426", "0.6169426", "0.6144895", "0.61372346", "0.6112166", "0.6110679", "0.610906", "0.610274", "0.60936046", "0.6074937", "0.6074925", "0.5988498", "0.5977947", "0.5951662",...
0.656126
1
PUT /help_offers/1 PUT /help_offers/1.xml
def update @help_offer = HelpOffer.find(params[:id]) if @help_offer.user != current_user && @help_offer.job_request.user != current_user raise "You dont have permission to edit this help offer" end respond_to do |format| if @job_request.user == current_user #accepting offer @help_offer.accepted = true if @help_offer.update_attributes(params[:help_offer]) && @job_request.offered! #TODO send email to help offerer flash[:notice] = "Offer accepted, confirmation from #{@help_offer.user.name} required." format.html { redirect_to(job_request_url(@job_request)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @help_offer.errors, :status => :unprocessable_entity } end else if @help_offer.update_attributes(params[:help_offer]) flash[:notice] = 'HelpOffer was successfully updated.' format.html { redirect_to(job_request_url(@job_request)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @help_offer.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end", "def updateOffer()\n @offer_operation = :update\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||=...
[ "0.68809974", "0.6786649", "0.65002185", "0.648612", "0.648612", "0.6473508", "0.6473457", "0.6356743", "0.6352532", "0.6352387", "0.6294533", "0.6275752", "0.6251643", "0.6241829", "0.6241829", "0.6239832", "0.6201567", "0.61994845", "0.6183136", "0.6164906", "0.61623156", ...
0.5834701
36
DELETE /help_offers/1 DELETE /help_offers/1.xml
def destroy @help_offer = HelpOffer.find(params[:id]) if @help_offer.user != current_user raise 'Only users that create help offers can destroy them' end if @job_request.accepted_offer == @help_offer @job_request.status = 'open' @job_request.save! end @help_offer.destroy flash[:notice] = "Your help offer has been removed." respond_to do |format| format.html { redirect_to(job_request_url(@job_request)) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @voucher_offer = VoucherOffer.find(params[:id])\n @voucher_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to(voucher_offers_url) }\n format.xml { head :ok }\n end...
[ "0.6665935", "0.6614053", "0.6556441", "0.6553204", "0.65302527", "0.6504326", "0.64642495", "0.6421738", "0.640071", "0.63902247", "0.6387391", "0.6357924", "0.634052", "0.6331929", "0.63229895", "0.6311654", "0.63091135", "0.63044333", "0.62851113", "0.6276473", "0.62751585...
0.62715256
23
Returns the result of the get operation
def get(url) private_get(url) Fiber.yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n execute(:get)\n end", "def get\n execute(:get)\n end", "def get\n execute(:get).to_s\n end", "def get(key)\n\n # FIXME: insert code that connects to the backend and affects the get\n # operation\n #\n # - If possible, this get should be done atomically\n #...
[ "0.78878057", "0.78878057", "0.7808642", "0.7428613", "0.69331926", "0.69275045", "0.69275045", "0.6909106", "0.6895932", "0.68577737", "0.6807275", "0.67328674", "0.67328674", "0.67231333", "0.67056185", "0.6705038", "0.6701849", "0.66738975", "0.66729003", "0.6663837", "0.6...
0.0
-1
Returns the hrefs of all links matching the given css attribute (don't forget the a selector !)
def linked_hrefs(css_selector, strip_spaces = true) lnks = css(css_selector) ret = [] for l in lnks if l['href'] url = l['href'] if strip_spaces url.gsub!(/\s/,'') end ret << normalize_url(url) end end return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def links\n @doc.css('a[href]').map do |a|\n parse_element_attribute_uri(a, 'href')\n end.compact.uniq\n end", "def href_parse\n href_elems = @parsed_page.css('a[href]')\n href_elems.map do |elem|\n elem.attributes['href'].value\n end\n end", "def href_parser(selector_attr, attrb)\n ...
[ "0.755724", "0.69653106", "0.68248546", "0.6805061", "0.66520023", "0.6606846", "0.6573507", "0.6469958", "0.64444256", "0.64281535", "0.64194435", "0.6322513", "0.63181245", "0.63096416", "0.62351394", "0.6229713", "0.6218495", "0.61730546", "0.61684823", "0.60782427", "0.60...
0.72517
1
GET /group_comments GET /group_comments.json
def index @group_comments = GroupComment.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @group_comments = GroupComment.all\n\n render json: @group_comments\n end", "def show\n render json: @group_comment\n end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list...
[ "0.78691083", "0.75575876", "0.7219774", "0.67327315", "0.67327315", "0.66567445", "0.6612792", "0.6608286", "0.6593954", "0.65640074", "0.65195", "0.6500414", "0.63990015", "0.63872886", "0.63727844", "0.63663155", "0.63621545", "0.6339159", "0.63308865", "0.63188297", "0.62...
0.72937405
2
GET /group_comments/1 GET /group_comments/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @group_comments = GroupComment.all\n\n render json: @group_comments\n end", "def show\n render json: @group_comment\n end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def index\n @group_comments = GroupComment.all\n end", "def show\n @comments_open_group_...
[ "0.76471514", "0.75349224", "0.72888666", "0.7225389", "0.68266976", "0.66935647", "0.6645439", "0.6645439", "0.6599492", "0.65860945", "0.65777653", "0.65206116", "0.6497984", "0.64764535", "0.64731354", "0.64413047", "0.6438477", "0.63444054", "0.63395834", "0.6337236", "0....
0.0
-1
POST /group_comments POST /group_comments.json
def create @group_comment = GroupComment.new(group_comment_params) respond_to do |format| if @group_comment.save format.html { redirect_to @group_comment, notice: 'Group comment was successfully created.' } format.json { render :show, status: :created, location: @group_comment } else format.html { render :new } format.json { render json: @group_comment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @group_comment = GroupComment.new(group_comment_params)\n\n if @group_comment.save\n render json: @group_comment, status: :created, location: @group_comment\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end", "def comment\n\t\t# Get the gro...
[ "0.7966938", "0.71134216", "0.70881176", "0.65414613", "0.6518584", "0.6468242", "0.64558345", "0.6336049", "0.6322477", "0.6322477", "0.62954056", "0.6287795", "0.62663126", "0.6227368", "0.6211254", "0.62031484", "0.6141405", "0.6120739", "0.6106294", "0.60928917", "0.60604...
0.75627595
1
PATCH/PUT /group_comments/1 PATCH/PUT /group_comments/1.json
def update respond_to do |format| if @group_comment.update(group_comment_params) format.html { redirect_to @group_comment, notice: 'Group comment was successfully updated.' } format.json { render :show, status: :ok, location: @group_comment } else format.html { render :edit } format.json { render json: @group_comment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end", "def update\n @my_group_comment = My::GroupComment.find(params[:id]...
[ "0.76894987", "0.7173845", "0.66449296", "0.6632936", "0.66221356", "0.6577847", "0.65027326", "0.6451958", "0.6449836", "0.64098847", "0.63980967", "0.63843966", "0.6376269", "0.636317", "0.63501906", "0.6314264", "0.6288119", "0.6282557", "0.6282378", "0.6282378", "0.623929...
0.7321224
1
DELETE /group_comments/1 DELETE /group_comments/1.json
def destroy @group_comment.destroy respond_to do |format| format.html { redirect_to group_comments_url, notice: 'Group comment was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @group_comment.destroy\n\n head :no_content\n end", "def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end"...
[ "0.77216685", "0.75853777", "0.7110435", "0.6995834", "0.6971399", "0.68888915", "0.6877323", "0.6877323", "0.6854101", "0.68328667", "0.68066293", "0.67974323", "0.6779638", "0.6766686", "0.6745163", "0.67264277", "0.6723388", "0.66722554", "0.66646594", "0.664582", "0.66454...
0.7408694
2
Use callbacks to share common setup or constraints between actions.
def set_group_comment @group_comment = GroupComment.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def group_comment_params params.require(:group_comment).permit(:body, :user_id, :group_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
event firing when document processing(transformation) is done
def doc_transformed(root) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process!(document); end", "def on_end_document\n end", "def after_processing\n end", "def post_process; end", "def after_processing_hook; end", "def post_process(doc)\n doc\n end", "def post_process\n end", "def on_end_document\n STDOUT << \"on_end_document\\n\"\n ...
[ "0.7037438", "0.6864252", "0.67200506", "0.6669725", "0.66413105", "0.660063", "0.6589206", "0.62968963", "0.62178844", "0.6135454", "0.60652685", "0.6048961", "0.603383", "0.59540254", "0.5935851", "0.5907491", "0.5879274", "0.58672494", "0.58672494", "0.58188516", "0.581801...
0.5643243
41
Builds the enum from string
def build_from_hash(value) constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value } raise "Invalid ENUM value #{value} for class #AnnotationType" if constantValues.empty? value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = NewOrResale....
[ "0.66046983", "0.6548398", "0.65373033", "0.6528928", "0.64598405", "0.6446511", "0.64443517", "0.6443306", "0.6406087", "0.6405894", "0.6379518", "0.6374375", "0.6367104", "0.6359485", "0.6346857", "0.63404876", "0.6319777", "0.63088304", "0.6306753", "0.63046414", "0.630464...
0.63550735
14