query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Public: Write a new version of a file to the Gollum repo. path The String path where the file will be written. data The new String contents of the page. commit The commit Hash details: :message The String commit message. :name The String author full name. :email The String email address. :parent Optional Gollum::Git::C... | def write_file(name, data, commit = {})
write(merge_path_elements(nil, name, nil), data, commit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_page(page, name, format, data, commit = {})\n name = name ? ::File.basename(name) : page.name\n format ||= page.format\n dir = ::File.dirname(page.path)\n dir = '' if dir == '.'\n filename = (rename = page.name != name) ? Gollum::Page.cname(name) : page.filename_stripp... | [
"0.62029845",
"0.6194479",
"0.5954787",
"0.58099425",
"0.57061607",
"0.5703369",
"0.5648676",
"0.5640222",
"0.56308824",
"0.56294787",
"0.562135",
"0.55780935",
"0.55345803",
"0.54769135",
"0.54635113",
"0.5386273",
"0.5331518",
"0.5312393",
"0.5300479",
"0.52892244",
"0.5258... | 0.6008673 | 2 |
Public: Write a file to the Gollum repo regardless of existing versions. path The String path where the file will be written. data The new String contents of the page. commit The commit Hash details: :message The String commit message. :name The String author full name. :email The String email address. :parent Optional... | def overwrite_file(name, data, commit = {})
write(merge_path_elements(nil, name, nil), data, commit, force_overwrite = true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit)\n end",
"def update_page(page, name, format, data, commit = {})\n name = name ? ::File.basename(name) : page.name\n format ||= page.format\n dir = ::File.dirname(page.path)\n dir ... | [
"0.63240737",
"0.61443555",
"0.6131746",
"0.5868356",
"0.57322294",
"0.5728045",
"0.57078475",
"0.5699554",
"0.5645879",
"0.5645103",
"0.5639555",
"0.5612382",
"0.5536948",
"0.54958296",
"0.54267526",
"0.5406553",
"0.54049265",
"0.53711426",
"0.5370828",
"0.5183242",
"0.51448... | 0.5985385 | 3 |
Public: Rename an existing page without altering content. page The Gollum::Page to update. rename The String extensionless full path of the page (leading '/' is ignored). commit The commit Hash details: :message The String commit message. :name The String author full name. :email The String email address. :parent Optio... | def rename_page(page, rename, commit = {})
return false if page.nil?
return false if rename.nil? or rename.empty?
(target_dir, target_name) = ::File.split(rename)
(source_dir, source_name) = ::File.split(page.path)
source_name = page.filename_stripped
# File.split giv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_page(page, rename, commit = {})\n return false if page.nil?\n return false if rename.nil? || rename.empty?\n\n (target_dir, target_name) = ::File.split(rename)\n (source_dir, source_name) = ::File.split(page.path)\n source_name = page.filename_stripped\n\n # F... | [
"0.76676464",
"0.65495855",
"0.63952535",
"0.6285936",
"0.5671585",
"0.54502773",
"0.5358517",
"0.50778943",
"0.50538933",
"0.5048372",
"0.49072894",
"0.49008095",
"0.47986045",
"0.47980314",
"0.47574434",
"0.47559842",
"0.46430343",
"0.46258214",
"0.4514446",
"0.45072678",
"... | 0.76163954 | 1 |
Public: Update an existing page with new content. The location of the page inside the repository will not change. If the given format is different than the current format of the page, the filename will be changed to reflect the new format. page The Gollum::Page to update. name The String extensionless name of the page.... | def update_page(page, name, format, data, commit = {})
name ||= page.name
format ||= page.format
dir = ::File.dirname(page.path)
dir = nil if dir == '.'
rename = (page.name != name || page.format != format)
new_path = ::File.join([dir, self.page_file_name(name, form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_page(page, name, format, data, commit = {})\n name = name ? ::File.basename(name) : page.name\n format ||= page.format\n dir = ::File.dirname(page.path)\n dir = '' if dir == '.'\n filename = (rename = page.name != name) ? Gollum::Page.cname(name) : page.filename_stripp... | [
"0.8066288",
"0.7657035",
"0.67497456",
"0.5750299",
"0.5526422",
"0.53825146",
"0.533675",
"0.53205603",
"0.52255136",
"0.5195347",
"0.5171513",
"0.51500803",
"0.5118075",
"0.5068095",
"0.505763",
"0.5055613",
"0.50194174",
"0.5013346",
"0.5001557",
"0.49503374",
"0.49402943... | 0.7920035 | 1 |
Public: Delete a page. page The Gollum::Page to delete. commit The commit Hash details: :message The String commit message. :name The String author full name. :email The String email address. :parent Optional Gollum::Git::Commit parent to this update. :tree Optional String SHA of the tree to create the index from. :com... | def delete_page(page, commit)
delete_file(page.url_path, commit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_page(page, commit)\n index = nil\n sha1 = commit_index(commit) do |idx|\n index = idx\n index.delete(page.path)\n end\n\n dir = ::File.dirname(page.path)\n dir = '' if dir == '.'\n\n @access.refresh\n update_working_dir(index, dir, page.name, page.format... | [
"0.7631725",
"0.66204196",
"0.63527775",
"0.5814283",
"0.5759498",
"0.57568246",
"0.5721702",
"0.5713253",
"0.56880254",
"0.5658033",
"0.55889535",
"0.5545445",
"0.54686487",
"0.53877455",
"0.53768647",
"0.5368079",
"0.5336074",
"0.5330418",
"0.5325932",
"0.5318844",
"0.53094... | 0.7385515 | 1 |
Public: Delete a file. path The path to the file to delete commit The commit Hash details: :message The String commit message. :name The String author full name. :email The String email address. :parent Optional Gollum::Git::Commit parent to this update. :tree Optional String SHA of the tree to create the index from. :... | def delete_file(path, commit)
fullpath = ::File.join([page_file_dir, path].compact)
multi_commit = !!commit[:committer]
committer = multi_commit ? commit[:committer] : Committer.new(self, commit)
committer.delete(fullpath)
committer.after_commit do |index, _sha|
dir = '' i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\n end",
"def delete_entry(path, revision, parent_baton)\n #... | [
"0.5756956",
"0.56980133",
"0.5590008",
"0.54597086",
"0.5430612",
"0.542552",
"0.5407058",
"0.53949404",
"0.5384353",
"0.5353365",
"0.53005266",
"0.5132617",
"0.50827134",
"0.5073963",
"0.5068417",
"0.5046429",
"0.5045027",
"0.5033839",
"0.5031721",
"0.50297695",
"0.5019818"... | 0.62943625 | 0 |
Public: Applies a reverse diff for a given page. If only 1 SHA is given, the reverse diff will be taken from its parent (^SHA...SHA). If two SHAs are given, the reverse diff is taken from SHA1...SHA2. page The Gollum::Page to delete. sha1 String SHA1 of the earlier parent if two SHAs are given, or the child. sha2 Optio... | def revert_page(page, sha1, sha2 = nil, commit = {})
return false unless page
left, right, options = parse_revert_options(sha1, sha2, commit)
commit_and_update_paths(@repo.git.revert_path(page.path, left, right), [page.path], options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revert_commit(sha1, sha2 = nil, commit = {})\n left, right, options = parse_revert_options(sha1, sha2, commit)\n tree, files = repo.git.revert_commit(left, right)\n commit_and_update_paths(tree, files, options)\n end",
"def rev_parse(*args)\n return args if args.empty?\n \n s... | [
"0.6047985",
"0.4921959",
"0.48838034",
"0.46333775",
"0.45735803",
"0.45692304",
"0.44218862",
"0.43746623",
"0.4337324",
"0.432476",
"0.42654553",
"0.41782284",
"0.4123224",
"0.41096488",
"0.4070695",
"0.40164143",
"0.40140742",
"0.40135458",
"0.40110704",
"0.39834735",
"0.... | 0.6442151 | 0 |
Public: Applies a reverse diff to the repo. If only 1 SHA is given, the reverse diff will be taken from its parent (^SHA...SHA). If two SHAs are given, the reverse diff is taken from SHA1...SHA2. sha1 String SHA1 of the earlier parent if two SHAs are given, or the child. sha2 Optional String SHA1 of the child. commit T... | def revert_commit(sha1, sha2 = nil, commit = {})
left, right, options = parse_revert_options(sha1, sha2, commit)
tree, files = repo.git.revert_commit(left, right)
commit_and_update_paths(tree, files, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rev_parse(*args)\n return args if args.empty?\n \n sandbox do |git,w,i|\n shas = git.run('', :rev_parse, '', {}, args).split(\"\\n\")\n \n # Grit::Git#run only makes stdout available, not stderr, and so this\n # wonky check relies on the fact that git rev-parse will p... | [
"0.57779396",
"0.5316683",
"0.5121301",
"0.50785434",
"0.49839997",
"0.4963344",
"0.487554",
"0.4851896",
"0.47758168",
"0.47130656",
"0.4608745",
"0.45920587",
"0.45713952",
"0.45704415",
"0.4569507",
"0.45613486",
"0.45506358",
"0.4548345",
"0.45470542",
"0.45004967",
"0.44... | 0.62574506 | 0 |
Public: Lists all pages for this wiki. | def pages(treeish = nil)
tree_list(treeish || @ref, true, false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pages = Page.all\n end",
"def index\n @cms_pages = Cms::Page.all\n end",
"def list_pages(limit: 0, sort: nil, direction: DIRECTION_ASC, load_content: false)\n wiki.list_pages(\n limit: limit,\n sort: sort,\n direction_desc: direction == DIRECTION_DESC,\n load_con... | [
"0.72419924",
"0.70491976",
"0.69897693",
"0.6974195",
"0.6930149",
"0.6888629",
"0.683244",
"0.678126",
"0.67740715",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.67456007",
"0.6742874",
"0.6... | 0.6636424 | 26 |
Public: Lists all nonpage files for this wiki. | def files(treeish = nil)
tree_list(treeish || @ref, false, true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end",
"def get_nondir_pages( directory )\n Dir[ File.join( directory, \"*/index.src\" ) ]\n end",
"def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link =... | [
"0.6818177",
"0.63700503",
"0.59839934",
"0.59839934",
"0.594371",
"0.58771324",
"0.58592826",
"0.5854037",
"0.58142513",
"0.57826644",
"0.5746824",
"0.5738451",
"0.57139635",
"0.56885856",
"0.56885153",
"0.5636207",
"0.5636207",
"0.56292725",
"0.5628431",
"0.56156456",
"0.55... | 0.57600594 | 10 |
Public: Returns the number of pages accessible from a commit ref A String ref that is either a commit SHA or references one. Returns a Fixnum | def size(ref = nil)
tree_map_for(ref || @ref).inject(0) do |num, entry|
num + (::Gollum::Page.valid_page_name?(entry.name) ? 1 : 0)
end
rescue Gollum::Git::NoSuchShaFound
0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(ref = nil)\n tree_map_for(ref || 'master').inject(0) do |num, entry|\n num + (@page_class.valid_page_name?(entry.name) ? 1 : 0)\n end\n rescue Grit::GitRuby::Repository::NoSuchShaFound\n 0\n end",
"def commits_count\n walker = Rugged::Walker.new(@repo.to_rugged)\n w... | [
"0.74588555",
"0.68364817",
"0.67575",
"0.62551874",
"0.62490857",
"0.6194543",
"0.6130833",
"0.61197084",
"0.61080015",
"0.60766804",
"0.60709447",
"0.60506415",
"0.6016462",
"0.6011633",
"0.59875613",
"0.5942346",
"0.58846563",
"0.58688563",
"0.58671474",
"0.5849722",
"0.58... | 0.76309574 | 0 |
Public: Search all pages for this wiki. query The string to search for Returns an Array with Objects of page name and count of matches | def search(query)
options = {:path => page_file_dir, :ref => ref}
search_terms = query.scan(/"([^"]+)"|(\S+)/).flatten.compact.map {|term| Regexp.escape(term)}
search_terms_regex = search_terms.join('|')
query = /^(.*(?:#{search_terms_regex}).*)$/i
results = @repo.git.grep(search_terms, op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:q].present?\n @results = Page.search(query: { fuzzy: { content: { value: params[:q] } } }, highlight: { fields: { content: {} } })\n @has_highlights = true\n else\n @results = Page.search('*')\n end\n @pages = @results.records\n end",
"def search(str)\n retur... | [
"0.66863966",
"0.6539015",
"0.64871925",
"0.6456954",
"0.6350453",
"0.62811387",
"0.60977465",
"0.60683525",
"0.60313946",
"0.5919283",
"0.5890094",
"0.5887567",
"0.5876648",
"0.58297634",
"0.57971835",
"0.57736754",
"0.5765854",
"0.5760964",
"0.57380176",
"0.57194316",
"0.57... | 0.7318667 | 0 |
Public: All of the versions that have touched the Page. options The options Hash: :page_num The Integer page number (default: 1). :per_page The Integer max count of items to return. Returns an Array of Gollum::Git::Commit. | def log(options = {})
@repo.log(@ref, nil, log_pagination_options(options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def versions\n self.git.commits\n end",
"def versions\n return @_versions ||= Regulate::Git::Interface.commits(id)\n end",
"def versions\n authorize @page\n @versions = @page.versions\n status = params[:by_status] && Page.statuses[params[:by_status]]\n if status\... | [
"0.6553735",
"0.6256945",
"0.62072563",
"0.6161507",
"0.6096494",
"0.5941071",
"0.58849686",
"0.5836921",
"0.58259594",
"0.58247536",
"0.58151895",
"0.58088404",
"0.5767442",
"0.57469803",
"0.56994045",
"0.56977344",
"0.5672206",
"0.5651959",
"0.56430924",
"0.5639977",
"0.563... | 0.0 | -1 |
Returns the latest changes in the wiki (globally) options The options Hash: :max_count The Integer number of items to return. Returns an Array of Gollum::Git::Commit. | def latest_changes(options={})
options[:max_count] = 10 unless options[:max_count]
@repo.log(@ref, page_file_dir, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recent_commit_shas count\n array_output_of(\"git rev-list HEAD -n #{count}\").reverse\nend",
"def get_all_commits(repo)\n all_commits = []\n page = 0\n page_size = 10\n commits = repo.commits('master', page_size, page)\n while commits.length > 0\n all_commits = all_commits + commits\n page = page... | [
"0.6114549",
"0.6078261",
"0.59370273",
"0.5936785",
"0.5835947",
"0.57691675",
"0.5725436",
"0.5709561",
"0.56974685",
"0.5689828",
"0.56570685",
"0.56469226",
"0.55805945",
"0.5574663",
"0.55701166",
"0.55678594",
"0.5527395",
"0.55133325",
"0.55119056",
"0.5510142",
"0.550... | 0.70890945 | 0 |
Public: Refreshes just the cached Git reference data. This should be called after every Gollum update. Returns nothing. | def clear_cache
@access.refresh
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_cache\n @cache = build_cache\n end",
"def cached_references\n @cached_references ||= []\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def refresh_repositories\n File.open(GITHUB_CACHE, ... | [
"0.6281668",
"0.62061083",
"0.617892",
"0.617892",
"0.6152173",
"0.605692",
"0.6040785",
"0.5927559",
"0.5925145",
"0.5904876",
"0.5896314",
"0.5873939",
"0.5872416",
"0.585339",
"0.5841224",
"0.58322936",
"0.58240986",
"0.58182025",
"0.5794824",
"0.5781314",
"0.5777646",
"... | 0.5373937 | 60 |
Normalize the data. data The String data to be normalized. Returns the normalized data String. | def normalize(data)
data.gsub(/\r/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(data)\n normalize_players data\n normalize_board data\n normalize_deals data\n data\n end",
"def normalize\n @data << \"\"\n end",
"def sanitize_data(data)\n data\n end",
"def normalize(string); end",
"def html_data_normalize(data)\n data.transform_... | [
"0.6897263",
"0.67976516",
"0.6649375",
"0.65771544",
"0.65287596",
"0.61712086",
"0.61110514",
"0.6101177",
"0.60774815",
"0.58634585",
"0.5623632",
"0.55866665",
"0.5554434",
"0.55186266",
"0.5514356",
"0.55023354",
"0.5486429",
"0.54751265",
"0.54744905",
"0.54739636",
"0.... | 0.6943592 | 1 |
Assemble a Page's filename from its name and format. name The String name of the page (should be precanonicalized). format The Symbol format of the page. Returns the String filename. | def page_file_name(name, format)
format.nil? ? name : "#{name}.#{::Gollum::Page.format_to_ext(format)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_file_name(name, format)\n ext = @page_class.format_to_ext(format)\n @page_class.cname(name) + '.' + ext\n end",
"def filename(format)\n \"#{filename_without_extension}.#{format}\"\n end",
"def filename\n @basename + PAGE_FILE_EXT\n end",
"def pdf_name(name = nil)\n name... | [
"0.82315075",
"0.63332784",
"0.62032163",
"0.61957616",
"0.614341",
"0.6058302",
"0.6034422",
"0.6034422",
"0.6021924",
"0.6020724",
"0.5863294",
"0.58567405",
"0.5831303",
"0.5820895",
"0.5814861",
"0.57571906",
"0.57571906",
"0.5756022",
"0.57363987",
"0.5720846",
"0.569865... | 0.8134208 | 1 |
Fill an array with a list of pages and files in the wiki. ref A String ref that is either a commit SHA or references one. Returns a flat Array of Gollum::Page and Gollum::File instances. | def tree_list(ref = @ref, pages=true, files=true)
if (sha = @access.ref_to_sha(ref))
commit = @access.commit(sha)
tree_map_for(sha).inject([]) do |list, entry|
if ::Gollum::Page.valid_page_name?(entry.name)
list << entry.page(self, commit) if pages
elsif files && !e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_list(ref)\n sha = @access.ref_to_sha(ref)\n commit = @access.commit(sha)\n tree_map_for(sha).inject([]) do |list, entry|\n next list unless @page_class.valid_page_name?(entry.name)\n list << entry.page(self, commit)\n end\n end",
"def load_ref_commits(ref)\n ... | [
"0.6122062",
"0.5933399",
"0.5713588",
"0.5620901",
"0.5507472",
"0.5506568",
"0.5471683",
"0.5471683",
"0.542936",
"0.5408229",
"0.5389706",
"0.5382573",
"0.5362797",
"0.5360148",
"0.5357895",
"0.53260326",
"0.5273892",
"0.52249753",
"0.52249753",
"0.521637",
"0.5209407",
... | 0.6641136 | 0 |
Gets the default name for commits. Returns the String name. | def default_committer_name
@default_committer_name ||= \
@repo.config['user.name'] || self.class.default_committer_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_name\n @default_name ||= \"__#{name}_default__\"\n end",
"def default_name\n return unless name\n Dry::Core::Inflector.underscore(name).tr('/', '_').to_sym\n end",
"def default_name\n [long_name, short_name].reject(&:empty?).first\n end",
"def defaul... | [
"0.7124973",
"0.6650022",
"0.6321299",
"0.61763304",
"0.6147961",
"0.61031544",
"0.60470724",
"0.59616375",
"0.5943736",
"0.58991456",
"0.58929616",
"0.5888019",
"0.5884618",
"0.58746636",
"0.5859471",
"0.5849903",
"0.5848335",
"0.5842896",
"0.5819907",
"0.57937866",
"0.57838... | 0.7709138 | 1 |
Gets the default email for commits. Returns the String email address. | def default_committer_email
email = @repo.config['user.email']
email = email.delete('<>') if email
@default_committer_email ||= email || self.class.default_committer_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_committer_email\n @default_committer_email ||= \\\n @repo.config['user.email'] || self.class.default_committer_email\n end",
"def default_user_email\n return default_email( DEFAULT_USER )\n end",
"def default_value_for_email\n git_global_config_for(\"user.email\") do |email_va... | [
"0.8338335",
"0.7425635",
"0.7308631",
"0.7196494",
"0.7092107",
"0.69934803",
"0.69651586",
"0.68942535",
"0.68252856",
"0.6661223",
"0.6639813",
"0.66253585",
"0.66253585",
"0.6562126",
"0.65618384",
"0.634422",
"0.6216453",
"0.6216453",
"0.6161266",
"0.61010253",
"0.610102... | 0.83815557 | 0 |
Gets the commit object for the given ref or sha. ref A string ref or SHA pointing to a valid commit. Returns a Gollum::Git::Commit instance. | def commit_for(ref)
@access.commit(ref)
rescue Gollum::Git::NoSuchShaFound
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit(ref)\n Commit.new(self, git.gcommit(ref))\n end",
"def rev_parse(ref)\n commit = git \"rev-parse #{ref}^{commit}\", :path => @full_path\n commit.chomp\n rescue R10K::ExecutionFailure => e\n logger.error \"Could not resolve ref #{ref.inspect} for git repo #{@full_path}\"\n raise\n ... | [
"0.7422145",
"0.6751967",
"0.66172963",
"0.64526206",
"0.6185365",
"0.60531366",
"0.6044704",
"0.6027647",
"0.5939044",
"0.5857137",
"0.5829165",
"0.5807901",
"0.5789055",
"0.5730718",
"0.5681903",
"0.5629648",
"0.56218517",
"0.56208974",
"0.5604513",
"0.5577994",
"0.5561285"... | 0.6896685 | 1 |
Finds a full listing of files and their blob SHA for a given ref. Each listing is cached based on its actual commit SHA. ref A String ref that is either a commit SHA or references one. ignore_page_file_dir Boolean, if true, searches all files within the git repo, regardless of dir/subdir Returns an Array of BlobEntry i... | def tree_map_for(ref, ignore_page_file_dir = false)
if ignore_page_file_dir && !@page_file_dir.nil?
@root_access ||= GitAccess.new(path, nil, @repo_is_bare)
@root_access.tree(ref)
else
@access.tree(ref)
end
rescue Gollum::Git::NoSuchShaFound
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_list(ref = @ref, pages=true, files=true)\n if (sha = @access.ref_to_sha(ref))\n commit = @access.commit(sha)\n tree_map_for(sha).inject([]) do |list, entry|\n if ::Gollum::Page.valid_page_name?(entry.name)\n list << entry.page(self, commit) if pages\n elsif ... | [
"0.63553715",
"0.6004246",
"0.6002092",
"0.5849015",
"0.5822561",
"0.56973326",
"0.56710935",
"0.5645902",
"0.5616881",
"0.56070334",
"0.55984116",
"0.55749846",
"0.5451996",
"0.5440513",
"0.5368058",
"0.53602153",
"0.5357161",
"0.5348032",
"0.5295856",
"0.5280364",
"0.527926... | 0.6144685 | 1 |
Public: Creates a Sanitize instance Returns a Sanitize instance. | def sanitizer
@sanitizer ||= Gollum::Sanitization.new(Gollum::Markup.to_xml_opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitization\n if @sanitization.nil?\n @sanitization = Sanitization.new\n end\n @sanitization\n end",
"def to_sanitize\n Sanitize.new(to_hash)\n end",
"def sanitizer\n if options = sanitization\n @sanitizer ||= options.to_sanitize\n end\n end",... | [
"0.6766314",
"0.6595113",
"0.63584226",
"0.62436336",
"0.57466245",
"0.5745006",
"0.57413834",
"0.5726023",
"0.56922114",
"0.55881053",
"0.55622596",
"0.55260146",
"0.5432649",
"0.53804314",
"0.5338153",
"0.52954715",
"0.5261283",
"0.5261283",
"0.5261283",
"0.5229848",
"0.522... | 0.58996975 | 4 |
Conjoins elements of a page or file path and prefixes the page_file_dir. Throws Gollum::IllegalDirectoryPath if page_file_dir is set, and the resulting path is not below it (e.g. if the dir or name contained '../') dir The String directory path name The String name of the Page or File format The Symbol format of the pa... | def merge_path_elements(dir, name, format)
result = ::File.join([@page_file_dir, dir, self.page_file_name(name, format)].compact)
result = Pathname.new(result).cleanpath.to_s
if @page_file_dir
raise Gollum::IllegalDirectoryPath unless result.start_with?("#{@page_file_dir}/")
result
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_directory(dir)\n format_dir = dir.strip\n format_dir = \"/#{format_dir}\" unless format_dir.start_with?('/')\n format_dir\nend",
"def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0.... | [
"0.6163197",
"0.5780102",
"0.5726545",
"0.5492942",
"0.541565",
"0.5377244",
"0.53496736",
"0.52786666",
"0.5193492",
"0.5124601",
"0.50819945",
"0.5069302",
"0.50276554",
"0.50249004",
"0.49910644",
"0.49868384",
"0.49550983",
"0.4952178",
"0.49425447",
"0.4919276",
"0.48733... | 0.77625287 | 0 |
returns either "rock", "paper", or "scissors" using rand() | def comp_choose_rps
rand_num = rand(3)
if rand_num == 1
"rock"
elsif rand_num == 2
"paper"
else
"scissors"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose\n [:rock, :paper, :scissors, :spock, :lizard].sample\n end",
"def choice\n\n\t$c_choice = 1 + rand(3)\n\n\t# Convert int to appropriate string\n\n\tcase $c_choice\n\t\twhen 1\n\t\t\t$c_choice = \"rock\"\n\t\twhen 2\n\t\t\t$c_choice = \"paper\"\n\t\twhen 3\n\t\t\t$c_choice = \"scissors\"\n\tend\n\n... | [
"0.7968223",
"0.7837162",
"0.77865666",
"0.7643488",
"0.75249976",
"0.7466412",
"0.73976225",
"0.7246445",
"0.71067935",
"0.70917755",
"0.6949861",
"0.69439",
"0.6943567",
"0.6913313",
"0.6849031",
"0.6848872",
"0.6791869",
"0.6776052",
"0.6756172",
"0.67293876",
"0.67293876"... | 0.8771647 | 0 |
returns either "It was a tie!", "You win!", or "The computer wins!" | def get_winner(comp,user)
if (comp == user)
puts "It was a tie!"
elsif (comp =="rock" && user == "scissors") || (comp =="paper" && user == "rock") || (comp =="scissors" && user == "paper")
puts "The computer wins!"
elsif ( comp == "scissors" && user =="rock") || (comp == "rock" && user =="paper"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overall_winner_message()\n if @score_count.get_determine_set_winner() == 1\n return \"#{@player.get_name()} won the set of games with a score of #{@score_count.get_games_won()} vs. #{@score_count.get_other_games_won()}. Both players tied #{@score_count.get_games_tied} time(s).\"\n\n elsif @score_count... | [
"0.8172127",
"0.77174723",
"0.7501867",
"0.74784404",
"0.7442822",
"0.74369466",
"0.73310965",
"0.73306316",
"0.7317713",
"0.73019964",
"0.72794193",
"0.72735095",
"0.7266918",
"0.7241502",
"0.72211546",
"0.7199557",
"0.71855134",
"0.7175772",
"0.71446514",
"0.7143359",
"0.71... | 0.66178316 | 75 |
asking whether the user wants to play again | def replay
puts "Would you like to play again? Please respond with yes or no."
answer = gets.chomp
if answer == "yes"
puts "Ready?...Go!"
play_game
elsif answer == "no"
puts "Alright then. Thank you for playing! OuO/"
else
puts "You didn't put neither 'yes' or 'no'. Let me ask you again."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_again?\r\n bool_input \"Play again?\"\r\n end",
"def play_again\n\tprint \"Would you like to play again? (y/n)\"\n end",
"def play_again?\n puts \"WOULD YOU LIKE TO PLAY AGAIN?\"\n puts 'Y/N?'\n response = gets.chomp\n if response.upcase == 'Y'\n @restart = true\n else\n ... | [
"0.84351206",
"0.8168121",
"0.8036621",
"0.7807066",
"0.7781239",
"0.7772749",
"0.77130455",
"0.7690588",
"0.7675418",
"0.7656487",
"0.76419294",
"0.76031095",
"0.76023567",
"0.7580011",
"0.7542804",
"0.7505544",
"0.75024956",
"0.74972117",
"0.7446378",
"0.74093497",
"0.73830... | 0.7418798 | 19 |
puts "The computer chose ____" followed by "You chose ____" followed by the result of get_winner | def play_game
#user_choose_rps
comp_choice = comp_choose_rps #<-- no need to use this because it's used once
user_choice = user_choose_rps
puts "The computer chose #{comp_choice}. You chose #{user_choice}."
puts get_winner(comp_choice, user_choice)
replay
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n\tputs \" - WoooW #{@name} !!!! Tu m'impressionne, Tu as gagne !!! \"\n\tputs \" \"\n end",
"def winning_msg(player_input, computer_input)\n puts \"You chose #{player_input} and the computer chose #{computer_input}. \\n You win!\"\nend",
"def you_win(winner)\n `say \"Congratulation! YOU WON, #{... | [
"0.80503815",
"0.77042395",
"0.7629916",
"0.7562705",
"0.75480455",
"0.75182754",
"0.74854726",
"0.7483953",
"0.74825186",
"0.74398243",
"0.7431016",
"0.7406745",
"0.7385483",
"0.7378422",
"0.73668295",
"0.7363375",
"0.7355274",
"0.73551506",
"0.73512566",
"0.73439217",
"0.73... | 0.0 | -1 |
Instance methods Override to_s method | def to_s
self.test_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end"... | [
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.87102795",
"0.8686291",
"0.8686291",
... | 0.0 | -1 |
Fonction pour inverser un string, le mettre en majuscule et supprimer les L, T, A | def reverse_upcase_noLTA(a)
a = a.reverse.upcase.gsub /[LTA]/, ""
return a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_upcase_noLTA(string)\n string = string.downcase\n string = string.delete \"a\"\n string = string.delete \"l\"\n string = string.delete \"t\"\n string = string.upcase\n string = string.reverse\n return string\nend",
"def reverse_upcase_noLTA(s1)\n\n\n\ts1 = s1.upcase.reverse\n\ts... | [
"0.6603916",
"0.6383868",
"0.6320998",
"0.6304817",
"0.6295204",
"0.62948227",
"0.6266459",
"0.6229937",
"0.6216116",
"0.61924094",
"0.6166164",
"0.61507154",
"0.6138225",
"0.60931486",
"0.6073247",
"0.6053886",
"0.60527736",
"0.6029099",
"0.59938943",
"0.59864354",
"0.594891... | 0.6132799 | 13 |
Identifie si le array inclu un 42 | def array_42(z)
if z.include? 42
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_42(a)\n\ta.any?{|x| x == 42}\nend",
"def include?(array, value)\r\n array.count(value) > 0\r\nend",
"def include_array?(array)\n array.any? { |member| array?(member) }\n end",
"def include?(ary, number)\n return false if ary.size == 0\n result = ary.detect do |item|\n item == number\n en... | [
"0.68770736",
"0.6762482",
"0.66344595",
"0.6589905",
"0.6419247",
"0.63957226",
"0.6354194",
"0.63487715",
"0.6348612",
"0.62703085",
"0.62668097",
"0.62611157",
"0.62393963",
"0.62144446",
"0.6200934",
"0.618982",
"0.6182823",
"0.6144957",
"0.6135623",
"0.6093848",
"0.60764... | 0.7273611 | 0 |
Returns an existing project by its name. :project_name The name of the project | def project_by_name(project_name)
projects.find { |project| project['name'].casecmp(project_name) == 0 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project(name)\n @projects.find { |p| p.name == name }\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n login unless authenticated?\n response = RestClient.g... | [
"0.88374454",
"0.8533017",
"0.8533017",
"0.84045345",
"0.83323795",
"0.80481815",
"0.79651904",
"0.77570105",
"0.7344556",
"0.7306633",
"0.7302666",
"0.7293204",
"0.72313297",
"0.71943",
"0.71731406",
"0.71730703",
"0.71719486",
"0.71429306",
"0.7138846",
"0.71175086",
"0.709... | 0.8610303 | 1 |
Override validate with our encrypt method: causes objects being saved to have relevant columns encrypted any errors raised during the encryption process result in validation failure. | def validate
encrypt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_validation(model)\n return if model.send(@attr_name).blank?\n model.send(\"crypted_#{@attr_name}=\", AsymmetricSentry.encrypt_to_base64(model.send(@attr_name)))\n end",
"def before_validation(model)\n return unless model.send(@attribute)\n model.send(\"crypted_#{@attribute}=\", ... | [
"0.6760192",
"0.66006285",
"0.57547784",
"0.5707015",
"0.5659598",
"0.56301117",
"0.56236565",
"0.55579126",
"0.55479115",
"0.55300814",
"0.5530031",
"0.54275495",
"0.54191786",
"0.53690463",
"0.5332338",
"0.5301963",
"0.528069",
"0.52783304",
"0.5273094",
"0.526426",
"0.5254... | 0.73497045 | 0 |
Record encryption ops in the Rails log. | def log_operation(column, op, sev=:info)
id = (self.id.nil?) ? 'new' : self.id.to_s
if ActiveRecord::Base.colorize_logging
message = " \e[4;32;1m%s(%s).%s %s\e[0m" % [self.class.to_s, id, column, op]
else
message = "%s(%s).%s %s" % [self.class.to_s, id, column, op]
end
log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encryption_logger\n @encryption_logger ||= HipaaCrypt.config.logger.tap do |logger|\n logger.formatter = LogFormatter.new(self) if logger.respond_to? :formatter=\n end\n end",
"def write_keylog_data\n output = session.ui.keyscan_dump\n\n if not output.empty?\n p... | [
"0.63816565",
"0.6235935",
"0.60788786",
"0.59013677",
"0.59013677",
"0.5862607",
"0.5810522",
"0.5810522",
"0.5810522",
"0.5810522",
"0.5810522",
"0.5810522",
"0.5810522",
"0.5810522",
"0.5793524",
"0.5789389",
"0.5760213",
"0.5746721",
"0.5656711",
"0.565483",
"0.55835736",... | 0.5431986 | 34 |
Displays the Tic Tac Toe Board given a board state | def display_board(board)
first_row = " #{board[0]} | #{board[1]} | #{board[2]} "
second_row = " #{board[3]} | #{board[4]} | #{board[5]} "
third_row = " #{board[6]} | #{board[7]} | #{board[8]} "
row_seperator = "-----------"
board = "#{first_row}\n"\
"#{row_seperator}\n"\
"#{second_row}\n"\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_board\n board =\n \" _______ _______ _______\n | | | |\n A| #{@state[:A1]} | #{@state[:A2]} | #{@state[:A3]} |\n |_______|_______|_______|\n | | | |\n B| #{@state[:B1]} | #{@state[:B2]} | #{@state[:B3]} |\... | [
"0.78369015",
"0.7769085",
"0.76257676",
"0.74422604",
"0.74041784",
"0.733471",
"0.73036766",
"0.7294039",
"0.72090185",
"0.718636",
"0.7173594",
"0.71548134",
"0.7152167",
"0.71395254",
"0.7113716",
"0.7113716",
"0.71100307",
"0.7104925",
"0.70980877",
"0.7097173",
"0.70971... | 0.0 | -1 |
Determines if the game is won. Takes an board array and returns a boolean | def won?(board)
WIN_COMBINATIONS.detect do |win|
board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&
position_taken?(board, win[0])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_won?\n\t\twon = false\n\t\t\n\t\tWINNING_POSITIONS.each do |positions|\n\t\t\tn = 0\n\t\t\tfor i in 0..8\n\t\t\t n += 1 if (positions[i] == @gameplay_positions[i] && positions[i] != 0)\n\t\t\tend\n\t\t\tif n == 3\n\t\t\t\twon = true\n\t\t\tend\n\t\tend\n\n\t\twon ? true : false\n\tend",
"def over?(bo... | [
"0.8116885",
"0.80759764",
"0.8044434",
"0.8042309",
"0.80259085",
"0.7980246",
"0.79785234",
"0.7925157",
"0.7919571",
"0.78810054",
"0.78647566",
"0.78619254",
"0.78493226",
"0.7843078",
"0.7840151",
"0.7839784",
"0.7839582",
"0.78106374",
"0.7797049",
"0.7796388",
"0.77963... | 0.78373814 | 17 |
Takes a array as an argument and returns true if all positions taken else false | def full?(board)
board.all? do |position|
position == "X" || position == "O"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_positions(array)\n array.each do |a|\n array.each do |b|\n next if a == b\n return false if a[1] == b[1] || a[2] == b[2]\n end\n end\n\n return true\nend",
"def reduce_to_all_true(array)\n counter = 0;\n while counter < array.length do\n return false if... | [
"0.75918967",
"0.72955745",
"0.7262054",
"0.7212886",
"0.70387447",
"0.702919",
"0.70074874",
"0.70060676",
"0.69824874",
"0.69789106",
"0.69506645",
"0.69408375",
"0.69335663",
"0.6922789",
"0.69175684",
"0.6887608",
"0.68833244",
"0.6854301",
"0.68147755",
"0.6814752",
"0.6... | 0.0 | -1 |
Takes a board as an argument and returns true for a draw, else false | def draw?(board)
!won?(board) && full?(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw?(board)\n\t if !won?(board) && full?(board)\n\t return true\n\t else\n\t return false\n\t end\nend",
"def draw?(board)\n if (full?(board) == false)\n return false\n else\n if (won?(board) != false)\n return false\n else\n return true\n end\n end\n end",
"def... | [
"0.8678764",
"0.863306",
"0.86123383",
"0.8589062",
"0.85821104",
"0.8572408",
"0.8560225",
"0.8560191",
"0.8537801",
"0.8537421",
"0.8537421",
"0.8535254",
"0.8524593",
"0.8522383",
"0.8522383",
"0.8507168",
"0.85056376",
"0.8504263",
"0.8495886",
"0.84906656",
"0.84821564",... | 0.83207524 | 59 |
Takes a board as an argument and returns true if the game is over else false | def over?(board)
draw?(board) || won?(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def over?(board)\n if won?(board) || draw?(board)\n return true\n else \n return false\n end\n end",
"def over?(board)\n if full?(board) || won?(board)\n return true\n else\n return false\n end\nend",
"def over?(board)\n if draw?(board) || full?(board) || won?(board)\n return t... | [
"0.8613887",
"0.855161",
"0.8547901",
"0.85068434",
"0.8494164",
"0.8494164",
"0.8485292",
"0.8483596",
"0.84664834",
"0.8463868",
"0.8462407",
"0.84535986",
"0.84535986",
"0.8444145",
"0.8441578",
"0.8441578",
"0.84413177",
"0.84376",
"0.84353673",
"0.8421253",
"0.84211284",... | 0.8249867 | 46 |
Takes a board as an argument and returns the winner as X or O | def winner(board)
if won = won?(board)
board[won[0]]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner(board)\n if (over?(board))\n if (board[won?(board)[0]] == \"X\")\n return \"X\"\n else\n return \"O\"\n end\n else\n end\n end",
"def winner(board)\n save = won?(board)\n if save == false\n return nil\n end\n if board[save[0]] == \"X\"\... | [
"0.88271916",
"0.88257676",
"0.86055344",
"0.8569516",
"0.85516334",
"0.85302",
"0.844751",
"0.84457445",
"0.84240496",
"0.8393373",
"0.83139795",
"0.83129966",
"0.83113253",
"0.8287799",
"0.8268309",
"0.82630044",
"0.82574457",
"0.82574457",
"0.82429934",
"0.82364154",
"0.82... | 0.0 | -1 |
Takes the board state as an argument and determines the current turn number | def turn_count(board)
turn = 0
board.each do |position|
if position == "X" || position == "O"
turn += 1
end
end
return turn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_player(board)\nturn_count(board).even? ? \"X\":\"O\"\nend",
"def turn\n marker = @turn_count.even? ? marker = \"X\" : marker = \"O\"\n move\n print \"Current board: \"\n show_board\n @player +=1\n end",
"def current_player(board)\n count = turn_count(board)\n count.even? ? \"X\" :... | [
"0.69618315",
"0.6913116",
"0.6868407",
"0.68213767",
"0.68077266",
"0.6802886",
"0.68011636",
"0.68007994",
"0.6793065",
"0.679255",
"0.6785544",
"0.6767105",
"0.6767105",
"0.67625844",
"0.67611146",
"0.67606616",
"0.67606616",
"0.67606616",
"0.67606616",
"0.67606616",
"0.67... | 0.670273 | 34 |
Takes the board state as an argument and determines the current player | def current_player(board)
if turn_count(board) % 2 == 0
return "X"
else
return "O"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end",
"def current_player(board)\n if turn_count(board).even?\n current_player = \"X\"\n else\n current_player = \"O\"\n end\nend",
"def current_player(board)\n player = turn... | [
"0.75564945",
"0.7406597",
"0.73669845",
"0.73560476",
"0.7283867",
"0.7278065",
"0.727573",
"0.727573",
"0.7263714",
"0.7248957",
"0.72482735",
"0.7245998",
"0.7209899",
"0.7205843",
"0.7183731",
"0.71613806",
"0.71613806",
"0.71613806",
"0.71613806",
"0.71294135",
"0.71281"... | 0.697724 | 60 |
Returns user input as a valid array index | def input_to_index(input)
offset = input.to_i - 1
return offset
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_to_index(user_input)\n user_input = user_input.to_i # converts string into integer\n index = user_input - 1 # Change user input to array index.\nend",
"def input_to_index(user_input) \n #converts the user's input (a string) into an integer / would use .to_i\n #convert... | [
"0.8062573",
"0.77591044",
"0.7719007",
"0.7384185",
"0.73381233",
"0.73381233",
"0.7239415",
"0.72209334",
"0.71974075",
"0.71820164",
"0.71820164",
"0.71820164",
"0.71820164",
"0.7164963",
"0.7152275",
"0.7132591",
"0.7107059",
"0.71044147",
"0.7089755",
"0.70779157",
"0.70... | 0.0 | -1 |
Marks players move on the board | def move(board, move, player)
board[move] = player
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_move(board, index, marker)\n board[index] = marker\n end",
"def set_move move\n@board[move] = @player\nend",
"def turn\n marker = @turn_count.even? ? marker = \"X\" : marker = \"O\"\n move\n print \"Current board: \"\n show_board\n @player +=1\n end",
"def move(board)\n ... | [
"0.77803814",
"0.7610095",
"0.7545085",
"0.74802303",
"0.7472013",
"0.7416865",
"0.7329196",
"0.7272946",
"0.72714347",
"0.72589004",
"0.724478",
"0.72422016",
"0.7241242",
"0.72309005",
"0.72166985",
"0.72157454",
"0.72125036",
"0.7208682",
"0.72054154",
"0.71934605",
"0.717... | 0.68970585 | 50 |
Takes the board as argument and runs through a complete turn | def turn(board)
index = -1
player = current_player(board)
until valid_move?(board, index) do
puts "Please enter 1-9:"
input = gets.strip
index = input_to_index(input)
end
move(board, index, player)
display_board(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_turn(board, search_depth); raise 'not implemented'; end",
"def turn(row, column)\n place_piece(row, column)\n puts display_board\n check_for_win() \n end",
"def turn\n marker = @turn_count.even? ? marker = \"X\" : marker = \"O\"\n move\n print \"Current board: \"\n show_board\... | [
"0.7892121",
"0.77743924",
"0.7554516",
"0.75393605",
"0.7422957",
"0.738623",
"0.73687863",
"0.73434997",
"0.73434",
"0.7331655",
"0.73286927",
"0.7324371",
"0.72979844",
"0.72942907",
"0.7283687",
"0.72696704",
"0.7258443",
"0.72394353",
"0.7237313",
"0.72257775",
"0.721573... | 0.0 | -1 |
Takes the board as an argument and runs through a complete game | def play(board)
until over?(board) do
turn(board)
end
if won?(board)
puts "Congratulations #{winner(board)}!"
else
puts "Cats Game!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend",
"def play_turn(board, search_depth); raise 'not implemented'; end",
"def turn(row, column)\n place_piece(row, column)\n puts display_board\n check_for_win() \n end",
"def play(... | [
"0.78039986",
"0.76778656",
"0.75027573",
"0.7498674",
"0.74959946",
"0.7485639",
"0.7485639",
"0.747795",
"0.7446707",
"0.74437356",
"0.744361",
"0.7435798",
"0.74167246",
"0.74055755",
"0.7405206",
"0.7396052",
"0.739569",
"0.7395227",
"0.73900783",
"0.7388644",
"0.73740923... | 0.7243143 | 52 |
Follows CanCanCan best practices for granting permissions. | def initialize(user)
return unless user.persisted?
if user.class == AdminUser
return unless user.role&.board_accessible?
can :read, ActiveAdmin::Page, name: 'Dashboard', namespace_name: 'admin'
can :read, CodeSchool
can :read, Location
can :read, Service
can :read, TeamMembe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can?(*args)\n permissions.can?(*args)\n end",
"def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def custom_permissions\n can ... | [
"0.731167",
"0.7203858",
"0.71161926",
"0.70987016",
"0.70987016",
"0.70865023",
"0.7059912",
"0.7059912",
"0.6979212",
"0.69178873",
"0.68830776",
"0.68830776",
"0.68547183",
"0.68497574",
"0.68102914",
"0.680772",
"0.6783865",
"0.6754158",
"0.6718715",
"0.67101794",
"0.6701... | 0.0 | -1 |
Since there could be the same plant in two plots, we need to find the record only in a certain plot | def growing_plant(plot_id)
self.growing_plants.where("growing_plants.plot_id = ?", plot_id).pluck(:id).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_reference_check(record,row)\n #riferimenti al plot\n plot = Plot.find(:first, :conditions => [\"numero_plot = ? AND deleted = false\", record.cod_plot])\n #se il plot non esiste\n if plot.blank?\n save_error(record,\"Riferimento al Plot\",row)\n #segnalo che c'è stato un errore s... | [
"0.55304325",
"0.54785895",
"0.52627754",
"0.5241792",
"0.51635766",
"0.51285154",
"0.506681",
"0.5057504",
"0.4975984",
"0.49615198",
"0.49615198",
"0.49615198",
"0.49615198",
"0.49615198",
"0.49615198",
"0.49615198",
"0.49615198",
"0.49440005",
"0.49405658",
"0.48630714",
"... | 0.5475822 | 2 |
an empty array accessible to all methods | def print_menu
puts "1. Input the students"
puts "2. Show the students"
puts "3. Save the list to students.csv"
puts "4. Load the list from students.csv"
puts "5. Exit"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array\n raise \"Not implemented\"\n end",
"def another; return []; end",
"def all\n []\n end",
"def __array__; self; end",
"def to_ary\n\t []\n\tend",
"def variables\n EMPTY_ARRAY\n end",
"def array\n @@array\n end",
"def initialize; @ary = []; end",
"def to_a; []... | [
"0.73341405",
"0.7154377",
"0.70395124",
"0.6939797",
"0.68577194",
"0.6831367",
"0.67742383",
"0.67736715",
"0.6770608",
"0.675761",
"0.6746169",
"0.67191696",
"0.6681353",
"0.661779",
"0.661779",
"0.661779",
"0.661779",
"0.6611431",
"0.65442127",
"0.6529813",
"0.652277",
... | 0.0 | -1 |
Insert page into tree tree Empty hash, to be filled with pages page Page to add as gollum::Page | def tree_insert(tree, page)
node_list = page.path.split("/")
_tree_insert(tree, page, node_list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_page_to_tree(page)\n if !page.root?\n #puts \"page: #{page}\"\n #puts \"page.fullpath: #{page.fullpath}\"\n #puts \"page.parent_id: #{page.parent_id}\"\n page.parent = @remote_pages_by_id[page.parent_id]\n #puts \"page.parent: #{page.parent}\"\n ... | [
"0.75847316",
"0.6881956",
"0.65700096",
"0.6422727",
"0.64048517",
"0.62687814",
"0.6181171",
"0.61767334",
"0.6121118",
"0.60213166",
"0.59795743",
"0.59611416",
"0.59034127",
"0.5891944",
"0.5876149",
"0.5859861",
"0.58153945",
"0.5790917",
"0.57699",
"0.5672251",
"0.56699... | 0.7567119 | 1 |
Recursively prints the page tree as a list tree tree Tree of Hash gollum::Pages folder Current folder, start with empty string | def tree_print(tree, folder)
str = "";
tree.each do |key, value|
if not value.is_a?(Hash)
# page
if value.name != "Home"
str += "<li><a href=\"/#{@wiki.base_path}#{value.url_path}\">#{value.name}</a></li>"
end
else
# folde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += ' ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end",
"def print_tree\n ''\n end",
"def flat_p... | [
"0.705941",
"0.7036967",
"0.6705626",
"0.6644185",
"0.6635575",
"0.65990317",
"0.65610635",
"0.6540181",
"0.6534913",
"0.6519284",
"0.6514515",
"0.64905924",
"0.64484364",
"0.6437291",
"0.64331853",
"0.64007074",
"0.63503546",
"0.6333948",
"0.63247776",
"0.63000214",
"0.62830... | 0.8189242 | 0 |
note: this really checks for apache2, which proxies the puppet dashbooard, if apache2 is down then the dashboard is not available (eventhough puppet system is ok) | def debug (msg = "")
if Object.const_defined?('Puppet')
Puppet.debug 'facter(extra_modulepath):'+msg
else
if ENV['FACTER_DEBUG'] == 'true'
$stdout.puts msg
$stdout.flush
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping\n http_get('/') == 'Consul Agent'\n rescue\n false\n end",
"def check\n puts\n puts \"Load Apache Balancer-Manager at '#{@balancer_manager_url}'\"\n puts\n puts \"Loading Details\"\n puts\n puts \" Balancer: #{get_balancer_manager.balancer_name}\"\n pu... | [
"0.6043811",
"0.6025303",
"0.59249675",
"0.5880701",
"0.57092494",
"0.5686053",
"0.56080455",
"0.56009674",
"0.55839986",
"0.5545523",
"0.552574",
"0.55129635",
"0.55092144",
"0.5497664",
"0.54610175",
"0.5460222",
"0.5456958",
"0.5438755",
"0.54276156",
"0.54166347",
"0.5409... | 0.0 | -1 |
if the user needs to be logged in (but is not), this function redirects to the signin page but saves the current location, so after the login the user can be redirected | def signed_in_user
unless signed_in?
store_location
redirect_to signin_url, notice: "You have to be logged in to do this"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in_user\n unless logged_in?\n store_location\n redirect_to root_url\n end\n end",
"def logged_in_user\n unless logged_in?\n store_location\n redirect_to root_url\n end\n end",
"def logged_in_user\n unless logged_in?\n store_location\n... | [
"0.83159953",
"0.8314148",
"0.8314148",
"0.8266438",
"0.80920374",
"0.8076656",
"0.8045759",
"0.8045759",
"0.80294365",
"0.80105996",
"0.7968521",
"0.79677814",
"0.79547155",
"0.7929061",
"0.7919851",
"0.79061097",
"0.79027677",
"0.7897464",
"0.7889551",
"0.7889551",
"0.78835... | 0.77519655 | 57 |
redirect to the stored location (if there is one) | def redirect_back_or(default)
redirect_to(session[:return_to] || default)
session.delete(:return_to)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end",
"def redirect?; end",
"def store_location\n session[:redirect] = request.url\n end",
"def store_location!\n session[\"return_to\"] = request.e... | [
"0.7381224",
"0.73708266",
"0.7339117",
"0.732073",
"0.7318128",
"0.7254937",
"0.72309023",
"0.7192216",
"0.7141708",
"0.71093285",
"0.7076754",
"0.7067377",
"0.7067377",
"0.7064908",
"0.7013761",
"0.6953116",
"0.69463634",
"0.6938234",
"0.6912283",
"0.68966955",
"0.686046",
... | 0.0 | -1 |
USER NOTIFICATIONS Someone replies to a user's comment | def comment_reply_notification(recipient_email, recipient_name, commenter_name, body, url)
email_with_name = "#{recipient_name} <#{recipient_email}>"
@recipient_name = recipient_name
@commenter_name = commenter_name
@body = body
@url = url
mail to: email_with_name, subject: "#{commenter_name} r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment_replied_to(options = {})\n send_comment_notification(options, \"reply_notice\")\n end",
"def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end",
"def notify\n reviewers = proposal.reviewers.reject{|r| r.id == user_id }\n Notification.create_for(... | [
"0.74379045",
"0.7126488",
"0.71163684",
"0.7109136",
"0.69349974",
"0.69329834",
"0.6927925",
"0.6907534",
"0.6896326",
"0.68674207",
"0.6842413",
"0.6770151",
"0.6737524",
"0.6697668",
"0.6670297",
"0.66652274",
"0.6649622",
"0.6635769",
"0.6590333",
"0.6583199",
"0.6568509... | 0.596739 | 77 |
ALEX NOTIFICATIONS New comment is posted | def new_comment(commenter_name, body, url)
@commenter_name = commenter_name
@body = body
@url = url
mail to: "Alex Yang <alexyang.personal@gmail.com>",
from: "BaseRails <notifications@baserails.com>",
subject: "#{commenter_name} posted a new comment on BaseRails"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_comment\n Notifications.new_comment\n end",
"def new_comment_notification(comment)\n\n blog = Post.find comment.post_id\n sender = User.find comment.user_id\n blog_owner = User.find blog.user_id\n #@subscribe = Subscribe.find :all, :conditions => [\"model_id = ? and model_type = ?\",blog.... | [
"0.7366315",
"0.7212313",
"0.7149339",
"0.69975203",
"0.69843256",
"0.6931522",
"0.69195795",
"0.69028443",
"0.6797928",
"0.67903423",
"0.67633265",
"0.6720222",
"0.6671905",
"0.6666856",
"0.6666589",
"0.664649",
"0.66284055",
"0.6590103",
"0.65852016",
"0.6565425",
"0.655716... | 0.68066525 | 8 |
New question is asked | def question_notification(asker, subject, details)
@asker = asker
@subject = subject
@details = details
mail to: "Alex Yang <alexyang.personal@gmail.com>",
from: "BaseRails <notifications@baserails.com>",
subject: "#{asker} posted a new question on BaseRails"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_new_question\n @for_new_question ||= false\n end",
"def questions\n \n end",
"def similar_questions\n\n end",
"def question(q, a)\n qu = Question.new(q,a)\n questions << qu\n @counter = 0 #Se inicializa el contador\n end",
"def new_question\n new_question = Question.new\n ... | [
"0.7336592",
"0.683144",
"0.67358756",
"0.66473466",
"0.6617984",
"0.6617463",
"0.6504145",
"0.644394",
"0.64160067",
"0.63654554",
"0.6343587",
"0.62691075",
"0.6254922",
"0.624288",
"0.6242147",
"0.6211092",
"0.62087",
"0.6206289",
"0.6163685",
"0.6160537",
"0.6151875",
"... | 0.0 | -1 |
SUSIE NOTIFICATIONS New free membership is created | def new_user(user_name, email)
@user_name = user_name
@email = email
mail to: "Susie Ye <susie@baserails.com>", subject: "Free User: #{email}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_user_notification\n\t\tUserMailer.new_user_notification('test@test.com',User.where(:administrator => nil).first)\n end",
"def create\n\n @pending_membership = PendingMembership.new(club_id: params[:user][:pending_membership][:club_id])\n\n params[:user].delete(\"pending_membership\")\n\n @user ... | [
"0.65898687",
"0.65527236",
"0.65236634",
"0.63877606",
"0.63744694",
"0.6345889",
"0.6345661",
"0.6344327",
"0.63308305",
"0.63035274",
"0.6296574",
"0.6282941",
"0.6268733",
"0.62682",
"0.62595916",
"0.6259286",
"0.62345225",
"0.6218828",
"0.6206919",
"0.6180948",
"0.615288... | 0.0 | -1 |
New paid subscription is created | def new_subscription(user_name, email, plan)
@user_name = user_name
@email = email
@plan = plan
mail to: "Susie Ye <susie@baserails.com>", subject: "#{plan.capitalize} User: #{email}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @subscription = Subscription.new(subscription_params)\n\n @subscription.sub_create(current_user,subscription_params[:stripe_plan_id],subscription_params[:coupon_code])\n\n # Create a subscription with the following information:\n #\n # 1) Customer Account\n # 2) Subscription Type... | [
"0.7746081",
"0.76549315",
"0.76422286",
"0.7485327",
"0.74802405",
"0.7476503",
"0.7459171",
"0.74475074",
"0.74396557",
"0.741183",
"0.739461",
"0.7369999",
"0.73657215",
"0.73461336",
"0.7341703",
"0.73408794",
"0.7329869",
"0.7320134",
"0.73191017",
"0.7317812",
"0.731781... | 0.0 | -1 |
Free user converts to paid subscription | def convert_to_paid(user_name, email, plan)
@user_name = user_name
@email = email
@plan = plan
mail to: "Susie Ye <susie@baserails.com>", subject: "Convert to #{plan}: #{email}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe\n # Find the user to pay.\n user = User.find( params[:id] )\n\n # Calculate the fee percentage that applies to\n # all invoices for this subscription.\n fee_percent = (Rails.application.secrets.fee_percentage * 100).to_i\n begin\n if user.stripe_customer_id\n customer = ... | [
"0.69839936",
"0.6858228",
"0.68579304",
"0.67189693",
"0.65107477",
"0.6440201",
"0.642846",
"0.6418202",
"0.63964564",
"0.6250977",
"0.624413",
"0.622063",
"0.62037724",
"0.6200478",
"0.6187639",
"0.61780113",
"0.6176871",
"0.614886",
"0.613117",
"0.6129322",
"0.61178",
"... | 0.69236606 | 1 |
User manually changes subscription plan | def edit_subscription(user_name, email, plan)
@user_name = user_name
@email = email
@plan = plan
mail to: "Susie Ye <susie@baserails.com>", subject: "Subscription changed to #{plan}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_plan(plan) \n unless stripe_customer_id.nil?\n customer = Stripe::Customer.retrieve(stripe_customer_id)\n customer.update_subscription(plan: plan.name, trial_end: 'now')\n self.subscription_plan_id = plan.id\n self.save\n end\n true\n rescue Stripe::StripeError => e\n ... | [
"0.76041776",
"0.74669385",
"0.7356115",
"0.724314",
"0.7236856",
"0.7213327",
"0.7182503",
"0.71035385",
"0.7092069",
"0.70577043",
"0.7033335",
"0.7026194",
"0.7015139",
"0.69181544",
"0.6916298",
"0.68789554",
"0.68789554",
"0.6859864",
"0.68326795",
"0.67719877",
"0.67303... | 0.7589928 | 1 |
User manually cancelled subscription | def unsubscribe(user_name, email, plan)
@user_name = user_name
@plan = plan
@email = email
mail to: "Susie Ye <susie@baserails.com>", subject: "#{user_name} unsubscribed from the #{plan} plan"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel!\n self.type = :unsubscribed\n reply_if_needed!\n end",
"def cancel\n success = current_subscriber.cancel_subscription\n render json: { success: success }\n end",
"def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :... | [
"0.8186676",
"0.7759023",
"0.76407486",
"0.7606256",
"0.75000703",
"0.7432854",
"0.7395187",
"0.7381974",
"0.73434424",
"0.7199396",
"0.7199396",
"0.7198324",
"0.7177332",
"0.71616846",
"0.71044433",
"0.71044433",
"0.70844054",
"0.7052843",
"0.7033653",
"0.701241",
"0.6978312... | 0.0 | -1 |
Ok so my code sux but I found this on stack overflow per wikipedia | def merge(left, right)
sorted = []
until left.empty? || right.empty? # I added the two lengths together to countdown index
if left.first <= right.first # This is not valid per instructions. mutates.
sorted << left.shift
else
sorted << right.shift
end
end
sorted.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def anchored; end",
"def schubert; end",
"def probers; end",
"def terpene; end",
"def berlioz; end",
"def stderrs; end",
"def rassoc(p0) end",
"def suivre; end",
"def schumann; end",
"def formation; end",
"def jack_handey; end",
"def hiss; end",
"def malts; end",
"de... | [
"0.6485155",
"0.6351451",
"0.6332772",
"0.6309414",
"0.61191106",
"0.60165817",
"0.5990105",
"0.59424376",
"0.592144",
"0.58605015",
"0.58037615",
"0.57828665",
"0.5780088",
"0.57763416",
"0.5763236",
"0.57541984",
"0.5707793",
"0.5686382",
"0.566465",
"0.566465",
"0.56440276... | 0.0 | -1 |
fixed mine. I think the flaw may have been in the logic determining if either array is empty. works now... Merge Sorted Lists | def merge(list1,list2)
x1 = list1.length
x2 = list2.length
out = []
if x1 == 0 || x2 == 0 ; return out = list1 + list2 else
x = x1 + x2 # add both lengths for # of steps
x1 -= 1 # -1 to equal index.last
x2 -= 1 # ^
while x > 0
if list1[x1] > list2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(arr1, arr2)\n return arr2 if arr1.size < 1\n return arr1 if arr2.size < 1\n\n merged_lists = []\n counter1 = 0\n counter2 = 0\n iterations = arr1.size + arr2.size\n\n iterations.times do |n|\n if arr1[counter1] == nil\n merged_lists << arr2[counter2]\n elsif arr2[counter2] == nil\n ... | [
"0.77788734",
"0.76593477",
"0.7489594",
"0.74631876",
"0.74030876",
"0.73905665",
"0.73739326",
"0.7349967",
"0.73142356",
"0.7302784",
"0.7251725",
"0.7204347",
"0.7201919",
"0.72010374",
"0.7198709",
"0.71880394",
"0.7166777",
"0.7146192",
"0.7130812",
"0.7120994",
"0.7109... | 0.6983743 | 33 |
number The Integer to check the previous Integer. Examples next_number(4) => 3 Returns the previous integer. | def previous_number(number)
return number - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_number(number)\n return number - 1 \nend",
"def previous_number(number)\n return number-1\nend",
"def previous_number(number)\n if !number.is_a?(Integer)\n return false\n else \n return number-1\n end\nend",
"def previous_number(num)\n return num - 1\nend",
"def... | [
"0.80320346",
"0.7950997",
"0.78540874",
"0.7842809",
"0.7842809",
"0.7842809",
"0.7842809",
"0.7803432",
"0.7368506",
"0.7184595",
"0.71002287",
"0.7099398",
"0.7064013",
"0.70106345",
"0.69623196",
"0.6933945",
"0.6791052",
"0.6791052",
"0.6791052",
"0.6791052",
"0.6752294"... | 0.81083083 | 1 |
Override in your job to control the workers lock key. | def lock_workers(*args)
"#{name}-#{args.to_s}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(worker)\n NotImplementedError\n end",
"def lock(key)\n raise NotImplementedError\n end",
"def with_lock(key)\n raise NotImplementedError\n end",
"def lock(worker)\n return true if locked? && locked_by == worker.name\n #all this to make sure t... | [
"0.7241906",
"0.70471346",
"0.6950251",
"0.6916594",
"0.6878906",
"0.6782911",
"0.6683809",
"0.6624477",
"0.6624477",
"0.6624477",
"0.660718",
"0.65577626",
"0.653717",
"0.6368507",
"0.63592064",
"0.63362813",
"0.629296",
"0.6269905",
"0.62202007",
"0.6199466",
"0.61821216",
... | 0.6776981 | 6 |
Override in your job to change the perform requeue delay | def requeue_perform_delay
1.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_queue_delay\n new_delay = params[:delay].to_f\n if new_delay == 0\n head :bad_request\n else\n Rails.application.config.queue_delay = new_delay\n render :get_queue_delay\n end\n end",
"def requeue_throttled\n Sidekiq.redis { |conn| ... | [
"0.69786054",
"0.65515125",
"0.6459481",
"0.64539534",
"0.642076",
"0.62689626",
"0.6257766",
"0.62181807",
"0.6182932",
"0.61827517",
"0.61612123",
"0.61576355",
"0.61546713",
"0.61506736",
"0.6126636",
"0.61198545",
"0.6104276",
"0.61037624",
"0.6097983",
"0.60850203",
"0.6... | 0.8617258 | 1 |
Number of maximum concurrent workers allow | def concurrent_workers(*args)
1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker_pool_size; end",
"def workers(count); end",
"def worker_concurrency\n ENV.fetch('PUB_SUB_WORKER_CONCURRENCY', 4).to_i\n end",
"def worker_count()\n @workers.size\n end",
"def worker_count()\n @workers.size\n end",
"def max_workers\n Resque::Kubernetes.max_workers\n ... | [
"0.78265285",
"0.77832997",
"0.77803946",
"0.77778155",
"0.77778155",
"0.769567",
"0.769012",
"0.7684243",
"0.76138914",
"0.76138914",
"0.75484043",
"0.7505982",
"0.74906987",
"0.7482726",
"0.739314",
"0.7364452",
"0.72857696",
"0.7277578",
"0.7227471",
"0.7182431",
"0.716082... | 0.76391906 | 8 |
Called with the job args before perform. If it raises Resque::Job::DontPerform, the job is aborted. | def before_perform_workers_lock(*args)
if lock_workers(*args)
workers_lock = get_lock_workers(*args)
if Resque.redis.incr(workers_lock) <= concurrent_workers(*args)
Resque.redis.expire(workers_lock, worker_lock_timeout(*args))
elsif
count = Resqu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_perform_ensure_proper_worker(*args)\n if args.last.is_a?(::Resque::Worker)\n self.worker = args.last\n else\n raise \"Resque::Job#args has not been overriden to pass worker as last argument.\"\n end\n \n if required_worker_class && worker.class.name !... | [
"0.72591966",
"0.6998915",
"0.67044365",
"0.6281824",
"0.61151856",
"0.58308643",
"0.5827616",
"0.58040285",
"0.5790611",
"0.57898456",
"0.5669318",
"0.562479",
"0.5598278",
"0.55628294",
"0.55579007",
"0.5505988",
"0.54788357",
"0.54226345",
"0.5406328",
"0.5389668",
"0.5347... | 0.60123044 | 5 |
The RGB value at position X | def at(x)
m = 1.0 * MAX_SEGMENTS * x
n = m.to_i # integer of m
f = m - n # Fraction of m
t = (f * 255).to_i
#puts "m: #{m} \tn: #{n} \tf: #{f} \tt: #{t}"
case n
when 0
[255, t, 0]
when 1
[255 - t, 255, 0]
when 2
[0, 255, t]
when 3
[0, 255 - t, 255]
when 4
[t, 0, 255]
when 5
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](x, y)\n get_pixel_color(x, y)\n end",
"def get_rgb_point(hue, chroma, x)\n case hue\n when 0...1 then [chroma, x, 0]\n when 1...2 then [x, chroma, 0]\n when 2...3 then [0, chroma, x]\n when 3...4 then [0, x, chroma]\n when 4...5 then [x, 0, chroma]\n when 5...6 then ... | [
"0.7031871",
"0.69783276",
"0.6930144",
"0.691593",
"0.6872396",
"0.6868721",
"0.68249416",
"0.67851305",
"0.6774456",
"0.67683727",
"0.6731148",
"0.66953063",
"0.6681526",
"0.6674518",
"0.66638625",
"0.6662558",
"0.66016954",
"0.654215",
"0.6527913",
"0.65197766",
"0.6513891... | 0.6297064 | 35 |
UK format is simply 9 digits | def valid_passport_number?(value)
value =~ /^[0-9]{9}$/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def international_toll_free_number\n FFaker.numerify('800 ### ####')\n end",
"def swedish_organisation_number\n # Valid leading digit: 1, 2, 3, 5, 6, 7, 8, 9\n # Valid third digit: >= 2\n # Last digit is a control digit\n base = [sample([1, 2, 3, 5, 6, 7, 8, 9]), sample((0..9)... | [
"0.7171287",
"0.67591935",
"0.6644684",
"0.6534203",
"0.6469353",
"0.64246917",
"0.6402178",
"0.63829374",
"0.6366664",
"0.63018835",
"0.6290397",
"0.6290397",
"0.62767375",
"0.6273385",
"0.62671703",
"0.6238793",
"0.6233969",
"0.6169826",
"0.61428577",
"0.61320007",
"0.61273... | 0.0 | -1 |
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end Confirms the correct user. | def correct_user
@user = User.find(params[:id])
redirect_to(root_url) unless current_user?(@user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in_user\n unless user_logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless user_logged_in?\n store_location\n flash[:danger] = 'Please log in.'\n redirect_to login_url\n end\n en... | [
"0.9257058",
"0.925327",
"0.925327",
"0.92527753",
"0.92310596",
"0.9213171",
"0.9205564",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.92050725",
"0.... | 0.0 | -1 |
Removes a scan engine from the list of available engines. | def delete_engine(engine_id, scope = 'silo')
xml = make_xml('EngineDeleteRequest', { 'engine-id' => engine_id, 'scope' => scope })
response = execute(xml, '1.2')
response.success
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engines_reset!\n @engine_instances = nil\n end",
"def purge_engine\n\n @engine.get_expression_storages.each { |s| s.purge }\n end",
"def remove\n uninstall_yri\n uninstall_yard\n end",
"def reset_engine_registrations!\n @@registered_engine_confs = {}\n end",
"de... | [
"0.6021842",
"0.57978475",
"0.5543416",
"0.5396357",
"0.5293891",
"0.52709705",
"0.52490824",
"0.5210177",
"0.5149985",
"0.51209754",
"0.5106502",
"0.50798714",
"0.5062802",
"0.5001143",
"0.49821478",
"0.4980737",
"0.49687755",
"0.49638912",
"0.49544933",
"0.49321955",
"0.493... | 0.49649525 | 17 |
Reverses the direction of a connection to an engine If the connection is currently initiated from the console this method will have the engine initiate the connection. If the connection is currently initiated by the engine this method with initiate the connection from the console instead. Requires a restart of the cons... | def reverse_engine_connection(engine_id)
uri = "/api/2.1/engine/#{engine_id}/reverseConnection"
response = AJAX.put(self, uri)
response.eql?('true')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_rev2self(*args)\n client.sys.config.revert_to_self\n end",
"def rev_engine\n\t\tputs \"VVVRRROOOMMM!!!!!! VVVVRRROOMMM!!!!!\"\n\tend",
"def unbind\n EM.add_timer(1) do\n puts \"Client: Reconnecting to #{@host}:#{@port}\"\n\n # Reconnect can be called with a different host / port and it... | [
"0.52937156",
"0.52782375",
"0.5225208",
"0.5181506",
"0.5174627",
"0.5144031",
"0.5144031",
"0.51084644",
"0.5023039",
"0.50131863",
"0.49626857",
"0.49626857",
"0.49580184",
"0.4947539",
"0.4947539",
"0.49339813",
"0.49339813",
"0.49336168",
"0.4928327",
"0.4928327",
"0.489... | 0.56109804 | 0 |
Provide a list of current scan activities for a specific Scan Engine. | def engine_activity(engine_id)
xml = make_xml('EngineActivityRequest', { 'engine-id' => engine_id })
r = execute(xml)
arr = []
if r.success
r.res.elements.each('//ScanSummary') do |scan_event|
arr << ScanSummary.parse(scan_event)
end
end
arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_activity\n r = execute(make_xml('ScanActivityRequest'))\n res = []\n if r.success\n r.res.elements.each('//ScanSummary') do |scan|\n res << ScanSummary.parse(scan)\n end\n end\n res\n end",
"def scan_activity\n r = execute(make_xml('ScanActivityReq... | [
"0.6531139",
"0.6531139",
"0.63660496",
"0.62723017",
"0.59774387",
"0.5886534",
"0.58821523",
"0.58210593",
"0.5661539",
"0.56202865",
"0.5569537",
"0.5528919",
"0.5512166",
"0.54550946",
"0.5436475",
"0.5417981",
"0.5391052",
"0.53896487",
"0.53633314",
"0.5358052",
"0.5355... | 0.6731486 | 0 |
Retrieve a list of all Scan Engines managed by the Security Console. | def list_engines
response = execute(make_xml('EngineListingRequest'))
arr = []
if response.success
response.res.elements.each('//EngineSummary') do |engine|
arr << EngineSummary.new(engine.attributes['id'].to_i,
engine.attributes['name'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @scanners = Scanner.all\n end",
"def list_scanners\n http_get(:uri=>\"/scanners\", :fields=>x_cookie)\n end",
"def engines\n @engines\n end",
"def index\n @scanhosts = Scanhost.all\n end",
"def list\n response = @client.get('scanners')\n verify response,\n ... | [
"0.5746477",
"0.57065904",
"0.57008016",
"0.56930375",
"0.56823623",
"0.5559899",
"0.5550172",
"0.5540904",
"0.5537062",
"0.5522223",
"0.5522174",
"0.54967386",
"0.5419142",
"0.541766",
"0.5414412",
"0.5404829",
"0.5400649",
"0.5395868",
"0.53940505",
"0.53471184",
"0.533045"... | 0.57659 | 0 |
Assign a site to this scan engine. | def add_site(site_id)
sites << SiteSummary.new(site_id, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_site\n @site = Site.find(params[:site_id])\n end",
"def set_site\n @site = Xmt::Press::Site.find(params[:id])\n end",
"def site=(site)\n @site = site\n end",
"def set_site\n @site = Site.find(params[:id])\n end",
"def set_site\n @site = Site.find(params[... | [
"0.7191745",
"0.7166264",
"0.71177214",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.70990056",
"0.7080954",
"0.70780957",
... | 0.0 | -1 |
Save this engine configuration to the security console. | def save(connection)
xml = '<EngineSaveRequest session-id="' + connection.session_id + '">'
xml << to_xml
xml << '</EngineSaveRequest>'
r = connection.execute(xml, '1.2')
if r.success
r.res.elements.each('EngineSaveResponse/EngineConfig') do |v|
return @id = v.attributes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end",
"def save_config\n\t\t# Build out the console config group\n\t\tgroup = {}\n\n\t\tif (active_module)\n\t\t\tgroup['ActiveModule'] = active_module.fullname\n\t\tend\n\n\t\t# Save it\n\t\tbegin\n\t\t\tMsf::Config.save(Co... | [
"0.681662",
"0.6630809",
"0.6502856",
"0.64619243",
"0.64393216",
"0.6413253",
"0.63849586",
"0.63841474",
"0.6371095",
"0.62953126",
"0.62655234",
"0.62274086",
"0.6182791",
"0.61431533",
"0.6122558",
"0.61088324",
"0.61045665",
"0.61045665",
"0.6085611",
"0.6033068",
"0.585... | 0.51955616 | 80 |
Delete this scan engine configuration from the security console. | def delete(connection)
connection.delete_engine(@id, @scope)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_configuration\n super\n end",
"def delete_configuration\n super\n end",
"def destroy\n @ddconfig.destroy\n end",
"def delete\n client.delete_launch_configuration(resource_options)\n nil\n end",
"def destroy\n conf.delete 'dashboard'\n end",
"def delet... | [
"0.6760006",
"0.6760006",
"0.6325618",
"0.63003814",
"0.61494595",
"0.6101288",
"0.6100471",
"0.60323316",
"0.6031614",
"0.5991961",
"0.5944621",
"0.5927239",
"0.5879597",
"0.5853687",
"0.58449",
"0.58449",
"0.58249944",
"0.582128",
"0.58144426",
"0.5813855",
"0.5775833",
"... | 0.0 | -1 |
Insert tuples into the relation | def insert(*args)
dataset.insert(*args)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(tuples)\n pks = tuples.map { |tuple| relation.insert(tuple) }\n relation.where(relation.primary_key => pks).to_a\n end",
"def multi_insert(tuples)\n pks = relation.multi_insert(tuples, return: :primary_key)\n relation.where(relation.primary_key => pks).to_a\n... | [
"0.80383486",
"0.7057741",
"0.6322903",
"0.62084985",
"0.6179151",
"0.61608",
"0.61463",
"0.6128502",
"0.6078597",
"0.6018639",
"0.59077644",
"0.587551",
"0.587551",
"0.5801934",
"0.58017886",
"0.5783541",
"0.5757908",
"0.57449186",
"0.5743243",
"0.57196814",
"0.5708825",
"... | 0.5758381 | 16 |
Delete tuples from the relation | def delete(*args)
dataset.delete(*args)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_vertex\n for rel in sorted_relations\n rel.remove(self)\n end\n\tend",
"def delete(rel)\n @relations.delete_if do |x|\n x === rel\n end\n @graph[rel.from].delete(rel.to)\n @graph[rel.to].delete(rel.from) if @undirected\n end",
"def delete!\n ... | [
"0.67862475",
"0.6555405",
"0.64511895",
"0.63844794",
"0.63304436",
"0.6162642",
"0.6135034",
"0.6130996",
"0.61221725",
"0.60315543",
"0.5983222",
"0.59773725",
"0.5948232",
"0.5934291",
"0.5916622",
"0.59121543",
"0.5908633",
"0.5894759",
"0.58906966",
"0.58822423",
"0.587... | 0.0 | -1 |
Web services initializer. The +appid+ is the Application ID that uniquely identifies your application. See: See | def initialize(appid)
@appid = appid
@url = URI.parse "http://api.local.yahoo.com/MapsService/V1/geocode"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(app_id)\n @app_id = app_id\n end",
"def initialize(app_id:)\n @app_id = app_id\n end",
"def initialize( app )\n\t\t@app = app\n\tend",
"def initialize(app, name, client_id=nil, client_secret=nil, client_options={}, options={}, &block)\n self.client_id = client_id\n ... | [
"0.6390914",
"0.6360193",
"0.63467044",
"0.62485325",
"0.6233828",
"0.62295395",
"0.62133735",
"0.61510885",
"0.61165386",
"0.61165386",
"0.61165386",
"0.60871094",
"0.6086187",
"0.6086187",
"0.6086187",
"0.6086187",
"0.60557175",
"0.60557175",
"0.60557175",
"0.6054705",
"0.6... | 0.5675151 | 45 |
Returns a Location for +address+. The +address+ can be any of: city, state city, state, zip zip street, city, state street, city, state, zip street, zip | def locate(address)
location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false))
# yahoo pukes on line breaks
get :location => location.gsub("\n", ', ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate(address)\n location = address.is_a?(String) ? address : location_from_params(address)\n case location\n when String\n get :qs => location\n when Location\n get \"street\" => location.street, \n \"region\" => location.region, \n \"ci... | [
"0.75734884",
"0.7498741",
"0.7437555",
"0.7437555",
"0.7437555",
"0.72646534",
"0.7046932",
"0.6777597",
"0.67576945",
"0.6753412",
"0.6645309",
"0.66367966",
"0.66080534",
"0.660201",
"0.6588839",
"0.6580375",
"0.6572701",
"0.6528612",
"0.6506962",
"0.64145756",
"0.6404193"... | 0.7231003 | 7 |
Extracts and raises an error from +xml+, if any. | def check_error(xml) #:nodoc:
if error = Error.parse(xml, :single => true)
raise Graticule::Error, error.message
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_error(xml) #:nodoc:\n err = xml.elements['Error']\n raise Error, err.elements['Message'].text if err\n end",
"def check_error(xml)\n raise NotImplementedError\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml)... | [
"0.75754756",
"0.7313642",
"0.7299152",
"0.7299152",
"0.7299152",
"0.7299152",
"0.66606736",
"0.64846176",
"0.63812006",
"0.6370814",
"0.63386154",
"0.62818575",
"0.6245293",
"0.6214026",
"0.6111986",
"0.61062044",
"0.5987903",
"0.5764052",
"0.5711715",
"0.56391513",
"0.56246... | 0.74455565 | 1 |
Creates a URL from the Hash +params+. Automatically adds the appid and sets the output type to 'xml'. | def make_url(params) #:nodoc:
params[:appid] = @appid
params[:output] = 'xml'
super params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_url(params) #:nodoc:\n params[:key] = @key\n params[:output] = 'xml'\n\n super params\n end",
"def make_url(params) #:nodoc:\n super params.merge(:output => \"xml\", :oe => 'utf8', :ll => @ll, :spn => @spn, :sensor => false)\n end",
"def make_url(method, params)\n... | [
"0.77202904",
"0.73859423",
"0.70935374",
"0.6519628",
"0.648389",
"0.64563817",
"0.64472604",
"0.6401922",
"0.6334719",
"0.63282037",
"0.6314989",
"0.6284054",
"0.62474936",
"0.62145054",
"0.6205274",
"0.6156818",
"0.6112958",
"0.60731816",
"0.6067982",
"0.6063928",
"0.60616... | 0.8514641 | 1 |
get hash of blocks names and its full path which have configs in /states folder in format key folder/subfolder value full path blockslibrary///wireframe/dist/index.html example = "header/header_1" => "PATH/header_1/wireframe/dist/index.html" | def block_paths
raise NotImplementedError, 'Implement this method in a child class'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_names\n @blocks.keys\n end",
"def basic_blocks\n cfg.blocks\n end",
"def class_name_to_blocks_dir(name)\n name = name.split('::')\n name.shift # Drop the application name\n dir = Origen.root.join('app', 'blocks')\n name.each_with_index do |n, i|\n ... | [
"0.60676914",
"0.5850342",
"0.5690418",
"0.56755036",
"0.55619407",
"0.55347025",
"0.5502979",
"0.54916793",
"0.5462911",
"0.5432573",
"0.5431822",
"0.5383319",
"0.53820235",
"0.5358739",
"0.533334",
"0.5328978",
"0.532226",
"0.53191423",
"0.53161263",
"0.5314122",
"0.5294759... | 0.0 | -1 |
Logs messages from ticket operations. By default, this is a memoized instance of Ruby's Logger class with log level DEBUG and log device set to standard error. | Log level | Data logged | +++ | DEBUG | Request URLs, response code/body, SSL context | In production, you may want to silence Castanet output. To do so, set ... | def logger
@logger ||= Logger.new($stderr).tap do |l|
formatter = Logger::Formatter.new
l.level = Logger::DEBUG
l.formatter = lambda { |*args| "[#{Module.nesting.first}] #{formatter.call(*args)}" }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(message)\n @ticket.log(message) unless message.blank?\n # always save the last log message\n @last_log_message = message\n end",
"def log\n @log || MPDClient.log\n end",
"def log\n Engine.logger\n end",
"def log\n @log\n end",
"def log()\n @log\n en... | [
"0.62768877",
"0.61188716",
"0.5869922",
"0.58544767",
"0.584124",
"0.5815229",
"0.57743937",
"0.5760339",
"0.57570636",
"0.57229143",
"0.570143",
"0.5679652",
"0.5660804",
"0.5659172",
"0.56579095",
"0.5656493",
"0.5643839",
"0.5639617",
"0.561211",
"0.5608594",
"0.55823493"... | 0.0 | -1 |
Returns the service ticket validation endpoint for the configured CAS URL. The service ticket validation endpoint is defined as `cas_url` + `"/serviceValidate"`. | def service_validate_url
URI.join(cas_url, 'serviceValidate').to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validation_url\n service_validate_url\n end",
"def proxy_validate_url\n URI.join(cas_url, 'proxyValidate').to_s\n end",
"def proxy_validate_url\n URI.join(cas_url, 'proxyValidate').to_s\n end",
"def service_validate_url(service, ticket)\n service = service.sub(/[?&]ticket... | [
"0.7028378",
"0.6827416",
"0.6827416",
"0.6221952",
"0.5654495",
"0.54053473",
"0.4980111",
"0.4980111",
"0.4937119",
"0.49363855",
"0.49133894",
"0.4900892",
"0.4869325",
"0.48612764",
"0.48407456",
"0.48298714",
"0.48224273",
"0.48054543",
"0.47764423",
"0.47663826",
"0.476... | 0.82871044 | 1 |
Returns the proxy ticket grantor endpoint for the configured CAS URL. | def proxy_url
URI.join(cas_url, 'proxy').to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint\n \"#{scheme}://#{host}#{suffix}#{reverse_proxy_path}\"\n end",
"def request_proxy_ticket(pgt, target_service)\n uri = URI.parse(proxy_url)\n h = uri.query ? query_to_hash(uri.query) : {}\n h['pgt'] = pgt.ticket\n h['targetService'] = target_service\n uri.query = hash_to... | [
"0.6436615",
"0.6221361",
"0.6175792",
"0.6175792",
"0.6166769",
"0.6137671",
"0.6137671",
"0.60677004",
"0.6045298",
"0.6045298",
"0.60039616",
"0.6000598",
"0.5977207",
"0.5941528",
"0.5904027",
"0.5875034",
"0.586606",
"0.58257544",
"0.5754683",
"0.5707499",
"0.56356704",
... | 0.7227306 | 1 |
Returns the proxy ticket validation endpoint for the configured CAS URL. | def proxy_validate_url
URI.join(cas_url, 'proxyValidate').to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_validate_url\n URI.join(cas_url, 'serviceValidate').to_s\n end",
"def service_validate_url\n URI.join(cas_url, 'serviceValidate').to_s\n end",
"def proxy_url\n URI.join(cas_url, 'proxy').to_s\n end",
"def proxy_url\n URI.join(cas_url, 'proxy').to_s\n end",
"def v... | [
"0.6927571",
"0.6927571",
"0.67784005",
"0.67784005",
"0.63889503",
"0.58226556",
"0.5812752",
"0.57911944",
"0.5709596",
"0.56785464",
"0.56785464",
"0.55982965",
"0.55319154",
"0.5475032",
"0.54404485",
"0.5390163",
"0.5323196",
"0.5287103",
"0.5208841",
"0.5208841",
"0.516... | 0.7894354 | 1 |
Build a cloneable repo url using http and basic auth | def repo_url_with_auth
auth = "gitlab-ci-token:#{token}@"
http_url_to_repo.sub(/^https?:\/\//) do |prefix|
prefix + auth
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone_url\n \"git://github.com/#{@account}/#{name}.git\"\n end",
"def giturl(project_name, repo_name) ; end",
"def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end",
"def repository_url(repositiory)\n http_uri + repositiory.path\n end",
"def git_clone... | [
"0.7415312",
"0.6901332",
"0.6834224",
"0.6737376",
"0.6643797",
"0.6624655",
"0.6560574",
"0.65568435",
"0.65453345",
"0.64887226",
"0.6465003",
"0.6459718",
"0.64289945",
"0.64037824",
"0.63792324",
"0.6331318",
"0.6287594",
"0.6268268",
"0.6202502",
"0.6198135",
"0.6180249... | 0.73203 | 1 |
Overwrite this method to customize how athletes are displayed across all pages of the admin dashboard. | def display_resource(athlete)
"#{athlete.first_name} #{athlete.last_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end",
"def index\n @athletes = Athlete.paginate(page: params[:page], :per_page => 15)\n end",
... | [
"0.63056684",
"0.61741674",
"0.6075385",
"0.59923637",
"0.59923637",
"0.56929433",
"0.56762433",
"0.54978",
"0.54602677",
"0.5383253",
"0.53410506",
"0.53213066",
"0.5308411",
"0.5274259",
"0.527108",
"0.5269547",
"0.52652836",
"0.5255453",
"0.52393126",
"0.52375156",
"0.5202... | 0.50953615 | 28 |
GET /answers GET /answers.json | def index
@answers = Replay.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n request('answers')\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity... | [
"0.8011635",
"0.7718146",
"0.7686177",
"0.76641846",
"0.76641846",
"0.76641846",
"0.76641846",
"0.75861204",
"0.75337416",
"0.7378286",
"0.72804594",
"0.72647053",
"0.7170898",
"0.7170898",
"0.7170898",
"0.71279556",
"0.7089768",
"0.7056577",
"0.7055519",
"0.6962942",
"0.6962... | 0.6625375 | 40 |
GET /answers/1 GET /answers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n ... | [
"0.8062779",
"0.75935924",
"0.74273294",
"0.74273294",
"0.74273294",
"0.74273294",
"0.7339199",
"0.72811383",
"0.72811383",
"0.72811383",
"0.7111482",
"0.7105832",
"0.70900667",
"0.70371944",
"0.7034046",
"0.6961521",
"0.68744123",
"0.68739426",
"0.6831872",
"0.68084544",
"0.... | 0.0 | -1 |
POST /answers POST /answers.json | def create
@replay = Replay.new(replay_params)
respond_to do |format|
if @replay.save
format.html { redirect_to admin_replay_path(@replay), notice: 'Replay was successfully created.' }
format.json { render :show, status: :created, location: @replay }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n request('answers')\n end",
"def add_answer\n request('answers/add')\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redi... | [
"0.7286637",
"0.7276844",
"0.7215924",
"0.71726644",
"0.70686775",
"0.70686775",
"0.7066745",
"0.7054315",
"0.7052485",
"0.70434344",
"0.7039424",
"0.69998896",
"0.69970363",
"0.69970363",
"0.6957991",
"0.69262266",
"0.6923806",
"0.69230163",
"0.6912971",
"0.6891326",
"0.6843... | 0.0 | -1 |
PATCH/PUT /answers/1 PATCH/PUT /answers/1.json | def update
respond_to do |format|
if @replay.update(replay_params)
format.html { redirect_to admin_replay_path(@replay), notice: 'Replay was successfully updated.' }
format.json { render :show, status: :ok, location: @replay }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @que... | [
"0.74345315",
"0.7360197",
"0.7190411",
"0.70442027",
"0.70442027",
"0.7028407",
"0.7019093",
"0.6977991",
"0.69718504",
"0.6914882",
"0.6914467",
"0.6898194",
"0.68933165",
"0.68796027",
"0.6867792",
"0.6852608",
"0.68504494",
"0.68504494",
"0.68504494",
"0.67942584",
"0.678... | 0.0 | -1 |
DELETE /answers/1 DELETE /answers/1.json | def destroy
@replay.destroy
respond_to do |format|
format.html { redirect_to admin_answers_path, notice: 'Replay was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end",
"def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :n... | [
"0.78710014",
"0.78369373",
"0.7804042",
"0.7804042",
"0.7779011",
"0.7779011",
"0.77608424",
"0.76613045",
"0.7621687",
"0.7613219",
"0.75670874",
"0.75555795",
"0.75216275",
"0.7514131",
"0.7514131",
"0.7514131",
"0.7514131",
"0.7514131",
"0.75009054",
"0.75009054",
"0.7500... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_replay
@replay = Replay.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def replay_params
params.require(:replay).permit(:description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69490993",
"0.6812977",
"0.6801889",
"0.67950445",
"0.6745037",
"0.6740698",
"0.65270424",
"0.6519444",
"0.6492448",
"0.6430671",
"0.6430671",
"0.6430671",
"0.63992614",
"0.6355569",
"0.6354901",
"0.63456345",
"0.63430274",
"0.63376623",
"0.6327184",
"0.6327184",
"0.632718... | 0.0 | -1 |
CLICKBAIT_PHRASES = [/Won't Believe/i, /Secret/i, /Top \d/i, /Guess/i] | def clickbait
if title && !title.include?("Won't Believe"||"Secret"||"Top"||"Guess")
errors.add(:title, "This isn't clickbait!")
end
# if self.title.include?("Won't Believe" || "Secret" || "Top" || "Guess")
# errors.add(:title, "This is clickbait.")
# end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebr... | [
"0.6236725",
"0.61731637",
"0.61398286",
"0.61398286",
"0.61348146",
"0.60834837",
"0.601706",
"0.59630066",
"0.5957516",
"0.5943533",
"0.5893468",
"0.584299",
"0.5812375",
"0.58034575",
"0.5792273",
"0.569639",
"0.56946933",
"0.567049",
"0.56658375",
"0.5661026",
"0.5653179"... | 0.6029704 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.