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 |
|---|---|---|---|---|---|---|
add_new_client(client_hash) prompts for new client information, adds to client_hash, then returns the updated hash. Also updates the clients.json file | def add_new_client(client_hash)
prompt = TTY::Prompt.new(symbols: {marker: ">"})
totalclients = client_hash[:clients].length
system('clear')
Debug.show("Debug ON")
puts "Create new client: \n\n\n"
name = prompt.ask("Name:") do |q|
q.validate(/^[\w ]+$/)
q.messages[:valid?] = "Inv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_client(new_client)\n output_strings = []\n if @clients[new_client.name.to_sym].nil?\n @clients[new_client.name.to_sym] = new_client\n output_strings << \"New client #{new_client.name} added.\"\n else\n output_strings << \"That client already exists. Not adding again.\"\n end\n e... | [
"0.69799507",
"0.65547836",
"0.65053415",
"0.6395103",
"0.6298468",
"0.62344766",
"0.6218407",
"0.6095143",
"0.5967004",
"0.58639014",
"0.5789714",
"0.5739492",
"0.5694084",
"0.5548911",
"0.55179197",
"0.5503776",
"0.5503776",
"0.550269",
"0.5466857",
"0.5460222",
"0.54471946... | 0.7650266 | 0 |
searches the client hash to match a string input from the user, then goes to clientselect menu | def clientsearch(client_hash,username)
prompt = TTY::Prompt.new(symbols: {marker: ">"})
input = ""
while input != "Exit"
system('clear')
Debug.show("Debug ON")
input = prompt.select("Client lookup\n\n\n",["Fulltext search","ID search","Exit"])
string = nil
if input ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu(companyname=\"Unknown\",username=\"Unknown\",client_hash)\n prompt = TTY::Prompt.new(symbols: {marker: \">\"})\n input = \"\"\n while input != \"Exit\"\n system('clear')\n Debug.show \"Debug ON\\ninput: #{input} | company_name: #{companyname} | username: #{username}\"\n ... | [
"0.6759327",
"0.6324657",
"0.5992985",
"0.59792423",
"0.597182",
"0.59325135",
"0.59264416",
"0.59149677",
"0.58898187",
"0.58865523",
"0.58832717",
"0.58218354",
"0.5807176",
"0.57887733",
"0.57650787",
"0.57365936",
"0.57117605",
"0.5711046",
"0.56862634",
"0.5668969",
"0.5... | 0.6830015 | 0 |
prints all invoices matching client ID | def view_invoices(id)
prompt = TTY::Prompt.new(symbols: {marker: ">"})
invoices = get_invoices()
invoice_match = invoices[:invoices].filter {|invoice| invoice[:clientid] == id}
if invoice_match.length == 0
return "No invoices on this account ID #{id}".colorize(:yellow)
else
input = "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_invoices(client_id, filter=Invoicexpress::Models::Filter.new, options={})\n raise(ArgumentError, \"filter has the wrong type\") unless filter.is_a?(Invoicexpress::Models::Filter)\n\n params = {\n :klass => Invoicexpress::Models::ClientInvoices,\n :per_page => 10,\n ... | [
"0.7460041",
"0.69941694",
"0.69087714",
"0.68493855",
"0.6661306",
"0.66494256",
"0.6632401",
"0.6574041",
"0.6473098",
"0.6442673",
"0.6439469",
"0.6430153",
"0.6423314",
"0.6418882",
"0.64145905",
"0.63945657",
"0.63620704",
"0.6357455",
"0.6357455",
"0.6357455",
"0.635745... | 0.6563154 | 8 |
Construct an XML fragment representing the assertion id request | def to_xml(xml=Builder::XmlMarkup.new)
xml.tag!('samlp:AssertionIDRequest') {
assertion_id_refs.each { |assertion_id_ref| xml << assertion_id_ref.to_xml }
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n a... | [
"0.61706084",
"0.61599076",
"0.6087966",
"0.6059848",
"0.5905357",
"0.5904865",
"0.5864847",
"0.58290994",
"0.5776716",
"0.56429183",
"0.5626103",
"0.5585975",
"0.55723405",
"0.5566708",
"0.5516159",
"0.54650563",
"0.5462001",
"0.5462001",
"0.5454173",
"0.544742",
"0.54470307... | 0.7901732 | 0 |
symbols_for() returns an array of symbols, one for each name in a group returns an array of the input symbol if not a group | def symbols_for( symbol )
return @group_members.member?(symbol.name) ? @group_members[symbol.name] : [symbol]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbols\n each_symbol.to_a\n end",
"def to_sym_arr\n @by_symbol.keys\n end",
"def symbols() @symbols end",
"def each() @symbols.each {|s| yield s if block_given? } end",
"def get_symbols\n\t\treturn @symbols\n\tend",
"def symbols\n @symbol_set.symbols\n end",
"de... | [
"0.65819234",
"0.62139195",
"0.62100434",
"0.6100269",
"0.606925",
"0.5971053",
"0.591074",
"0.5895718",
"0.57150704",
"0.5707035",
"0.56902176",
"0.5631679",
"0.5603679",
"0.5585194",
"0.55822146",
"0.5581193",
"0.55746925",
"0.5570102",
"0.55147666",
"0.54776484",
"0.546128... | 0.8255681 | 0 |
syntactic_determinants_for() given a syntactic production name, returns a list of token symbols that can start it | def syntactic_determinants_for( symbols, into = nil, trail_marker = nil )
if symbols.is_an?(Array) then
trail_marker = Util::TrailMarker.new() if trail_marker.nil?
determinants = into.nil? ? {} : into
symbols.each do |symbol|
syntactic_determinant... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lexical_determinants_for( symbols, visited = {} )\n if symbols.is_an?(Array) then\n determinants = CharacterRange.new()\n symbols.each do |symbol|\n determinants.add( lexical_determinants_for(symbol) )\n end\n return determinants\n \n... | [
"0.6983176",
"0.52609754",
"0.51561874",
"0.50732535",
"0.5068226",
"0.5001423",
"0.49060056",
"0.4905483",
"0.48939398",
"0.48845258",
"0.48724672",
"0.48724097",
"0.48724097",
"0.48143458",
"0.47996315",
"0.47958252",
"0.47951737",
"0.478103",
"0.47741196",
"0.47638944",
"0... | 0.6365912 | 1 |
lexical_determinants_for() given a lexical production name, returns a CharacterRange of codes that can start it | def lexical_determinants_for( symbols, visited = {} )
if symbols.is_an?(Array) then
determinants = CharacterRange.new()
symbols.each do |symbol|
determinants.add( lexical_determinants_for(symbol) )
end
return determinants
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_lowercase_from_to(_production, _range, _tokens, theChildren)\n raw_range = [theChildren[2].token.lexeme, theChildren[4].token.lexeme]\n range_sorted = raw_range.sort\n ch_range = char_range(range_sorted[0], range_sorted[1])\n char_class(false, ch_range)\n end",
"def reduce_any_l... | [
"0.56431746",
"0.5321983",
"0.5181111",
"0.51556695",
"0.5087949",
"0.5080007",
"0.5034374",
"0.49998444",
"0.49993026",
"0.49961925",
"0.4989283",
"0.4929375",
"0.49053985",
"0.49018884",
"0.48989484",
"0.48989484",
"0.48989484",
"0.48772302",
"0.48247",
"0.48078308",
"0.476... | 0.65678203 | 0 |
Operations compile_parser_plan() generates a ParserPlan for a specific start rule | def compile_parser_plan( name )
case name
when Model::Markers::Reference, Plan::Symbol
name = name.name
end
assert( @production_sets.member?(name), "not a valid start rule name" )
state_table = StateTable.build( self, name )
return ParserPlan.new( self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_plan()\n return Plan::ParserPlan.build( self )\n end",
"def to_PLParser(startSym)\n\n thePLP = TextRect.new\n\n @ntIndex.each do |nt, s|\n\n theNT = TextRect.new(\"#{nt.name} ::= \")\n before = ' '\n\n s[:rules].each do |i|\n rhs = @ruleTable[i][:rule].rhs\n... | [
"0.72693294",
"0.57516396",
"0.5487987",
"0.5416214",
"0.53655916",
"0.53655916",
"0.53655916",
"0.53655916",
"0.5356571",
"0.52816594",
"0.52816594",
"0.52816594",
"0.52816594",
"0.526989",
"0.52506024",
"0.52485204",
"0.5246364",
"0.5225648",
"0.5221498",
"0.52035743",
"0.5... | 0.7557306 | 0 |
PAGE BLOCK / UNBLOCK | def unblock!
BlockedObject.unblock_page!(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_block\n block = params[:block].to_s.underscore\n @user = User.current\n # remove block in all groups\n layout = @user.pref[:my_page_layout] || {}\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n redirect_t... | [
"0.68944937",
"0.68944937",
"0.6604916",
"0.62867475",
"0.6128054",
"0.60872334",
"0.59948605",
"0.5919669",
"0.5906602",
"0.58931273",
"0.5814955",
"0.5722318",
"0.5694024",
"0.562722",
"0.5619188",
"0.5578735",
"0.5554629",
"0.5541825",
"0.5530828",
"0.55217445",
"0.5509632... | 0.7843868 | 0 |
Use callbacks to share common setup or constraints between actions. | def find_doccredit
@documentary_credit = DocumentaryCredit.find(params[:documentary_credit_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def document_params
params.require(:document).permit(:description, :currency, :amount, :documents_date, :shipment_date, :shipment_from, :port_of_loading, :port_of_discharge, :final_destination, :incoterm, :goods, :remarks, :tenor, :consignee_name, :consignee_address1, :consignee_address2, :consignee_address3, :sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7122858",
"0.70540553",
"0.69476545",
"0.6902004",
"0.6735809",
"0.671776",
"0.668886",
"0.66776645",
"0.66611695",
"0.6555913",
"0.6527077",
"0.64584446",
"0.64516115",
"0.64500964",
"0.64474493",
"0.6435065",
"0.6413185",
"0.6413185",
"0.6391701",
"0.6380101",
"0.6380101... | 0.0 | -1 |
GET /invites GET /invites.json | def index
@invites = Invite.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @invites }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end",
"def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n ... | [
"0.7959769",
"0.7742536",
"0.76677245",
"0.76677245",
"0.76677245",
"0.76677245",
"0.76677245",
"0.76200795",
"0.7490277",
"0.7401339",
"0.72609353",
"0.7259135",
"0.72381604",
"0.7088142",
"0.70818603",
"0.7015903",
"0.700781",
"0.7004371",
"0.69964284",
"0.69862264",
"0.685... | 0.79404175 | 2 |
GET /invites/1 GET /invites/1.json | def show
@invite = Invite.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @invite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites ... | [
"0.7688263",
"0.7688263",
"0.7688263",
"0.74287134",
"0.73801136",
"0.73801136",
"0.73801136",
"0.73801136",
"0.73801136",
"0.7367896",
"0.7329601",
"0.70713496",
"0.7045998",
"0.699091",
"0.69735",
"0.695193",
"0.6947367",
"0.69188094",
"0.6821972",
"0.674742",
"0.6738955",
... | 0.7069864 | 13 |
GET /invites/new GET /invites/new.json | def new
@invite = Invite.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @invite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end",
"def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render... | [
"0.7493549",
"0.7443391",
"0.71866524",
"0.70564896",
"0.7012656",
"0.6996705",
"0.6996705",
"0.69863653",
"0.69833046",
"0.6968096",
"0.69313127",
"0.6828738",
"0.6754267",
"0.6735638",
"0.6729011",
"0.67265517",
"0.66909343",
"0.6641987",
"0.6636304",
"0.6627488",
"0.662025... | 0.77566123 | 1 |
POST /invites POST /invites.json | def create
@user = User.find_by_uid(params[:uid])
if (@user.nil?)
@user = User.new
@user['uid'] = params[:uid]
@user['provider'] = 'facebook'
@user['name'] = params[:name]
@user.save
end
if (Invite.find_by_plan_id_and_user_id(params[:plan_id], @user.id).nil?)
@inv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@ema... | [
"0.69836557",
"0.68339646",
"0.6658787",
"0.6656012",
"0.66232026",
"0.6613374",
"0.6608064",
"0.66002876",
"0.66002876",
"0.66002876",
"0.6584541",
"0.6574404",
"0.65533906",
"0.65394384",
"0.650337",
"0.6476115",
"0.6453246",
"0.64286774",
"0.64260733",
"0.642091",
"0.64209... | 0.0 | -1 |
PUT /invites/1 PUT /invites/1.json | def update
@invite = Invite.find(params[:id])
respond_to do |format|
if @invite.update_attributes(params[:invite])
format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user... | [
"0.67971087",
"0.6618287",
"0.65161586",
"0.6390445",
"0.6334604",
"0.63328683",
"0.63240236",
"0.631525",
"0.62761694",
"0.62655914",
"0.6194846",
"0.6194846",
"0.6194846",
"0.6194846",
"0.61786485",
"0.61532885",
"0.61532885",
"0.6117154",
"0.6110349",
"0.6110349",
"0.61103... | 0.6579294 | 4 |
DELETE /invites/1 DELETE /invites/1.json | def destroy
@invite = Invite.find(params[:id])
@invite.destroy
respond_to do |format|
format.html { redirect_to invites_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to(invites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url }\n ... | [
"0.7457771",
"0.7420519",
"0.7420519",
"0.72055924",
"0.7199649",
"0.7199649",
"0.7199649",
"0.7199649",
"0.7193738",
"0.71763223",
"0.7166482",
"0.7079448",
"0.70431536",
"0.70200104",
"0.6986385",
"0.6942255",
"0.6895627",
"0.6848635",
"0.6829932",
"0.6790051",
"0.6718232",... | 0.7668476 | 3 |
log a message, and increment future messages in this thread. useful for nesting logic | def log_incr(*args)
log(*args) unless args.empty?
@log_indents[Thread.current] += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment\n @attempt += 1\n log\n end",
"def updated(message)\n @count += 1\n @out.puts \"#{@count}/#{@total}: #{message}\"\n end",
"def updated(message)\n @count += 1\n @out.print \".\"\n @out.flush\n end",
"def act(user_id, msg)\r\n # check if it's double\... | [
"0.65136504",
"0.6327033",
"0.6314633",
"0.5977783",
"0.5883685",
"0.5883685",
"0.5855488",
"0.5843392",
"0.5843274",
"0.5843274",
"0.5842695",
"0.5828528",
"0.5821041",
"0.5753555",
"0.5752149",
"0.56461215",
"0.5638304",
"0.56194335",
"0.558727",
"0.5581589",
"0.5572643",
... | 0.671669 | 0 |
close the logical block, and (optionally) log | def log_decr(*args)
@log_indents[Thread.current] -= 1\
if @log_indents[Thread.current] > 0
log(*args) unless args.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n flush\n @log.close if @log.respond_to?(:close) && !@log.tty?\n @log = nil\n end",
"def close( &block )\n compile!( :close!, &block )\n end",
"def close\n checkpoint\n @logfile.close\n end",
"def close() end",
"def close() end",
"def close()... | [
"0.6679224",
"0.66725653",
"0.65911025",
"0.65641767",
"0.65641767",
"0.65641767",
"0.65641767",
"0.65612316",
"0.6505269",
"0.6492085",
"0.64888525",
"0.6470666",
"0.6470666",
"0.64085066",
"0.64085066",
"0.640207",
"0.640207",
"0.6369778",
"0.630416",
"0.62928706",
"0.62420... | 0.0 | -1 |
the last message in a logical block | def log_then_decr(*args)
log(*args)
log_decr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_message\r\n @messages.fetch(self.count_messages - 1)\r\n end",
"def last_message \n messages.last\n end",
"def last_block\n\t\t(self.track_count*8)-1\n\tend",
"def receive_last\n\n wrap('ret' => Flor.type(@node['ret']).to_s)\n end",
"def last_block?\n return @last_block\n... | [
"0.7076223",
"0.6946903",
"0.685687",
"0.67307407",
"0.66529876",
"0.66513914",
"0.65659124",
"0.65659124",
"0.6544465",
"0.6500039",
"0.64759725",
"0.64757425",
"0.64757425",
"0.64757425",
"0.64757425",
"0.64757425",
"0.64757425",
"0.64757425",
"0.6463573",
"0.6438773",
"0.6... | 0.0 | -1 |
GET /heading_bg_images GET /heading_bg_images.json | def index
@heading_bg_images = HeadingBgImage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end",
"def index\n @admin_bg_images = BgImage.all\n end",
"def set_heading_bg_image\n @heading_bg_image = HeadingBgImage.find(... | [
"0.6790276",
"0.6626622",
"0.6578999",
"0.6426558",
"0.6372974",
"0.62523603",
"0.6239958",
"0.62089497",
"0.6175802",
"0.61658424",
"0.61657625",
"0.615235",
"0.61382",
"0.61350834",
"0.6124343",
"0.609146",
"0.6050378",
"0.60362095",
"0.603073",
"0.6007625",
"0.5997535",
... | 0.77676207 | 0 |
GET /heading_bg_images/1 GET /heading_bg_images/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @heading_bg_images = HeadingBgImage.all\n end",
"def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end",
"def set_heading_bg_image\n @heading_bg_image = HeadingBgIm... | [
"0.74470675",
"0.7115792",
"0.65705925",
"0.64297235",
"0.6429603",
"0.6423409",
"0.6405757",
"0.637211",
"0.63674724",
"0.63315374",
"0.6312085",
"0.6267603",
"0.62554383",
"0.6235422",
"0.6222349",
"0.6197766",
"0.619669",
"0.6174919",
"0.6158557",
"0.6139819",
"0.6139061",... | 0.0 | -1 |
POST /heading_bg_images POST /heading_bg_images.json | def create
@heading_bg_image = HeadingBgImage.new(heading_bg_image_params)
respond_to do |format|
if @heading_bg_image.save
format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully created.' }
format.json { render :show, status: :created, location: @heading_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heading_bg_image_params\n params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_id)\n end",
"def create\n @bgimage = Bgimage.new(params[:bgimage])\n\n respond_to do |format|\n if @bgimage.save\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successf... | [
"0.7049247",
"0.6899239",
"0.669983",
"0.6676121",
"0.6632883",
"0.64705336",
"0.6375366",
"0.6182906",
"0.6119136",
"0.60856164",
"0.6063008",
"0.6038866",
"0.59725153",
"0.5958938",
"0.5747429",
"0.5580354",
"0.5564568",
"0.5524865",
"0.5522614",
"0.55215967",
"0.5515622",
... | 0.7398027 | 0 |
PATCH/PUT /heading_bg_images/1 PATCH/PUT /heading_bg_images/1.json | def update
respond_to do |format|
if @heading_bg_image.update(heading_bg_image_params)
format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully updated.' }
format.json { render :show, status: :ok, location: @heading_bg_image }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n if @bgimage.update_attributes(params[:bgimage])\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render... | [
"0.7140328",
"0.6984076",
"0.65215087",
"0.6396768",
"0.62812066",
"0.62448156",
"0.62393636",
"0.61540604",
"0.608948",
"0.60528225",
"0.59571034",
"0.5954023",
"0.5947635",
"0.5944986",
"0.5939279",
"0.59181815",
"0.5906304",
"0.59062713",
"0.5894343",
"0.5874175",
"0.58734... | 0.7552205 | 0 |
DELETE /heading_bg_images/1 DELETE /heading_bg_images/1.json | def destroy
@heading_bg_image.destroy
respond_to do |format|
format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_bg_image.destroy\n respond_to do |format|\n format.html { redirect_t... | [
"0.7598086",
"0.7362263",
"0.7010724",
"0.6887027",
"0.6883116",
"0.68821466",
"0.673138",
"0.67213213",
"0.6695897",
"0.66865927",
"0.6625925",
"0.6621367",
"0.661563",
"0.6603099",
"0.6593489",
"0.65894014",
"0.65531045",
"0.6537283",
"0.6532978",
"0.6526688",
"0.6518221",
... | 0.7694713 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_heading_bg_image
@heading_bg_image = HeadingBgImage.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 heading_bg_image_params
params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
do for all paginated pages in particular category | def all_pages(list_page_url)
max_page_count = get_max_page_count(list_page_url)
puts "max_page_count: #{max_page_count}"
(1..max_page_count).each do |page_num|
begin
puts "Crawling page ##{page_num} of #{max_page_count}"
page = get_page(list_page_url, page_num)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n@categories = Category.paginate(page: params[:page], per_page: 5) #list all categories, with pagination\nend",
"def index\n @categories = Category.paginate(page: params[:page], per_page: 5)\n end",
"def index\n @categories = Category.paginate(:page => params[:page], :per_page => 10)\n end",... | [
"0.7455122",
"0.7313033",
"0.7235396",
"0.70560974",
"0.69715595",
"0.695745",
"0.6879415",
"0.6841381",
"0.68185544",
"0.68185544",
"0.68185544",
"0.68185544",
"0.6810872",
"0.67405134",
"0.6706144",
"0.6688571",
"0.6673065",
"0.66178083",
"0.6616867",
"0.6575179",
"0.655359... | 0.0 | -1 |
do for company list pages for each category | def all_list_page_urls
LIST_PAGE_URLS.each_with_index do |list_page_url, i|
begin
puts "-- Crawling #{list_page_url} (#{i + 1} of #{LIST_PAGE_URLS.count}) --"
yield(list_page_url)
rescue => e
puts "Failed to crawl list_page_url:#{e.message}"; next
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_products_categories\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Product categories\"\n \n if(@company.can_view(current_user))\n @products_categories = ProductsCategory.where(company_id: @company.id).paginate(:page => params[:page])\n else\n e... | [
"0.734375",
"0.6995736",
"0.6966665",
"0.6959313",
"0.6819947",
"0.66477656",
"0.66477656",
"0.66477656",
"0.66477656",
"0.6521306",
"0.64818853",
"0.6464777",
"0.6423017",
"0.6418467",
"0.638049",
"0.6349131",
"0.6339463",
"0.6338715",
"0.63326764",
"0.63326764",
"0.63326764... | 0.0 | -1 |
Create a new instance of the serviceclass. | def initialize
super("ssh-userauth")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @service = Service.new\n end",
"def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end",
"def instantiate_service\n @service = ContestService.new\n end",
"def create\n super(@@service)\n end",
"def instanti... | [
"0.813433",
"0.8106599",
"0.74702615",
"0.7342044",
"0.71809626",
"0.7008772",
"0.6948667",
"0.6891608",
"0.6887791",
"0.6887791",
"0.67984176",
"0.6784219",
"0.6761309",
"0.66824305",
"0.6647162",
"0.6631954",
"0.6617591",
"0.65732557",
"0.6518413",
"0.6518413",
"0.6510791",... | 0.0 | -1 |
Assign a callback to enable _password authentication_. As soon as an callback is assigned here, _password authentication_ is enabled for the service. The assigned `Proc`instance will get two arguments: 1. The username of the authentication request, 2. The password received from the client. The return value of the callb... | def password(&blk)
@authentication_methods ||= {}
@authentication_methods[:password] = blk
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate(request, realm, &password_procedure); end",
"def login_with_username username, password, callback\n\t\t\t@method_callbacks['login'] = callback\n\t\t\t@auth_client = SRP::Client.new\n\t\t\t@username = username\n\t\t\t@password = password\n\t\t\t\n\n\t\t\ta = @auth_client.start_authentication()\n\... | [
"0.678788",
"0.65130705",
"0.63509667",
"0.6343934",
"0.62818825",
"0.6265266",
"0.6260336",
"0.6154966",
"0.6154966",
"0.61415225",
"0.60966676",
"0.6053996",
"0.60286903",
"0.59829164",
"0.59793717",
"0.5945088",
"0.5945088",
"0.5907736",
"0.58849216",
"0.587753",
"0.582972... | 0.6806943 | 0 |
Included methods, info "something" | def fatal(*args, &block)
Log.fatal(*args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info; end",
"def info; end",
"def my_info\r\n end",
"def info\n puts 'Info'\n end",
"def info\n\tend",
"def display_method_info\n end",
"def get_info\n end",
"def get_info\n end",
"def get_info\n end",
"def info()\n #This is a stub, used for indexing\n end",
"... | [
"0.74552923",
"0.74552923",
"0.71124506",
"0.710758",
"0.6977473",
"0.6709184",
"0.6665955",
"0.6665955",
"0.6665955",
"0.6649786",
"0.66243404",
"0.6616635",
"0.6520083",
"0.64937305",
"0.648558",
"0.645028",
"0.645028",
"0.6434832",
"0.6393445",
"0.6344164",
"0.63312745",
... | 0.0 | -1 |
Test +has_content+ method to return false if a post have no content | def test_has_content
assert(!@contentless_post.has_content?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_content?\n !content.nil?\n end",
"def has_content?\n ( not self.title.nil? and not self.title.length == 0 ) or \n (not self.description.nil? and not self.description.length == 0 ) or \n (not self.teaser.nil? and not self.teaser.length == 0 )\n end",
"def content?\n !content... | [
"0.86837167",
"0.8039077",
"0.79284716",
"0.7381666",
"0.7365182",
"0.73450917",
"0.7279623",
"0.72548395",
"0.72285765",
"0.71555996",
"0.7096712",
"0.7013007",
"0.6975677",
"0.6899152",
"0.68618256",
"0.6848791",
"0.6807338",
"0.68008524",
"0.68008524",
"0.67762303",
"0.677... | 0.8497628 | 1 |
Test if we can add a post | def test_add_post
c = Post.count
Post.create(:title => @normal_post.title, :content => @normal_post.content)
assert_equal(c + 1, Post.count)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_request?(post)\n post[:post_id] != posts\n end",
"def post?\n false\n end",
"def can_manage_post\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:manage, @post)\n true\n end",
"def posted?\n post.present?\n end",
"def check_for_posts\n ... | [
"0.73170227",
"0.7270087",
"0.7250163",
"0.71660525",
"0.71120405",
"0.7099603",
"0.69570595",
"0.67883915",
"0.67574406",
"0.6746768",
"0.6736897",
"0.6647308",
"0.66458845",
"0.6602758",
"0.64949626",
"0.64761287",
"0.64258635",
"0.63795084",
"0.6350008",
"0.6336586",
"0.63... | 0.5777686 | 90 |
Test if we can add a comment to a post | def test_add_comment_to_post
nc = @normal_post.number_of_comments
@normal_post.comments << @comment
assert_equal(nc + 1, @normal_post.number_of_comments)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_create_comment?(post); true; end",
"def can_have_comments?\n self.post?\n end",
"def is_comment_creation?\n request.post? && request.request_parameters['comment'].present?\n end",
"def check_add_comment_access\r\n return true if logged_in?\r\n return false\r\n end",
"def comment?\n ... | [
"0.8473132",
"0.78050846",
"0.7210564",
"0.7093226",
"0.6989414",
"0.6951286",
"0.6887808",
"0.6841043",
"0.6840276",
"0.6768204",
"0.6732097",
"0.67305493",
"0.67109066",
"0.6699442",
"0.66292524",
"0.66136503",
"0.66127545",
"0.66127545",
"0.6601555",
"0.65573275",
"0.65447... | 0.69220555 | 6 |
Test if the order is correct (from newest to oldest) | def test_ordered
posts = Post.all
assert_equal(Post.ordered, posts.sort {|a,b| b.created_at <=> a.created_at})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_ordering?(proposed_ordering)\n question_assessments_hash.keys.sort == proposed_ordering.sort\n end",
"def valid_ordering?(proposed_ordering)\n question_assessments_hash.keys.sort == proposed_ordering.sort\n end",
"def check_order\n return if order.present? && Faq.where(order: order).where.... | [
"0.67181987",
"0.67181987",
"0.6708488",
"0.6614307",
"0.6552122",
"0.6551697",
"0.65345234",
"0.6495333",
"0.6454099",
"0.6394244",
"0.638909",
"0.63826233",
"0.63441443",
"0.63337606",
"0.63058877",
"0.6280503",
"0.6225544",
"0.6156251",
"0.61195153",
"0.61118865",
"0.61118... | 0.5854435 | 41 |
Scarica dal sito FTP il file associato al tipo di flusso Parameters : file => "MGP_Prezzi" (Tipo di flusso che deve scaricate) Return : "K:/.../esiti_xml/20141009/20141010MGPPrezzi.xml" (path del flusso scaricato) | def download_file(file)
#name_file = "20141010MGPPrezzi.xml"
name_file = parse_name_file file
path_xml = crea_dir_per_xml
full_path = path_xml+name_file
#entro dentro la directory nel server ftp
@ftp.chdir("/MercatiElettrici/#{file}")
#scarico nella directory corren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_name_file file\r\n #name_file = \"#{@giorno_flusso}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".xml\" \r\n name_file = case file\r\n when /OffertePubbliche/ then \"#{@giorno}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".zip\" \r\n when /MGP/ then \"#{@giorno}\" + \"... | [
"0.5706662",
"0.5615323",
"0.54685116",
"0.54543585",
"0.53751504",
"0.5345411",
"0.5313451",
"0.5194258",
"0.5150226",
"0.5145376",
"0.5145376",
"0.5145376",
"0.5145376",
"0.5143473",
"0.51386917",
"0.5077058",
"0.5052922",
"0.5045206",
"0.5037909",
"0.50337553",
"0.5001857"... | 0.68472946 | 0 |
Chiude la connesione FTP Parameters : nil Return : nil | def close_connection
@ftp.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_ftp\n require \"net/ftp\"\n require 'timeout'\n result = true\n \n if @connection.nil? then\n host = @config['ftp']['host_address']\n username = @config['ftp']['username']\n password = @config['ftp']['password']\n @connection = Net::FTP.new\n ... | [
"0.6680768",
"0.65361094",
"0.64885414",
"0.6263674",
"0.62524533",
"0.6233291",
"0.62327033",
"0.6221403",
"0.61966604",
"0.61561334",
"0.613992",
"0.60499626",
"0.600968",
"0.5957385",
"0.589155",
"0.5890658",
"0.5853896",
"0.5825947",
"0.58177894",
"0.5656974",
"0.56547713... | 0.55499136 | 25 |
Fa il parse dal tipo di flusso, mi crea il nome del file da scaricare Parameters : file => "MGP_Prezzi" (Tipo di flusso che deve scaricate) Return : "20141010MGPPrezzi.xml" (nome del file da scaricare) | def parse_name_file file
#name_file = "#{@giorno_flusso}" + "#{file.gsub "MGP_","MGP"}" + ".xml"
name_file = case file
when /OffertePubbliche/ then "#{@giorno}" + "#{file.gsub "MGP_","MGP"}" + ".zip"
when /MGP/ then "#{@giorno}" + "#{file.gsub "MGP_","MGP"}" + ".xml... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_path\n \"studio/#{type}/#{id}.xml\"\n end",
"def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend",
"def get_raw_filename (file)\n\t\n\t\t# convert to string\n\t\tfile = get_filename(file)\n\t\t# remove extension\n\t\tfile.sub(get_ext(file), \"\")\n... | [
"0.6458312",
"0.5919844",
"0.5889206",
"0.5834126",
"0.57996136",
"0.5780383",
"0.5776114",
"0.5747106",
"0.5729227",
"0.56961703",
"0.56716084",
"0.56539774",
"0.5615984",
"0.5579325",
"0.55407673",
"0.5537919",
"0.5535777",
"0.55299205",
"0.55248857",
"0.5524413",
"0.551755... | 0.74010056 | 0 |
Crea la directory che contiene il flusso e si posiziona al suo interno Parameters : nil Return : "K:/.../esiti_xml/20141009" (path della directory che contiene il flusso scaricato) | def crea_dir_per_xml
path_xml = (Pathname.new(__dir__).parent)+"esiti_xml"+@giorno
path_xml.mkdir(0700) unless path_xml.exist?
return path_xml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatedReportFolder\n currentData, currentTime = DateTime.now.strftime(\"%Y_%m_%d %H_%M\").split(' ')\n path = \"#{$ROOT}/../output\"\n creatFolder(path)\n path += \"/#{currentData}\"\n creatFolder(path)\n path += \"/#{currentTime}\"\n creatFolder(path)\n path\n end",
"def gen_news... | [
"0.65916455",
"0.6519942",
"0.6290221",
"0.62499833",
"0.62050813",
"0.61929095",
"0.6168694",
"0.61671066",
"0.6141717",
"0.61197937",
"0.6118008",
"0.6118008",
"0.6112808",
"0.6100345",
"0.6099804",
"0.60835993",
"0.6065124",
"0.60574055",
"0.603878",
"0.60367334",
"0.60239... | 0.868211 | 0 |
returns an array of the answers sorted by their vote score in descending order | def highest_voted_answers
answers.sort_by {|answer| answer.vote_score}.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n answers = Post.find_all_by_post_type_and_parent_id('answer', self.id)\n answers.sort{|x,y| y.rating <=> x.rating }\n end",
"def index\n @answers = Answer.joins(:post).order('votes DESC')\n end",
"def get_chosen_answers\n ChosenAnswer.order('created_at DESC')\n end",
"def answer... | [
"0.7481147",
"0.68326414",
"0.6691776",
"0.66833985",
"0.642999",
"0.64024454",
"0.64024454",
"0.63260174",
"0.6305289",
"0.6238024",
"0.619802",
"0.6185966",
"0.6174613",
"0.61741894",
"0.6155579",
"0.6088728",
"0.6088554",
"0.6081778",
"0.60578936",
"0.59995997",
"0.5967209... | 0.8469105 | 0 |
to be called as question.vote_score/ answer.vote_score. returns the score for a particular question/answer OUTPUT: total score as an integer | def vote_score
votes.sum(:value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n votes.sum(:vote)\n end",
"def score\n # add score caching\n total = 0\n self.votes.each do |vote|\n total += vote.value\n end\n total\n end",
"def get_total_score\n\t\tquestion_scores = Question_score.for_game_record(self.id)\n\t\tscore = 0\n\t\tquestion_scores.length.times... | [
"0.8218928",
"0.8117503",
"0.79747325",
"0.7670091",
"0.75999284",
"0.75368756",
"0.751258",
"0.74791527",
"0.7412172",
"0.7394929",
"0.735004",
"0.73118377",
"0.7304688",
"0.72910094",
"0.7285687",
"0.72447073",
"0.7212126",
"0.7207223",
"0.71611756",
"0.71505785",
"0.708746... | 0.7999801 | 2 |
delete spaces count chars | def count_chars(str)
p str.delete(' ').size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def space_out\n gsub(/(.)/, ' \\1')\n end",
"def undent\n gsub /^.{#{slice(/^ +/).length}}/, ''\n end",
"def no_space(x)\n x.delete(' ')\nend",
"def cleanup(string)\n string = string.gsub(/[^a-z]/i, ' ')\n until !string.include?(' ')\n string.gsub!(' ', ' ')\n end\n string\nend",
"d... | [
"0.70882356",
"0.6962683",
"0.6941634",
"0.6851901",
"0.6835531",
"0.6805154",
"0.6731454",
"0.67170936",
"0.66799074",
"0.66562206",
"0.6621571",
"0.6621571",
"0.6620938",
"0.66016906",
"0.6591884",
"0.6587177",
"0.6557829",
"0.6552568",
"0.65323687",
"0.6520586",
"0.6498263... | 0.631482 | 41 |
Each component has a span for the title, a tttype if it's a value type an ttdesc if it has an associated fact type child nodes | def component c, klass = ''
name = c.name
title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : ''))
desc = ''
type = ''
case c
when MM::Indicator
ft = c.role.fact_type
desc = div(div(expand_reading(ft.preferred_reading, false), '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_part_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n num_part, title = title.split ':', 2\n move_down 150\n typeset_text num_part + \"\\n\" + title, (calc_line_metrics 1.5), inline_format: true, align: :center\n end",
"def assess... | [
"0.5838458",
"0.55890626",
"0.5564517",
"0.55099326",
"0.5479761",
"0.54552555",
"0.543057",
"0.54146856",
"0.53108644",
"0.53073305",
"0.5296283",
"0.52507603",
"0.5195523",
"0.51909584",
"0.5187873",
"0.51597935",
"0.5089572",
"0.5045953",
"0.5045502",
"0.5043693",
"0.50358... | 0.5529715 | 3 |
A definition of a term | def termdef(name)
element(name, {:name => name, :class=>:term}, 'a')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term; end",
"def term\n @term\n end",
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end",
"def termdef(name)\n element(name, {:nam... | [
"0.8450216",
"0.73270005",
"0.7184933",
"0.7184933",
"0.7184933",
"0.7182944",
"0.71664697",
"0.7082566",
"0.6986552",
"0.6804663",
"0.6804663",
"0.6802982",
"0.6773592",
"0.67692256",
"0.67692256",
"0.67692256",
"0.67021185",
"0.6594718",
"0.65766084",
"0.65515333",
"0.65326... | 0.7654662 | 1 |
A reference to a defined term (excluding role adjectives) | def termref(name, role_name = nil)
role_name ||= name
element(role_name, {:href=>'#'+name, :class=>:term}, 'a')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def term\n @term\n end",
"def term\n Term.find(self.term_id)\n end",
"def term\n self.name\n end",
"def termref(name, role_name = nil, o = nil)\n if o && !@definitions[o]\n element(name, :class=>:object_type)\n else\n role_name ||= name\n element... | [
"0.7376947",
"0.7266853",
"0.7164853",
"0.7057247",
"0.705128",
"0.705128",
"0.6895083",
"0.6875203",
"0.6833116",
"0.675118",
"0.67177707",
"0.64436173",
"0.63903314",
"0.6357252",
"0.6262721",
"0.6262721",
"0.6252465",
"0.6252465",
"0.6252465",
"0.62485987",
"0.62372154",
... | 0.7302213 | 1 |
Text that should appear as part of a term (including role adjectives) | def term(name)
element(name, :class=>:term)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_text\n \"#{role} by #{person.full_name}\"\n end",
"def term_name\n self.content\n end",
"def text\n visibility_term&.label\n end",
"def text\n visibility_term&.label\n end",
"def term\n return unless lecture.present?\n lecture.term\n end",
"def term\n @term\n end",
"... | [
"0.7101018",
"0.63308316",
"0.6277732",
"0.6277732",
"0.6241964",
"0.6220916",
"0.60920113",
"0.596945",
"0.59375936",
"0.59372103",
"0.5896458",
"0.5787705",
"0.5787705",
"0.57774895",
"0.57607836",
"0.57270074",
"0.5706567",
"0.5706522",
"0.5704815",
"0.5694019",
"0.5684886... | 0.5550888 | 43 |
Starts the sprint. Only valid if there is no running sprint. | def start(start_date, end_date)
self.start_date = start_date
self.end_date = end_date
self.active = true
issues.each do |issue|
log_activity(issue, 'start', issue.estimate)
end
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_start\n start\n sv_command('start') if supervised?\n end",
"def start!\n raise 'Workshop must have at least one session to start.' if sessions.empty?\n\n sessions.each(&:assign_code)\n update!(started_at: Time.zone.now)\n\n # return nil in case any callers are still expecting ... | [
"0.6557358",
"0.6504527",
"0.64273775",
"0.6339489",
"0.61980784",
"0.61461645",
"0.6062989",
"0.59757465",
"0.5909539",
"0.58762586",
"0.58721805",
"0.58678514",
"0.58613294",
"0.5850875",
"0.5850436",
"0.58404005",
"0.5806118",
"0.57981837",
"0.57851905",
"0.57562727",
"0.5... | 0.0 | -1 |
Creates a log event to indicate a scope change (e.g. sprint started, issue closed). | def log_activity(issue, type, change)
activities.build(:issue_id => issue.id,
:type_of_change => type,
:scope_change => change)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scopeChanged\n pp [:got_scopeChanged] if $DEBUG\n end",
"def write_initial_event\n publish_to_feed(\"project:#{self.id}:create\", \"#{self.group.display_name} created a new project: #{self.display_name}\")\n end",
"def provenance_log_create\n curation_concern.provenance_create( current_use... | [
"0.5870572",
"0.5510152",
"0.54862803",
"0.545429",
"0.5380848",
"0.5293876",
"0.5244658",
"0.5223669",
"0.517622",
"0.5153984",
"0.5148474",
"0.5142857",
"0.5141063",
"0.5138201",
"0.51122475",
"0.51114655",
"0.51103956",
"0.5067827",
"0.50516737",
"0.5024196",
"0.49972418",... | 0.63244087 | 0 |
Given an array and a random number generator, shuffle the array. | def shuffle(array)
new_array = array.dup
array.each_index do |index|
rand_index = index + rand(array.length - index)
new_array[index], new_array[rand_index] = new_array[rand_index], new_array[index]
end
new_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_array array\n array.sort_by!{ rand }\n end",
"def shuffle( array )\n array.shuffle\n end",
"def shuffle array\r\n array.sort_by{rand}\r\nend",
"def shuffle array\n array.sort_by {rand}\nend",
"def shuffle arr\r\n\tarr.sort_by{rand}\r\nend",
"def shuffle arr\r\n\tarr.sort_by{... | [
"0.82818013",
"0.8206815",
"0.8096721",
"0.8096119",
"0.7900061",
"0.7900061",
"0.78506154",
"0.7743308",
"0.76755786",
"0.7656548",
"0.75886804",
"0.7502277",
"0.7492258",
"0.746042",
"0.7459064",
"0.7440705",
"0.74078643",
"0.7343142",
"0.7316552",
"0.7254793",
"0.7252766",... | 0.738536 | 17 |
binding.pry def get_japanese_emoticon(file_path, emoticon) library = load_library(file_path) end | def get_japanese_emoticon(file_path,emoticon)
library = load_library(file_path)
library.each do |key, value|
if value[:english] == emoticon
return value[:japanese]
end
end
return "Sorry, that emoticon was not found"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_japanese_emoticon(file_path, emoticon)\n load_library(file_path).each do |emotion, char_hash|\n # binding.pry\n # returns the Japanese equivalent of an English grinning\n # i am given \":)\" in emoticon argument, which is found in get_emoticon\n char_hash.each do |original, translation|\n ... | [
"0.8397296",
"0.83729917",
"0.80688554",
"0.7899776",
"0.78091913",
"0.7798595",
"0.77853024",
"0.7618974",
"0.73331916",
"0.7276545",
"0.7084184",
"0.7042319",
"0.7032837",
"0.701261",
"0.7005068",
"0.6961939",
"0.6889547",
"0.68615234",
"0.68371344",
"0.669029",
"0.658042",... | 0.7933185 | 3 |
When a photo is creted inside an album, then the photo will inherit the security level of the album, other wise use the securitylevel_id from the params when updated , the photo will always be updated using the securitylevel_id from the params, as photos can have different security level from the album | def create
# create Photo from the params
@photo = Photo.new(photo_params)
@photo.security_setting = SecuritySetting.new
# set the album if album_id exists in params
if params.has_key?(:album_id)
@photo.album_id = params[:album_id]
end
# if albums exists then photo inherits albums security level
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n forma... | [
"0.7001577",
"0.6906989",
"0.67637694",
"0.67520857",
"0.6647662",
"0.6615151",
"0.6552947",
"0.6551689",
"0.6550872",
"0.6446365",
"0.6439794",
"0.64313036",
"0.6426188",
"0.6425772",
"0.63961726",
"0.63713",
"0.6371026",
"0.6359979",
"0.6359942",
"0.63452965",
"0.63356364",... | 0.638676 | 15 |
GET /tapiocas GET /tapiocas.json | def index
@tapiocas = Tapioca.all
@hash = Gmaps4rails.build_markers(@tapiocas) do |tapioca, marker|
marker.lat tapioca.latitude
marker.lng tapioca.longitude
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end",
"def index\n @tocs = Toc.all\n end",
"def index\n @tccapis = Tccapi.all\n end",
"def index\n @apoios = Apoio.all\n end",
"def index\n @an... | [
"0.6940787",
"0.66825086",
"0.6646059",
"0.6398644",
"0.63228947",
"0.6307126",
"0.61926484",
"0.6151571",
"0.6131858",
"0.61314875",
"0.61283803",
"0.6117644",
"0.6100829",
"0.6095741",
"0.6084428",
"0.60658044",
"0.60533553",
"0.6053348",
"0.6037764",
"0.60281074",
"0.60216... | 0.0 | -1 |
GET /tapiocas/1 GET /tapiocas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end",
"def index\n @tccapis = Tccapi.all\n end",
"def index\n @tocs = Toc.all\n end",
"def index\n @apoios = Apoio.all\n end",
"def tattoos\n r... | [
"0.6856503",
"0.6749254",
"0.6569943",
"0.626916",
"0.62049735",
"0.6163696",
"0.6135971",
"0.6124757",
"0.61226964",
"0.61190087",
"0.607844",
"0.60745156",
"0.6037414",
"0.60234797",
"0.60129344",
"0.60047185",
"0.59946895",
"0.59764385",
"0.59730387",
"0.5971325",
"0.59502... | 0.0 | -1 |
POST /tapiocas POST /tapiocas.json | def create
@tapioca = Tapioca.new(tapioca_params)
respond_to do |format|
if @tapioca.save
format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }
format.json { render action: 'show', status: :created, location: @tapioca }
else
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n fo... | [
"0.6131813",
"0.60093284",
"0.586882",
"0.5858763",
"0.5846922",
"0.57569057",
"0.5745011",
"0.5740417",
"0.5723218",
"0.5709544",
"0.56913114",
"0.5662861",
"0.5643988",
"0.56313294",
"0.562105",
"0.5578551",
"0.5571476",
"0.5570174",
"0.5552587",
"0.5532697",
"0.55326873",
... | 0.68628556 | 0 |
PATCH/PUT /tapiocas/1 PATCH/PUT /tapiocas/1.json | def update
respond_to do |format|
if @tapioca.update(tapioca_params)
format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @tapioca.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.630356",
"0.62408584",
"0.6227141",
"0.6220228",
"0.61816573",
"0.6161129",
"0.6144715",
"0.61440086",
"0.61382145",
"0.61067414",
"0.6091236",
"0.60742587",
"0.60506177",
"0.60506177",
"0.59808683",
"0.5949832",
"0.5927379",
"0.59171987",
"0.59117854",
"0.5898775",
"0.589... | 0.6973547 | 0 |
DELETE /tapiocas/1 DELETE /tapiocas/1.json | def destroy
@tapioca.destroy
respond_to do |format|
format.html { redirect_to tapiocas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"de... | [
"0.7292021",
"0.7255884",
"0.7255884",
"0.7255884",
"0.7255884",
"0.72435254",
"0.7203925",
"0.71367854",
"0.70688",
"0.70488787",
"0.70350146",
"0.70326376",
"0.7016501",
"0.7010592",
"0.6976672",
"0.696649",
"0.6962057",
"0.6935283",
"0.6904715",
"0.69023746",
"0.6899159",
... | 0.77813435 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tapioca
@tapioca = Tapioca.find(params[:id])
@comment = @tapioca.comments.build
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 tapioca_params
params.require(:tapioca).permit(:name, :description, :picture)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
the 'allowance' method is supposed to do what lines 2224 did, but the new instances aren't recognized inside the method | def allowance(amt.to_f)
save.deposit(amt.to_f * 0.6)
puts "Save balance = $#{@balance}."
spend.deposit(amt.to_f * 0.3)
puts "Spend balance = $#{@balance}."
spare.deposit(amt.to_f * 0.1)
puts "Spare balance = $#{@balance}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invention; end",
"def instantiate!; end",
"def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @@all << self\n @owner.dogs << self\n end",
"def initialize ability\n @ability = ability\n end",
"def award; end",
"def accountability_objects\n case cou... | [
"0.57412106",
"0.5722591",
"0.56297004",
"0.56122124",
"0.5579363",
"0.55111486",
"0.5494307",
"0.5453874",
"0.54471165",
"0.54356885",
"0.54356885",
"0.54180986",
"0.540438",
"0.54012364",
"0.5396885",
"0.5396885",
"0.5396885",
"0.53967965",
"0.538233",
"0.53685546",
"0.5363... | 0.0 | -1 |
Returns a word from the words list. | def selectWord
words = [
"anvil",
"black",
"break",
"clear",
"doubt",
"exist",
"first",
"girth",
"heart",
"icons",
"joker",
"loath",
"mirth",
"notch",
"overt",
"print",
"qualm",
"react",
"solid",
"trick",
"until",
"viola",
"water",
"young",
"zebra"
]
return words[Ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word\n word = @word_list[rand(@word_list.length)]\n @word = word.gsub(/\\s+/, \"\").downcase\n end",
"def get_random_word(words)\n # rand method with an integer argument (the length of words) get a new integer between 0 & the length of words\n return words[rand(words.count)]\n end",
"def... | [
"0.740347",
"0.7345122",
"0.7064219",
"0.6806759",
"0.6798714",
"0.67390877",
"0.6737293",
"0.6701437",
"0.6665192",
"0.65684175",
"0.655368",
"0.6551452",
"0.64853525",
"0.6449667",
"0.64320153",
"0.6431649",
"0.6416838",
"0.63600695",
"0.6316261",
"0.631124",
"0.63046426",
... | 0.71173567 | 2 |
Prints guessed word along with which letters are correct or contained in solution. | def printSimilarities(guess,word)
(0..4).each do |i|
print "#{guess[i].upcase} "
end
puts ""
(0..4).each do |i|
if guess[i].upcase==word[i].upcase
print "* "
else
print findMatch(guess[i],word)
end
end
puts ""
print "--------- "
$linesPrinted += 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_word\n\t\t$current_print = []\n\t\t@player.word_to_guess.each_with_index do |i,index|\n\t\t\tif @player.correct_letters.include? i\n\t\t\t\t$current_print << \"#{i}\"\n\t\t\telse\n\t\t\t\t$current_print << \" _\"\n\t\t\tend\n\t\tend\n\t\tprint $current_print.join\n\tend",
"def print_puzzle(word,guessed... | [
"0.81975496",
"0.7793149",
"0.7530711",
"0.7485306",
"0.7391476",
"0.735982",
"0.72266334",
"0.7180469",
"0.7134649",
"0.7132773",
"0.7106594",
"0.71056545",
"0.70474654",
"0.70210266",
"0.6996465",
"0.6984805",
"0.6981714",
"0.69601464",
"0.6913293",
"0.69015723",
"0.6871004... | 0.7254813 | 6 |
Determines if a letter is contained in solution word. | def findMatch(char,word)
(0..4).each do |j|
if char.upcase == word[j].upcase
return "? "
end
end
return "X "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_has?(letter)\r\n @word.include?(letter)\r\n end",
"def word_has?(letter)\n @word.include?(letter)\n end",
"def letter_in_word?(letter)\n end",
"def is_a_letter?(guess)\n return true if @word.include?(guess)\n return false\n end",
"def word_has?(letter)\n @word.include? letter\n ... | [
"0.8241431",
"0.81953824",
"0.81838804",
"0.8148832",
"0.81416166",
"0.81149185",
"0.783519",
"0.7718781",
"0.7601324",
"0.75153035",
"0.74810106",
"0.7462446",
"0.74621785",
"0.7406686",
"0.7385139",
"0.7356739",
"0.73504966",
"0.7336687",
"0.7293635",
"0.7256151",
"0.722715... | 0.0 | -1 |
Ask user for new guess word. | def takeGuess
guess = gets.chomp
if guess.length == 5
return guess
else
if guess.downcase == "quit"
overwrite($linesPrinted, true)
exit 0
end
puts "Word must have 5 characters"
$linesPrinted += 2
takeGuess
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_hidden_word\n puts (\"Enter your guess: \")\n end",
"def ask_guess\n guess = gets.chomp.downcase\n check_guess_is_valid?(guess) ? guess : ask_guess\n end",
"def make_guess\n puts \"Make a guess:\"\n @current_guess = gets.chomp\n unless good_guess?\n puts \"That is an ... | [
"0.7887683",
"0.76413906",
"0.7537839",
"0.7476759",
"0.7453326",
"0.7417057",
"0.7355088",
"0.7344044",
"0.7275638",
"0.7274246",
"0.7226434",
"0.7222999",
"0.72081137",
"0.7152601",
"0.7064345",
"0.7041464",
"0.7014236",
"0.6955892",
"0.69475216",
"0.68816847",
"0.6871213",... | 0.6636819 | 45 |
Load configuration from file | def config
@config ||= YAML.load_file(@config_file_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(file)\n @config = YAML.load_file(file)\n end",
"def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::ENOENT\n return\n end",
"def load_from_file filename\n fnm = File.exist?(filename) ? filename : File.join(@wd,filename)\n load... | [
"0.82215965",
"0.8170373",
"0.8109283",
"0.80555797",
"0.8050724",
"0.79680526",
"0.77575",
"0.7717083",
"0.77039105",
"0.7680567",
"0.7673431",
"0.75970244",
"0.7590911",
"0.75882334",
"0.75785476",
"0.75683767",
"0.7566534",
"0.7559168",
"0.754216",
"0.7531337",
"0.7518861"... | 0.744123 | 27 |
Return an object with reader method for allowed, path and patterns attributes builded from configuration file. Merge from configuration file in following order: repository_owner/repository_name repository_owner/repository_name repository_owner/ repository_owner/ repository_owner/ / | def repository_info(repository_owner, repository_name, reload = false)
if @repository_info.nil? || reload
@repository_info = {}
@repository_info.default_proc = proc {|hash, repository|
hash[repository] = RepositoryInfo.new(false, nil, {})
matches = (config['repositories'] || {}).select... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_config(**attrs)\n config = config_defaults.merge(attrs.transform_keys(&:to_s))\n file_path = File.join(config['root'], config['config_path'])\n file_config = config_from_file(file_path, mode: config['mode'])\n new DEFAULT_CONFIG.merge(file_config).merge(config_from_env).merge(config... | [
"0.5813235",
"0.5720142",
"0.563452",
"0.55872416",
"0.55781966",
"0.55332816",
"0.54723233",
"0.54536825",
"0.5441712",
"0.52953726",
"0.5289665",
"0.52744013",
"0.5253997",
"0.5242925",
"0.52349234",
"0.52274066",
"0.5199857",
"0.51949877",
"0.5194828",
"0.5176196",
"0.5175... | 0.0 | -1 |
:nodoc: Return a expanded path to repository mirror build with information from configuration for repository. Replace keywords (:keyword) with value matched by it pattern. | def mirror_path(repository_owner, repository_name)
mirror_path = repository_info(repository_owner, repository_name).path || raise(GithubMirrorError, "Path for repository '#{repository_owner}/#{repository_name}' doesn\'t exist in config")
mirror_patterns = repository_info(repository_owner, repository_name).patte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n Config.artifactory_publish_pattern % package.metadata\n )\n end",
"def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n package.metadata[:name],\n package.metada... | [
"0.51905787",
"0.4863092",
"0.48016113",
"0.47350195",
"0.47256953",
"0.4716721",
"0.4687411",
"0.46648857",
"0.4656888",
"0.4625272",
"0.46233362",
"0.4597609",
"0.4588955",
"0.450325",
"0.45013463",
"0.44999027",
"0.4498575",
"0.4486967",
"0.4459705",
"0.44430637",
"0.44391... | 0.5798709 | 0 |
Handle request from Github, return always success response, but write an error message in body if an error raised | def handle_request
raise GithubMirrorError, 'Only POST request allowed' unless @request.post? # return fail message if request is not a POST
raise GithubMirrorError, 'Token not match' if config['token'] && !@request.path_info.end_with?('/' + config['token'])
payload = JSON.parse(@request[:payload]) rescue ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_github_response\n Retriable.retriable(retry_options) do\n yield\n end\n rescue MovedPermanentlyError => e\n fail_with_message(e, \"The repository has moved, update your configuration\")\n rescue Octokit::Forbidden => e\n fail_with_message(e, \"Exceeded retry limit\")\n ... | [
"0.68274355",
"0.6453231",
"0.6271996",
"0.61509717",
"0.6090275",
"0.60855705",
"0.60430235",
"0.5970443",
"0.5966946",
"0.5830605",
"0.5812657",
"0.5804717",
"0.5800088",
"0.57575405",
"0.5746899",
"0.5736847",
"0.56812423",
"0.5675688",
"0.56490225",
"0.5618825",
"0.561208... | 0.66120815 | 1 |
to make sure that your mailer uses the devise views | def confirmation_instructions(record, token, _opts = {})
options = {
to: record.email,
subject: 'Welcome to Railway',
template_id: 'f025ac9f-bcd3-41d7-a46a-fe8c43e3f27a',
substitutions: {
'-url-': confirmation_url(record, confirmation_token: token)
}
}
sendgrid_send opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_notfication\n UserMailer.show_notfication\n end",
"def mailer; end",
"def show\n render layout: 'devise_layout' if current_user.present? && current_user.admin?\n end",
"def send_devise_notification(notification, *args)\n if Rails.env.development?\n devise_mailer.send(notification, se... | [
"0.61909235",
"0.6105773",
"0.6085343",
"0.6029788",
"0.6009531",
"0.5985422",
"0.5985422",
"0.59779036",
"0.59539247",
"0.59071994",
"0.5882642",
"0.58775485",
"0.58602035",
"0.5855734",
"0.58492506",
"0.58469176",
"0.58369833",
"0.5828436",
"0.5825904",
"0.5823687",
"0.5814... | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.722... | 0.0 | -1 |
GET /users/new GET /users/new.json | def new
@user = User.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ... | [
"0.8287854",
"0.8169699",
"0.8155993",
"0.80478656",
"0.8022629",
"0.80212307",
"0.801024",
"0.7950962",
"0.7930549",
"0.7930549",
"0.7873416",
"0.7873416",
"0.7873416"
] | 0.7860817 | 98 |
POST /users POST /users.json | def create
@user = User.new(params[:user])
respond_to do |format|
if @user.save
format.html { redirect_to root_path, notice: 'User was successfully created.' }
format.json { render json: @user, status: :created}
else
format.html { render action: "new" }
format.json {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.77178615",
"0.751936",
"0.73831904",
"0.72412014",
"0.719768",
"0.7140784",
"0.7103724",
"0.70586866",
"0.7041747",
"0.70236677",
"0.7003012",
"0.7002012",
"0.7002012",
"0.7002012",
"0.6992873",
"0.6990429",
"0.6980341",
"0.69790155",
"0.6978697",
"0.6978697",
"0.69763535"... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to root_url, notice: 'User successfully deleted' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935"... | 0.0 | -1 |
helper method to get image from url | def image_from_url
io = open(URI.parse(image_url))
def io.original_filename; base_uri.path.split('/').last; end
self.image = io.original_filename.blank? ? nil : io
rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_url (origin_url)\n begin\n html = open(origin_url).read\n urls = URI.extract(html)\n .select { |lnk| lnk[/\\.jpg$|\\.png$|\\.gif$|\\.jpeg/m] }\n return urls.empty? ? nil : urls[0]\n rescue Exception => e\n puts \"[ERROR] in 'Dav... | [
"0.7597434",
"0.7441028",
"0.73810947",
"0.7166025",
"0.7112345",
"0.70828986",
"0.7024592",
"0.7016788",
"0.6996657",
"0.6988121",
"0.69312656",
"0.6928905",
"0.6912796",
"0.69104064",
"0.6886367",
"0.6862008",
"0.6861769",
"0.6852125",
"0.684585",
"0.6840781",
"0.68401504",... | 0.77521545 | 0 |
The elements of the first set are strictly smaller than x. The elements of the second set are strictly greater than x. The sum of the elements of both the sets is equal. If such an integer exists then print Yes otherwise print No. | def divider sorted_arr, i=0, j=sorted_arr.size-1, left_sum = 0, right_sum = 0
return 'No' if j<=i
right_sum += sorted_arr[j]
while left_sum < right_sum
left_sum += sorted_arr[i]
i +=1
end
if left_sum == right_sum
return 'Yes' if( sorted_arr[i] == sorted_arr[j-1] || (i == j && sorted_arr[i-1]+1<sorted_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_two?(set)\n set.any? { |x| set.include?(self-x) }\n end",
"def twoArrays(n, k, a, b)\n a_sorted = a.sort\n b_sorted = b.sort.reverse\n sum_ele = []\n n.times do |i|\n sum_ele << a_sorted[i] + b_sorted[i]\n end\n if sum_ele.min >= k\n return 'YES'\n else\n ... | [
"0.69001323",
"0.6606822",
"0.65256405",
"0.640583",
"0.61512184",
"0.6131378",
"0.6119854",
"0.6109189",
"0.6100239",
"0.60931826",
"0.6085886",
"0.6070099",
"0.60471666",
"0.6041455",
"0.6023747",
"0.6013874",
"0.6007071",
"0.5973631",
"0.5931144",
"0.5904315",
"0.5879873",... | 0.0 | -1 |
Link to kata: Description: Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is pres... | def spinWords(string)
string.split(" ").map { |word| word.length >= 5 ? word.reverse : word }.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_words(string)\n array = string.split(\" \").each do |word|\n if word.length >= 5\n word.reverse!\n else\n word\n end\n end\n array.join(\" \")\nend",
"def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend",
"def reverse_word... | [
"0.83576137",
"0.8289384",
"0.8289384",
"0.8289208",
"0.8285551",
"0.82757497",
"0.82717496",
"0.82553536",
"0.8246794",
"0.82418805",
"0.82380617",
"0.8204497",
"0.81993335",
"0.8176601",
"0.8171168",
"0.8146561",
"0.81432444",
"0.81398904",
"0.8137971",
"0.8130754",
"0.8129... | 0.0 | -1 |
manually writing relationship method as primary_key is set to route_short_name has_many :trips | def trips
Trip.where(:route_id => self.route_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_relationships; end",
"def macro\n :belongs_to_related\n end",
"def relationship_related_link(attribute_name); end",
"def relationship(sym)\n self.class.relationship(sym)\n end",
"def one_relationship(name)\n end",
"def child_relation; end",
"def add_relationship(r... | [
"0.6416039",
"0.6262816",
"0.62232363",
"0.6137972",
"0.60455704",
"0.60186136",
"0.59086",
"0.5809414",
"0.57868505",
"0.57434756",
"0.5699105",
"0.5693595",
"0.5653831",
"0.56534135",
"0.5623296",
"0.5622213",
"0.56205326",
"0.5612764",
"0.55571556",
"0.55413824",
"0.551075... | 0.5505604 | 22 |
action for when payment is successful. finding the correct product listing my the eventid, assigning the buyer to the current user, creating a new sale and then making the item unapproved by changing the boolean value from true to false. | def success
# using find to find exact result that matches the conditions(params with correct eventId)
@product_listing = ProductListing.find(params["eventId"])
@sale = Payment.create(user_id: current_user.id, buyer_email: current_user.email, seller_email: @product_listing.user.email, product_listing_id: @p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_sub_existing_edu_bridge #like newcustomer action #channeling back to original checkout process\n @user = current_user\n @plan = params[:snc][:plan] #gives my_plan_id\n @event_type = params[:snc][:event_type] #gives 'reception' or 'wedding' depending on the channel; actually, will just be 'receptio... | [
"0.6630691",
"0.65302056",
"0.64458394",
"0.6417934",
"0.6382279",
"0.6348252",
"0.63372695",
"0.6313289",
"0.6240675",
"0.62329525",
"0.62276113",
"0.62220705",
"0.6205922",
"0.6197361",
"0.6179753",
"0.6163918",
"0.6156938",
"0.6153812",
"0.614195",
"0.614129",
"0.61407804"... | 0.78068453 | 0 |
action to run if payment unsuccessful | def cancel
redirect_to root_url, flash[:alert] = "Something went wrong."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry_failed_payment\n end",
"def payment_failed?\n cancel_reason == PAYMENT_FAILED\n end",
"def retry_failed_payment\n pay_subscription.update(status: :active)\n end",
"def failed_purchase_response\n end",
"def receipt\n check_payment(\"GET\", current_user)\n if... | [
"0.73759115",
"0.6906974",
"0.6846999",
"0.68319744",
"0.67229575",
"0.67106324",
"0.66818583",
"0.6670587",
"0.6570027",
"0.6504929",
"0.644172",
"0.64226747",
"0.63766766",
"0.6360292",
"0.6351418",
"0.6323684",
"0.63178676",
"0.6317282",
"0.6307986",
"0.6300509",
"0.629467... | 0.0 | -1 |
GET /garbages/1 GET /garbages/1.xml | def show
@garbage = Garbage.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.csv { send_data(@garbage.to_a.to_csv(Garbage), :type => "text/csv") }
# format.xml { send_data(@garbage.to_xml, :type => "text/xml; charset=utf8;", :disposition => "attachement") }
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end",
"def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redire... | [
"0.6078544",
"0.5801877",
"0.54188895",
"0.53903717",
"0.5386759",
"0.51681507",
"0.51070327",
"0.5083102",
"0.50804937",
"0.5069457",
"0.50450295",
"0.504464",
"0.5034735",
"0.5002348",
"0.499506",
"0.498331",
"0.49692464",
"0.49654755",
"0.49651444",
"0.49595964",
"0.494019... | 0.5322204 | 5 |
GET /garbages/new GET /garbages/new.xml | def new
@garbage = Garbage.new(params[:garbage])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n ... | [
"0.6720236",
"0.6146797",
"0.6136578",
"0.6127441",
"0.60301995",
"0.6021557",
"0.6003334",
"0.5982964",
"0.59825677",
"0.59700555",
"0.59499127",
"0.5934086",
"0.5903696",
"0.5872607",
"0.5869017",
"0.585763",
"0.58523476",
"0.58399767",
"0.5836569",
"0.58240443",
"0.5818218... | 0.62358534 | 1 |
POST /garbages POST /garbages.xml | def check
@garbage = Garbage.new(params[:garbage])
render :action => :new, :status => 400 and return unless @garbage.valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.... | [
"0.58374274",
"0.57502586",
"0.5622415",
"0.5446513",
"0.54210997",
"0.52940273",
"0.52940273",
"0.5208411",
"0.51746607",
"0.5089867",
"0.5080046",
"0.5039509",
"0.4958417",
"0.48838887",
"0.482864",
"0.48264802",
"0.48125473",
"0.47895554",
"0.47783107",
"0.47161138",
"0.46... | 0.5373751 | 5 |
POST /garbages POST /garbages.xml | def create
begin
@garbage = Garbage.new(params[:garbage])
@garbage.save!
flash[:notice] = t(:success_created, :id => @garbage.id)
redirect_to(garbages_url)
rescue => e
# flash[:error] = t(:error_default, :message => e.message)
render :action => :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.... | [
"0.58414936",
"0.57558656",
"0.56258106",
"0.54507506",
"0.53766555",
"0.5297253",
"0.5297253",
"0.5210727",
"0.51777273",
"0.5092629",
"0.5084742",
"0.5044907",
"0.49621168",
"0.4888065",
"0.48304462",
"0.48264277",
"0.48132402",
"0.47908372",
"0.47777233",
"0.47144556",
"0.... | 0.542469 | 4 |
PUT /garbages/1 PUT /garbages/1.xml | def confirm
@garbage = Garbage.find(params[:id])
@garbage.attributes = params[:garbage]
render :action => :edit, :status => 400 and return unless @garbage.valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garba... | [
"0.579919",
"0.5777506",
"0.5608368",
"0.55363846",
"0.5440373",
"0.5383936",
"0.53672445",
"0.53136075",
"0.5302597",
"0.5242781",
"0.519381",
"0.5171501",
"0.51113164",
"0.51033497",
"0.50803775",
"0.5073408",
"0.5036417",
"0.5008357",
"0.5005093",
"0.4999928",
"0.49902135"... | 0.45404404 | 73 |
PUT /garbages/1 PUT /garbages/1.xml | def update
begin
@garbage = Garbage.find(params[:id])
@garbage.update_attributes(params[:garbage])
flash[:notice] = t(:success_updated, :id => @garbage.id)
redirect_to(garbages_url)
rescue => e
# flash[:error] = t(:error_default, :message => e.message)
render :action => :edi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garba... | [
"0.5797847",
"0.5780015",
"0.5609568",
"0.5536864",
"0.54401624",
"0.5383693",
"0.53691864",
"0.53138787",
"0.5301043",
"0.52435005",
"0.5195912",
"0.5112155",
"0.51022756",
"0.50801253",
"0.5074097",
"0.5036314",
"0.5010618",
"0.50072706",
"0.5002062",
"0.49902228",
"0.49887... | 0.5173622 | 11 |
POST /garbages POST /garbages.xml | def upload
upload_file = ApplicationUpload.new(params[:file])
upload_msgs = upload_file.import(Garbage)
flash[:notice] = t(:success_imported, :msg => upload_msgs) unless upload_msgs.blank?
redirect_to(garbages_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.... | [
"0.58374274",
"0.57502586",
"0.5622415",
"0.5446513",
"0.54210997",
"0.5373751",
"0.52940273",
"0.52940273",
"0.5208411",
"0.51746607",
"0.5089867",
"0.5080046",
"0.5039509",
"0.4958417",
"0.48838887",
"0.482864",
"0.48264802",
"0.48125473",
"0.47895554",
"0.47783107",
"0.471... | 0.0 | -1 |
DELETE /garbages/1 DELETE /garbages/1.xml | def destroy
begin
@garbage = Garbage.find(params[:id])
@garbage.destroy
Log.create(:user_id => session_get_user, :action => controller_name, :error => action_name + " " + params[:id])
flash[:notice] = t(:success_deleted, :id => @garbage.id)
redirect_to(garbages_url)
rescue => e
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purge\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\... | [
"0.6368339",
"0.6364902",
"0.6294549",
"0.6283909",
"0.6192396",
"0.6169065",
"0.6063494",
"0.59932286",
"0.5977732",
"0.5933209",
"0.5931921",
"0.59067416",
"0.58970565",
"0.587881",
"0.58348244",
"0.58313096",
"0.58155304",
"0.5811328",
"0.5802984",
"0.5781506",
"0.57791215... | 0.0 | -1 |
INDEX Warning: cannot be memoized | def init_search_form
@search_form = SearchForm.new(search_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index()\n INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }\n end",
"def construct_index\n end",
"def lazy_index(index)\n index -= @map.keys.select{|e| e < index}.size\n result = 0\n @deleted.each do |deleted_index|\n if deleted_index - result > index\n ... | [
"0.6536306",
"0.6460917",
"0.64352965",
"0.6350692",
"0.62916666",
"0.62751746",
"0.62178475",
"0.6176336",
"0.6163126",
"0.605742",
"0.6017804",
"0.5993588",
"0.59718364",
"0.5968406",
"0.5968406",
"0.5954747",
"0.59406984",
"0.5935629",
"0.5935629",
"0.5917862",
"0.59016955... | 0.0 | -1 |
Set geolocation variables to cookie | def set_position
if @search_form.search_location == I18n.t('conf.current_location')
# erase cookie so that next time the current location will be used again
cookies[:last_search_location] = nil
else
# set cookie so that next time the same location will be prefilled
cookies[:last_search_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_ip_location\n session[:geo_location] ||= retrieve_location_from_cookie_or_service\n cookies[:geo_location] = { :value => session[:geo_location].to_json, :expires => 30.days.from_now } if session[:geo_location]\n end",
"def save_location\n\n if @location != nil\n ... | [
"0.7550488",
"0.7157694",
"0.6689789",
"0.65365225",
"0.6448468",
"0.6251704",
"0.6215958",
"0.6166221",
"0.606778",
"0.6041171",
"0.60210645",
"0.60034806",
"0.59778637",
"0.5942829",
"0.5873466",
"0.5872391",
"0.58530974",
"0.5829178",
"0.5827184",
"0.5827184",
"0.5820643",... | 0.66431713 | 3 |
prepare an UpdateRequest that will be displayed if the user entered a search that has no nearby_hits | def prepare_location_unavailable
@update_request = UpdateRequest.new(
search_location: @search_form.search_location # TODO: set by JS
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end",
"def update_search\n respond_to do |format|\n #byebug\n if params[:q] == nil\n unless search_params.nil?\n #search_params.each do |key, param|\n # search_params[key] = nil\n #end\n ... | [
"0.5943165",
"0.5862006",
"0.56999207",
"0.56999207",
"0.5656402",
"0.5646221",
"0.5646221",
"0.5560123",
"0.5559098",
"0.5556221",
"0.55299383",
"0.5523097",
"0.5522777",
"0.5522777",
"0.5513652",
"0.54755884",
"0.5455988",
"0.54506475",
"0.54491895",
"0.5445691",
"0.5444222... | 0.7450269 | 1 |
def product_params params.permit(:roomname, :image, :text) end | def product_params
params.require(:product).permit(:roomname, :text, :image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_params\n params.require(:product).permit(:name, :image)\n end",
"def room_params\n params.require(:room).permit(:roomtype,:image, :romnum, :pricepn,:hotel_id,:quantity)\n end",
"def product_params\n params.require(:product).permit(:title, :price, :image)\n end",
"def produ... | [
"0.8410431",
"0.828694",
"0.82692325",
"0.82331",
"0.8221226",
"0.8167253",
"0.8149526",
"0.8133822",
"0.8123091",
"0.8122155",
"0.8101613",
"0.80931664",
"0.80878526",
"0.8064436",
"0.80643433",
"0.8060577",
"0.8028389",
"0.8027768",
"0.8004703",
"0.7995737",
"0.798819",
"... | 0.96327066 | 0 |
initialize Instance Methods ===================================================================== Repository | def repo
if @repo == NRSER::NO_ARG
@repo = QB::Repo.from_path root_path
end
@repo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n init\n end",
"def initialize\n @configuration = RepositoryConfiguration.new\n end",
"def init\n\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def i... | [
"0.7023822",
"0.6996723",
"0.6984403",
"0.6972417",
"0.6972417",
"0.6972417",
"0.6943062",
"0.6943062",
"0.684795",
"0.68139386",
"0.68035287",
"0.68035287",
"0.68035287",
"0.68035287",
"0.6758314",
"0.67540157",
"0.6741457",
"0.6731434",
"0.67160606",
"0.6710222",
"0.6703070... | 0.0 | -1 |
Get the string prefix for tagging versions of this package. Only makes any sense if the package is in a recognized repo, and will error out if that's not the case. The most basic prefix is "v" for packages located at the root of the repository. | def version_tag_prefix
if root_path == repo.root_path
'v'
else
(repo_rel_path / 'v').to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_tag(tag)\n tag = Origen::VersionString.new(tag)\n if tag.semantic?\n tag.prefixed\n else\n tag\n end\n end",
"def version_prefix\n '/v2'\n end",
"def version_tag\n version_composition.join(\".\")\n end",
"def prefixed(str = 'v')\n ... | [
"0.70594865",
"0.6634987",
"0.6620091",
"0.6477108",
"0.6475548",
"0.646715",
"0.6141901",
"0.60339195",
"0.5953307",
"0.58897",
"0.5819408",
"0.58188736",
"0.575975",
"0.5679773",
"0.56518424",
"0.56303906",
"0.56298345",
"0.56200975",
"0.56118286",
"0.55761737",
"0.55416447... | 0.8411623 | 0 |
define geter y seter attr_reader :nombre define el getter attr_writer :nombre define el setter | def initialize(name)
@nombre = name #propiedad del objeto
#puts @nombre
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_nombre(nombre) # la convencion de ruby es def nombre=(nombre) * Sin espacios\n @nombre = nombre\n end",
"def get_nombre # definicion del metodo get para el nombre no esperamos ningun argumento \n @nombre # hacemos un return de la variable, la variable como atributo hasta que nosotros usamos @n... | [
"0.7702928",
"0.73755383",
"0.7338956",
"0.7288412",
"0.7153824",
"0.7091198",
"0.69981533",
"0.6985139",
"0.69685125",
"0.6968393",
"0.6950722",
"0.67523205",
"0.6746073",
"0.6746073",
"0.67316544",
"0.67135125",
"0.66731066",
"0.662901",
"0.6477316",
"0.6427793",
"0.6370351... | 0.581895 | 41 |
GET /events GET /events.json | def index
@upcoming_events = Event.upcoming.paginate(page: params[:page])
@upcoming_header = 'Upcoming Events'
@prev_events = Event.prev.paginate(page: params[:page])
@prev_header = 'Previous Events'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.8340207",
"0.82428277",
"0.79464173",
"0.79294795",
"0.7770336",
"0.7741841",
"0.76710856",
"0.7667053",
"0.7659808",
"0.764342",
"0.7622101",
"0.7616673",
"0.7616673",
"0.7614018",
"0.7569864",
"0.7523623",
"0.74899524",
"0.74831337",
"0.74718815",
"0.74428016",
"0.744209... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
@event = Event.find(params[:id])
@event_attendees = @event.attendees
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.75022924",
"0.74003553",
"0.7360236",
"0.73483384",
"0.734628",
"0.7336635",
"0.73162717",
"0.7286345",
"0.7280093",
"0.72448486",
"0.722994",
"0.7218412",
"0.7218412",
"0.721763",
"0.721763",
"0.72140783",
"0.7203632",
"0.7198198",
"0.71961105",
"0.7191874",
"0.7191539",
... | 0.0 | -1 |
POST /events POST /events.json | def create
@event = Event.new(event_params.merge(user_id: current_user.id))
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render :show, status: :created, location: @event }
else
format.html { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036... | 0.0 | -1 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
event_id = session[:event_id]
event = Event.find(event_id)
ids = params[:event][:attendee_ids]
ids.each do |id|
next if event.events_attendees.exists?(attendee_id: id)
event.events_attendees.create(attendee_id: id)
end
redirect_to event
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.75299805",
"0.7372486",
"0.71766764",
"0.7172103",
"0.7170955",
"0.71424884",
"0.70959055",
"0.7082709",
"0.7082709",
"0.7057662",
"0.70209146",
"0.6989379",
"0.69825095",
"0.69775003",
"0.69601995",
"0.6954494",
"0.6954494",
"0.6951992",
"0.692109",
"0.692109",
"0.692109"... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.7693312",
"0.7688612",
"0.7688612",
"0.7688612",
"0.7681831",
"0.75866115",
"0.7569791",
"0.75618947",
"0.7541904",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541593",
"0.7541025",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.