query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Return the entity for the given code point or name +point_or_name+. source://kramdown//lib/kramdown/utils/entities.rb334 | def entity(point_or_name); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity(name)\n # These are the valid entities and their validators are defined\n if [\"Taluk\",\"Panchayat\",\"Place\"].include?(name)\n return name.constantize, name.downcase+\"_params\", name.downcase\n else\n return nil\n end\n end",
"def get_entity( name, parent_c... | [
"0.6850996",
"0.6223368",
"0.5862044",
"0.5767504",
"0.54414725",
"0.5394591",
"0.5384727",
"0.53341097",
"0.5312583",
"0.52810585",
"0.52768296",
"0.521545",
"0.5202799",
"0.51103914",
"0.5108255",
"0.5097626",
"0.50950974",
"0.50831383",
"0.50731385",
"0.5064551",
"0.503980... | 0.7954123 | 0 |
Escape the special HTML characters in the string +str+. The parameter +type+ specifies what is escaped: :all all special HTML characters except the quotation mark as well as entities, :text all special HTML characters except the quotation mark but no entities and :attribute all special HTML characters including the quo... | def escape_html(str, type = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape_html(str, type = :all)\n str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m }\n end",
"def escape_html(str)\n\t\t\t#table = HTML_ESC # optimize\n\t\t\t#str.gsub(/[&\"<>]/) {|s| table[s] }\n\t\t\treturn str\n\t\tend",
"def escape_html( string )\n\t\t\treturn \"nil\" if string.n... | [
"0.87306046",
"0.6625273",
"0.64837503",
"0.64837503",
"0.6451524",
"0.6367661",
"0.63450086",
"0.63414353",
"0.6306099",
"0.6234855",
"0.6173434",
"0.61491007",
"0.61271805",
"0.6112833",
"0.60939795",
"0.607207",
"0.6067362",
"0.60635066",
"0.60222423",
"0.6001454",
"0.5990... | 0.7626595 | 1 |
Return the HTML representation of the attributes +attr+. source://kramdown//lib/kramdown/utils/html.rb44 | def html_attributes(attr); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes(attr)\n return '' if attr.empty?\n\n attr.map do |k, v|\n v.nil? || (k == 'id' && v.strip.empty?) ? '' : \" #{k}=\\\"#{escape_html(v.to_s, :attribute)}\\\"\"\n end.join('')\n end",
"def html_attr(str)\n '\"' + str.gsub(/[&<>\"]/) {|ch| HTML_ATTR_ESCAPE_HA... | [
"0.7969514",
"0.7139553",
"0.71388316",
"0.6851227",
"0.66984785",
"0.6626081",
"0.6464293",
"0.6434695",
"0.6337037",
"0.6318707",
"0.6251863",
"0.62484103",
"0.62225974",
"0.62173116",
"0.6196902",
"0.6139329",
"0.6125275",
"0.6078094",
"0.6075083",
"0.6075083",
"0.6059811"... | 0.817378 | 0 |
Revert the position to one saved by save_pos. source://kramdown//lib/kramdown/utils/string_scanner.rb56 | def revert_pos(data); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revert_pos(data)\n self.pos = data[0]\n @previous_pos, @previous_line_number = data[1], data[2]\n end",
"def position_string\n # Oddly, String#delete is non-destructive, unlike Array#delete\n @padded_board_string.delete('*').scan(/..../).reverse.join\n end",
"def cleanupPosition(p... | [
"0.6966103",
"0.61710536",
"0.604987",
"0.60009456",
"0.5952824",
"0.58150023",
"0.58150023",
"0.58060724",
"0.5797898",
"0.5797898",
"0.5797898",
"0.57558066",
"0.57538366",
"0.569892",
"0.56771815",
"0.5656948",
"0.5639175",
"0.56355745",
"0.5575105",
"0.5575039",
"0.554535... | 0.6863002 | 1 |
The start line number. Used for nested StringScanners that scan a substring of the source document. The kramdown parser uses this, e.g., for span level parsers. source://kramdown//lib/kramdown/utils/string_scanner.rb21 | def start_line_number; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_line_number=(_); end",
"def start_line_for(code_object)\n if code_object.command? || opts.present?(:'base-one')\n 1\n else\n code_object.source_line.nil? ? 1 :\n (code_object.source_line - code_object.doc.lines.count)\n end\n end",
"def compute_line_index\n ... | [
"0.7498265",
"0.68917525",
"0.6772231",
"0.6764973",
"0.67344815",
"0.6655831",
"0.6614809",
"0.65535533",
"0.6455089",
"0.6450324",
"0.64286715",
"0.6359351",
"0.6326042",
"0.63174963",
"0.6293908",
"0.6293908",
"0.6293908",
"0.6293908",
"0.6293908",
"0.6293908",
"0.6293908"... | 0.7541828 | 1 |
Delete the file on disk associated with the given identifier. | def delete(id:)
path = file_path(id)
storage_object_id, file_category = id_from_path(path)
delete_from_moab(storage_object_id, path, file_category)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(id)\n file = get_file(id)\n delete_file(file) unless file.nil?\n end",
"def delete_file(filename)\r\n DeleteFile.new(filename)\r\n end",
"def delete(filename); end",
"def delete(filename)\n File.delete File.join(@base_path, filename)\n end",
"def delete... | [
"0.7753455",
"0.75347674",
"0.7480596",
"0.733458",
"0.730662",
"0.7261648",
"0.71939886",
"0.7140739",
"0.7138197",
"0.7138197",
"0.71220696",
"0.7097918",
"0.7006054",
"0.69826937",
"0.6961377",
"0.695251",
"0.69200426",
"0.6918295",
"0.6911334",
"0.6868734",
"0.68632686",
... | 0.77041084 | 1 |
this makes sure that the user who is deleting and edit that Photoblog belongs to them, it will check see if the photoblog is yours if not you are back to the photos path | def correct_user
@photo = current_user.photos.find_by(id: params[:id])
redirect_to photos_path, notice: "Not Your PhotoBlog Dude, So You Cannot edit or delete this Photoblog." if @photo.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @user = User.find_by_id(params[:id])\n logged_in_user = session[:user_hash][\"username\"]\n if logged_in_user != @user.sunet and not \n User.is_power_user(logged_in_user)\n # permission denied\n flash[:error] = \"Your privileges don't allow you to edit profiles other than your o... | [
"0.68911445",
"0.68911445",
"0.66872865",
"0.6585169",
"0.65286225",
"0.6413091",
"0.63877916",
"0.63769144",
"0.63739026",
"0.6364625",
"0.6348241",
"0.6323254",
"0.6315091",
"0.6295549",
"0.6294799",
"0.6281951",
"0.622029",
"0.61824775",
"0.6167336",
"0.61659575",
"0.61575... | 0.7734518 | 0 |
Use the .values method to collect all of the values of the grocery type keys (:dairy, :vegetables, :meat, :grains). The method should return a onedimensional (or "flat") array that only includes the values (groceries such as "milk" and "carrots") without their keys. | def second_challenge
groceries = {
dairy: ["milk", "yogurt", "cheese"],
vegetable: ["carrots", "broccoli", "cucumbers"],
meat: ["chicken", "steak", "salmon"],
grains: ["rice", "pasta"]
}
groceries.values.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_winter_holiday_supplies(holiday_supplies)\n holiday_supplies[:winter].values.flatten\nend",
"def values\n candy.values\n end",
"def values; distinct_values.map(&:value).compact; end",
"def brands_array\n ($products_hash['items'].map { |toy| toy['brand'] }).uniq\nend",
"def values(key)\n ... | [
"0.56968075",
"0.56512284",
"0.5635136",
"0.55399734",
"0.54000294",
"0.53403",
"0.53366864",
"0.53139293",
"0.5282584",
"0.52620107",
"0.52439934",
"0.52202815",
"0.52202815",
"0.52202815",
"0.52202815",
"0.5173351",
"0.5165489",
"0.5164946",
"0.5108356",
"0.5077115",
"0.506... | 0.6306369 | 0 |
GET /accidentes GET /accidentes.json | def index
@accidentes = Accidente.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @identities = Identity.all\n\n render json: @identities\n end",
"def expiracion\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def identities\n render json: current_... | [
"0.624255",
"0.6158073",
"0.61507326",
"0.6138176",
"0.61191577",
"0.6101391",
"0.61010253",
"0.60651475",
"0.6058778",
"0.60339236",
"0.6028149",
"0.6004951",
"0.60036534",
"0.5998545",
"0.5983443",
"0.59714586",
"0.5967912",
"0.5941996",
"0.59269434",
"0.5910533",
"0.590614... | 0.6985516 | 0 |
POST /accidentes POST /accidentes.json | def create
@accidente = Accidente.new(accidente_params)
render action: :new unless @accidente.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @accion = Accion.new(accion_params)\n\n respond_to do |format|\n if @accion.save\n format.html { redirect_to @accion, notice: 'Accion creada exitosamente.' }\n format.json { render action: 'show', status: :created, location: @accion }\n else\n format.html { render ... | [
"0.652013",
"0.5895201",
"0.5847785",
"0.583884",
"0.58007175",
"0.58005655",
"0.5789756",
"0.57837325",
"0.5772176",
"0.57651883",
"0.575323",
"0.5750407",
"0.5730321",
"0.5710307",
"0.56849843",
"0.5668426",
"0.56612164",
"0.56494635",
"0.5648141",
"0.5647909",
"0.5645647",... | 0.6237946 | 1 |
DELETE /accidentes/1 DELETE /accidentes/1.json | def destroy
@accidente.destroy
respond_to do |format|
format.html { redirect_to accidentes_url, notice: 'Accidente was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @accion.destroy\n respond_to do |format|\n format.html { redirect_to accions_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @accident_item.destroy\n respond_to do |format|\n format.html {... | [
"0.7169705",
"0.7108639",
"0.6962973",
"0.6882811",
"0.6845923",
"0.6828928",
"0.6817945",
"0.6790488",
"0.6789484",
"0.67807055",
"0.6768389",
"0.6768265",
"0.6755551",
"0.67128545",
"0.66978383",
"0.6694797",
"0.6691981",
"0.6691981",
"0.6685902",
"0.668336",
"0.66791105",
... | 0.7359874 | 0 |
Spud site ids getter | def spud_site_ids
if @spud_site_ids.nil?
@spud_site_ids = spud_post_sites.collect{ |site| site.spud_site_id }
end
return @spud_site_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spud_site_ids=(site_ids)\n\t\tif site_ids.is_a?(Array)\n\t\t\t@spud_site_ids = site_ids.collect{ |id| id.to_i }\n\t\telse\n\t\t\traise 'Site ids must be an Array'\n\t\tend\n\tend",
"def sharepoint_ids\n return @sharepoint_ids\n end",
"def get_sites\n\t\ts = get_admin_section \"sys... | [
"0.69944745",
"0.66566867",
"0.6398866",
"0.6395107",
"0.6282639",
"0.6214205",
"0.61405754",
"0.6124763",
"0.61203855",
"0.6048213",
"0.60348314",
"0.60057384",
"0.60056716",
"0.5992277",
"0.5974304",
"0.59538126",
"0.59402007",
"0.59224313",
"0.5897582",
"0.58619815",
"0.58... | 0.82730377 | 0 |
Spud site ids setter | def spud_site_ids=(site_ids)
if site_ids.is_a?(Array)
@spud_site_ids = site_ids.collect{ |id| id.to_i }
else
raise 'Site ids must be an Array'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spud_site_ids\n\t\tif @spud_site_ids.nil?\n\t\t\t@spud_site_ids = spud_post_sites.collect{ |site| site.spud_site_id }\n\t\tend\n\t\treturn @spud_site_ids\n\tend",
"def site_id=(value)\n @site_id = value\n end",
"def sharepoint_ids=(value)\n @sharepoint_ids = value\n... | [
"0.74038255",
"0.7030946",
"0.68315667",
"0.6496073",
"0.64073306",
"0.64073306",
"0.63194376",
"0.6141984",
"0.6054207",
"0.6045327",
"0.5897091",
"0.5843985",
"0.584386",
"0.58398783",
"0.5827313",
"0.58149844",
"0.5792403",
"0.5789005",
"0.57707053",
"0.57553375",
"0.57553... | 0.81486374 | 0 |
Tries to load data from OpenExchangeRates for the given rate. Won't do anything if there's no data available for that date in OpenExchangeRates (short) history. | def load_data(date)
doc = Yajl::Parser.parse(open(rates_source(date)).read)
base_currency = doc['base'] || 'USD'
doc['rates'].each do |currency, rate|
# Don't use set_rate here, since this method can only be called from
# get_rate, which already aquired a mutex.
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_rates(date)\n data = retrieve_rates date\n rate_snapshot = JSON.parse data\n exit 1 unless rate_snapshot['base'].downcase == 'usd' # TODO: better error handling\n\n rate_date = DateTime.strptime(rate_snapshot['timestamp'].to_s, '%s').to_date\n\n upload_usd_rates(rate_date, rate_snapshot['rates'])\n ... | [
"0.6889252",
"0.6619852",
"0.6268327",
"0.6268327",
"0.6259666",
"0.61682063",
"0.60285634",
"0.59789395",
"0.59077513",
"0.5872574",
"0.58360463",
"0.5815869",
"0.5787438",
"0.5732337",
"0.5716017",
"0.57057405",
"0.56714934",
"0.56420076",
"0.55915916",
"0.5556599",
"0.5554... | 0.7310385 | 0 |
Check if a word is one of the configured rejects to ignore | def reject?(word)
config.rejects.include?(word)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_be_skipped?(word)\n reject?(word) || hashtag?(word) || uri?(word) || mention?(word)\n end",
"def invalid_word? word\n\t\tstopwords_list.collect{ |w| w if w.include? word.to_s.strip }.uniq.any?\n\tend",
"def mysql_ignore(words)\r\n return false unless words\r\n return true if supers... | [
"0.708476",
"0.6778514",
"0.64825577",
"0.64362985",
"0.64096063",
"0.6368557",
"0.63258076",
"0.62613773",
"0.6245944",
"0.62441945",
"0.62298906",
"0.6187067",
"0.61741894",
"0.6142993",
"0.61231923",
"0.6096196",
"0.60630137",
"0.6057357",
"0.6050647",
"0.6047702",
"0.6039... | 0.832672 | 0 |
Check if a word is a hashtag. | def hashtag?(word)
return false if config.include_hashtags
!(word =~ /#(\w+)/).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hashtag(str)\n return false if str.strip.empty?\n str = str.split(\" \").map(&:capitalize).join.prepend(\"#\")\n str.length > 30 ? false : str\nend",
"def hashtag(str)\n return_string = \"#\"\n words = str.split()\n\n words.each do |word|\n word_index = 0\n word.chars.each do |char|... | [
"0.71941006",
"0.7146409",
"0.69511306",
"0.683687",
"0.6498755",
"0.64839417",
"0.64464307",
"0.6326533",
"0.6268126",
"0.62550443",
"0.6239227",
"0.62217045",
"0.6156451",
"0.6148024",
"0.611809",
"0.60501057",
"0.6028367",
"0.59997946",
"0.59966916",
"0.59223497",
"0.58561... | 0.8943438 | 0 |
Check if a word is a URI. Uses URIregexp to match URIs | def uri?(word)
return false if config.include_uris
!(word =~ URI.regexp).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uriish? str\n (str.include? ':') && (UriSniffRx.match? str)\n end",
"def is_uri?(source)\n !!(source =~ URI_REGEXP)\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
... | [
"0.76445943",
"0.7524367",
"0.74579215",
"0.74579215",
"0.74417084",
"0.740697",
"0.73404336",
"0.7307246",
"0.7260797",
"0.72423816",
"0.7142389",
"0.7142136",
"0.7137949",
"0.7006741",
"0.6968623",
"0.692938",
"0.6913344",
"0.6886654",
"0.68382955",
"0.67733145",
"0.6700803... | 0.8370963 | 0 |
Finds the shortest path form the _source_ to every other vertex of the graph. Returns the shortest paths map that contains the shortest path (if it exists) from the source to any vertex of the graph. | def shortest_paths(source)
init(source)
relax_edges
PathBuilder.new(source, @visitor.parents_map).paths(@graph.vertices)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_path\n dist, previous = Hash.new(Infinity), {}\n dist[@source] = 0.0\n queue = @graph.vertex_set.dup\n\n until queue.empty?\n u = queue.min { |a,b| dist[a.name] <=> dist[b.name] }\n break if dist[u.name].infinite?\n queue.delete(u)\n\n u.each_edge do |e, v|\n... | [
"0.7579126",
"0.75771856",
"0.7236127",
"0.7144063",
"0.7015905",
"0.69843316",
"0.6980914",
"0.69167995",
"0.6792238",
"0.67859924",
"0.66944426",
"0.6686809",
"0.6675672",
"0.66239876",
"0.6621126",
"0.66187644",
"0.66102654",
"0.6543173",
"0.63965595",
"0.63952535",
"0.637... | 0.78730774 | 0 |
function for extracting the buddies | def extract_buddies(path)
blist_xml = ""
buddies = ""
print_status("Reading blist.xml file...")
### modified to use pidgin_path, which already has .purple in it
blist_file = @client.fs.file.new(path + "\\blist.xml", "rb")
until blist_file.eof?
blist_xml << blist_file.read
end
blist_file.close
doc = (REXML::D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buys\n orders[:buys]\n end",
"def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.sele... | [
"0.6377777",
"0.6198202",
"0.6132588",
"0.61107355",
"0.5993325",
"0.59645975",
"0.5921704",
"0.59141344",
"0.59131825",
"0.5912964",
"0.5895537",
"0.58663625",
"0.5839939",
"0.5837141",
"0.58155686",
"0.5812912",
"0.5801119",
"0.5795234",
"0.5786405",
"0.5782139",
"0.5774964... | 0.6579316 | 0 |
Function to enumerate the users if running as SYSTEM | def enum_users(os)
users = []
user = @client.sys.config.getuid
path4users = ""
sysdrv = @client.fs.file.expand_path("%SystemDrive%")
if os =~ /Windows 7|Vista|2008/
path4users = sysdrv + "\\users\\"
path2purple = "\\AppData\\Roaming\\"
else
path4users = sysdrv + "\\Documents and Settings\\"
path2purple =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum_users\n\tos = @client.sys.config.sysinfo['OS']\n\tusers = []\n\tuser = @client.sys.config.getuid\n\tpath4users = \"\"\n\tsysdrv = @client.fs.file.expand_path(\"%SystemDrive%\")\n\n\tif os =~ /7|Vista|2008/\n\t\tpath4users = sysdrv + \"\\\\users\\\\\"\n\t\tprofilepath = \"\\\\AppData\\\\Local\\\\VMware\\\\... | [
"0.7661958",
"0.70077425",
"0.68071336",
"0.6773763",
"0.6597722",
"0.6345329",
"0.6345329",
"0.6250108",
"0.62308115",
"0.6025262",
"0.6006564",
"0.5987482",
"0.5983143",
"0.5983143",
"0.5982099",
"0.597539",
"0.5952162",
"0.5926803",
"0.59138334",
"0.58977234",
"0.58474517"... | 0.73381805 | 1 |
Test to make sure a nonleter noncharacter is removed from id | def test_remove_non_letter_character_from_id
result = remove_punctuation("sh&awn")
assert_equal("shawn", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_punctuation_from_id\nresult = remove_punctuation(\"sha?wn\")\nassert_equal(\"shawn\", result)\t\nend",
"def test_delete_existing_message_id\n content = 'test palindrome'\n message = Message.create content: content, is_palindrome: Palindrome.palindrome?(content).to_s\n\n delete \"/message... | [
"0.64088595",
"0.62516224",
"0.60973006",
"0.6075322",
"0.5779523",
"0.57628953",
"0.5743983",
"0.5734862",
"0.5733863",
"0.5728769",
"0.5725073",
"0.5719113",
"0.56942594",
"0.56931305",
"0.5689859",
"0.5686871",
"0.5656815",
"0.56475246",
"0.56208026",
"0.56160396",
"0.5588... | 0.6304727 | 1 |
Test to confirm every other letter capitalized with even number length id | def test_to_capitalize_every_other_character_with_even_id_length
result = capitalize_every_other("landon")
assert_equal("LaNdOn", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_capitalize_every_other_character_with_odd_id_length\nresult = capitalize_every_other(\"shawn\")\nassert_equal(\"ShAwN\", result)\nend",
"def test_capital_letters\n v = Verify.new\n return_code = v.verify_second_pipeset('2As3', '2As3')\n assert_equal 1, return_code\n end",
"def test_to_cap... | [
"0.760193",
"0.68334144",
"0.6821282",
"0.67502296",
"0.67442566",
"0.6658044",
"0.66286325",
"0.6612318",
"0.6538171",
"0.65326345",
"0.65203357",
"0.6519799",
"0.64699376",
"0.6450865",
"0.6426675",
"0.63771886",
"0.6374905",
"0.6374303",
"0.63658375",
"0.6364434",
"0.63471... | 0.7805735 | 0 |
Test to confirm every other letter capitalized with some capitalized characters | def test_to_capitalize_every_other_character_with_capitalized_characters
result = capitalize_every_other("SHaWn")
assert_equal("ShAwN", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_capitalize_every_other_character_with_even_id_length\nresult = capitalize_every_other(\"landon\")\nassert_equal(\"LaNdOn\", result)\nend",
"def test_capital_letters\n v = Verify.new\n return_code = v.verify_second_pipeset('2As3', '2As3')\n assert_equal 1, return_code\n end",
"def test_3_r... | [
"0.7634113",
"0.7529102",
"0.7446098",
"0.74344003",
"0.74178207",
"0.7371045",
"0.73275036",
"0.7248689",
"0.7209058",
"0.72027063",
"0.71849966",
"0.7168847",
"0.7098444",
"0.709561",
"0.70634866",
"0.6964634",
"0.6952889",
"0.68987995",
"0.6892706",
"0.6879316",
"0.6862019... | 0.7842174 | 0 |
Test to confirm every other letter capitalized with odd number length id | def test_to_capitalize_every_other_character_with_odd_id_length
result = capitalize_every_other("shawn")
assert_equal("ShAwN", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_capitalize_every_other_character_with_even_id_length\nresult = capitalize_every_other(\"landon\")\nassert_equal(\"LaNdOn\", result)\nend",
"def test_to_capitalize_every_other_character_with_capitalized_characters\nresult = capitalize_every_other(\"SHaWn\")\nassert_equal(\"ShAwN\", result)\nend",
"d... | [
"0.77504516",
"0.68037313",
"0.67794526",
"0.67644966",
"0.666261",
"0.6648547",
"0.66058165",
"0.65963197",
"0.65763485",
"0.6551726",
"0.6547437",
"0.65332323",
"0.6501478",
"0.64991415",
"0.6475643",
"0.6449153",
"0.6449123",
"0.64127403",
"0.63825166",
"0.63790005",
"0.63... | 0.7573846 | 1 |
Test to confirm name generator output gives expected output for a valid input | def test_name_generator_with_valid_input
result = name_generator("SH&$3aw(,n")
assert_equal("xX_ShAwN_Xx", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_name_generator_with_invalid_input\nresult = name_generator(\"89&6\\n 5.,?<\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def test_name_generator_with_nil\nresult = name_generator(\"\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lowe... | [
"0.79572743",
"0.738345",
"0.68745744",
"0.65365005",
"0.6487747",
"0.64501643",
"0.64450103",
"0.64311266",
"0.64203054",
"0.6344209",
"0.63096714",
"0.629343",
"0.62903416",
"0.61871296",
"0.6151005",
"0.6127153",
"0.61251915",
"0.61162955",
"0.6080572",
"0.6080507",
"0.608... | 0.7843347 | 1 |
Test to confirm name generator output gives expected output for nil input | def test_name_generator_with_nil
result = name_generator("")
assert_equal("Inavalid ID. Please enter new ID with only lower case letters.", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_name_generator_with_invalid_input\nresult = name_generator(\"89&6\\n 5.,?<\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def test_name_generator_with_valid_input\nresult = name_generator(\"SH&$3aw(,n\")\nassert_equal(\"xX_ShAwN_Xx\", result)\nend",... | [
"0.68112487",
"0.6618601",
"0.643468",
"0.64299476",
"0.6328121",
"0.6325073",
"0.63202477",
"0.6301352",
"0.6293458",
"0.62664074",
"0.6241788",
"0.6220351",
"0.61446214",
"0.61320645",
"0.6099375",
"0.6096164",
"0.6085004",
"0.60541195",
"0.6027971",
"0.60036653",
"0.599669... | 0.809704 | 0 |
Test to confirm name generator output gives expected output for invalid input | def test_name_generator_with_invalid_input
result = name_generator("89&6\n 5.,?<")
assert_equal("Inavalid ID. Please enter new ID with only lower case letters.", result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_name_generator_with_valid_input\nresult = name_generator(\"SH&$3aw(,n\")\nassert_equal(\"xX_ShAwN_Xx\", result)\nend",
"def test_name_generator_with_nil\nresult = name_generator(\"\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend",
"def test_username_wi... | [
"0.7539099",
"0.7514286",
"0.68381304",
"0.67764014",
"0.6564897",
"0.6482579",
"0.6425867",
"0.636187",
"0.63354665",
"0.6333315",
"0.6331615",
"0.63212395",
"0.63146347",
"0.6294053",
"0.6281815",
"0.62735236",
"0.626366",
"0.6247601",
"0.62462366",
"0.62456006",
"0.6239605... | 0.8061815 | 0 |
Extends the EPPClient::Contactcontact_info so that the specific smallregistry's informations are processed, the additionnal informations are : one of : [:org] indicating that the contact is an organisation with the following informations : [:companySerial] the company's SIREN / RPPS / whatever serial number is required... | def contact_info(xml)
super # placeholder so that I can add some doc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_info(contact)\n super # placeholder so that I can add some doc\n end",
"def contact\n ::HubEdos::Common::Reference::Descriptor.new(@data['contact']) if @data['contact']\n end",
"def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new... | [
"0.68655604",
"0.6292246",
"0.60662687",
"0.59460694",
"0.58497345",
"0.5826407",
"0.58256036",
"0.582172",
"0.5762148",
"0.57586086",
"0.5731913",
"0.5719765",
"0.5709294",
"0.56989515",
"0.5688525",
"0.56841564",
"0.56736976",
"0.5654556",
"0.56517804",
"0.56498194",
"0.564... | 0.63690656 | 1 |
Extends the EPPClient::Contactcontact_update so that the specific afnic update informations can be sent, the additionnal informations are : [:chg] changes one of : [:org] indicating that the contact is an organisation with the following informations : [:companySerial] the company's SIREN / RPPS / whatever serial number... | def contact_update(args)
super # placeholder so that I can add some doc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @raw_contact_info = args[:raw_contact_info] if args.key?(:raw_contact_info)\n end",
"def update!(**args)\n @contact = args[:contact] if args.key?(:contact)\n @contact_type = args[:contact_type] if args.key?(:contact_type)\n end",
"def update!(**arg... | [
"0.6775345",
"0.6756919",
"0.67465925",
"0.6719646",
"0.66605943",
"0.66190743",
"0.6583792",
"0.65648264",
"0.64978814",
"0.648271",
"0.64039385",
"0.6377058",
"0.63632816",
"0.636136",
"0.63103795",
"0.62895495",
"0.6281392",
"0.6264615",
"0.6240061",
"0.6235728",
"0.623362... | 0.68763816 | 0 |
Searches for a file starting with 'name', whose extensions satisfy the given regexp's in the given directories. The file which matches the highest ordered regex is returned. | def findFile(name, dirs, regex)
dirs.each { |dn|
if(dn.directory?)
dn.opendir { |dir|
regex.each { |r|
dir.each { |ff|
if(ff != "." && ff != ".." && ff[0...name.length] == name)
ext = ff[name.length..-1]
if(ext =~ r)
return dn + ff
end
end
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_file_matching_pattern(search_dirs, pattern)\n search_dirs = [search_dirs] unless search_dirs.is_a?(Array)\n\n search_dirs.each do |d|\n matches = Dir.glob(File.join(d, pattern))\n return matches.first if matches.size > 0\n end\n return nil\n end",
"def find(name)\n # look into ... | [
"0.681028",
"0.6538875",
"0.6411976",
"0.6407495",
"0.6384688",
"0.6384688",
"0.6370842",
"0.6287401",
"0.62861633",
"0.62640256",
"0.625942",
"0.6176909",
"0.6151984",
"0.6132284",
"0.6116483",
"0.6071455",
"0.6062249",
"0.6046361",
"0.6033235",
"0.59842074",
"0.5974223",
... | 0.7569573 | 0 |
Sets up a controller for a request. | def setup_controller(controller, env, vars)
controller.env = env
controller.headers = {}
setup_controller_params(controller, env, vars)
controller.cookies = Fastr::HTTP.parse_cookies(env)
controller.app = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_controller_request_and_response\n setup_controller_request_and_response_without_vanity\n Vanity.context = @controller\n end",
"def setup_request_environment(controller_class)\n controller_class.class_eval do\n def rescue_action(e)\n raise e\n ... | [
"0.67167723",
"0.6693177",
"0.6676451",
"0.6592682",
"0.6436174",
"0.6312369",
"0.6300604",
"0.6295191",
"0.61675143",
"0.61371785",
"0.60750467",
"0.6032089",
"0.6011555",
"0.60103166",
"0.600633",
"0.600633",
"0.59772635",
"0.5932672",
"0.5887685",
"0.58805394",
"0.5846928"... | 0.7204971 | 0 |
Runs before_dispatch in all plugins. | def plugin_before_dispatch(env)
new_env = env
self.plugins.each do |plugin|
if plugin.respond_to? :before_dispatch
new_env = plugin.send(:before_dispatch, self, env)
end
end
new_env
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_before_all_hooks( env )\n env[:hooks][:before_all].each { |hook| hook.call }\n end",
"def run_before_each_hooks( env )\n env[:hooks][:before_each].each { |hook| hook.call }\n end",
"def before_dispatch(env); end",
"def run_plugins_pre_integrate_hooks\n if any_plugin_pre_integrate... | [
"0.7070142",
"0.7054101",
"0.6558446",
"0.64753115",
"0.63440716",
"0.63352376",
"0.6276784",
"0.6238913",
"0.6206541",
"0.6194312",
"0.6168831",
"0.6164669",
"0.6157872",
"0.6148644",
"0.6121313",
"0.60953236",
"0.60621136",
"0.60470176",
"0.600518",
"0.6003982",
"0.6003612"... | 0.71040326 | 0 |
Runs after_dispatch in all plugins. | def plugin_after_dispatch(env, response)
new_response = response
self.plugins.each do |plugin|
if plugin.respond_to? :after_dispatch
new_response = plugin.send(:after_dispatch, self, env, response)
end
end
new_response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after\n return nil if blue_prints.after.empty?\n\n hook_action = HookAction.new(driver,\n blue_prints.after,\n :hook_action, self, location + '[hook_action]')\n hook_action.run\n end",
"def after_all\n supe... | [
"0.6733336",
"0.6595034",
"0.6498506",
"0.64533925",
"0.64516425",
"0.6430933",
"0.6425265",
"0.63431454",
"0.6285344",
"0.6277739",
"0.6251936",
"0.62390035",
"0.62140846",
"0.6200298",
"0.6181435",
"0.61568487",
"0.61563206",
"0.61406374",
"0.6104861",
"0.60962015",
"0.6096... | 0.7050754 | 0 |
GET /biomechanical_symmetries/1 GET /biomechanical_symmetries/1.json | def show
@biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @biomechanical_symmetry }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @biomechanical_symmetry = BiomechanicalSymmetry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @biomechanical_symmetry }\n end\n end",
"def destroy\n @biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])\n @biomechanical_sy... | [
"0.58732855",
"0.56762433",
"0.5463085",
"0.5429788",
"0.5426565",
"0.53987235",
"0.53586245",
"0.5289495",
"0.5278747",
"0.5274626",
"0.5246507",
"0.5199844",
"0.5192963",
"0.51601356",
"0.5126649",
"0.5112367",
"0.5110515",
"0.5097045",
"0.5095158",
"0.5055735",
"0.5038098"... | 0.6478767 | 0 |
GET /biomechanical_symmetries/new GET /biomechanical_symmetries/new.json | def new
@biomechanical_symmetry = BiomechanicalSymmetry.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @biomechanical_symmetry }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n... | [
"0.66283655",
"0.65704393",
"0.6533935",
"0.6410435",
"0.6315793",
"0.6308777",
"0.627542",
"0.6269437",
"0.6250386",
"0.6241876",
"0.6229969",
"0.6229969",
"0.6216341",
"0.6213974",
"0.62139165",
"0.62074983",
"0.61787826",
"0.6177299",
"0.61763775",
"0.6166183",
"0.61616766... | 0.6961035 | 0 |
POST /biomechanical_symmetries POST /biomechanical_symmetries.json | def create
@biomechanical_symmetry = BiomechanicalSymmetry.new(params[:biomechanical_symmetry])
respond_to do |format|
if @biomechanical_symmetry.save
format.html { redirect_to @biomechanical_symmetry, notice: 'Biomechanical symmetry was successfully created.' }
format.json { render json:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbole_params\n params.require(:symbole).permit(:lang, :example_fr, :symbole_type, :css_class, :sound, :upload, kanji_attribute_attributes: [:value,:concept, :fr],\n kana_attribute_attributes: [:hiragana_value,:katakana_v... | [
"0.5602991",
"0.5530744",
"0.53106433",
"0.5294261",
"0.5234856",
"0.4763799",
"0.47223517",
"0.4717412",
"0.47029984",
"0.46589923",
"0.46264604",
"0.46170646",
"0.4610218",
"0.45820782",
"0.45658457",
"0.45484206",
"0.45365652",
"0.45307776",
"0.45189783",
"0.44837594",
"0.... | 0.5942458 | 0 |
PUT /biomechanical_symmetries/1 PUT /biomechanical_symmetries/1.json | def update
@biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])
respond_to do |format|
if @biomechanical_symmetry.update_attributes(params[:biomechanical_symmetry])
format.html { redirect_to @biomechanical_symmetry, notice: 'Biomechanical symmetry was successfully updated.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @symbole.update(symbole_params)\n format.html { redirect_to @symbole, notice: 'Symbole was successfully updated.' }\n format.json { render :show, status: :ok, location: @symbole }\n else\n format.html { render :edit }\n format.json {... | [
"0.57316095",
"0.5729297",
"0.5664679",
"0.55341375",
"0.53216285",
"0.5281559",
"0.5241237",
"0.5170546",
"0.51672626",
"0.5132021",
"0.51081294",
"0.5093987",
"0.50855595",
"0.5045413",
"0.5040465",
"0.5022935",
"0.4992287",
"0.49910006",
"0.49904525",
"0.49767604",
"0.4962... | 0.64080673 | 0 |
DELETE /biomechanical_symmetries/1 DELETE /biomechanical_symmetries/1.json | def destroy
@biomechanical_symmetry = BiomechanicalSymmetry.find(params[:id])
@biomechanical_symmetry.destroy
respond_to do |format|
format.html { redirect_to biomechanical_symmetries_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bio_signal = BioSignal.find(params[:id])\n @bio_signal.destroy\n\n respond_to do |format|\n format.html { redirect_to bio_signals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |for... | [
"0.6772954",
"0.6705242",
"0.66069084",
"0.6575207",
"0.64993674",
"0.6477402",
"0.63922167",
"0.6374782",
"0.63443625",
"0.6340351",
"0.6298148",
"0.62889344",
"0.62620914",
"0.6257219",
"0.6254506",
"0.62481016",
"0.6236265",
"0.6210439",
"0.61975425",
"0.6196425",
"0.61815... | 0.7513341 | 0 |
Default value for directory containing PID lock files. | def _default_locks_dir
defined?(Rails) ? Rails.root.join('tmp/pids') : Pathname.new('tmp/pids')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_pidfile\n monit_name_path('/var/run/%{name}_real.pid')\n end",
"def locks_dir\n @locks_dir || _default_locks_dir\n end",
"def lock_file_path\n @lock_file_path ||= \"#{Rails.root.to_s}/log/#{@process_name}.lock\"\n end",
"def lockfile_path\n config.pwd.join(LOCKF... | [
"0.7538626",
"0.7280818",
"0.71157926",
"0.7023322",
"0.6858486",
"0.6830345",
"0.6811383",
"0.67831516",
"0.6758305",
"0.6758305",
"0.6709369",
"0.6657077",
"0.6657077",
"0.661551",
"0.6577703",
"0.65767914",
"0.64926535",
"0.6430676",
"0.6367568",
"0.63658404",
"0.6359912",... | 0.806981 | 0 |
Path to the PID lock file backing this FileMutex instance. | def lock_file_path
File.join(self.class.locks_dir, "#{@name}.lock")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock_file_path\n @lock_file_path ||= \"#{Rails.root.to_s}/log/#{@process_name}.lock\"\n end",
"def lockfile_path\n config.pwd.join(LOCKFILE)\n end",
"def pid_path\n @pid_path.to_s\n end",
"def pid_path\n File.join(\"tmp\", \"fuseki.pid\")\n end",
"def pid_path\n #need to... | [
"0.75783557",
"0.7501662",
"0.73111755",
"0.7142563",
"0.7043315",
"0.7026902",
"0.6916616",
"0.68004984",
"0.673428",
"0.67261004",
"0.6716035",
"0.6701547",
"0.6694745",
"0.6693766",
"0.65743166",
"0.65738845",
"0.6568347",
"0.6567216",
"0.6547614",
"0.6464485",
"0.64487743... | 0.77213275 | 0 |
Attempt to acquire the mutex by obtaining a filesystem lock on the PID file. | def acquire
# Ensure the locks_dir directory exists
FileUtils.mkdir_p(self.class.locks_dir)
# Open PID file and attempt to obtain a filesystem lock (non-blocking)
@lock_file ||= File.open(lock_file_path, File::RDWR|File::CREAT, 0644)
acquired = !! @lock_file.flock(File::LOCK_EX|File::LOCK_NB)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acquire_atomic_fs_lock(name)\n times = 0\n name += '.lock'\n Dir.mkdir name, 0700\n logger.debug(\"Acquired lock #{name}\")\n yield\n rescue Errno::EEXIST\n times += 1\n logger.debug(\"Waiting for lock #{name}\")\n sleep 1\n unless times >= 10\n retry\n ... | [
"0.6913945",
"0.68105364",
"0.6526021",
"0.6290666",
"0.6176993",
"0.6170114",
"0.6169534",
"0.61503667",
"0.60848975",
"0.6067799",
"0.6062308",
"0.60352725",
"0.60180354",
"0.59909767",
"0.59645164",
"0.5912079",
"0.58769137",
"0.5872195",
"0.58651197",
"0.5815587",
"0.5793... | 0.8410547 | 0 |
Close and unset the lock file. | def close_file
@lock_file.close
@lock_file = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock\n FileUtils.rm(lock_file) if File.exist?(lock_file)\n reset!\n end",
"def unlock\n FileUtils.rm(lock_file) if File.exist?(lock_file)\n reset!\n end",
"def unlock!\n FileUtils.rm_f @path\n end",
"def release\n return unless @lock_file # Skip if we don't have a... | [
"0.8475608",
"0.84741455",
"0.8310715",
"0.8249608",
"0.8228551",
"0.8228551",
"0.8161158",
"0.7916561",
"0.7765764",
"0.7764657",
"0.7694159",
"0.74746907",
"0.7464127",
"0.7464127",
"0.74387264",
"0.73998344",
"0.7279354",
"0.7245966",
"0.72219527",
"0.71911705",
"0.7136450... | 0.84746736 | 1 |
This is to create a micropost | def create
# Create a new micropsot object
@micropost = current_user.microposts.build(micropost_params)
# Save the micropsot to the database
if @micropost.save
flash[:success] = "Micropost created!"
redirect_to root_url
else
# When there is an error in submitting a micropost, we sti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @micropost = Micropost.new\n\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Mikeropost created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n ... | [
"0.7869009",
"0.785171",
"0.7784331",
"0.77619624",
"0.7691097",
"0.7686667",
"0.7675119",
"0.7642483",
"0.7559705",
"0.75494367",
"0.75382966",
"0.7485384",
"0.7481694",
"0.7459353",
"0.74569774",
"0.7451064",
"0.74447936",
"0.7408875",
"0.73567235",
"0.7354707",
"0.73451847... | 0.7854349 | 1 |
This is to delete a micropost | def destroy
@micropost.destroy
redirect_to root_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @micropost.destroy\n redirect_back_or root_path\n end",
"def destroy\n \t@micropost.destroy\n redirect_back_or root_path\n end",
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n flash[:success] = \"Micropost deleted\"\n redirect_to request.ref... | [
"0.83085084",
"0.82437336",
"0.8222856",
"0.8219582",
"0.8175802",
"0.7970287",
"0.7925911",
"0.7870203",
"0.7861557",
"0.7778321",
"0.7739279",
"0.77095157",
"0.76762044",
"0.75594366",
"0.75594366",
"0.75131756",
"0.75091696",
"0.7446902",
"0.74434376",
"0.74091804",
"0.730... | 0.83180267 | 0 |
This is to fill in the parameters of the micropost which is the contents | def micropost_params
params.require(:micropost).permit(:content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def micropost_params\n params.require(:micropost).permit(:content, :user_id)\n end",
"def mymicropost_params\n params.require(:mymicropost).permit(:content, :user_id)\n end",
"def micropost_params\n params.require(:micropost).permit(:datecode, :user_id, :content, :mood, :is_onechance)\n ... | [
"0.699695",
"0.68787134",
"0.67865485",
"0.6708392",
"0.6659183",
"0.6658233",
"0.6652208",
"0.6645525",
"0.66390693",
"0.6637002",
"0.6571771",
"0.65645283",
"0.65645283",
"0.6559833",
"0.655504",
"0.655504",
"0.655504",
"0.655504",
"0.655504",
"0.65484315",
"0.65101576",
... | 0.70932734 | 1 |
this method update articles by taking article parameters, updated tag_ids and sub_tag_ids | def update_with_tags(article_params, tag_ids, sub_tag_ids)
# Load all tags from tag ids and load subtags of it to avoid n+1 query while fetching subtags for individual tags
tags = Tag.where(id: tag_ids).includes(:sub_tags)
# load article tags and subtags
article_tags = self.tags
article_sub_tags = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n\r\n article = Article.find(params[:id])\r\n prevTags = article.Tags\r\n if article.update(article_params)\r\n\r\n addTopic(topic_params[:topic_name].to_s,article)\r\n\r\n if prevTags != article_params[:Tags]\r\n handleTagUpdates(prevTags)\r\n addTagsAndhandleTagCount... | [
"0.70870537",
"0.6379515",
"0.6167453",
"0.60761714",
"0.6056466",
"0.60111785",
"0.601049",
"0.5937825",
"0.5926905",
"0.5884413",
"0.58704895",
"0.58533186",
"0.5824487",
"0.5819519",
"0.57973063",
"0.57442456",
"0.5729177",
"0.5727069",
"0.5715003",
"0.57141113",
"0.571211... | 0.81699514 | 0 |
Load filters Returns nothing | def load_filters
loaded_data = MultiJson.decode(
File.new(MailFilter.config.value['filter_file'], 'r').read)
loaded_data.each do |name,filter|
data = {:name => name}.merge(translate(filter))
add(data)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n end",
"def initialize_available_filters\n @@available_filters ||= {}\n end",
"def filters\n @filters ||= FiltersProvider.new... | [
"0.7438833",
"0.74232197",
"0.74232197",
"0.7273409",
"0.7171736",
"0.71422815",
"0.7109617",
"0.7109617",
"0.7042693",
"0.69758964",
"0.68891865",
"0.6833887",
"0.6812787",
"0.68120044",
"0.6730281",
"0.65607166",
"0.65319365",
"0.6508745",
"0.65046424",
"0.64994204",
"0.649... | 0.7896651 | 0 |
Delete a filter by name Returns nothing | def delete(name)
delete = get(name)
@filters = @filters - delete
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_filter(name)\n filters.delete(name)\n end",
"def destroy\n if params[:id] != '-1'\n @filter = Filter.find(params[:id])\n else\n @filter = Filter.where( :name => params[:filter][:name], :group => params[:filter][:group], :pattern => params[:filter][:pattern] ).first\n end\n\n... | [
"0.7940607",
"0.7702631",
"0.74229014",
"0.7074616",
"0.69385064",
"0.6830094",
"0.6816925",
"0.6816925",
"0.6816925",
"0.67227787",
"0.67225987",
"0.6719601",
"0.6648545",
"0.6626291",
"0.65921617",
"0.65590745",
"0.6547417",
"0.65379024",
"0.6537539",
"0.6481225",
"0.646374... | 0.82924795 | 0 |
Get a filter by name Returns filter | def get(name)
@filters.select {|f| f[:name] == name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter(filter_name)\n \n java_import (Filter_package_name + filter_name.to_s)\n\n Module.const_get(filter_name).new\n \n end",
"def filter\n @filter ||= filter_class.new default_filter\n end",
"def filter( filter_name, value )\n defined? @filters \\\n or return nil\... | [
"0.75060326",
"0.6783214",
"0.6773656",
"0.67075706",
"0.6567159",
"0.65190405",
"0.6513069",
"0.65014917",
"0.6420398",
"0.62948936",
"0.62928784",
"0.62762177",
"0.62742037",
"0.6183663",
"0.61567134",
"0.61524576",
"0.6132259",
"0.6078266",
"0.60484606",
"0.60116917",
"0.5... | 0.8059893 | 0 |
Walk the tree to assert that the current_node's traversal_id is always present and equal to it's parent's traversal_ids plus it's own ID. | def validate_traversal_ids(current_node, parent = null_node)
expect(current_node.traversal_ids).to be_present
expect(current_node.traversal_ids).to eq parent.traversal_ids + [current_node.id]
current_node.children.each do |child|
validate_traversal_ids(child, current_node)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_node_1_has_0_ancestors_after_building_ancestors_ids_attribute\n id=1\n assert_equal 0, find_node(id).ancestors.size\n assert find_node(id).update_ancestor_ids\n assert_equal 0, find_node(id).ancestors.size\n end",
"def no_loops_in_organization_relationship_graph(seen_ids = [])\n return f... | [
"0.6166572",
"0.59008074",
"0.567273",
"0.56517017",
"0.564146",
"0.56257755",
"0.5556258",
"0.54911524",
"0.54750204",
"0.54200274",
"0.5328986",
"0.5315992",
"0.52871907",
"0.5283463",
"0.5282388",
"0.52649355",
"0.5247181",
"0.5212215",
"0.5183636",
"0.518327",
"0.51829123... | 0.8265778 | 0 |
Calls a method on a list of objects in concurrent threads. | def call_threaded(objects, method_name, concurrency)
threads = []
raise 'concurrency must be > 0' if concurrency < 1
objects.each do |obj|
sleep 3 until threads.map(&:alive?).count(true) < concurrency
threads << Thread.new { obj.method(method_name).call }
end
threads.map(&:join)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_threaded(objects, method_name, concurrency)\n puts \"method_name: #{method_name}, concurrency: #{concurrency}\"\n threads = []\n raise 'concurrency must be > 0' if concurrency < 1\n objects.each do |obj|\n sleep 3 until threads.map(&:alive?).count(true) < concurrency\n threads << Thr... | [
"0.7637461",
"0.6869346",
"0.6643732",
"0.66164225",
"0.6405993",
"0.60663676",
"0.6029304",
"0.5939332",
"0.58040273",
"0.5786965",
"0.57781714",
"0.57092",
"0.56738806",
"0.564103",
"0.5636355",
"0.5602527",
"0.56012034",
"0.55963063",
"0.5586346",
"0.5584706",
"0.5577624",... | 0.7724276 | 0 |
update profile / employee info | def update_profile
@profile = @account.employee
if params[:profile].present?
@profile.assign_attributes(profile_params)
@profile.save
redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @employers_profile = EmployersProfile.find(params[:id])\n respond_to do |format|\n if @employers_profile.update(employers_profile_params)\n format.html { redirect_to @employers_profile, notice: \"Employers profile was successfully updated.\" }\n format.json { render :show, sta... | [
"0.7255793",
"0.7248337",
"0.7224278",
"0.71607804",
"0.7126109",
"0.70835286",
"0.70663655",
"0.70269275",
"0.7011513",
"0.7003412",
"0.6974838",
"0.69215256",
"0.69166696",
"0.69137865",
"0.6910496",
"0.69015706",
"0.6881782",
"0.6881417",
"0.6872799",
"0.68726885",
"0.6871... | 0.81447035 | 0 |
An accessor which lazily constructs them memoizes the order. The order itself might come from session or it might be a new instance. In the case where it is being pulled from session, it has promotions applied to it. | def order
@order ||= if session['order']
OrderBasket.load(session['order']).tap(&:apply_promotions!)
else
OrderBasket.new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def order\n @order ||= Order.find_by(id: session[:order_id]) if session[:order_id]\n end",
"def load_order\n @cache_load_order = read_load_order unless defined?(@cache_load_order)\n @cache_load_order\n end",
"def order(*order)\n ... | [
"0.59503055",
"0.5808334",
"0.57309884",
"0.5529909",
"0.549827",
"0.5371059",
"0.5321616",
"0.5312329",
"0.5286854",
"0.5214103",
"0.5211961",
"0.5205157",
"0.51777035",
"0.5169474",
"0.51579136",
"0.5153756",
"0.51139444",
"0.51002955",
"0.50870776",
"0.5049347",
"0.5037999... | 0.6384921 | 0 |
Uses the Promotions::Decorator to generate a summary for a promotion. | def promotion_summary(promotion)
Promotions::Decorator.new(promotion).summary_text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotion\r\n\r\n end",
"def apply_promotion( promotion )\n unless has_promotion?\n promotion.adjustment_class.create! adjustable: self, \n basis: promotion.discount_amount, \n message: \"Promotional Code: #{ pro... | [
"0.60590863",
"0.5941305",
"0.58611023",
"0.5650339",
"0.5650292",
"0.5633709",
"0.5633709",
"0.5481207",
"0.547847",
"0.5477966",
"0.538557",
"0.5370577",
"0.53518367",
"0.5311955",
"0.5311955",
"0.5311955",
"0.5311955",
"0.513396",
"0.5129039",
"0.5121383",
"0.5111921",
"... | 0.8594796 | 0 |
A predicate which checks to see if there are any checkout promotions available. | def checkout_promotions?
!checkout_promotions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_promotions?\n !pending_promotions.empty?\n end",
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def checkout_allowed?\n order_items.count > 0\n end",
"def checkout_promotions\n @checkout_promotions ||= Promotion.active.code_based\n end",
"def related_pr... | [
"0.7011322",
"0.6996481",
"0.68735325",
"0.68225825",
"0.6602446",
"0.6421146",
"0.6264687",
"0.62470263",
"0.6102296",
"0.5860835",
"0.5833799",
"0.5815197",
"0.5699425",
"0.5679781",
"0.56603724",
"0.56072277",
"0.5597505",
"0.5593545",
"0.5554813",
"0.5493857",
"0.54717773... | 0.8067705 | 0 |
A simple accessor which looks up and caches promotions that should be displayed at checkout. | def checkout_promotions
@checkout_promotions ||= Promotion.active.code_based
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def promotions\n Spree::Promotion.find_by_sql(\"#{order.promotions.active.to_sql} UNION #{Spree::Promot... | [
"0.7322485",
"0.6748452",
"0.6398421",
"0.6270428",
"0.5963651",
"0.5935999",
"0.59244025",
"0.59244025",
"0.59244025",
"0.5912868",
"0.57370883",
"0.5661884",
"0.55134666",
"0.55038095",
"0.5476001",
"0.5472201",
"0.54346526",
"0.5340041",
"0.5334708",
"0.5302928",
"0.529619... | 0.7326678 | 0 |
Move the cursor to the given editposition | def moveToEditPosition(new_position)
return @field_win.wmove(0, @field_width - new_position - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"column\"]) end",
"def set_cursor_position locator, position\r\n command 'setCursorPosition', locator, position\r\n end",
"def moveto(point={})\n set RGhost::Cursor.moveto(point)\n end",
"def cursor(position)\n new_cursor ... | [
"0.71875745",
"0.7031022",
"0.66096425",
"0.6591082",
"0.6582318",
"0.657288",
"0.64968365",
"0.6490339",
"0.64731115",
"0.63816494",
"0.631626",
"0.6299192",
"0.6250319",
"0.62476265",
"0.6192541",
"0.61889124",
"0.61889124",
"0.6119668",
"0.61177796",
"0.6110332",
"0.610656... | 0.7626468 | 0 |
Check if the cursor is on a valid editposition. This must be one of the nonblank cells in the field. | def validEditPosition(new_position)
if new_position <= 0 || new_position >= @field_width
return false
end
if self.moveToEditPosition(new_position) == Ncurses::ERR
return false
end
ch = @field_win.winch
if ch.chr != ' '
return true
end
if new_positi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end",
"def validate_current_position_boundaries\n if (@initial_position.nil? || row_pos_invalid? || col_pos_invalid?) \n puts \"\\nPlease enter valid chess pi... | [
"0.71680623",
"0.66823673",
"0.6672058",
"0.66661114",
"0.6641937",
"0.6627228",
"0.6571279",
"0.65229374",
"0.65212494",
"0.6521245",
"0.6515245",
"0.64452404",
"0.640958",
"0.6401757",
"0.6399133",
"0.63779",
"0.63775957",
"0.6370197",
"0.6334301",
"0.63326263",
"0.6328231"... | 0.76688325 | 0 |
Set the edit position. Normally the cursor is one cell to the right of the editable field. Moving it left over the field allows the user to modify cells by typing in replacement characters for the field's value. | def setEditPosition(new_position)
if new_position < 0
CDK.Beep
elsif new_position == 0
@field_edit = new_position
elsif self.validEditPosition(new_position)
@field_edit = new_position
else
CDK.Beep
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveToEditPosition(new_position)\n return @field_win.wmove(0, @field_width - new_position - 1)\n end",
"def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"column\"]) end",
"def pos=(val)\n #setter method for position \n row, col = val\n @pos = val\n\n ... | [
"0.7302207",
"0.63134617",
"0.6223474",
"0.6148514",
"0.6037938",
"0.6031669",
"0.59551746",
"0.5952261",
"0.59177023",
"0.5858347",
"0.5818793",
"0.58087987",
"0.5800714",
"0.57589877",
"0.57490927",
"0.57490927",
"0.57483745",
"0.57483745",
"0.5747984",
"0.5747984",
"0.5747... | 0.6928086 | 1 |
This function sets the low/high/current values of the widget. | def set(low, high, value, box)
self.setLowHigh(low, high)
self.setValue(value)
self.setBox(box)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLowHigh(low, high)\n # Make sure the values aren't out of bounds.\n if low <= high\n @low = low\n @high = high\n elsif low > high\n @low = high\n @high = low\n end\n\n # Make sure the user hasn't done something silly.\n self.limitCurrentValue\n en... | [
"0.6801224",
"0.6071023",
"0.59961647",
"0.59961647",
"0.59961647",
"0.5942109",
"0.59372807",
"0.5735384",
"0.5730954",
"0.5558175",
"0.55567044",
"0.55500555",
"0.5544024",
"0.5518116",
"0.5505227",
"0.5482651",
"0.5441688",
"0.538435",
"0.53692126",
"0.5356698",
"0.5343693... | 0.67975885 | 1 |
This function sets the low/high values of the widget. | def setLowHigh(low, high)
# Make sure the values aren't out of bounds.
if low <= high
@low = low
@high = high
elsif low > high
@low = high
@high = low
end
# Make sure the user hasn't done something silly.
self.limitCurrentValue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(low, high, value, box)\n self.setLowHigh(low, high)\n self.setValue(value)\n self.setBox(box)\n end",
"def setValue(low, high, value)\n # We should error check the information we have.\n @low = if low <= high then low else 0 end\n @high = if low <= high then high else 0 e... | [
"0.6959029",
"0.6253468",
"0.608557",
"0.608557",
"0.608557",
"0.5993081",
"0.5602401",
"0.5537275",
"0.55257595",
"0.55241185",
"0.54858285",
"0.5482015",
"0.54652876",
"0.5450102",
"0.544418",
"0.54030293",
"0.53283405",
"0.5284889",
"0.52618223",
"0.52426",
"0.5208613",
... | 0.7263298 | 0 |
We can disable our branding if we have an invitation and our subscription is not the initial subscription or it is no longer a trial | def can_disable_affiliate_branding?
!self.invitation.nil? &&
!self.affiliate.nil? &&
(!self.subscription.trial? || !self.invitation_subscription?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_cobranding\n change_cobranding_status_link.click\n cobranding_status_select.select('No')\n submit_cobranding_status_btn.click\n wait_until{ !submit_cobranding_status_btn.visible? }\n end",
"def subscriber_notice_subscription_renewal\n BrandMailer.subscriber_notice(\n ... | [
"0.62985575",
"0.6020542",
"0.59693795",
"0.588908",
"0.5865819",
"0.58535475",
"0.5845465",
"0.5827879",
"0.5816248",
"0.5788038",
"0.5787872",
"0.5740036",
"0.57077324",
"0.5706518",
"0.56858224",
"0.5685244",
"0.56697243",
"0.56668234",
"0.5661692",
"0.56468314",
"0.563989... | 0.71345705 | 0 |
Gathers the todos for the month across all habitats for the monthly digest | def monthly_digest_todos(limit=10)
self.habitats.todos.todo_instances.system.dashboard.all({
:completed_on => nil,
:due_on.gt => Date.today - Preference.read_value("digest_todo_past_limit", nil, :default => "3").to_i.days,
:due_on.lt => Date.today + Preference.read_value("digest_todo_future_limit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest_todos(limit=3)\n self.habitats.todos.todo_instances.system.dashboard.all({\n :completed_on => nil, \n :due_on.gt => Date.today - Preference.read_value(\"digest_todo_past_limit\", nil, :default => \"3\").to_i.days,\n :due_on.lt => Date.today + Preference.read_value(\"digest_todo_future_... | [
"0.6635735",
"0.63089514",
"0.6198033",
"0.6162277",
"0.61262465",
"0.6084371",
"0.6021043",
"0.5933659",
"0.59159017",
"0.5862512",
"0.583255",
"0.58103937",
"0.57955796",
"0.578834",
"0.57720757",
"0.5768203",
"0.57675856",
"0.5748344",
"0.5746",
"0.5732165",
"0.5731909",
... | 0.75806147 | 0 |
current_ability This method is to override the original one used by "CanCan" to create and return the current_user's ability. | def current_ability
@current_ability ||= UserAbility.new( current_user )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_ability\n @current_ability ||= ::Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(User.current)\n end",
"def current_ability\n @current_ability ||= ::Abilities::Ability.new(current_user)\n end",
"def current_ability\n @current_ab... | [
"0.88124585",
"0.8795426",
"0.8761911",
"0.86767405",
"0.86767405",
"0.865131",
"0.85999835",
"0.8558527",
"0.85419905",
"0.8526072",
"0.8518074",
"0.8511258",
"0.84837294",
"0.8472227",
"0.8464304",
"0.8464304",
"0.8463583",
"0.8461158",
"0.84322",
"0.84322",
"0.8410189",
... | 0.8860631 | 0 |
Freeze serialization metadata when freezing model class. | def freeze
@deserialization_map.freeze
@serialization_map.freeze
@serialization_module.freeze if @serialization_module
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze\n @original_deserialized_values ||= {}\n @original_deserialized_values.freeze\n super\n end",
"def freeze\n deserialized_values.freeze\n super\n end",
"def freeze\n freeze!\n attributes.freeze\n super\n end",
"def freeze\... | [
"0.7004075",
"0.68310916",
"0.6800045",
"0.6725927",
"0.6725927",
"0.67005426",
"0.667753",
"0.6627565",
"0.6559366",
"0.6495032",
"0.6426521",
"0.6417311",
"0.64016765",
"0.63990533",
"0.63982546",
"0.63498664",
"0.6288274",
"0.62770885",
"0.62070036",
"0.6184745",
"0.617030... | 0.7359411 | 0 |
The columns that will be serialized. This is only for backwards compatibility, use serialization_map in new code. | def serialized_columns
Sequel::Deprecation.deprecate("#{self}.serialized_columns in the serialization plugin", "Use #{self}.serialization_map.keys instead")
serialization_map.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialized_columns\n serialization_map.keys\n end",
"def columns\n @columns = @clazz.columns_hash.map do |name, column|\n [name, @columns[name] || Column.new(column, @dump)]\n end.to_h.with_indifferent_access\n end",
"def columns\n @columns_hash.values\n ... | [
"0.91089463",
"0.7815236",
"0.76045114",
"0.74995327",
"0.73476094",
"0.7309735",
"0.7270515",
"0.7211798",
"0.7211798",
"0.7207648",
"0.7189877",
"0.7188584",
"0.7175685",
"0.7167729",
"0.71215236",
"0.7113289",
"0.710899",
"0.7106019",
"0.7106019",
"0.7103062",
"0.7100349",... | 0.8554167 | 1 |
Freeze the deserialized values | def freeze
deserialized_values.freeze
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze\n @original_deserialized_values ||= {}\n @original_deserialized_values.freeze\n super\n end",
"def freeze\n @deserialization_map.freeze\n @serialization_map.freeze\n @serialization_module.freeze if @serialization_module\n\n super\n ... | [
"0.79905236",
"0.71223813",
"0.6934243",
"0.69028854",
"0.67680776",
"0.67289394",
"0.6560203",
"0.6276474",
"0.6200753",
"0.61508983",
"0.61338496",
"0.6105797",
"0.60769284",
"0.60595524",
"0.6033046",
"0.60173815",
"0.5976557",
"0.5942519",
"0.5942519",
"0.5933229",
"0.590... | 0.8443404 | 0 |
Clear any cached deserialized values when doing a manual refresh. | def _refresh_set_values(hash)
@deserialized_values.clear if @deserialized_values
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh\n @deserialized_values = {}\n super\n end",
"def reload\n clear_memoizations!\n remove = data.keys.find_all do |k|\n ![:id, :name].include?(k.to_sym)\n end\n remove.each do |k|\n data.delete(k)\n end\n ... | [
"0.8153968",
"0.7323888",
"0.7221541",
"0.709591",
"0.70771027",
"0.70219004",
"0.69647324",
"0.6954087",
"0.6930644",
"0.69286144",
"0.69235015",
"0.6921005",
"0.69132906",
"0.69076496",
"0.69050753",
"0.6872864",
"0.6845646",
"0.68382156",
"0.68382156",
"0.6821892",
"0.6792... | 0.79685146 | 1 |
Serialize all deserialized values | def serialize_deserialized_values
deserialized_values.each{|k,v| @values[k] = serialize_value(k, v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marshal_dump#:nodoc:\n fields_to_serialize.map{|field| instance_variable_value(field)}\n end",
"def serialize; end",
"def serialize; end",
"def serialize\n end",
"def serialize_attrs\n @serialize_attrs ||= []\n end",
"def before_save\n deserialized_values.each{|k... | [
"0.69683653",
"0.6934432",
"0.6934432",
"0.6899538",
"0.6887831",
"0.6847232",
"0.6842823",
"0.66871035",
"0.66671216",
"0.65962034",
"0.64141154",
"0.6353699",
"0.6353699",
"0.634839",
"0.63412064",
"0.6325189",
"0.63176805",
"0.63137364",
"0.63137364",
"0.6304732",
"0.62874... | 0.77426696 | 0 |
Execute negated rspec expectation | def when_negated_expectation(actual)
expect(result(&actual)).not_to public_send(*expectation_args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_not(matcher=nil, &block)\n Spec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, &block)\n end",
"def should_not(matcher)\n subject.should_not(matcher)\n end",
"def should_not(matcher)\n if Shoulda::Context.current_context\n Shoulda::Context... | [
"0.7843709",
"0.71765655",
"0.7038197",
"0.6907618",
"0.66611964",
"0.6636043",
"0.6601398",
"0.6601398",
"0.651693",
"0.6499215",
"0.6475404",
"0.64546114",
"0.6443144",
"0.6404985",
"0.6398844",
"0.6389563",
"0.63813007",
"0.634664",
"0.63308775",
"0.631805",
"0.6314967",
... | 0.83777934 | 0 |
overridden by subclass to help controller find the right classspecific view. | def get_view
#debugger
self.becomes(self.type.constantize).get_view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _view; end",
"def controller_class; end",
"def controller_class; end",
"def view_name\n self.class.view_name\n end",
"def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n ... | [
"0.6679489",
"0.6476002",
"0.6476002",
"0.64434487",
"0.6429863",
"0.6409708",
"0.6369702",
"0.6304021",
"0.63004214",
"0.6280164",
"0.62466955",
"0.62358606",
"0.62333196",
"0.6068357",
"0.6066545",
"0.60621023",
"0.601761",
"0.6016638",
"0.6008258",
"0.6000413",
"0.60002625... | 0.6771365 | 0 |
POST /creators POST /works/:work_id/creators | def create
@creator.works << Work.where(id: work_ids)
if @creator.save
render json: @creator, status: :created, location: @creator
else
render json: @creator.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @work = Work.new(work_params)\n process_work_contributors\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render text: \"success\"}\n else\n format.html { render :new }\n ... | [
"0.71503645",
"0.6855367",
"0.6717528",
"0.6442042",
"0.63661134",
"0.63637996",
"0.63637996",
"0.63285637",
"0.63285637",
"0.6305013",
"0.62673545",
"0.6251676",
"0.62508637",
"0.62397987",
"0.6203035",
"0.61471635",
"0.6140621",
"0.6119206",
"0.6089534",
"0.60816646",
"0.60... | 0.755555 | 0 |
Create lead form web form | def create_web_form_lead
web_form = WebForm.where("form_unique_id =?",params[:form_unique_id]).first
# check web form is present or not, if form is not present return error message.
if web_form.present?
# Return if form if disabled
unless web_form.is_active
render text: "Opps! Sorry. the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_webform(title, fields, browser = @browser)\n browser.navigate.to($config['sut_url'] + create_webform_url)\n Log.logger.debug(\"Entering new webform title '#{title}'\")\n fields.each{|fieldname|\n self.add_webform_component(fieldname)\n }\n self.add_webform_title(title)\n message =... | [
"0.68922174",
"0.6871585",
"0.6429081",
"0.63197035",
"0.6309857",
"0.6279695",
"0.6257549",
"0.6232367",
"0.62230486",
"0.6205113",
"0.6182437",
"0.61015147",
"0.60966825",
"0.6087134",
"0.6077255",
"0.60685897",
"0.6048655",
"0.60185874",
"0.5991127",
"0.5975717",
"0.594220... | 0.7110373 | 0 |
GET /cicadas GET /cicadas.json | def index
@cicadas = Cicada.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render ... | [
"0.691724",
"0.69065446",
"0.6880173",
"0.68574893",
"0.6853239",
"0.67422825",
"0.67218006",
"0.6708276",
"0.6647747",
"0.66040975",
"0.65881985",
"0.6586901",
"0.65666825",
"0.65666825",
"0.65647095",
"0.6559063",
"0.6559063",
"0.6547339",
"0.6543469",
"0.65409",
"0.6540226... | 0.70051867 | 0 |
POST /cicadas POST /cicadas.json | def create
@cicada = Cicada.new(cicada_params)
respond_to do |format|
if @cicada.save
format.html { redirect_to @cicada, notice: 'Cicada was successfully created.' }
format.json { render :show, status: :created, location: @cicada }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cio = Cio.new(cio_params)\n\n respond_to do |format|\n if @cio.save\n format.html { redirect_to @cio, notice: 'Cio cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @cio }\n else\n format.html { render :new }\n format.json... | [
"0.6891336",
"0.67611694",
"0.67611694",
"0.67611694",
"0.6577187",
"0.65199304",
"0.64807034",
"0.6461457",
"0.6425855",
"0.6423225",
"0.6404901",
"0.638281",
"0.63348794",
"0.62979203",
"0.6295042",
"0.62919044",
"0.62866634",
"0.62767684",
"0.62615466",
"0.62485707",
"0.62... | 0.72277874 | 0 |
DELETE /cicadas/1 DELETE /cicadas/1.json | def destroy
@cicada.destroy
respond_to do |format|
format.html { redirect_to cicadas_url, notice: 'Cicada was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to ... | [
"0.73973036",
"0.7287723",
"0.72202903",
"0.7206778",
"0.7163734",
"0.71597564",
"0.7156203",
"0.715362",
"0.7129718",
"0.7120062",
"0.7112079",
"0.710966",
"0.710966",
"0.7078405",
"0.7075703",
"0.7073965",
"0.70653194",
"0.7064144",
"0.7061419",
"0.7053661",
"0.70473504",
... | 0.7328198 | 1 |
print the person's information to te screen | def print_person
puts "Name: #{name}"
puts "Age: #{age} years old"
puts "ID: VCN#{id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_person\n print \"The peoples registered are: #{@person}\"\n end",
"def about_person\n\t\tputs \"Name: #{name}, agr: #{age}\"\n\tend",
"def display_details()\n\t\tputs \"------------------------------\"\n\t\tputs \"User Details\"\n\t\tputs \"#{@first_name} #{@surname} aged '#{@age}'\"\n\t\tputs \"... | [
"0.793985",
"0.7876863",
"0.76849747",
"0.76690894",
"0.76576644",
"0.76271033",
"0.7497966",
"0.730065",
"0.7218921",
"0.71883607",
"0.7167499",
"0.71558833",
"0.7135093",
"0.7129714",
"0.71252203",
"0.7105164",
"0.7079419",
"0.7073703",
"0.70679885",
"0.7060874",
"0.7060303... | 0.8273932 | 0 |
Passes it operator with optional argument returns negatively. 10.wont_be :>, 20 10.wont_be :odd? | def wont_be(operator, argument=nil, msg=nil)
if argument
ExecutionAssay.refute!(:message=>msg) do
self.__send__(operator, argument)
end
else
ExecutionAssay.refute!(:message=>msg) do
self.__send__(operator)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclusive_or(num1, num2)\r\n\t# your code here\r\nend",
"def odd?\n odd\n end",
"def odd?\n !even?\n end",
"def exclusive_or (p,q)\n p ^ q\nend",
"def not( arg ); { $not => arg } end",
"def is_also_odd?(param_integer)\n param_integer % 2 > 0\nend",
"def operator; end",
"def yeah_or_b... | [
"0.6189683",
"0.6143584",
"0.6030042",
"0.5878972",
"0.58664465",
"0.58584654",
"0.5842042",
"0.5828082",
"0.58197784",
"0.57031375",
"0.5698227",
"0.5681362",
"0.56402963",
"0.56156456",
"0.5603533",
"0.55986476",
"0.5590194",
"0.5580891",
"0.55770665",
"0.55585116",
"0.5557... | 0.61853665 | 1 |
Passes if expected and actual are equal within absolute delta tolerance. 0.05.must_be_within_delta (50000.0 / 106), 0.00001 | def must_be_within_delta(exp, delta, msg=nil)
WithinAssay.assert!(self, exp, delta, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_in_delta(exp, act, delta, msg=nil)\n test = (exp.to_f - act.to_f).abs <= delta.to_f\n msg = \"Expected #{exp} to be within #{delta} of #{act}\" unless msg\n __assert__(test, msg)\n end",
"def assert_equalish(x, y, delta=0.1)\n assert_in_delta(x, y, delta)\n end",
"def ... | [
"0.7260599",
"0.72175306",
"0.6955708",
"0.68456334",
"0.659904",
"0.659451",
"0.65293956",
"0.6367576",
"0.6257652",
"0.6214836",
"0.61815864",
"0.6076989",
"0.6073764",
"0.60613126",
"0.6060512",
"0.60225904",
"0.6014282",
"0.60035646",
"0.60034037",
"0.59849703",
"0.593544... | 0.7232335 | 1 |
Passes if expected and actual are equal within relative epsilon tolerance. 0.05.must_be_within_epsilon (50000.0 / 106), 0.00001 | def must_be_within_epsilon(exp, epsilon, msg=nil)
CloseAssay.assert!(self, exp, epsilon, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_in_epsilon(a, b, epsilon, message = nil)\n return assert(true) if a == b # count assertion\n\n error = ((a - b).to_f / ((b.abs > a.abs) ? b : a)).abs\n message ||= \"#{a} expected to be within #{epsilon * 100}% of #{b}, was #{error}\"\n\n assert_block message do error <= epsilon end\... | [
"0.7437084",
"0.68849754",
"0.68615234",
"0.6816651",
"0.68042797",
"0.6623395",
"0.64238673",
"0.6312192",
"0.6232382",
"0.61241364",
"0.5943144",
"0.59215724",
"0.58908397",
"0.5854739",
"0.5810052",
"0.5803312",
"0.5722474",
"0.571617",
"0.5701787",
"0.5686166",
"0.5675670... | 0.7421645 | 1 |
Passes if expected and actual are NOT equal within relative epsilon tolerance. 0.05.wont_be_within_epsilon (50000.0 / 106), 0.00001 | def wont_be_within_epsilon(exp, epsilon, msg=nil)
WithinAssay.refute!(self, exp, epsilon, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_in_epsilon(a, b, epsilon, message = nil)\n return assert(true) if a == b # count assertion\n\n error = ((a - b).to_f / ((b.abs > a.abs) ? b : a)).abs\n message ||= \"#{a} expected to be within #{epsilon * 100}% of #{b}, was #{error}\"\n\n assert_block message do error <= epsilon end\... | [
"0.7306701",
"0.7214656",
"0.7064344",
"0.68663657",
"0.67166185",
"0.6576846",
"0.6518659",
"0.6293951",
"0.6285413",
"0.60936266",
"0.59579754",
"0.5869394",
"0.58594376",
"0.5818782",
"0.5756963",
"0.5744064",
"0.57244736",
"0.57241833",
"0.5686187",
"0.56802607",
"0.56781... | 0.7219011 | 1 |
Passes if object is an instance of class. 'foo'.must_be_instance_of(String) | def must_be_instance_of(cls, msg=nil)
InstanceAssay.assert!(self, cls, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_instance_of(cls, obj, msg = T.unsafe(nil)); end",
"def assert_instance_of(cls, obj, msg=nil)\n test = (cls === obj)\n msg = \"Expected #{obj} to be a #{cls}\" unless msg\n __assert__(test, msg)\n end",
"def refute_instance_of(cls, obj, msg = T.unsafe(nil)); end",
"def as... | [
"0.72632664",
"0.7109617",
"0.71054804",
"0.70150656",
"0.6876782",
"0.6846153",
"0.68060744",
"0.6783954",
"0.6720246",
"0.6619281",
"0.65843266",
"0.65391284",
"0.6460889",
"0.645925",
"0.64368665",
"0.6404119",
"0.63913774",
"0.6340505",
"0.6318945",
"0.6244144",
"0.624125... | 0.7347827 | 0 |
Passes if object is not an instance of class. 'foo'.wont_be_instance_of(Integer) | def wont_be_instance_of(cls, msg=nil)
InstanceAssay.refute!(self, cls, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refute_instance_of(cls, obj, msg = T.unsafe(nil)); end",
"def assert_instance_of(cls, obj, msg = T.unsafe(nil)); end",
"def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end",
"def assert_kind_of(cls, obj, msg = T.unsafe(nil)); end",
"def instance_of?(klass)\n super || object.instance_of?(klass)\... | [
"0.77021855",
"0.73809206",
"0.694174",
"0.68505853",
"0.67505765",
"0.6742237",
"0.6728565",
"0.66537595",
"0.66122794",
"0.6587347",
"0.6577457",
"0.6547424",
"0.6489457",
"0.64517313",
"0.64300126",
"0.64268273",
"0.64107716",
"0.640871",
"0.638188",
"0.6357079",
"0.632173... | 0.74642175 | 1 |
Passes if `criterion.eql?(actual)`. Note that the ordering of arguments is important, since a helpful error message is generated when this one fails that tells you the values of expected and actual. 'MY STRING'.must_be_equivalent_to('my string'.upcase) | def must_be_equivalent_to(criterion, msg=nil)
EqualityAssay.assert!(self, criterion, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches?(actual)\n expected_value == actual\n end",
"def test_equality(expected, actual)\n \tif expected == actual\n \t\tputs \"pass :):):)\"\n \telse\n \t\tputs \"fail :(:(:(\"\n\tend\nend",
"def matches?(actual)\n @actual = actual\n @expected.eql?(@actual)\n end",
"def matches?... | [
"0.68832886",
"0.66588616",
"0.6580149",
"0.6450966",
"0.6385585",
"0.6330357",
"0.62316465",
"0.62288725",
"0.62279725",
"0.6186966",
"0.6158113",
"0.61074",
"0.6102348",
"0.6051545",
"0.60028327",
"0.5948154",
"0.5942292",
"0.5936552",
"0.59342396",
"0.5926394",
"0.59245795... | 0.6875507 | 1 |
Passes if NOT `criterion.eql?(actual)`. 'MY STRING'.wont_be_equivalent_to('some other string') | def wont_be_equivalent_to(criterion, msg=nil)
EqualityAssay.refute!(self, criterion, :message=>msg, :backtrace=>caller)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def must_be_equivalent_to(criterion, msg=nil)\n EqualityAssay.assert!(self, criterion, :message=>msg, :backtrace=>caller)\n end",
"def assert_match(value, other)\n flunk(\"#{value.inspect} =~ #{other.inspect}\") unless other =~ Regexp.new(value)\n success\n end",
"def matches?(actual)\n exp... | [
"0.65915287",
"0.63668877",
"0.6343066",
"0.62627006",
"0.6219189",
"0.6138046",
"0.60447985",
"0.60226846",
"0.6016208",
"0.6006172",
"0.5988189",
"0.5978147",
"0.5947483",
"0.5921366",
"0.5920157",
"0.59017324",
"0.58906645",
"0.5885371",
"0.58851695",
"0.5818381",
"0.58177... | 0.6718849 | 0 |
Constructor Returns an instance of a FileStat object. | def initialize(file)
self.stathash = stat(file) if (file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(obj)\n if obj.is_a?(VfsRealFile::Stat)\n stat_init(obj)\n else\n hash_init(obj)\n end\n end",
"def initialize(path, state=FileStatEnum::NEW, size=-1, mod_time=-1, indexed=false, cycles=0)\n # File\\Dir path\n @path = path\n\n # File size\n @size ... | [
"0.7103045",
"0.6944901",
"0.6531215",
"0.6423044",
"0.6377483",
"0.6325787",
"0.6316175",
"0.61975443",
"0.6111855",
"0.60379493",
"0.60168266",
"0.59658736",
"0.59522057",
"0.591225",
"0.5867817",
"0.5860865",
"0.584813",
"0.584813",
"0.58399945",
"0.5821631",
"0.5815638",
... | 0.7489244 | 0 |
Swaps in a new stat hash. | def update(stat_buf)
elem = @@struct_stat
hash = {}
offset = 0
index = 0
while (index < elem.length)
size = elem[index + 1]
format = 'V'
case size
when 2
format = 'v'
when 8
format = 'Q'
end
value = stat_buf[offset, size].unpack(format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update32(stat_buf)\n elem = @@struct_stat32\n hash = {}\n offset = 0\n index = 0\n\n while (index < elem.length)\n size = elem[index + 1]\n\n value = stat_buf[offset, size].unpack(size == 2 ? 'v' : 'V')[0]\n offset += size\n\n hash[elem[index]] = value\n\n index +... | [
"0.5921685",
"0.56577873",
"0.560993",
"0.557446",
"0.55690175",
"0.55612457",
"0.5554754",
"0.5531327",
"0.55268914",
"0.5490094",
"0.5406227",
"0.5401966",
"0.53705007",
"0.53404635",
"0.53348404",
"0.52944416",
"0.52700615",
"0.52407956",
"0.5236209",
"0.5236209",
"0.52266... | 0.5943806 | 0 |
Swaps in a new old style stat hash. | def update32(stat_buf)
elem = @@struct_stat32
hash = {}
offset = 0
index = 0
while (index < elem.length)
size = elem[index + 1]
value = stat_buf[offset, size].unpack(size == 2 ? 'v' : 'V')[0]
offset += size
hash[elem[index]] = value
index += 2
end
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(stat_buf)\n elem = @@struct_stat\n hash = {}\n offset = 0\n index = 0\n\n while (index < elem.length)\n size = elem[index + 1]\n format = 'V'\n case size\n when 2\n format = 'v'\n when 8\n format = 'Q'\n end\n\n value = stat_buf[offset... | [
"0.6183647",
"0.5709543",
"0.5704372",
"0.5649181",
"0.55852854",
"0.548099",
"0.53263164",
"0.5294099",
"0.52706426",
"0.51228476",
"0.5119591",
"0.5117407",
"0.5116194",
"0.51041913",
"0.5071417",
"0.5063633",
"0.506107",
"0.5014386",
"0.50065595",
"0.49381375",
"0.49375883... | 0.61234665 | 1 |
POST /societies POST /societies.json | def create
@society = Society.new(society_params)
respond_to do |format|
if @society.save
session[:society_id] = @society.id
format.html { redirect_to @society }
format.json { render action: 'show', status: :created, location: @society }
else
format.html { render acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @society = Society.new(society_params)\n\n respond_to do |format|\n if @society.save\n format.html { redirect_to @society, notice: 'Se ha creado exitosamente.' }\n format.json { render :show, status: :created, location: @society }\n else\n format.html { render :new... | [
"0.65982425",
"0.6192062",
"0.6117143",
"0.6009919",
"0.5997539",
"0.59523",
"0.59219193",
"0.59219193",
"0.59219193",
"0.59137714",
"0.5859136",
"0.57940185",
"0.5751825",
"0.5729203",
"0.572618",
"0.5720178",
"0.5683922",
"0.56793356",
"0.5673189",
"0.5667659",
"0.5658367",... | 0.65407765 | 1 |
PATCH/PUT /societies/1 PATCH/PUT /societies/1.json | def update
respond_to do |format|
if @society.update(society_params)
format.html { redirect_to @society }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @society.errors, status: :unprocessable_entity }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @society.update(society_params)\n format.html { redirect_to @society, notice: 'Society was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socie... | [
"0.6718941",
"0.6499053",
"0.64737153",
"0.6437565",
"0.6436087",
"0.6402298",
"0.6386968",
"0.6368777",
"0.6263729",
"0.6258636",
"0.6255496",
"0.62410384",
"0.6233088",
"0.6222298",
"0.6212322",
"0.6208488",
"0.61364764",
"0.60971844",
"0.60956115",
"0.6085918",
"0.6070932"... | 0.6747731 | 0 |
DELETE /societies/1 DELETE /societies/1.json | def destroy
@society.destroy
respond_to do |format|
format.html { redirect_to societies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n f... | [
"0.73177135",
"0.73177135",
"0.72974396",
"0.7211492",
"0.7211355",
"0.70283234",
"0.69822747",
"0.69710207",
"0.6895689",
"0.6879676",
"0.68679124",
"0.6830956",
"0.682914",
"0.67985505",
"0.6796223",
"0.6782308",
"0.6770808",
"0.6762179",
"0.67616576",
"0.6751006",
"0.67484... | 0.75081176 | 0 |
returns posts visible for user from feed of other user(self) | def visible_posts_for(user, args = {})
search_conditions = {
where: {
friends_only: false,
user_id: self.id
},
page: args[:page],
per_page: 20,
include: [:user, :attachments, comments: [:attachments]],
order: {created_at: :desc}
}
user = User.find(user) if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n people_in_feed = current_user.feed_list\n @posts = Post.where(user: people_in_feed)\n end",
"def feed\n Post.where(\"user_id IN (?) OR user_id = ?\", friend_ids, id).feed\n end",
"def feed\n Post.from_users_followed_by(self)\n end",
"def feed\n Post.from_users_followed_by(self)\... | [
"0.7886713",
"0.71718496",
"0.71240944",
"0.71240944",
"0.70466506",
"0.6970439",
"0.6964664",
"0.6934543",
"0.69285226",
"0.6824209",
"0.6761148",
"0.6738516",
"0.67319363",
"0.66552234",
"0.66474473",
"0.6622371",
"0.66085184",
"0.6570647",
"0.65657663",
"0.65580755",
"0.65... | 0.74577856 | 1 |
Get metadata from remote_file_url param remote_file_url: url string of remote file | def get_remote_file_url_metadata(remote_file_url: "")
@file_service.get_metadata_from_remote_url(remote_file_url: remote_file_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_metadata_for_video url\n mfile = metadata_file_for(url)\n unless File.file? mfile\n\n # self << url\n # self << %w[ skip-download write-info-json ignore-errors ]\n # self << { output: mfile.gsub(/\\.info\\.json$/, '') }\n # self.run\n\n # Run directly:\n command = \... | [
"0.7001275",
"0.6801939",
"0.66920906",
"0.6652156",
"0.6633616",
"0.65227306",
"0.63330895",
"0.63117844",
"0.6306303",
"0.62430733",
"0.6206582",
"0.6109734",
"0.6095657",
"0.6054993",
"0.60183764",
"0.6004319",
"0.6000844",
"0.5982187",
"0.59749097",
"0.59618795",
"0.59618... | 0.8903694 | 0 |
returns a nested array with time of commit and nested within that, an array of insertions and deletions | def all_file_commits_data(path)
time = ` cd /tmp/#{@repo} && git log --format=%ct #{path} `.split("\n").map{|time| time.to_i}
ins_del = ` cd /tmp/#{@repo} && git log --numstat --format=%h #{path} | grep #{path} `.split("\n").map{|line| line.split(" ")[0..1]}.map{|insert| insert.map{|x| x.to_i}}
time.zip(ins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_commit_times\n `git --git-dir=#{git_dir} log --all --pretty='%at'`.split(/\\n/).uniq\n end",
"def commit_time_line events\n events.map(&:date).uniq.sort.each_cons(2).map {|before,after| [before, (after.to_i - before.to_i) / (60 * 60 * 24)] }\nend",
"def format_commit_info timestamp... | [
"0.59109104",
"0.5850618",
"0.58349246",
"0.579356",
"0.57556224",
"0.57302254",
"0.5662134",
"0.55666",
"0.55396575",
"0.55275553",
"0.5501855",
"0.5491748",
"0.54832906",
"0.54802597",
"0.54574937",
"0.53717214",
"0.53511125",
"0.5350055",
"0.5338958",
"0.53046757",
"0.5276... | 0.63229054 | 0 |
Process convertation from VCR cassettes to WebMock and outputs result to STDOUT | def convert
$stdout.puts "# #{path_file}"
cassette.requests.each_with_index do |request, idx|
WebMocker.output do |params, response|
params.body = request.body
params.method = request.method
params.address = request.address
# TODO: It can be op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recording_webmock_cassette(name, options = {}, &block)\n WebMock::Config.instance.net_http_connect_on_start = true\n VCR.use_cassette(name, options, &block)\n ensure\n WebMock::Config.instance.net_http_connect_on_start = false\n end",
"def test_it_can_execute_reports\n VCR.i... | [
"0.60611653",
"0.5727629",
"0.5662083",
"0.54520977",
"0.53407776",
"0.5340444",
"0.53163445",
"0.5307457",
"0.5227067",
"0.51501864",
"0.51027346",
"0.5085982",
"0.5084549",
"0.5042847",
"0.50394166",
"0.5010704",
"0.49999472",
"0.4997034",
"0.49966782",
"0.49948478",
"0.497... | 0.7004887 | 0 |
GET /scheduled_events GET /scheduled_events.json | def index
@scheduled_events = ScheduledEvent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def get_events\n Resources::Event.parse(request(:g... | [
"0.73183286",
"0.7203255",
"0.7140837",
"0.7099001",
"0.7092772",
"0.7066279",
"0.7024111",
"0.70026785",
"0.6991664",
"0.6937575",
"0.6931055",
"0.68780065",
"0.68129265",
"0.6769903",
"0.67647344",
"0.67535466",
"0.6745506",
"0.67154956",
"0.6710445",
"0.67065084",
"0.67062... | 0.7581626 | 0 |
POST /scheduled_events POST /scheduled_events.json | def create
@scheduled_event = ScheduledEvent.new(scheduled_event_params)
respond_to do |format|
if @scheduled_event.save
format.html { redirect_to @scheduled_event, notice: 'Scheduled event was successfully created.' }
format.json { render :show, status: :created, location: @scheduled_eve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n... | [
"0.72523135",
"0.6805537",
"0.6771838",
"0.6689296",
"0.66778606",
"0.6649039",
"0.66385996",
"0.66368794",
"0.66329116",
"0.6631748",
"0.6622204",
"0.6606015",
"0.6589601",
"0.65525347",
"0.6480221",
"0.64720064",
"0.6462348",
"0.64600813",
"0.645847",
"0.64443976",
"0.64172... | 0.7448463 | 0 |
PATCH/PUT /scheduled_events/1 PATCH/PUT /scheduled_events/1.json | def update
respond_to do |format|
if @scheduled_event.update(scheduled_event_params)
format.html { redirect_to @scheduled_event, notice: 'Scheduled event was successfully updated.' }
format.json { render :show, status: :ok, location: @scheduled_event }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #@event.status = \"Pending\"\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, success: 'Event was successfully rescheduled.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render... | [
"0.7138874",
"0.70280945",
"0.6984063",
"0.6898324",
"0.6893733",
"0.6852769",
"0.68440026",
"0.6804216",
"0.67925805",
"0.6776155",
"0.675722",
"0.675722",
"0.67291313",
"0.67157817",
"0.6709191",
"0.66881",
"0.6684542",
"0.664622",
"0.66239816",
"0.652797",
"0.652797",
"0... | 0.7301208 | 0 |
DELETE /scheduled_events/1 DELETE /scheduled_events/1.json | def destroy
@scheduled_event.destroy
respond_to do |format|
format.html { redirect_to scheduled_events_url, notice: 'Scheduled event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to admin_schedule_url, notice: 'Schedule was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n ... | [
"0.7336564",
"0.7271508",
"0.72207785",
"0.72136223",
"0.72136223",
"0.72136223",
"0.71970797",
"0.7154858",
"0.71054316",
"0.7091841",
"0.7076937",
"0.7052171",
"0.7048142",
"0.70456815",
"0.70449144",
"0.7018586",
"0.70163083",
"0.7012871",
"0.7012871",
"0.7012871",
"0.7012... | 0.75089127 | 0 |
Posts the applogs to the Giraffi | def add_applogs(options={})
self.class.post("#{applogs_endpoint}/applogs.json?apikey=#{apikey}", :body => MultiJson.encode({applog: options}))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logs\n\n end",
"def logs\n end",
"def create\n @log = current_app.logs.create(params)\n render json: @log\n end",
"def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend",
"def webhook\n header = \"<h4>#{params[:verb]} #{params[:url]}</h4><p>Server: <b>#{params[:mode]}</b></p>\"\... | [
"0.6003195",
"0.59803087",
"0.588858",
"0.58525395",
"0.5718368",
"0.57128704",
"0.57100874",
"0.570773",
"0.5548281",
"0.5546431",
"0.5532451",
"0.5530541",
"0.5454139",
"0.54526997",
"0.54473096",
"0.54222137",
"0.5385549",
"0.5382427",
"0.5323574",
"0.5323106",
"0.5302692"... | 0.683763 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.