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 |
|---|---|---|---|---|---|---|
Escape only the tags of certain HTML elements in +string+. Takes an element or elements or array of elements. Each element is specified by the name of the element, without angle brackets. This matches both the start and the end tag of that element. The attribute list of the open tag will also be escaped (for instance, ... | def escapeElement(string, *elements)
elements = elements[0] if elements[0].kind_of?(Array)
unless elements.empty?
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do
CGI.escapeHTML($&)
end
else
string
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescapeElement(string, *elements)\n elements = elements[0] if elements[0].kind_of?(Array)\n unless elements.empty?\n string.gsub(/<\\/?(?:#{elements.join(\"|\")})(?!\\w)(?:.|\\n)*?>/i) do\n unescapeHTML($&)\n end\n else\n string\n end\n end",
"def escapeHTML(string)\... | [
"0.6998917",
"0.5968915",
"0.59454304",
"0.5887967",
"0.578459",
"0.578459",
"0.57355684",
"0.572788",
"0.57181287",
"0.5710775",
"0.56940216",
"0.5627674",
"0.5567298",
"0.55522794",
"0.55522794",
"0.55522794",
"0.55522794",
"0.55522794",
"0.55522794",
"0.55522794",
"0.55522... | 0.827577 | 0 |
Undo escaping such as that done by CGI.escapeElement() print CGI.unescapeElement( CGI.escapeHTML(''), "A", "IMG") "<BR>" print CGI.unescapeElement( CGI.escapeHTML(''), ["A", "IMG"]) "<BR>" | def unescapeElement(string, *elements)
elements = elements[0] if elements[0].kind_of?(Array)
unless elements.empty?
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do
unescapeHTML($&)
end
else
string
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape_html\n CGI.unescapeHTML(self)\n end",
"def unescape(html)\n CGI.unescapeHTML(html)\n end",
"def unescape(input)\n CGI.unescapeHTML(input) rescue input\n end",
"def get_unescaped(element, path='.')\n result = self.get(element, path)\n CGI.unescape(result) if result\n... | [
"0.6955724",
"0.6683671",
"0.6542188",
"0.6475637",
"0.6407396",
"0.63856876",
"0.63711596",
"0.6336787",
"0.62625784",
"0.6237028",
"0.6191657",
"0.6176745",
"0.6095689",
"0.6074906",
"0.60525227",
"0.60431737",
"0.6035399",
"0.6031304",
"0.6004307",
"0.599223",
"0.5989708",... | 0.60888094 | 13 |
Format a +Time+ object as a String using the format specified by RFC 1123. CGI.rfc1123_date(Time.now) Sat, 01 Jan 2000 00:00:00 GMT | def rfc1123_date(time)
time.getgm.strftime("%a, %d %b %Y %T GMT")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(time)\n strftime_preset = '%Y-%m-%dT%l:%M:%S%z'\n time.strftime(strftime_preset)\n end",
"def rfc2822(time)\n time.strftime('%a, %d %b %Y %T GMT')\n end",
"def rfc1123date()\r\n current_time = Time.now\r\n \r\n return current_time.httpdate()\r\n end",
"def forma... | [
"0.717272",
"0.7126366",
"0.6787436",
"0.6735548",
"0.67110413",
"0.66453254",
"0.6564129",
"0.65466124",
"0.6545202",
"0.6480195",
"0.64631075",
"0.6407955",
"0.64079356",
"0.63943624",
"0.6364523",
"0.63248104",
"0.6308842",
"0.6280864",
"0.62767667",
"0.62741625",
"0.62369... | 0.7360653 | 0 |
Prettify (indent) an HTML string. +string+ is the HTML string to indent. +shift+ is the indentation unit to use; it defaults to two spaces. print CGI.pretty("") print CGI.pretty("", "\t") | def pretty(string, shift = " ")
lines = string.gsub(/(?!\A)<.*?>/m, "\n\\0").gsub(/<.*?>(?!\n)/m, "\\0\n")
end_pos = 0
while end_pos = lines.index(/^<\/(\w+)/, end_pos)
element = $1.dup
start_pos = lines.rindex(/^\s*<#{element}/i, end_pos)
lines[start_pos ... end_pos] = "__" + lines[start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty(indent = ' ')\n io = StringIO.new\n pretty_print(io, 0, indent)\n io.string\n end",
"def indent_string(string, *args)\n string = string.dup\n indent_string!(string, *args)\n string\n end",
"def prettify(str); end",
"def indented_puts(string, indent_le... | [
"0.6415813",
"0.5879747",
"0.5846257",
"0.5533372",
"0.5378807",
"0.5326498",
"0.5302997",
"0.52511764",
"0.5176587",
"0.51178145",
"0.507459",
"0.50699526",
"0.50175416",
"0.5011699",
"0.5009874",
"0.49889573",
"0.49389413",
"0.4921205",
"0.4912393",
"0.49085897",
"0.4871715... | 0.75794756 | 0 |
include SmartListing::Helper::ControllerExtensions helper SmartListing::Helper | def index
@inventory = CaseInventory.all
# @case_inventories = smart_listing_create(:case_inventories, CaseInventory.all, partial: "case_inventories/listing")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_action_helpers; end",
"def helpers\n ApplicationController.helpers\n end",
"def helpers\n ApplicationController.helpers\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def helper\n @helper ||= ApplicationController.helpers\n end",
"def helpers\n ActionCont... | [
"0.64365613",
"0.6392023",
"0.6392023",
"0.6372341",
"0.6372341",
"0.6372341",
"0.63702637",
"0.6318528",
"0.62983894",
"0.62983894",
"0.62522495",
"0.6251727",
"0.62296396",
"0.6207042",
"0.6125727",
"0.59585357",
"0.5919432",
"0.5905697",
"0.58977795",
"0.5863774",
"0.58586... | 0.0 | -1 |
show data for one cat | def show
@cat = Cat.find(params[:id])
@pictures = Picture.where("title LIKE '"+@cat.id.to_s+"'")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cat_stats \n puts \"#{self.name}, age #{self.age}, color #{self.color}\"\n end",
"def show\n @p_cats = PCat.all\n end",
"def show\n cat = @cathegory.sub_cathegories.map(&:id) << @cathegory.id\n @articles = Article.where(cathegory_id: cat)\n\n end",
"def list_cats\n Cat.all.eac... | [
"0.6794675",
"0.65611947",
"0.63898754",
"0.6211298",
"0.6174625",
"0.6155977",
"0.6130099",
"0.60851943",
"0.6059537",
"0.6045683",
"0.59685725",
"0.5944139",
"0.5924226",
"0.5911468",
"0.5897852",
"0.58751327",
"0.5872642",
"0.58473843",
"0.5836366",
"0.58343345",
"0.583340... | 0.5941055 | 12 |
print a form to add another cat | def new
@cat = Cat.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cat\n puts \"\\n\\n\"\n puts \" /\\\\__/\\\\\"\n puts \" /' \\'\\\\\"\n puts \" === 0 0 ===\"\n puts \" \\\\ -- /\"\n puts \" / \\\\\"\n puts \" / \\\\\"\n puts \"| |\"\n puts \" \\\\ || || /\"\n ... | [
"0.60594964",
"0.5889643",
"0.5627393",
"0.55782706",
"0.554569",
"0.55146235",
"0.5505015",
"0.54871225",
"0.5474901",
"0.54662085",
"0.5454725",
"0.5452265",
"0.5431054",
"0.54146767",
"0.5407368",
"0.5346084",
"0.5338729",
"0.53224885",
"0.5300968",
"0.529721",
"0.52959096... | 0.53156215 | 19 |
insert form data into our database | def create
@cat = Cat.new(catparams)
if @cat.save
redirect_to @cat
else
render 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_form_data_to_database\n db = get_db\n db.execute 'INSERT INTO Messages (username, phone, email, option, comment)\n VALUES (?, ?, ?, ?, ?)', [@username, @phone, @email, @option, @comment]\n db.close\nend",
"def insert()\n\t\t@db.execute(\"insert into ausgaben (jahr, monat, name, betrag, gemeinsam, ta... | [
"0.7443473",
"0.6239051",
"0.612931",
"0.61044693",
"0.58938384",
"0.58659554",
"0.58374774",
"0.5835979",
"0.5744594",
"0.5643889",
"0.561698",
"0.5614951",
"0.5614813",
"0.5609919",
"0.5600337",
"0.5597627",
"0.5585515",
"0.55833113",
"0.55789375",
"0.5533687",
"0.55314714"... | 0.0 | -1 |
print a form to edit one of our cats | def edit
@cat = Cat.find(params[:id])
@picture = Picture.new
@pictures = Picture.where("title LIKE '"+@cat.id.to_s+"'")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n puts \"\\n******* edit *******\"\n end",
"def edit\n puts \"******* edit *******\"\n end",
"def show_edit_menu\n puts \" You are now in edit mode\"\n puts \" edit name - edit the name of this contact\"\n puts \" edit email - edit the email of this contact\"\n put... | [
"0.6890467",
"0.67364883",
"0.6620673",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
"0.62922376",
... | 0.0 | -1 |
update form data into the database | def update
@cat = Cat.find(params[:id])
if @cat.update(catparams)
redirect_to @cat
else
render 'edit'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n\tend",
"def update\n\n\tend",
"def update\n\t\tend",
"def update\n\t\tend",
"def update\r\n end",
"def update\n \n end",
"def update\n \n end",
"def update!\n self.save\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\... | [
"0.6756951",
"0.6756951",
"0.67347205",
"0.67347205",
"0.6708002",
"0.66488403",
"0.66488403",
"0.66440886",
"0.66336924",
"0.66336924",
"0.66336924",
"0.66336924",
"0.6630912",
"0.661368",
"0.6611626",
"0.6601749",
"0.6601749",
"0.6601749",
"0.6601749",
"0.6601749",
"0.65569... | 0.0 | -1 |
delete a cat from the database | def destroy
@cat = Cat.find(params[:id])
#TODO @pictures = Picture.where("title LIKE '"+@cat.id.to_s+"'")
#TODO: call @picture.destroy for each @pictures..
@cat.destroy
redirect_to cats_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n... | [
"0.72776455",
"0.7115928",
"0.70383584",
"0.7002107",
"0.7001244",
"0.6964194",
"0.6945521",
"0.6924615",
"0.67654634",
"0.67603046",
"0.6759367",
"0.6752174",
"0.6730293",
"0.67094076",
"0.66936505",
"0.66936505",
"0.6679236",
"0.666879",
"0.6663968",
"0.66556954",
"0.664556... | 0.67916995 | 8 |
Returns coming games list from domain | def announces
load_page("http://#{@domain}/").css('#boxCenterComingGames #lnkGameTitle')
.map { |a| parse_game(a) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_games\n games, doc = [], get_xml(bungie_net_recent_games_url)\n (doc/:item).each_with_index do |item, i|\n games[i] = {\n :title => (item/:title).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :link => (item/'link')... | [
"0.722455",
"0.70800173",
"0.70295507",
"0.69646525",
"0.68930113",
"0.67867684",
"0.67663985",
"0.67138076",
"0.6682054",
"0.66251767",
"0.65560716",
"0.6488863",
"0.6482165",
"0.6477678",
"0.6427586",
"0.64091927",
"0.6404047",
"0.64025044",
"0.6401499",
"0.63992715",
"0.63... | 0.0 | -1 |
Returns domain player list | def players
parse_domain_top '/UserList.aspx', 'lnkUserInfo'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def players\n @players.select(&:playing)\n end",
"def players(list=\"all\")\n\t\t\t\tdata = send(['listPlayers', list])\n\t\t\t\tif data\n\t\t\t\t\treturn Player.players_from_list(data,0)\n\t\t\t\tend\n\t\t\tend",
"def players\n @players ||= []\n end",
"def players\n @players ||= [... | [
"0.69564253",
"0.68327355",
"0.6793527",
"0.6793527",
"0.6788949",
"0.6709352",
"0.6674563",
"0.66438437",
"0.66347814",
"0.6568185",
"0.65476936",
"0.6526663",
"0.65245897",
"0.6513",
"0.64692116",
"0.6461211",
"0.6426637",
"0.63977885",
"0.6376283",
"0.6342835",
"0.6294991"... | 0.6625741 | 9 |
Returns domain team list | def teams
parse_domain_top '/Teams/TeamList.aspx', 'lnkTeamInfo'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end",
"def all_teams_in_league\n \treturnArray = []\n\t\tbase_uri = 'https://www.thesportsdb.com/api/v1/json/1/search_all_teams.php?l=' + @league_name.to_s\n\t\tresponse = RestClient.get(base_uri)\n\t\tjson_response = ... | [
"0.73125136",
"0.7231146",
"0.71496284",
"0.70939606",
"0.70593905",
"0.7050746",
"0.69734114",
"0.6965925",
"0.6946394",
"0.69093406",
"0.6891909",
"0.6844851",
"0.6822773",
"0.68111235",
"0.6797867",
"0.6725695",
"0.67255926",
"0.6703615",
"0.6698429",
"0.66864663",
"0.6670... | 0.76919526 | 0 |
Returns past game list from domain | def archive
dom = load_page("http://#{@domain}/Games.aspx")
max = parse_max_page(dom.css('#tdContentCenter').first, 'Games.aspx')
1.upto(max).flat_map do |page|
load_page('/Games.aspx', page: page).css('#lnkGameTitle')
.map { |a| parse_game(a) }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def past_games\n SubRequest.past_games(self)\n end",
"def upcoming_games_host\n self.games.all.select { |g| g.date >= Date.today }.sort\n end",
"def upcoming_games_all\n (upcoming_games_host | upcoming_games_player).sort\n end",
"def recent_games\n fetch_games\n end",
"def get_live_... | [
"0.7211162",
"0.67502177",
"0.63929147",
"0.6380601",
"0.63174814",
"0.62400067",
"0.6207179",
"0.60426956",
"0.59061146",
"0.58968693",
"0.5854843",
"0.58430606",
"0.58421797",
"0.5803042",
"0.5759193",
"0.57239175",
"0.5720758",
"0.5704603",
"0.5675906",
"0.5610017",
"0.559... | 0.0 | -1 |
Return domain rating. It is integer number between 0 and 7. | def stars
load_page("http://#{@domain}/").css('#tdLogo img').first['src']
.match(/en_logo(\d)s/).captures.first.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_rating\n 10\n end",
"def rating\n if self.rating_sum > 0 && self.rating_count > 0\n (self.rating_sum / self.rating_count).round(2)\n end\n end",
"def rating\n 0\n end",
"def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25... | [
"0.68154806",
"0.66514105",
"0.6613564",
"0.65973663",
"0.6572545",
"0.65617937",
"0.6529795",
"0.6497438",
"0.6496938",
"0.6446792",
"0.6433318",
"0.64039046",
"0.63941765",
"0.6391707",
"0.63635236",
"0.6362082",
"0.63335645",
"0.6307441",
"0.62747705",
"0.62743276",
"0.627... | 0.0 | -1 |
Method to load game announces by filter | def calendar(filter = { status: 'Coming', zone: 'Real' })
page = load_page @cal_url, filter
page_number = parse_max_page(page, 'GameCalendar.aspx')
return parse_calendar_page(page) if filter.key? :page
1.upto(page_number).flat_map do |i|
page = load_page @cal_url, filter.merge(page: i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def announces\n load_page(\"http://#{@domain}/\").css('#boxCenterComingGames #lnkGameTitle')\n .map { |a| parse_game(a) }\n end",
"def load_ats(required)\n load_from(\"store:ats\", get_at_words_count, required)\n end",
"def index\n @announces = Announce.al... | [
"0.62463206",
"0.5196281",
"0.5147411",
"0.5086854",
"0.4997523",
"0.49708095",
"0.48240405",
"0.48011333",
"0.47893932",
"0.47841692",
"0.4775869",
"0.47602972",
"0.47549286",
"0.47432545",
"0.47379357",
"0.47254524",
"0.47082007",
"0.47081244",
"0.4707825",
"0.46697628",
"0... | 0.49407116 | 6 |
Method to load list of countries, regions and cities available to use in filters. | def calendar_regions
@regions ||= parse_countries(load_page(@cal_url))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelisted_filters_for_countries\n country_slugs = @params[:countries] || []\n @regions.each do |region|\n country_slugs = country_slugs.concat(region[:countries])\n end\n if country_slugs.empty?\n []\n else\n Country.where(slug: country_slugs)\n end\n end... | [
"0.74773073",
"0.6907863",
"0.6771901",
"0.6688041",
"0.6632351",
"0.6546253",
"0.65231377",
"0.64897394",
"0.64751667",
"0.6466227",
"0.64288926",
"0.63984245",
"0.6394222",
"0.63640076",
"0.630132",
"0.63007385",
"0.62748414",
"0.6272311",
"0.6251616",
"0.62357056",
"0.6229... | 0.6253424 | 18 |
GET /tasks/1 GET /tasks/1.json | def show
if (AppSub.exists?(params[:id]))
@appsubs = AppSub.find(params[:id])
render json: @appsubs
else
redirect_to :action => 'index'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def show\n \n @task = @project.tasks.find(params[:i... | [
"0.76096785",
"0.7555889",
"0.7456459",
"0.74471563",
"0.73451596",
"0.7336069",
"0.7332103",
"0.72564024",
"0.7243799",
"0.72252154",
"0.72077334",
"0.72030824",
"0.72028416",
"0.72028416",
"0.72028416",
"0.72028416",
"0.72028416",
"0.72028416",
"0.72028416",
"0.72028416",
"... | 0.0 | -1 |
POST /tasks POST /tasks.json | def create
if (AppSub.exists?(:sub_name => sub_params[:sub_name],:app_name => sub_params[:app_name]))
render json: '{"message": "app in this sub already exists"}'
else
@appsubs = AppSub.new(sub_params)
@appsubs.app_id=(App.find_by app_name: sub_params[:app_name]).id;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entit... | [
"0.7529737",
"0.74976224",
"0.7411092",
"0.7389878",
"0.7261207",
"0.72587913",
"0.7183996",
"0.7147952",
"0.71120256",
"0.70759165",
"0.70639485",
"0.70576006",
"0.70560944",
"0.70294535",
"0.7016957",
"0.7012058",
"0.70110804",
"0.7009976",
"0.6993863",
"0.69896185",
"0.698... | 0.0 | -1 |
PATCH/PUT /tasks/1 PATCH/PUT /tasks/1.json | def update
@appsubs = AppSub.find(params[:id])
if @appsubs.update(sub_params)
head :no_content
else
render json: @appsubs.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n task = Task.find(params[:id])\n if task.update(t... | [
"0.7446562",
"0.7293086",
"0.7265396",
"0.7265396",
"0.71397257",
"0.70778626",
"0.70257324",
"0.6966163",
"0.6963022",
"0.69535804",
"0.6911542",
"0.6907889",
"0.6907889",
"0.6907889",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",
"0.6897803",... | 0.0 | -1 |
DELETE /tasks/1 DELETE /tasks/1.json | def destroy
@appsubs = AppSub.find(params[:id])
@appsubs.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |f... | [
"0.78326327",
"0.75876695",
"0.7564121",
"0.75633883",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7529625",
"0.7488168",
"0.7488168",
"0.7488168",
"0.7488168",
... | 0.0 | -1 |
Returns the Event for this Stamp. | def event
MailCannon::Event.from_code(self.code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event\n @event\n end",
"def event\n @event ||= build_event\n end",
"def event\n @event ||= build_event\n end",
"def event\n @event ||= ::Event.find(self.id)\n end",
"def event\n fetch('esport.events')\n end",
"def name\n attributes[:event]\n end",
"def kl... | [
"0.74802095",
"0.71894985",
"0.71894985",
"0.71856105",
"0.6897338",
"0.67861325",
"0.67572695",
"0.6646091",
"0.6623964",
"0.6570579",
"0.6462598",
"0.6459252",
"0.6388882",
"0.63037324",
"0.62795156",
"0.6251102",
"0.62396306",
"0.6167396",
"0.61298496",
"0.6089065",
"0.606... | 0.0 | -1 |
random unique serial number after product save | def generate_serial_number
self.serial_number = SecureRandom.uuid
generate_serial_number if Product.find_by(serial_number: serial_number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_id\n SecureRandom.uuid\n end",
"def identifier\n SecureRandom.hex(16)\n end",
"def assign_uuid\n self.uuid = UUIDTools::UUID.random_create.to_s\n self.document_number ||= Numerator.get_number\n end",
"def generate_unique_name\n SecureRandom.uuid\n end",
"def generate_numb... | [
"0.7185183",
"0.7019581",
"0.6986026",
"0.689782",
"0.68887794",
"0.68825614",
"0.6853645",
"0.68506205",
"0.684625",
"0.6844437",
"0.6832777",
"0.6831101",
"0.6819032",
"0.6814973",
"0.6814973",
"0.6801432",
"0.67674553",
"0.6766756",
"0.67657936",
"0.67657936",
"0.6762583",... | 0.831378 | 0 |
Class level cache for to_partial_path. | def _to_partial_path
@_to_partial_path ||= "#{name.underscore.pluralize}/#{name.demodulize.underscore}".freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_partial_path\n self.class._to_partial_path\n end",
"def to_partial_path\n self.class._to_partial_path\n end",
"def virtual_path(path, partial)\n return path unless partial\n if index = path.rindex(\"/\")\n path.insert(index + 1, \"_\")\n else\n \"_#{path}... | [
"0.7281819",
"0.7159887",
"0.68143296",
"0.67981166",
"0.67260754",
"0.652912",
"0.6479134",
"0.6186984",
"0.6177597",
"0.6177597",
"0.61216694",
"0.6101591",
"0.6067784",
"0.60378397",
"0.59833056",
"0.5967401",
"0.59542644",
"0.5943318",
"0.5884961",
"0.5883519",
"0.5882977... | 0.6936852 | 2 |
Record that an object was destroyed, for later use by destroyed? | def after_destroy
super
@destroyed = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroyed(obj)\n (@destroyed ||= {})[obj.object_id] = true\n end",
"def autolog_destroyed\n autolog_event(:destroyed, orphan: true)\n end",
"def after_destroyed\n end",
"def destroyed?(obj)\n @destroyed && @destroyed[obj.object_id]\n end",
"def destroyed?\n @destro... | [
"0.78749734",
"0.7263085",
"0.70457375",
"0.6956661",
"0.6923508",
"0.6923508",
"0.6923508",
"0.6923508",
"0.68616736",
"0.6820521",
"0.6820521",
"0.6820521",
"0.6713481",
"0.6713481",
"0.6713481",
"0.6713481",
"0.6693419",
"0.653659",
"0.6533613",
"0.65208364",
"0.65208364",... | 0.66935366 | 16 |
False if the object is new? or has been destroyed, true otherwise. | def persisted?
!new_record? && @destroyed != true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroyed?\n !!@destroyed\n end",
"def new?\n !@object\n end",
"def new?\n !@object\n end",
"def destroyed?\n !!destroyed\n end",
"def destroyed?\n @destroyed ||= false\n end",
"def destroyed?\n @destroyed ||= false\n end",
"def destroyed?\n ... | [
"0.78742564",
"0.7861606",
"0.7861606",
"0.7846646",
"0.7814636",
"0.7814636",
"0.7814636",
"0.7814636",
"0.77727294",
"0.7769472",
"0.7769472",
"0.7769472",
"0.7769472",
"0.76566905",
"0.76566905",
"0.76566905",
"0.763302",
"0.75984365",
"0.74541354",
"0.7342817",
"0.7342817... | 0.7112728 | 24 |
An array of primary key values, or nil if the object is not persisted. | def to_key
[id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pk\n raise(Error, \"No primary key is associated with this model\") unless key = primary_key\n case key\n when Array\n key.collect{|k| @values[k]}\n else\n @values[key]\n end\n end",
"def primary_keys\n cached_fetch(:primary_keys){Array(primary_key)}\n ... | [
"0.70461726",
"0.6904112",
"0.6690824",
"0.6645465",
"0.6414832",
"0.63685185",
"0.62919635",
"0.62919635",
"0.619496",
"0.61821014",
"0.6166973",
"0.61458176",
"0.6111565",
"0.6111565",
"0.6092465",
"0.6061327",
"0.603876",
"0.59534186",
"0.59363174",
"0.59111553",
"0.588014... | 0.54830396 | 50 |
With the ActiveModel plugin, Sequel model objects are already compliant, so this returns self. | def to_model
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def this\n return @this if @this\n raise Error, \"No dataset for model #{model}\" unless ds = model.instance_dataset\n\n cond = if ds.joined_dataset?\n # SEQUEL5: Remove as joined model datasets are now allowed\n qualified_pk_hash\n else\n pk_hash\n end... | [
"0.64277923",
"0.6273308",
"0.622747",
"0.61825454",
"0.61825454",
"0.5886829",
"0.5886829",
"0.58396477",
"0.57824737",
"0.5753254",
"0.5719877",
"0.5719877",
"0.5719827",
"0.5689365",
"0.5630683",
"0.55865777",
"0.55862474",
"0.5585413",
"0.55636936",
"0.5501189",
"0.550097... | 0.55069625 | 21 |
returns true if record has not been saved yet | def new_record?
id.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_record?\n !_persisted_obj\n end",
"def new_record?\n !self.persisted?\n end",
"def new_record?\n !persisted?\n end",
"def new_record?\n !persisted?\n end",
"def new_record?\n !persisted?\n end",
"def persisted?\n !new_record? && !changed?\n ... | [
"0.82001126",
"0.8064828",
"0.8052895",
"0.80019015",
"0.80019015",
"0.7967176",
"0.7907606",
"0.78848714",
"0.78819376",
"0.7866451",
"0.78640056",
"0.78631973",
"0.78631973",
"0.78150684",
"0.7797816",
"0.7751791",
"0.7741471",
"0.77348745",
"0.7733926",
"0.77323294",
"0.77... | 0.0 | -1 |
An string representing the object's primary key. For composite primary keys, joins them with to_param_joiner. | def to_param
if persisted? and k = to_key
k.join(to_param_joiner)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_key_string\n key_attributes.join(' ').parameterize\n end",
"def primary_key\n @primary_key ||= @klass.primary_key.to_s\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_key\n \"#{quoted_table_name}.#{... | [
"0.7761622",
"0.77275413",
"0.7714792",
"0.7714792",
"0.7578287",
"0.7463288",
"0.72049093",
"0.7198453",
"0.7194824",
"0.719096",
"0.7189055",
"0.71767837",
"0.7167063",
"0.71420735",
"0.70845944",
"0.706944",
"0.69505775",
"0.6942707",
"0.6901287",
"0.68976444",
"0.68854123... | 0.64476633 | 60 |
Returns a string identifying the path associated with the object. | def to_partial_path
self.class._to_partial_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialized_path(object); end",
"def serialized_path(object); end",
"def to_s\n @path\n end",
"def to_s\n @path\n end",
"def to_s\n path\n end",
"def to_s\n @path\n end",
"def to_s\n @path\n end",
"def to_s\n @path\n end",
"def path_to(obj)\n ... | [
"0.7864009",
"0.7864009",
"0.7815115",
"0.78011376",
"0.7794015",
"0.7709531",
"0.7689186",
"0.7689186",
"0.75835407",
"0.75788635",
"0.7576191",
"0.7568173",
"0.74744904",
"0.73795795",
"0.73160213",
"0.72367567",
"0.7235434",
"0.7235434",
"0.7235434",
"0.7192207",
"0.716962... | 0.0 | -1 |
The string to use to join composite primary key param strings. | def to_param_joiner
DEFAULT_TO_PARAM_JOINER
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_key_string\n key_attributes.join(' ').parameterize\n end",
"def build_key(last_part)\n [scope[:id], super].compact.join(\"_\")\n end",
"def pkey_selection(table = nil)\n prefix = table ? \"#{table}.\" : \"\"\n \"#{primary_key.map { |k| \"#{prefix}`#{k}` AS '#{k}'\"... | [
"0.71287215",
"0.65808505",
"0.6478045",
"0.6387495",
"0.62977725",
"0.6283893",
"0.622337",
"0.60316914",
"0.60225636",
"0.6009306",
"0.598758",
"0.5971248",
"0.5958679",
"0.59452903",
"0.592269",
"0.5921892",
"0.591827",
"0.5914318",
"0.5872495",
"0.5872495",
"0.5872495",
... | 0.0 | -1 |
Executes the command. Broadcasts these events: :ok when everything is valid, together with the participation. :invalid if the form wasn't valid and we couldn't proceed. Returns nothing. | def call
destroy_participation_vote
broadcast(:ok, @participation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n transaction do\n @failures = {}\n update_contents_and_resort_opinions(form)\n end\n\n if @failures.any?\n broadcast(:invalid, @failures)\n else\n broadcast(:ok)\n end\n end",
"def call\n return broad... | [
"0.6995822",
"0.6982713",
"0.68221265",
"0.6734246",
"0.66096115",
"0.6516866",
"0.6291481",
"0.62754035",
"0.62662244",
"0.6098319",
"0.6017598",
"0.59426636",
"0.57981616",
"0.56944835",
"0.56658405",
"0.56471026",
"0.56118584",
"0.55927354",
"0.557432",
"0.5555891",
"0.552... | 0.0 | -1 |
GET /topics_users/1 GET /topics_users/1.json | def show
@topics_user = TopicsUser.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @topics_user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_following_topics\n topics = User.find(params[:user_id]).following_topics\n render :json => topics\n end",
"def topics(usernames)\n get(\"/1/users/topics.json\", :users => [usernames].flatten).users\n end",
"def index\n @user_topics = UserTopic.all\n end",
"def all_following_users\n... | [
"0.7250482",
"0.7181233",
"0.7031486",
"0.6963222",
"0.68611103",
"0.67538786",
"0.6748551",
"0.6734115",
"0.6722852",
"0.6721511",
"0.6518718",
"0.65090513",
"0.6506752",
"0.64003384",
"0.63992",
"0.63832533",
"0.6372093",
"0.6306832",
"0.6282125",
"0.6262929",
"0.62513787",... | 0.76173556 | 0 |
GET /topics_users/new GET /topics_users/new.json | def new
@topics_user = TopicsUser.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @topics_user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @topic = current_user.topics.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def create\n @topics_user = TopicsUser.new(:topic_id=>params[:topic_id], :user_id=>params[:user_id])\n respond_to do |format|\n ... | [
"0.79243606",
"0.75485766",
"0.747229",
"0.73932546",
"0.73546106",
"0.7253936",
"0.7253382",
"0.7253382",
"0.7253382",
"0.7253382",
"0.7253382",
"0.7151737",
"0.71355903",
"0.71067905",
"0.71054554",
"0.7031698",
"0.7027832",
"0.70262843",
"0.69909483",
"0.69685924",
"0.6937... | 0.82281697 | 0 |
POST /topics_users POST /topics_users.json | def create
@topics_user = TopicsUser.new(:topic_id=>params[:topic_id], :user_id=>params[:user_id])
respond_to do |format|
if @topics_user.save
format.html { redirect_to find_topics_url, notice: 'Topic successfully added.' }
format.json { render json: @topics_user, status: :created, locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user_topic = UserTopic.new(user_topic_params)\n\n respond_to do |format|\n if @user_topic.save\n format.html { redirect_to @user_topic, notice: 'User topic was successfully created.' }\n format.json { render :show, status: :created, location: @user_topic }\n else\n ... | [
"0.699589",
"0.6800423",
"0.6689278",
"0.6543309",
"0.6540271",
"0.65247196",
"0.6482679",
"0.6408596",
"0.64030355",
"0.63900304",
"0.63737786",
"0.6355139",
"0.63174254",
"0.6302141",
"0.62938774",
"0.62622637",
"0.62318265",
"0.6204288",
"0.6132678",
"0.610995",
"0.6095085... | 0.70461357 | 0 |
PUT /topics_users/1 PUT /topics_users/1.json | def update
@topics_user = TopicsUser.find(params[:id])
respond_to do |format|
if @topics_user.update_attributes(params[:topics_user])
format.html { redirect_to @topics_user, notice: 'Topics user was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @user_topic.update(user_topic_params)\n format.html { redirect_to @user_topic, notice: 'User topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_topic }\n else\n format.html { render :edit }\n ... | [
"0.71202374",
"0.69494754",
"0.68679404",
"0.68499273",
"0.68366075",
"0.67425716",
"0.6657552",
"0.6580514",
"0.65669537",
"0.6554556",
"0.64990634",
"0.64698416",
"0.64449286",
"0.64169794",
"0.6357749",
"0.6320527",
"0.6309593",
"0.6291134",
"0.62755525",
"0.6238191",
"0.6... | 0.7398855 | 0 |
DELETE /topics_users/1 DELETE /topics_users/1.json | def destroy
@topics_user = TopicsUser.find(params[:id])
@topics_user.destroy
respond_to do |format|
format.html { redirect_to my_topics_url, notice: 'Remove topic succeed!' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_topic.destroy\n respond_to do |format|\n format.html { redirect_to user_topics_url, notice: 'User topic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteTopic id\n \n APICall(path: \"topics/#{id}.json\",method: 'DELET... | [
"0.754712",
"0.73029554",
"0.7271947",
"0.7182711",
"0.71661615",
"0.70716566",
"0.7051659",
"0.703346",
"0.7030519",
"0.7018429",
"0.6977617",
"0.6972291",
"0.69497794",
"0.6949241",
"0.6920581",
"0.6917501",
"0.6917501",
"0.6917501",
"0.6917501",
"0.6917501",
"0.6917501",
... | 0.78433996 | 0 |
this methods feels too weak and wrong. | def find(basename)
list.include?(basename) ?
self.read_from_disk(basename) :
throw('Not Found')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def anchored; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def offences_by; end",
"def refutal()\n end",
"def internal; end",
"def same; end",
"def used?; end",
"def ... | [
"0.7486017",
"0.6566034",
"0.65214694",
"0.62923855",
"0.6164853",
"0.6164853",
"0.6164853",
"0.6164853",
"0.61272717",
"0.6025784",
"0.60136884",
"0.59634817",
"0.5873962",
"0.5827416",
"0.5817011",
"0.57992727",
"0.5794809",
"0.5794809",
"0.5768216",
"0.5747822",
"0.5747525... | 0.0 | -1 |
Prints students grouped by cohort | def print_student_list
existing_cohorts = get_cohort_list
existing_cohorts.each do |cohort|
puts "The students in the #{cohort.to_s} cohort are:"
@students.each do |student|
if student[:cohort] == cohort
puts student[:name]
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_by_cohort\n cohorts = []\n @students.each do |student|\n unless cohorts.include? student[:cohort]\n cohorts << student[:cohort]\n end\n end\n cohorts.each do |month|\n puts \"#{month} cohort:\"\n students.each_with_index do |student, index|\n if student[:cohort] == month\n ... | [
"0.8107176",
"0.8064773",
"0.78191364",
"0.7761817",
"0.77249837",
"0.7635129",
"0.7552162",
"0.75503147",
"0.7544922",
"0.7531778",
"0.7526639",
"0.74350446",
"0.74297285",
"0.7397973",
"0.73865646",
"0.7378727",
"0.73594517",
"0.73342764",
"0.73052275",
"0.722907",
"0.72251... | 0.7649072 | 5 |
Logic for column_headers for each export type | def export_column_headers(export_type = :addon_address)
unless self.accepted.include? export_type
raise ArgumentError, "Invalid export_type. Try one of these: \n \t #{self.accepted.join ' '}"
end
#todo make this private or add check for export_type
headers = self.parsed_content[0]
case expor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_headers\n use_column_headers ? columns.map(&:heading) : true\n end",
"def csv_headers\n raise NotImplementedError\n end",
"def column_headers(data)\n headers = { :types => [], :names => [] }\n\n data.map do |header|\n name = Utils.unprefix(header['name'])\n type = hea... | [
"0.73553234",
"0.70157266",
"0.66813874",
"0.66603106",
"0.66317266",
"0.6623747",
"0.659776",
"0.6540402",
"0.6516187",
"0.6505155",
"0.6494812",
"0.64886457",
"0.6485136",
"0.6465873",
"0.64211315",
"0.64196014",
"0.6411696",
"0.6382358",
"0.6357",
"0.63307416",
"0.6308727"... | 0.83014584 | 0 |
GET /termins/1 GET /termins/1.json | def show
@termin = Termin.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @termin }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @termin = Termin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @termin }\n end\n end",
"def index\n @terminarzs = Terminarz.all\n end",
"def index\n\t\t@termin = Terminarz.all(:order => 'created_at DESC')\n\tend",
"def destroy\n ... | [
"0.66523993",
"0.6480315",
"0.6382976",
"0.6332584",
"0.6223349",
"0.61679995",
"0.58842444",
"0.5854668",
"0.5764415",
"0.57432413",
"0.56781965",
"0.56748766",
"0.5635063",
"0.55911034",
"0.55531967",
"0.5514411",
"0.5514411",
"0.55108327",
"0.55092436",
"0.5509229",
"0.550... | 0.74776566 | 0 |
GET /termins/new GET /termins/new.json | def new
@termin = Termin.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @termin }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @termin = Termin.new(params[:termin])\n\n respond_to do |format|\n if @termin.save\n format.html { redirect_to @termin, notice: 'Termin was successfully created.' }\n format.json { render json: @termin, status: :created, location: @termin }\n else\n format.html { r... | [
"0.75744635",
"0.68876183",
"0.67761034",
"0.67529637",
"0.6721049",
"0.66839004",
"0.6673111",
"0.6644565",
"0.6644565",
"0.6613647",
"0.66125405",
"0.6609478",
"0.6605929",
"0.6605929",
"0.659977",
"0.6585091",
"0.65749484",
"0.65687704",
"0.6562174",
"0.6558203",
"0.654989... | 0.8053478 | 0 |
POST /termins POST /termins.json | def create
@termin = Termin.new(params[:termin])
respond_to do |format|
if @termin.save
format.html { redirect_to @termin, notice: 'Termin was successfully created.' }
format.json { render json: @termin, status: :created, location: @termin }
else
format.html { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @terminarz = Terminarz.new(terminarz_params)\n\n respond_to do |format|\n if @terminarz.save\n format.html { redirect_to @terminarz, notice: 'Terminarz was successfully created.' }\n format.json { render :show, status: :created, location: @terminarz }\n else\n form... | [
"0.6511384",
"0.64238125",
"0.6205436",
"0.59421515",
"0.58541644",
"0.5830588",
"0.5805205",
"0.5531025",
"0.5516914",
"0.55096585",
"0.55043274",
"0.549659",
"0.5491037",
"0.54290277",
"0.54263455",
"0.5416002",
"0.54142094",
"0.5348045",
"0.53465956",
"0.5271226",
"0.52640... | 0.72198546 | 0 |
PUT /termins/1 PUT /termins/1.json | def update
@termin = Termin.find(params[:id])
respond_to do |format|
if @termin.update_attributes(params[:termin])
format.html { redirect_to @termin, notice: 'Termin was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @termin = Termin.new(params[:termin])\n\n respond_to do |format|\n if @termin.save\n format.html { redirect_to @termin, notice: 'Termin was successfully created.' }\n format.json { render json: @termin, status: :created, location: @termin }\n else\n format.html { r... | [
"0.6386113",
"0.62208",
"0.6174401",
"0.6124222",
"0.57638955",
"0.5707722",
"0.5598836",
"0.55739063",
"0.5537467",
"0.5504435",
"0.54983324",
"0.5477274",
"0.5472967",
"0.5426562",
"0.5425809",
"0.54223293",
"0.5416955",
"0.5369492",
"0.5356489",
"0.5341756",
"0.5323779",
... | 0.7180205 | 0 |
DELETE /termins/1 DELETE /termins/1.json | def destroy
@termin = Termin.find(params[:id])
@termin.destroy
respond_to do |format|
format.html { redirect_to termins_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @terminarz.destroy\n respond_to do |format|\n format.html { redirect_to terminarzs_url, notice: 'Terminarz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_tenant_circle(args = {... | [
"0.696051",
"0.68382066",
"0.6801691",
"0.67106575",
"0.6680146",
"0.6674916",
"0.6653369",
"0.66507745",
"0.6644909",
"0.6638376",
"0.66344726",
"0.6617857",
"0.65899485",
"0.6573741",
"0.6562855",
"0.6559746",
"0.6555325",
"0.6543112",
"0.6535545",
"0.65281236",
"0.6524768"... | 0.76176965 | 0 |
GET /orders GET /orders.json | def index
@orders = current_customer.try(:orders).order(date: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n ... | [
"0.83267236",
"0.815406",
"0.80041754",
"0.7947603",
"0.7846487",
"0.7823147",
"0.78028905",
"0.76992875",
"0.76980406",
"0.7682792",
"0.7682792",
"0.7682792",
"0.7682792",
"0.76827645",
"0.75880665",
"0.7574349",
"0.756171",
"0.7531827",
"0.74860185",
"0.7432208",
"0.7369724... | 0.0 | -1 |
GET /orders/1 GET /orders/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def index\n @orders = Order.order(\"id\").all\n\n resp... | [
"0.7554187",
"0.7488565",
"0.7475228",
"0.73777765",
"0.73714006",
"0.7341344",
"0.73384553",
"0.73168725",
"0.73018956",
"0.7291244",
"0.7291244",
"0.7291244",
"0.7291244",
"0.72911215",
"0.7281374",
"0.7266143",
"0.72498786",
"0.7228276",
"0.7213504",
"0.71842283",
"0.71261... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_order
@order = Order.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 order_params
params.require(:order).permit()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.shepherd_mailer.password_reset.subject | def password_reset(shepherd)
@shepherd = shepherd
mail to: shepherd.email, subject: "Password reset"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset_notice (email, accounts)\n @from = Bolt::Config.email_from\n @recipients = email\n @subject = \"Reset your password for #{Bolt::Config.application_name}\"\n @body = {:accounts => accounts}\n end",
"def forgot_password(user)\n setup_email(user)\n subject \"Pass... | [
"0.6716346",
"0.65993583",
"0.6577311",
"0.65342104",
"0.652989",
"0.6513245",
"0.6482341",
"0.64283997",
"0.6424556",
"0.6422543",
"0.6404799",
"0.6357062",
"0.63203406",
"0.63133824",
"0.6301189",
"0.6300384",
"0.6300044",
"0.62994015",
"0.6296661",
"0.62940603",
"0.6290390... | 0.6165986 | 33 |
Generate a lexer instance. | def initialize(src, filename = nil, initial_lineno = 1, comment: false, single_quote: false)
optionable_init binding()
@src = src
@file = filename
@line = initial_lineno
@col = 1
@fib = Fiber.new(&method(:lex))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n raise 'Au contraire, mon frere. No lexer instances will be running around.'\n end",
"def initialize(options = {})\n @options = Lexer.defaults.merge(options)\n reset\n end",
"def lexer(op=nil)\n return @lexer if op.nil?\n @lexers[op.to_sym]\n end",
"def initialize(inpu... | [
"0.6807625",
"0.6360805",
"0.62784076",
"0.6206052",
"0.618148",
"0.618148",
"0.6071194",
"0.6043438",
"0.6011354",
"0.599536",
"0.589911",
"0.5818438",
"0.5818438",
"0.5818438",
"0.5818438",
"0.58150333",
"0.57860905",
"0.5782377",
"0.57205176",
"0.57166606",
"0.5694593",
... | 0.5270744 | 51 |
Returns filename of lexing subject. | def filename
@file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject\n\t\tlink = self.links.find {|link| link.llabel[0] == ?S } or return nil\n\t\treturn link.lword.sub( /\\.[np]$/, '' )\n\tend",
"def filename\n @__lexer.filename\n end",
"def filename\n if original_filename.present?\n \"#{model.story.slug}-#{secure_token}.#{file.extension}\"\n end... | [
"0.6941709",
"0.6639778",
"0.6450906",
"0.64315605",
"0.64307827",
"0.63727456",
"0.63427764",
"0.6339174",
"0.6311631",
"0.63060087",
"0.6299923",
"0.62638175",
"0.6259859",
"0.62505704",
"0.62219757",
"0.61850417",
"0.6182578",
"0.6168828",
"0.6166126",
"0.6139569",
"0.6139... | 0.5847786 | 68 |
GET /tasks or /tasks.json | def index
#binding.pry
if params[:sort_expired_at]
#@tasks = Task.all.order(expired_at: :desc)
@tasks = current_user.tasks.page(params[:page]).per(PER).order(expired_at: :desc)
elsif params[:sort_priority]
#@tasks = Task.all.order(priority: :desc)
@tasks = current_user.tasks.page(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def index\n # GET /tasks\n @tasks = Task.all\n end",
"def tasks_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.tasks_get ...'\n ... | [
"0.7532662",
"0.7170146",
"0.70539886",
"0.70490366",
"0.7041225",
"0.6999935",
"0.6963649",
"0.69378513",
"0.692819",
"0.6868948",
"0.6868948",
"0.6868948",
"0.68433535",
"0.6840866",
"0.6837937",
"0.68377566",
"0.68377566",
"0.68377566",
"0.68377566",
"0.68377566",
"0.68377... | 0.0 | -1 |
GET /tasks/1 or /tasks/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def get_task\n @task = @current_user.tasks.find(params[:id])\n head 404 and return unless @task\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def show\n @task = Task[params[:id]]\n\n ... | [
"0.7341129",
"0.721575",
"0.7110176",
"0.70889103",
"0.7039673",
"0.70228446",
"0.6980746",
"0.69669926",
"0.6936293",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
"0.6936095",
... | 0.0 | -1 |
POST /tasks or /tasks.json | def create
#binding.pry
@task = current_user.tasks.new(task_params) #1
#binding.pry
#@task.tagging_ids.build
#@task = Task.new(task_params)
#@task.user_id = current_user.id #1と同じ意味(association使ってない)
#respond_to do |format|
if @task.save
redirect_to task_path(@task.id), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render j... | [
"0.7268535",
"0.717493",
"0.71400195",
"0.71334976",
"0.7084802",
"0.7079791",
"0.7057359",
"0.6988835",
"0.69781363",
"0.6913902",
"0.68908507",
"0.6871712",
"0.6863563",
"0.6839375",
"0.68256986",
"0.68256986",
"0.68256986",
"0.68256986",
"0.6822469",
"0.68047833",
"0.68047... | 0.0 | -1 |
PATCH/PUT /tasks/1 or /tasks/1.json | def update
#binding.pry
respond_to do |format|
if @task.update(task_params)
format.html { redirect_to @task, notice: "Task was successfully updated." }
format.json { render :show, status: :ok, location: @task }
else
format.html { render :edit, status: :unprocessable_entity }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def update\n task = Task.find(params[:id])\n if task.update(t... | [
"0.7519484",
"0.7457246",
"0.7330742",
"0.7330742",
"0.72682106",
"0.72032315",
"0.72018063",
"0.715693",
"0.71517575",
"0.71080583",
"0.71080583",
"0.71080583",
"0.71080583",
"0.71080583",
"0.71080583",
"0.71080583",
"0.71080583",
"0.71033895",
"0.71033895",
"0.71033895",
"0... | 0.6775069 | 89 |
DELETE /tasks/1 or /tasks/1.json | def destroy
@task.destroy
respond_to do |format|
format.html { redirect_to tasks_url, notice: "Task was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |f... | [
"0.7763837",
"0.7501929",
"0.7478803",
"0.747828",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.742595",
"0.7424186",
"0.74118066",
"0.74118066",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_task
@task = Task.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def task_params
params.require(:task).permit(:title, :content, :expired_at, :status, :priority, tag_ids: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
capitalized and ends with an exclamation point. My solution best practice | def greet(name)
"Hello #{name.capitalize}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excite\n @name.upcase + '!!'\n end",
"def exclamation?\n self.end_with?(\"!\")\n end",
"def exclamation?\n self.end_with?(\"!\")\n end",
"def exclamation?\n self.end_with?(\"!\")\n end",
"def exclamation(str)\n\n str.gsub(/!/, \"\")\nend",
"def exclamation?\n if self.end_with?(\"!... | [
"0.7322346",
"0.71219546",
"0.71219546",
"0.71219546",
"0.70162237",
"0.6948754",
"0.6674502",
"0.6659229",
"0.6659163",
"0.6554695",
"0.6551824",
"0.6515328",
"0.65015125",
"0.65015125",
"0.65015125",
"0.65015125",
"0.6483568",
"0.6480453",
"0.64711124",
"0.6445653",
"0.6422... | 0.0 | -1 |
Transforms a module name for use in a file path | def module_name_for_path(module_name)
module_name.underscore
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_name(module_path)\n dir_name = File.dirname(module_path)\n base_name = File.basename(module_path, '.*')\n dir_name == '.' ? base_name.camelize : \"#{dir_name}/#{base_name}\".camelize\n end",
"def filename2module(slice_file)\n File.basename(slice_file, '.rb').gsub('-', '_').cam... | [
"0.7047375",
"0.69776475",
"0.6917033",
"0.68323845",
"0.65701866",
"0.65595835",
"0.65595835",
"0.635875",
"0.635633",
"0.6326772",
"0.6310991",
"0.6281707",
"0.62288773",
"0.62061894",
"0.61963105",
"0.6155354",
"0.6103536",
"0.6042263",
"0.6036829",
"0.6029335",
"0.6002009... | 0.74370074 | 0 |
So we don't get puts to test output | def silenced
$stdout = StringIO.new
yield
ensure
$stdout = STDOUT
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stdouts; end",
"def should_print?\n !@suppress_output\n end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def real_puts message = \"\"\n $stdout.puts message\n end",
"def sputs(str)\n puts str unless @simple_out... | [
"0.69189674",
"0.67930496",
"0.6791756",
"0.6791756",
"0.6791756",
"0.6791756",
"0.6791756",
"0.6791756",
"0.67897177",
"0.6698585",
"0.6663314",
"0.6593508",
"0.6553716",
"0.6491276",
"0.6476425",
"0.6451843",
"0.6443892",
"0.6420688",
"0.6420688",
"0.63771164",
"0.63750595"... | 0.0 | -1 |
TODO trap Oj JSON errors FIXME common code with the pagerduty gateway, move to shared module | def send_pagerduty_event(opts = {})
event = { 'service_key' => opts[:service_key],
'incident_key' => opts[:incident_key],
'event_type' => opts[:event_type],
'description' => opts[:description] }
uri = URI::HTTPS.build(:host => 'events.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_error; end",
"def send_to_pagerduty(alert)\n # This creates and updates alerts from nagios.\n # It requires the following json data (at a minimum):\n # {\n # \"service_key\": @alert_api_key, # this comes from the CONTACTPAGER var passed by nagios\n # \"inicident_key\": @problemid, # th... | [
"0.6131463",
"0.60708755",
"0.5927232",
"0.5879076",
"0.5877905",
"0.5877905",
"0.5828958",
"0.58059585",
"0.58021474",
"0.57982033",
"0.5767288",
"0.57494533",
"0.5738607",
"0.5733819",
"0.5715713",
"0.5688995",
"0.56476474",
"0.5645673",
"0.5637194",
"0.5631249",
"0.5631249... | 0.0 | -1 |
TODO buffer if not connected? | def announce(msg)
@lock.synchronize do
unless @muc_clients.empty?
@muc_clients.each_pair do |room, muc_client|
muc_client.say(msg)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buffer; end",
"def buffer; end",
"def buffer; end",
"def connected?; end",
"def connected?; end",
"def connected?; end",
"def read_buffer; end",
"def initialize_buffered_io; end",
"def communicates?; !disconnected? end",
"def buffered_messages; end",
"def active\n @buffering\n end"... | [
"0.6640483",
"0.6640483",
"0.6640483",
"0.65874594",
"0.65874594",
"0.65874594",
"0.6539785",
"0.64801115",
"0.6417226",
"0.63939834",
"0.63268566",
"0.632493",
"0.632493",
"0.632493",
"0.632493",
"0.632493",
"0.6290202",
"0.6282617",
"0.6277863",
"0.6226526",
"0.611075",
"... | 0.0 | -1 |
included class can defined method notify_publishability_upchain!() to define additional notification chain and must define method check_publishing_rules() that add to publishing_errors | def check_publishing_rules
raise Exception.new("check_publishing_rules needs to be redefined by including class: #{self.class}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enforce_publishing_validation!\n @enforce_publishing_validation = true\n end",
"def publish!\n raise 'Not implemented!'\n end",
"def publishing_requirements\n\t\tif is_published\n\t\t\terrors.add :first_name, I18n.t('models.profile.name_and_company.missing') if (first_name.blank? || last_na... | [
"0.71565014",
"0.6326933",
"0.60648936",
"0.6044602",
"0.5998983",
"0.59870046",
"0.5983206",
"0.59628075",
"0.58846956",
"0.58621156",
"0.5849984",
"0.5849984",
"0.5810728",
"0.5765199",
"0.57219017",
"0.5708958",
"0.5706855",
"0.56739396",
"0.56615776",
"0.5656604",
"0.5641... | 0.795027 | 0 |
validation: trigger by calling enforce_publishing_validation! on model | def enforce_publishing_validation!
@enforce_publishing_validation = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_publishing_rules\n raise Exception.new(\"check_publishing_rules needs to be redefined by including class: #{self.class}\")\n end",
"def publish_changes\n return unless resource.valid?\n private_publish resource\n end",
"def valid_for_publish\n\t\tvalid = true\n \tif structural_set.nil... | [
"0.6766191",
"0.67361385",
"0.6593682",
"0.65325046",
"0.6461334",
"0.639071",
"0.63716054",
"0.6361726",
"0.6285678",
"0.6267555",
"0.62661654",
"0.62582844",
"0.62380064",
"0.62191963",
"0.62191963",
"0.6212744",
"0.6188127",
"0.6167869",
"0.61476785",
"0.6136509",
"0.61354... | 0.8730563 | 0 |
GET /items GET /items.json | def index
@items = Item.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def index\n @items =... | [
"0.79562956",
"0.7546286",
"0.74375594",
"0.7434485",
"0.73975587",
"0.7358414",
"0.7358414",
"0.7358414",
"0.7358414",
"0.7357372",
"0.7313286",
"0.73129123",
"0.7311041",
"0.7306297",
"0.7281173",
"0.7273615",
"0.72629416",
"0.72484964",
"0.72301924",
"0.71767205",
"0.71181... | 0.66965467 | 87 |
GET /items/1 GET /items/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n item = I... | [
"0.7736526",
"0.7547988",
"0.74948645",
"0.73696035",
"0.7328169",
"0.7293223",
"0.7287578",
"0.71326286",
"0.71247333",
"0.71196556",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"... | 0.0 | -1 |
POST /items POST /items.json | def create
@item = Item.new(item_params)
@category = Category.find(params[:category]) unless params[:category].nil?
respond_to do |format|
if @item.save
@category.items << @item if @category
current_user.items << @item
format.html { redirect_to @item, notice: 'Item was successf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { ... | [
"0.7971939",
"0.7285761",
"0.7231758",
"0.721958",
"0.71792215",
"0.71131957",
"0.7062943",
"0.7053179",
"0.6988855",
"0.69712186",
"0.6903009",
"0.68806237",
"0.6871792",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6839645",
... | 0.0 | -1 |
PATCH/PUT /items/1 PATCH/PUT /items/1.json | def update
redirect_to(root_url) && return if @user && @user.id != current_user.id
@category = Category.find(params[:category]) unless params[:category].nil?
respond_to do |format|
if @item.update(item_params)
@category.items << @item if @category
format.html { redirect_to @item, notic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n\n #update the item of request_item\n if (par... | [
"0.7441431",
"0.7142895",
"0.71380275",
"0.7023379",
"0.7001047",
"0.69935596",
"0.69790584",
"0.69358337",
"0.6920435",
"0.687061",
"0.6831513",
"0.68161917",
"0.68039197",
"0.68039197",
"0.67934185",
"0.67872036",
"0.67872036",
"0.67872036",
"0.67872036",
"0.67872036",
"0.6... | 0.0 | -1 |
DELETE /items/1 DELETE /items/1.json | def destroy
if @user.id != current_user.id
redirect_to '/'
else
@item.destroy
respond_to do |format|
format.html { redirect_to root_url, notice: 'Item was successfully destroyed.' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def destroy\n @item = Item.find(params[:id... | [
"0.7906849",
"0.76885504",
"0.7604411",
"0.7585917",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.7547388",
"0.7539847",
"0.7528851",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_item
@item = Item.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 item_params
params.require(:item).permit(:name, :content, :price, :unit, :location, :rent, :avatar)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
updated daily between 2.15 p.m. and 3.00 p.m. CET | def refresh_exchange_rates
CurrencyConverter.cache_current_exchange_rates!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date() updated; end",
"def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end",
"def update_mountain_ranges_cron\n begin\n date = Date.today.prev_day.to_s.delete(\"-\").to_i\n update_mountain_ranges(date)\n rescue Exception => e\n puts \"bra_meteo_france indisponible \"\... | [
"0.6437743",
"0.6328427",
"0.5960997",
"0.5939035",
"0.582634",
"0.58143437",
"0.5763916",
"0.5709819",
"0.56821084",
"0.56740415",
"0.56722265",
"0.5661249",
"0.5658069",
"0.5632629",
"0.5625644",
"0.56144196",
"0.5610171",
"0.557516",
"0.55677253",
"0.5558388",
"0.5544949",... | 0.0 | -1 |
Will have to validate arguments at some point | def phpbb( args )
puts "\n\t\t\tCStyl -- phpbb analysis"
"-".hline
db = args.fetch :db
mysql = Mysql.new( db[:host], db[:user], db[:pass], db[:db_name] )
rs = mysql.query("select poster_id,post_subject,post_text from phpbb_posts where length(post_tex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_args (args)\n\t# todo\nend",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments_valid?\n true \n # to do\n end",
"def arguments_valid?\n true\n end",
"def validate(args = {})\n end",
"def arguments_valid?\n true \n end",
"def args; en... | [
"0.7961628",
"0.7561869",
"0.7561869",
"0.7561869",
"0.72686577",
"0.72486085",
"0.72168905",
"0.7208649",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"0.71559155",
"... | 0.0 | -1 |
algorithm use breadth first search | def knight_moves(position_start,position_end)
move = [-2,-1,1,2,].product([-2,-1,1,2]).select do |x,y| x.abs != y.abs end
board = (0..7).map do
[Array.new(8,nil)]
end
queue= []
queue.push(position_start)
notFind = true
while... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #Setting up initial steps \r\n if !search_queue.empty?\r\n search_queue.each do... | [
"0.7708737",
"0.7384521",
"0.7360996",
"0.7262891",
"0.72244847",
"0.7211692",
"0.72112316",
"0.7141405",
"0.7140441",
"0.71143967",
"0.7109182",
"0.7026341",
"0.69911826",
"0.69751126",
"0.6940207",
"0.6922968",
"0.69024247",
"0.6863297",
"0.6856875",
"0.68184966",
"0.681807... | 0.0 | -1 |
Temporary hack because all routes require authentication in Fulcrum | def disable_devise_for_cloudfuji_controllers!
puts "Disabling devise auth protection on cloudfuji controllers"
::Cloudfuji::DataController.instance_eval { before_filter :authenticate_user!, :except => [:index] }
::Cloudfuji::EnvsController.instance_eval { before_filter :authenticate_user!, :ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth\n end",
"def auth\n end",
"def unauthenticated\n end",
"def skip_authorization; end",
"def require_no_authentication\n end",
"def web\n _auth(false)\n end",
"def home\n authenticate!\n end",
"def require_auth\n redirect_to login_path unless authenticated?\n end",
"def user... | [
"0.6751081",
"0.6751081",
"0.6691343",
"0.655302",
"0.64368784",
"0.63600826",
"0.62613785",
"0.62470347",
"0.6246645",
"0.623086",
"0.6229114",
"0.6200103",
"0.6190793",
"0.6190793",
"0.6152423",
"0.6152267",
"0.6131631",
"0.610005",
"0.60874075",
"0.607641",
"0.60696757",
... | 0.0 | -1 |
Let's see how much you've got now... | def calculate_balance(month)
plus = month[:income].sum
minus = month[:expenses].sum
plus - minus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def stats; end",
"def stats; end",
"def percent_passes; end",
"def percent_passes; end",
"def total; end",
"def num_known\n @num_known ||= worth_counting { count_known }\nend",
"def measure\n\t\t1\n\tend",
"def total_time; end",
"def counting\n puts \"hard to do right\"\n... | [
"0.67176074",
"0.67021394",
"0.67021394",
"0.6513376",
"0.6513376",
"0.6486386",
"0.6422887",
"0.6411202",
"0.6350286",
"0.62915546",
"0.6273256",
"0.62529564",
"0.6210636",
"0.6204597",
"0.61850905",
"0.6179464",
"0.6156877",
"0.6152296",
"0.6144652",
"0.6136861",
"0.6132980... | 0.0 | -1 |
GET /users GET /users.xml | def index
@users = User.order(:name).paginate :page =>params[:page],:per_page => 10
@cart = current_cart
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_users\n self.class.get('/users')\n end",
"def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end",
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n en... | [
"0.7657926",
"0.76263535",
"0.7490723",
"0.7470033",
"0.74069935",
"0.7387062",
"0.7248585",
"0.72448206",
"0.721343",
"0.7211573",
"0.7210826",
"0.71998477",
"0.71764135",
"0.71337295",
"0.71337295",
"0.71337295",
"0.7132803",
"0.7132208",
"0.7130947",
"0.7115423",
"0.709057... | 0.0 | -1 |
GET /users/1 GET /users/1.xml | def show
@user = User.find(params[:id])
@cart = current_cart
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end",
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end",
"def index\n @users = User.all\n render :xml ... | [
"0.7207758",
"0.71160614",
"0.7054628",
"0.70484746",
"0.6916555",
"0.6916146",
"0.6915502",
"0.6890011",
"0.68641984",
"0.68633956",
"0.6853434",
"0.68511736",
"0.68511736",
"0.68511736",
"0.6828291",
"0.68280435",
"0.68278646",
"0.68065727",
"0.6801009",
"0.6786165",
"0.676... | 0.0 | -1 |
GET /users/new GET /users/new.xml | def new
@user = User.new
@cart = current_cart
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end"... | [
"0.77330446",
"0.7697235",
"0.7628986",
"0.75933844",
"0.7592385",
"0.75490505",
"0.7536828",
"0.7530958",
"0.7530958",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
"0.7508645",
... | 0.0 | -1 |
POST /users POST /users.xml | def create
@user = User.new(params[:user])
@cart = current_cart
respond_to do |format|
if @user.save
Cart.create(:user_id => @user.id)
if session[:user_id] && User.find_by_id(session[:user_id]).name == "admin"
format.html { redirect_to(users_url, :alert => "User #{@user.name... | {
"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 post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def CreateUser params = {}\n \n ... | [
"0.71678036",
"0.6338476",
"0.6224363",
"0.61548346",
"0.6088076",
"0.6079892",
"0.60536397",
"0.60094374",
"0.5940851",
"0.59352076",
"0.59313804",
"0.59236705",
"0.59006655",
"0.58788294",
"0.5857175",
"0.58492076",
"0.58427423",
"0.58262956",
"0.58248377",
"0.5821217",
"0.... | 0.0 | -1 |
PUT /users/1 PUT /users/1.xml | def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
if User.find_by_id(session[:user_id]).name == "admin"
format.html { redirect_to(users_url, :alert => "User #{@user.name} was successfully updated.") }
else
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :a... | [
"0.6635185",
"0.6546547",
"0.6365357",
"0.6259716",
"0.6222739",
"0.62200224",
"0.6171894",
"0.6131896",
"0.61308634",
"0.61273426",
"0.6110778",
"0.6106035",
"0.61059886",
"0.60566944",
"0.603521",
"0.603402",
"0.6016474",
"0.6012614",
"0.6003888",
"0.5980906",
"0.59783655",... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.xml | def destroy
@user = User.find(params[:id])
begin
@user.destroy
flash[:alert] = "User #{@user.name} deleted"
rescue Exception => e
flash[:alert] = e.message
end
respond_to do |format|
format.html { redirect_to(users_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def delete_users\n delete(users_path)\n end",
"def destroy\n @user = ... | [
"0.7177572",
"0.7172003",
"0.70611066",
"0.70607454",
"0.7031703",
"0.70033735",
"0.69609874",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",
"0.6912414",... | 0.0 | -1 |
Translate a word to its phonetic alphabet equivalent | def to_phonetic(word)
string = ""
word.each_char {|letter|
string += Letters[letter.upcase.ord - "A".ord][1] + " "
}
return string[0..-2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate word\n\n\tsplit = word.split(\" \")\n\tlatin = \"\"\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\n\n\n\tsplit.each do |string|\n\n\t\ta = 0\n\t\tconsts = 0\n\n\t\twhile vowels.include?(string[a]) === false\n\t\t\tconsts = consts + 1\n\t\t\ta = a + 1\n\t\tend\n\n\t\tif string[consts -1] === \"q... | [
"0.7491817",
"0.74143124",
"0.73681045",
"0.732374",
"0.7193738",
"0.7102742",
"0.703711",
"0.70202893",
"0.6982565",
"0.6940975",
"0.69236284",
"0.6897841",
"0.68840784",
"0.6863229",
"0.6816618",
"0.6807697",
"0.6780053",
"0.6777554",
"0.67768455",
"0.67637813",
"0.6762327"... | 0.6669481 | 34 |
Translate a sequence of phonetic alphabet code words to their alphabetic equivalent | def from_phonetic(str)
string = ""
for word in str.split(" ")
string += word[0].upcase
end
return string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate s\n \n words = s.split.map{|word|\n if %w(a e i o u).include?(word[0])\n word << \"ay\"\n elsif %w(thr sch squ).include?(word[0..2])\n word[3..-1] << (word[0..2] << \"ay\")\n elsif %w(ch qu br th).include?(word[0..1])\n word[2..-1] << word[0... | [
"0.7044385",
"0.7029036",
"0.6955653",
"0.6948912",
"0.6901087",
"0.69005954",
"0.6897976",
"0.68639094",
"0.6853675",
"0.68194664",
"0.6819439",
"0.6812757",
"0.67761475",
"0.6757768",
"0.6752249",
"0.67471045",
"0.67352945",
"0.67216164",
"0.66940373",
"0.6693085",
"0.66779... | 0.0 | -1 |
If the line starts with A2P, call to_phonetic on the rest of the substring If the line starts with P2A, call from_phonetic on the rest of the substring Otherwise, return nothing. | def translate(line)
if line[0, 3].upcase == "A2P"
return to_phonetic(line[4..-1])
elsif line[0, 3].upcase == "P2A"
return from_phonetic(line[4..-1])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(line)\r\n if line[0,3] == \"A2P\"\r\n return to_phonetic(line[4,line.length])\r\n end\r\n if line[0,3] == \"P2A\"\r\n return from_phonetic(line[4,line.length])\r\n end\r\n \r\n return nil\r\n end",
"def test_p2a_not_found\n alpha = \"FOXMART ALFA INDIGO LARGE\"\n... | [
"0.73856175",
"0.5599336",
"0.5291099",
"0.5264401",
"0.5163784",
"0.5096464",
"0.50855136",
"0.502628",
"0.5023042",
"0.50213987",
"0.50153244",
"0.5015283",
"0.5006143",
"0.4983015",
"0.4967499",
"0.49672565",
"0.49176428",
"0.4898002",
"0.48841867",
"0.4794388",
"0.4788532... | 0.7657642 | 0 |
Implements abstract base's requirement. It looks in the Chef::Config.cookbook_path file hierarchy for the requested file. | def get_filename(filename)
location = File.join(cookbooks[cookbook_name].root_dir, filename) if cookbooks.key?(cookbook_name)
raise "File #{filename} does not exist for cookbook #{cookbook_name}" unless location && File.exist?(location)
location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cookbook_file?(cbf, cookbook=nil)\n has_source?(cbf, :files, cookbook)\n end",
"def cookbook_path\n @cookbook_paths.first\n end",
"def validate_cookbook!(path)\n unless File.cookbook?(path)\n raise CookbookNotFound, \"#{dependency.name} not found at #{to_s}\"\n end\n\n ... | [
"0.68373686",
"0.67487395",
"0.67214745",
"0.65889543",
"0.6503262",
"0.6503262",
"0.6473427",
"0.6463662",
"0.6405895",
"0.63826543",
"0.6258492",
"0.6219261",
"0.61762375",
"0.6166792",
"0.61571956",
"0.6145498",
"0.6138357",
"0.61130035",
"0.61072046",
"0.6087591",
"0.6078... | 0.0 | -1 |
returns a entity object for passing to functions what container and what object to manipulate | def get_container_key(control_name, parent_name)
container_key = OpenStruct.new
container_key.container = nil
container_key.map_key = nil
container_key.modal_or_applet = nil
container_key.control_name = control_name
parsed_name = parse_parent_name(parent_name)
container_key.container = get_container(par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_container\n @entity_container ||= EntityContainer.new(self)\n end",
"def entity_container\n @entity_container ||= EntityContainer.new(self)\n end",
"def wrapped_entity\n self\n end",
"def entity_factory\n @entity_factory\n end",
"def entity_factory\n @e... | [
"0.7094969",
"0.7094969",
"0.69012964",
"0.6822129",
"0.6822129",
"0.6669037",
"0.6650095",
"0.634469",
"0.6333446",
"0.63184637",
"0.6303898",
"0.61693865",
"0.61178255",
"0.6089356",
"0.6026498",
"0.59918004",
"0.597153",
"0.5969984",
"0.59514815",
"0.5950267",
"0.5926624",... | 0.0 | -1 |
def collect_tests(tests = nil, testcases = nil) | def add_test(filepath, testcases = nil)
@tests << Test.new(filepath, testcases, @options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cases; end",
"def test_cases(*args, **kwargs, &block)\n if block_given?\n process_block(&block)\n elsif kwargs.length.positive?\n process_kwargs(**kwargs)\n elsif args.length.positive?\n add_tests(*args)\n else\n @tests || {}\n end\n end",
"def doTests( *tests )\n ... | [
"0.7265221",
"0.7106709",
"0.7053912",
"0.6761521",
"0.6761521",
"0.6500917",
"0.6464875",
"0.64376956",
"0.6408981",
"0.6393513",
"0.6393513",
"0.6376683",
"0.6340699",
"0.63138115",
"0.6296986",
"0.6295406",
"0.6284558",
"0.6275935",
"0.62403476",
"0.6238492",
"0.6238492",
... | 0.61218166 | 28 |
GET /stories/1/tasks/1 GET /stories/1/tasks/1.xml | def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @task }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_stories(id, options = {})\n request(:get, \"tasks/#{id}/stories\", options)\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end",
"def index\n get_tasks\n get_priorities\n get_users\n\n ... | [
"0.7105491",
"0.67208135",
"0.669099",
"0.65815073",
"0.64722437",
"0.6463199",
"0.643944",
"0.6428022",
"0.6382996",
"0.6334761",
"0.63339317",
"0.63339317",
"0.63339317",
"0.63339317",
"0.63339317",
"0.6316785",
"0.63014024",
"0.6246223",
"0.62169075",
"0.62159127",
"0.6215... | 0.6263104 | 17 |
GET /stories/1/tasks/new GET /stories/1/tasks/new.xml | def new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @task }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re... | [
"0.72562456",
"0.7025522",
"0.7025522",
"0.7025522",
"0.7025522",
"0.69213307",
"0.6824653",
"0.68054307",
"0.6719033",
"0.6692319",
"0.6672762",
"0.6656726",
"0.6608628",
"0.65962917",
"0.65962917",
"0.65962917",
"0.65896255",
"0.65721744",
"0.6528442",
"0.6517244",
"0.65074... | 0.71565044 | 1 |
POST /stories/1/tasks POST /stories/1/tasks.xml | def create
if params[:cancel]
redirect_to(@story)
else
respond_to do |format|
if @story.save
format.html { redirect_to(@story, :notice => 'task was successfully created.') }
format.xml { render :xml => @task, :status => :created, :location => @task }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @task = Task.new(params[:task])\n @sprint = Sprint.find(@task.sprint_id)\n\n respond_to do |format|\n if @task.save\n flash[:notice] = 'Task was successfully created.'\n format.html { redirect_to(@task) }\n format.xml { render :xml => @task, :status => :created, :lo... | [
"0.6448368",
"0.6440873",
"0.6342439",
"0.6297757",
"0.62599254",
"0.62146956",
"0.6214568",
"0.61969054",
"0.6195398",
"0.61395377",
"0.6119366",
"0.6073951",
"0.60678416",
"0.60625273",
"0.60581064",
"0.6056984",
"0.60425824",
"0.6039985",
"0.6038545",
"0.60267633",
"0.6020... | 0.0 | -1 |
PUT /stories/1/tasks/1 PUT /stories/1/tasks/1.xml | def update
if params[:cancel]
redirect_to(@story)
else
respond_to do |format|
if @task.update_attributes(params[:task])
format.html { redirect_to(@story, :notice => 'Task was successfully updated.') }
format.xml { head :ok }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @task = Task.find(params[:id])\n @sprint = Sprint.find(@task.sprint_id)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to(@task) }\n format.xml { head :ok }\n e... | [
"0.62451875",
"0.61798424",
"0.61607164",
"0.6148663",
"0.61423385",
"0.6140542",
"0.6140542",
"0.6132338",
"0.61026615",
"0.60768706",
"0.60227215",
"0.6022428",
"0.60186523",
"0.5988259",
"0.5953789",
"0.5910177",
"0.59004235",
"0.5879525",
"0.58749247",
"0.5848885",
"0.584... | 0.6139664 | 7 |
DELETE /stories/1/tasks/1 DELETE /stories/1/tasks/1.xml | def destroy
@task.destroy
respond_to do |format|
format.html { redirect_to(tasks_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end",
"def delete_story(id)\n @client.raw('delete', \"/content/stories/#{i... | [
"0.69403136",
"0.67927676",
"0.6787149",
"0.676515",
"0.6746203",
"0.6729713",
"0.6729713",
"0.6729713",
"0.6729713",
"0.665317",
"0.66450596",
"0.66163594",
"0.65779215",
"0.6568849",
"0.6567719",
"0.6567719",
"0.6567719",
"0.6561938",
"0.6556181",
"0.654523",
"0.65182364",
... | 0.6710613 | 9 |
GET /teamcommitments/1 GET /teamcommitments/1.xml | def show
@teamcommitment = Teamcommitment.find(params[:id])
team = Team.find_by_id(@teamcommitment[:team_id])
project = Project.find_by_id(@teamcommitment[:project_id])
teamname = team.name unless team.nil?
projectname = project.name unless project.nil?
@output = { :teamname => teamname,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @commitments = Commitment.all\n @title = \"Commitments\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commitments }\n end\n end",
"def new\n @teamcommitment = Teamcommitment.new\n\n respond_to do |format|\n format.html # n... | [
"0.6461112",
"0.6388444",
"0.61788845",
"0.5975228",
"0.5957336",
"0.58220506",
"0.5801756",
"0.5800053",
"0.5774213",
"0.5763551",
"0.5763551",
"0.57509923",
"0.57275915",
"0.5669196",
"0.565169",
"0.56339854",
"0.5624396",
"0.5613064",
"0.56075305",
"0.5607072",
"0.5591452"... | 0.6254563 | 2 |
GET /teamcommitments/new GET /teamcommitments/new.xml | def new
@teamcommitment = Teamcommitment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @teamcommitment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @commitment = Commitment.new\n @title = \"New Commitment\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commitment }\n end\n end",
"def create\n @teamcommitment = Teamcommitment.new(params[:teamcommitment])\n\n respond_to do |forma... | [
"0.7190019",
"0.7036686",
"0.6849406",
"0.6841729",
"0.6836062",
"0.6836062",
"0.679132",
"0.66169006",
"0.659123",
"0.6564806",
"0.65193945",
"0.65034676",
"0.6491903",
"0.64757115",
"0.644497",
"0.64037764",
"0.6389344",
"0.63847685",
"0.6366639",
"0.6366639",
"0.6359101",
... | 0.7841436 | 0 |
POST /teamcommitments POST /teamcommitments.xml | def create
@teamcommitment = Teamcommitment.new(params[:teamcommitment])
respond_to do |format|
@teamcommitment.status = Teamcommitment::StatusProposed
if @teamcommitment.save
flash[:notice] = 'Commitment was successfully created.'
format.html { redirect_to(session[:original_uri]) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @teamcommitment = Teamcommitment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @teamcommitment }\n end\n end",
"def create\n @internship_committee = InternshipCommittee.new(internship_committee_params)\n\n respond_to do |format|\n ... | [
"0.5826433",
"0.5790251",
"0.5739878",
"0.56035376",
"0.55839235",
"0.55641216",
"0.5521148",
"0.5497773",
"0.5489046",
"0.5398655",
"0.53853774",
"0.5374284",
"0.534613",
"0.53285956",
"0.5292761",
"0.52915907",
"0.52721274",
"0.5259976",
"0.5256894",
"0.5247587",
"0.5241222... | 0.6697624 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.