query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Config.time returns nil or VAR as time | def test_time
assert_equal(nil, Config.time('T'))
=begin
set_env 'T', '2000'
assert_equal(Time.utc(2000), Config.time(:t))
set_env 'T', '2000-2'
assert_equal(Time.utc(2000,2), Config.time(:t))
=end
set_env 'T', '2000-2-2'
assert_equal(Time.new(2000,2,2), Config.time(:t))
set_env 'T', '2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hold_time\n game_type == 'zones' ? config.time || 99999999 : nil\n end",
"def time\n set_function_and_argument(:time, nil)\n end",
"def get_setting_time\n return {setting_time: @config.encounter_duration}\n end",
"def default_time\n Time.now.utc\n end",
"def utime=(*) en... | [
"0.7117846",
"0.67626053",
"0.6723045",
"0.67150104",
"0.64486444",
"0.63894355",
"0.63808775",
"0.63477385",
"0.63347065",
"0.6333319",
"0.6331528",
"0.62289095",
"0.6211566",
"0.62080956",
"0.61654603",
"0.61646426",
"0.61570966",
"0.61313653",
"0.6121884",
"0.6117744",
"0.... | 0.7178664 | 0 |
Return `true` if all the category id's belong to `community` | def valid_categories?(community, category_attributes)
is_community_category = category_attributes.map do |category|
community.categories.any? { |community_category| community_category.id == category[:category_id].to_i }
end
is_community_category.all?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_categories?\n only? :categories\n end",
"def has_categories\n @categories.empty? ? false : true\n end",
"def has_categories? \n true\n end",
"def has_categories?(company, *category_ids)\n return false if category_ids.empty?\n customer_category_ids = get_customer_cat... | [
"0.6573119",
"0.6328586",
"0.60964656",
"0.609207",
"0.60839653",
"0.6050558",
"0.60442847",
"0.6016234",
"0.60128194",
"0.59169894",
"0.58793694",
"0.5808752",
"0.57905126",
"0.57713646",
"0.5764605",
"0.57643753",
"0.5762091",
"0.5730514",
"0.5705969",
"0.5669539",
"0.56654... | 0.80068696 | 0 |
validate fasta sequenz format hier needs MSA fasta format check for alphabet and length | def validate()
# rung base method to check
# for alphabet
super
# check for sequenz
# an validate sequenz length
if (sequenz?)
# hier check sequenz length
if(@lenth != @string.length)
raise "String length is not correct\nRequired lenght: #{@lenth}\nCurrent length: #{@string.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate()\n if (sequenz?)\n @string.each_char do |char|\n if(!@alphabet.match(/#{char}+/))\n raise \"String alphabet is not correct\\nChar: #{char}\\nString: #{@string}\" \n end\n end\n end\n end",
"def check_csfasta(fasta)\n # length is the total read len... | [
"0.6925251",
"0.6455059",
"0.63530064",
"0.628756",
"0.60741246",
"0.6000198",
"0.59571326",
"0.5888959",
"0.5878916",
"0.58740747",
"0.58740747",
"0.5857332",
"0.5821567",
"0.5818215",
"0.5772781",
"0.57560366",
"0.5747272",
"0.57197076",
"0.5693963",
"0.567099",
"0.5662518"... | 0.68026394 | 1 |
An adaptation of John Prince's code for resolving peptides. | def prince_resolve
puts "\n--------------------------------"
puts "Resolving isoforms...\n\n"
header = %w(title search_engines pep qvalue)
cutoff = config_value("//Refiner/@cutoff").to_f
files = []
@samples.each do |key, value|
value.combined.each {|file| files << file}
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve\n puts \"\\n--------------------------------\"\n puts \"Resolving isoforms...I think...\\n\\n\"\n \n pepHash = Hash.new {|h,k| h[k] = []}\n proHash = Hash.new {|h,k| h[k] = []}\n \n # Places proteins and peptides into hashes for mapping\n @samples.each do |key, value|\n val... | [
"0.5938126",
"0.56522924",
"0.5572143",
"0.5555317",
"0.5380705",
"0.5377989",
"0.5253232",
"0.5139917",
"0.51322055",
"0.5124179",
"0.5107821",
"0.5006957",
"0.49712193",
"0.4969611",
"0.49449944",
"0.49449944",
"0.49309972",
"0.49261695",
"0.49079403",
"0.4880741",
"0.48767... | 0.5788141 | 1 |
INTRO: convert objects to lowest level hashes peptide aaseq => [protein id, protein id...] protein id => [aaseq, aaseq, aaseq...] prot_to_pep and pep_to_prot (all by id) | def prepare_data(peptide_hits)
prot_to_peps = Hash.new{ |h,k| h[k] = Set.new }
pep_to_prots = {}
peptide_hits.group_by(&:aaseq).each do |aaseq, hits|
prots = hits.first.prots
pep_to_prots[aaseq] = prots.map(&:id)
prots.each do |prot|
prot_to_peps[prot.id] << aaseq
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_proteins!(peptide_hits)\n #peptide_hit responds to .prots\n #peptide_hit responds to .aaseq\n \n #protein_hit responds to .id\n #protein_hit responds to .peps\n \n prot_to_peps, most_overlap, pep_to_prots = prepare_data(peptide_hits)\n \n prot_to_peps_sorted = prot_to_peps.... | [
"0.5755786",
"0.5728069",
"0.55316556",
"0.5453384",
"0.54499656",
"0.54351956",
"0.54283655",
"0.5389162",
"0.5316094",
"0.51865596",
"0.51767796",
"0.5144883",
"0.51433766",
"0.5127153",
"0.50725245",
"0.50669444",
"0.5018673",
"0.49953076",
"0.49950114",
"0.49641547",
"0.4... | 0.6210964 | 0 |
UPDATE CODE: update the peptide hits with new proteins and proteins with new peptide hits update the peptide hits with minimum_proteins and proteins with peptides | def update_hits(peptide_hits, final_peps_to_prots)
peptide_hits.each do |pep|
pep.prots = pep.prots.select do |prot|
prot.peps = [] # clear the peptides
#final_peps_to_prots.each {|k,v| puts "K: #{k} V: #{v}"; break }
final_peps_to_prots[pep.aaseq].include?(prot.id)
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_proteins!(peptide_hits)\n #peptide_hit responds to .prots\n #peptide_hit responds to .aaseq\n \n #protein_hit responds to .id\n #protein_hit responds to .peps\n \n prot_to_peps, most_overlap, pep_to_prots = prepare_data(peptide_hits)\n \n prot_to_peps_sorted = prot_to_peps.... | [
"0.7743253",
"0.57975274",
"0.56039804",
"0.54089814",
"0.53479284",
"0.5271071",
"0.50881445",
"0.5079246",
"0.5060532",
"0.50107425",
"0.500542",
"0.49991724",
"0.4887907",
"0.48546088",
"0.48278812",
"0.4799673",
"0.47881007",
"0.47538394",
"0.47440156",
"0.47038057",
"0.4... | 0.7710889 | 1 |
PATCH/PUT /alien_groups/1 PATCH/PUT /alien_groups/1.json | def update
respond_to do |format|
if @alien_group.update(alien_group_params)
format.html { redirect_to @alien_group, notice: 'Alien group was successfully updated.' }
format.json { render :show, status: :ok, location: @alien_group }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @api_v1_group_update.update(api_v1_group_update_params)\n format.html { redirect_to @api_v1_group_update, notice: 'Grou... | [
"0.72715586",
"0.70165724",
"0.6953428",
"0.69406337",
"0.69252783",
"0.682161",
"0.6801648",
"0.6751748",
"0.67461103",
"0.67394817",
"0.6724707",
"0.6723086",
"0.6703838",
"0.6634446",
"0.6622171",
"0.6601423",
"0.66009647",
"0.6585322",
"0.65841097",
"0.6578291",
"0.657637... | 0.7263857 | 1 |
DELETE /alien_groups/1 DELETE /alien_groups/1.json | def destroy
@alien_group.destroy
respond_to do |format|
format.html { redirect_to alien_groups_url, notice: 'Alien group was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redire... | [
"0.74731827",
"0.73118705",
"0.73103017",
"0.7260079",
"0.7188299",
"0.7154165",
"0.7142955",
"0.71309",
"0.7126828",
"0.7102055",
"0.7068009",
"0.70677537",
"0.70677537",
"0.7067593",
"0.70589143",
"0.70589143",
"0.70589143",
"0.70589143",
"0.70589143",
"0.7054951",
"0.70374... | 0.76827157 | 0 |
Return the prerequirement scoped course ids in an array | def prereq_ids
return [] unless scoped_course
scoped_course.prereq_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abstract_prereq_ids\n return [] unless scoped_course\n scoped_course.strict_prereqs.collect { |scoped_course| scoped_course.abstract_course_id }\n end",
"def course_array\n self.current_active_courses.all.map { |course| [course.name, course.id] }\n end",
"def assigned_court_ids\n @assigne... | [
"0.7042337",
"0.6583046",
"0.64745396",
"0.6410201",
"0.6392798",
"0.6288837",
"0.6148386",
"0.5882102",
"0.5853609",
"0.5853609",
"0.58152366",
"0.5788103",
"0.57802814",
"0.5771133",
"0.5751438",
"0.5713546",
"0.5706579",
"0.56926143",
"0.5688796",
"0.5657131",
"0.5652808",... | 0.82930005 | 0 |
Returns an array of abstract_course_ids that are the direct prereqs of this planned course | def abstract_prereq_ids
return [] unless scoped_course
scoped_course.strict_prereqs.collect { |scoped_course| scoped_course.abstract_course_id }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prereq_ids\n return [] unless scoped_course\n scoped_course.prereq_ids\n end",
"def prerequisites\n Prerequisite.where(postrequisite: self).map do |prereq|\n Course.where(id: prereq.prerequisite_ids)\n end\n end",
"def prerequisites\n Prerequisite.where(postrequisite: self).map do |pr... | [
"0.73647773",
"0.68167424",
"0.68167424",
"0.6762918",
"0.6530194",
"0.5860083",
"0.5588996",
"0.55860823",
"0.55852145",
"0.54406625",
"0.5339909",
"0.52734447",
"0.51703405",
"0.5157346",
"0.51159817",
"0.5107313",
"0.50853354",
"0.5073671",
"0.50736",
"0.5071423",
"0.50696... | 0.7719463 | 0 |
Returns the length of the course in periods and nil if unknown | def length_or_one
length = scoped_course.length( period )
length.nil? ? 1 : length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end",
"def period_length_in_seconds\n @period_length_in_seconds ||= period_length.to_i.minutes.to_i\n end",
"def get_num_courses_for_department(valid_department)\r\n valid_department.courses.count\r... | [
"0.6547006",
"0.65180045",
"0.64718693",
"0.6457455",
"0.6374169",
"0.6332257",
"0.6324708",
"0.6249138",
"0.618105",
"0.6139582",
"0.6105394",
"0.6101783",
"0.60623413",
"0.6047448",
"0.60268676",
"0.5990418",
"0.59859174",
"0.59399426",
"0.5900482",
"0.58945185",
"0.5894518... | 0.7931033 | 0 |
Returns the period name or nil | def localized_period_name
localized_period_description.nil? ? '' : localized_period_description.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def period\n return @period\n end",
"def report_period_to_title\n case self\n when 'this_month'\n 'Days'\n when 'last_month'\n 'Days'\n when 'last_6_months'\n 'Months'\n when 'this_year'\n ... | [
"0.66455996",
"0.66134",
"0.65427357",
"0.6541722",
"0.6525342",
"0.64106554",
"0.6392802",
"0.6245681",
"0.6239655",
"0.61977935",
"0.61576086",
"0.61536294",
"0.6134436",
"0.61082804",
"0.60620195",
"0.59536374",
"0.5949386",
"0.593406",
"0.58681697",
"0.58681697",
"0.58595... | 0.8431742 | 0 |
Returns the course's ending period | def ending_period
start_period = self.period
length = self.length
return nil if start_period.nil?
return start_period if length.nil? or length <= 1
return start_period.find_following(length).last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def course_end\n self.course_start + self.course_length - 1\n end",
"def ends_at\n @ends_at ||= begin\n if period == :quarter\n starts_at.advance months: length * 3\n else\n starts_at.advance periods => length\n end\n end\n end",
"def end_date\n @end_date ||= re... | [
"0.7516135",
"0.74503475",
"0.68874884",
"0.68509376",
"0.6830939",
"0.6595501",
"0.65691435",
"0.64899254",
"0.6450257",
"0.6430022",
"0.6398308",
"0.6397822",
"0.6391961",
"0.6351767",
"0.6332437",
"0.6319667",
"0.6295124",
"0.6279896",
"0.6254394",
"0.6223517",
"0.62054384... | 0.74797916 | 1 |
set all options['xxx'] to given value | def setAllOptions(value)
$allSites.keys.each do |site|
cmd = "\$options['" + "#{site}'] " + "= #{value}"
eval(cmd)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_option(opt, val)\n @options[opt] = val\n end",
"def option key, value\n @options[ key ] = value\n end",
"def []=( name, value )\n @options[ name ] = value\n end",
"def set_options(options = {})\n options.each_pair do | key, value |\n send \"#{key}=\", value\n e... | [
"0.6991116",
"0.6834251",
"0.6711979",
"0.66408384",
"0.6564818",
"0.65535283",
"0.6542634",
"0.6542634",
"0.65073085",
"0.65073085",
"0.6479509",
"0.64764917",
"0.64621174",
"0.64374214",
"0.64040726",
"0.63876307",
"0.6364163",
"0.6351359",
"0.6335293",
"0.63165927",
"0.631... | 0.7063763 | 0 |
replaces primes with smartquotes using RubyPants | def smart_quotes(input)
require 'rubypants'
RubyPants.new(input).to_html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def priming_dilemma_non_religious_prime\n return %Q|\n Some species of fish are viviparous. In such species the mother retains the \n eggs and nourishes the embryos. Typically, viviparous fish have a strucure \n analogous to the placenta seen in mammals connecting the mother's blood supply \n ... | [
"0.59489524",
"0.5779246",
"0.5753408",
"0.5728606",
"0.5584244",
"0.5558951",
"0.550473",
"0.5470196",
"0.54106945",
"0.5403513",
"0.5395534",
"0.53925323",
"0.53291595",
"0.5317508",
"0.5303706",
"0.52736944",
"0.5270987",
"0.5262394",
"0.5260147",
"0.52362674",
"0.5229285"... | 0.6053738 | 0 |
outputs the registration header | def register_header(app_name, app_icon)
message = "#{get_gntp_header_start('REGISTER')}\r\n"
message << "Application-Name: #{app_name}\r\n"
message << "#{handle_icon(@app_icon, 'Application')}\r\n" if app_icon
message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header\n end",
"def register\n grab_header.invert\n end",
"def header; end",
"def header; end",
"def header; end",
"def wizard_header()\n header = '<meta name=\"wizard_controller\" content=\"'+@wizard_controller+'\" />'\n header += '<meta name=\"wizard_id_prefix\" content=\"'+@wi... | [
"0.6601196",
"0.6592004",
"0.65435505",
"0.65435505",
"0.65435505",
"0.63849205",
"0.63738155",
"0.6185565",
"0.61811817",
"0.6059196",
"0.6047695",
"0.6043485",
"0.6040072",
"0.60387546",
"0.6024507",
"0.60157514",
"0.59685534",
"0.59645444",
"0.5963876",
"0.59597653",
"0.59... | 0.69983524 | 0 |
outputs the notification header | def notify_header(app_name, name, title, text, sticky, icon)
message = "#{get_gntp_header_start('NOTIFY')}\r\n"
message << "Application-Name: #{@app_name}\r\n"
message << "Notification-Name: #{name}\r\n"
message << "Notification-Title: #{title}\r\n"
message << "Notification-Text: #{text}\r\n" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_header( notification )\n\t\ttemplate = self.load_template( HEADER_TEMPLATE )\n\t\treturn template.result( binding() )\n\tend",
"def start( notification )\n\t\tsuper\n\t\t@output.puts self.render_header( notification )\n\t\t@output.flush\n\tend",
"def notification_header(notification)\n notifiable... | [
"0.70451725",
"0.6943825",
"0.686929",
"0.68251926",
"0.6778807",
"0.66588837",
"0.6623875",
"0.66186357",
"0.6499475",
"0.64753044",
"0.6455165",
"0.6452541",
"0.6452541",
"0.6452541",
"0.63597035",
"0.63453174",
"0.6313948",
"0.6260118",
"0.6255415",
"0.6242556",
"0.6232892... | 0.7456835 | 0 |
figure out how to handle the icon a URL icon just gets put into the header a file icon gets read and stored, ready to be appended to the end of the request | def handle_icon(icon, type)
if File.exists?(icon) && @target_host != 'localhost'
file = File.new(icon)
data = file.read
size = data.length
if size > 0
binary = {
:size => size,
:data => data,
:uniqueid => Digest::MD5.hexdigest(data)
}
@bi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon\n respond_to do |format|\n if @package.present?\n format.png do\n send_file @package.icon.photo.path, :url_based_filename => true, :type => \"image/png\", :disposition => \"inline\"\n fresh_when :etag => @package, :last_modified => @package.created_at.utc, :public => true\... | [
"0.6998463",
"0.6710478",
"0.6710478",
"0.6534807",
"0.6529459",
"0.62498295",
"0.6220127",
"0.61119086",
"0.6108352",
"0.6024251",
"0.6011236",
"0.59997475",
"0.59926254",
"0.59678924",
"0.5960718",
"0.59463465",
"0.5917697",
"0.5910595",
"0.5898856",
"0.58755803",
"0.584076... | 0.7234427 | 0 |
outputs any binary data to be sent | def output_binary(binary)
message = "\r\n"
message << "Identifier: #{binary[:uniqueid]}\r\n"
message << "Length: #{binary[:size]}\r\n"
message << "\r\n"
message << "#{binary[:data]}\r\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_binary(data)\n @driver.binary(data)\n end",
"def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end",
"def write(bytes)\r\n end",
"def write bytes\n r = response_object\n r.body \"\" if r.body_io.nil?\n ... | [
"0.68129057",
"0.67759067",
"0.66480505",
"0.6387877",
"0.62728494",
"0.62482935",
"0.6208244",
"0.6198304",
"0.6198304",
"0.6198304",
"0.6198304",
"0.61971706",
"0.6193097",
"0.61363375",
"0.6131978",
"0.61209637",
"0.6119124",
"0.6083965",
"0.59884375",
"0.59635025",
"0.596... | 0.7098975 | 0 |
This function is used to get the annual electricity and natural gas results from the result.xml file | def get_results(result_xml_path)
results = {}
# parse the xml
raise "File '#{result_xml_path}' does not exist" unless File.exist?(result_xml_path)
File.open(result_xml_path, 'r') do |file|
doc = REXML::Document.new(file)
ns = 'auc'
doc.root.namespaces.each_pair do |k,v|
ns = k if /bedes-auc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_results\n begin\n results = Nokogiri::XML(open(URI.encode(@request.full)))\n rescue SystemCallError, EOFError\n retry\n end\n # puts results\n parse results, :query => @request.q\n end",
"def setup\n xml_results = <<BEGIN\n <search:response total=\"2\" start=\"1\" page-l... | [
"0.5676918",
"0.5552428",
"0.5477818",
"0.5461554",
"0.5418782",
"0.54067767",
"0.5342803",
"0.53422236",
"0.5329062",
"0.5316001",
"0.53021973",
"0.5295528",
"0.52857584",
"0.5274823",
"0.5260015",
"0.5257274",
"0.52563834",
"0.5255132",
"0.52443624",
"0.5231765",
"0.5230633... | 0.6767997 | 0 |
Cette method est invoque pour calcule automatiquement le montant de taxes payables. Dans ce systeme: le client paie un montant total. De ce total une partie est taxable et une partie non taxable. L'organisation doit donc les taxes sur la partie taxable. Utilise Cotisation.non_taxable, cotisation.total Il se peut que pl... | def calculDesTaxes
# Si un montant negatif, il s'agit d'une correction pour un
# paiement annule. Ne rien modifier.
return if self.montant < 0
# Trouver la somme des montants non-taxable de tous les paiements precedents
if self.new_record? # Est-ce un nouveau paiement ou une modification?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcular_monto_total\n self.monto_total = total_de_unidades_funcionales\n end",
"def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = ... | [
"0.71578056",
"0.7128268",
"0.6977935",
"0.6967035",
"0.6837983",
"0.67424256",
"0.6712449",
"0.6704683",
"0.6697918",
"0.6671124",
"0.66550195",
"0.66433233",
"0.66198236",
"0.6596945",
"0.65962636",
"0.65416855",
"0.65093386",
"0.6481994",
"0.64724934",
"0.6470986",
"0.6461... | 0.7266745 | 0 |
Protect WordPress special option from being modified. Will die if $option is in protected list. Protected options are 'alloptions' and 'notoptions' options. | def wp_protect_special_option( option )
if 'alloptions' == option || 'notoptions' == option
raise sprintf( '%s is a protected WP option and may not be modified', esc_html(option))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_option( option )\n option = option.strip\n return false if option.blank?\n\n wp_protect_special_option( option )\n\n Rails.cache.delete 'Railspress::' + 'options' + '/' + option\n true\n end",
"def validate(option)\n unless Config.settings.keys.include?(option.to_sym)\n ... | [
"0.63848835",
"0.5917857",
"0.5917857",
"0.5911756",
"0.5869207",
"0.5842024",
"0.5760393",
"0.56277233",
"0.5563038",
"0.55057794",
"0.55054516",
"0.5498228",
"0.5476935",
"0.54313034",
"0.5429991",
"0.5362703",
"0.5362703",
"0.5362703",
"0.5362703",
"0.5362703",
"0.5362703"... | 0.8959088 | 0 |
Loads and caches all autoloaded options, if available or all options. | def wp_load_alloptions
if true # ! wp_installing() || ! is_multisite()
alloptions = false # TS_INFO: don't save all in cache wp_cache_get( 'alloptions', 'options' )
else
alloptions = false
end
unless alloptions
alloptions = {}
# TS_INFO: Don't load all in the cache
# fore... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options_reload\n @cooldown, @ignore, @control, @thread =\n OPTIONS.values_at(:cooldown, :ignore, :control, :thread)\n end",
"def set_defaults\r\n @options = {\r\n :caching => true\r\n }\r\n end",
"def option_set\n @options ||= {}\n end",
"def l... | [
"0.66486764",
"0.64120317",
"0.631419",
"0.62852657",
"0.6206205",
"0.60008466",
"0.5985679",
"0.5971755",
"0.59669745",
"0.5940398",
"0.5846874",
"0.582684",
"0.58178484",
"0.579842",
"0.5771621",
"0.5760272",
"0.575054",
"0.56726325",
"0.56665325",
"0.56463104",
"0.5645417"... | 0.69808793 | 0 |
Returns the configured namespaces as an array This adds a root namespace to the end of the array if one was not configured manually. This fallback ensures that all components in the component dir can be loaded. | def to_a
namespaces.values.tap do |arr|
arr << Namespace.default_root unless arr.any?(&:root?)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespaces\n warn \"DEPRECATED: this is no longer supported by LDAP. This method will always return an empty Array\"\n []\n end",
"def namespaces\n root ? root.collect_namespaces : {}\n end",
"def namespaces\n root ? root.namespaces : {}\n end",
"def get_namespa... | [
"0.6893053",
"0.673565",
"0.6507269",
"0.64138985",
"0.639812",
"0.6397382",
"0.6397382",
"0.6294257",
"0.6225862",
"0.6171471",
"0.6164271",
"0.6062778",
"0.6057619",
"0.5921645",
"0.59160876",
"0.5889838",
"0.58515316",
"0.5817676",
"0.58030796",
"0.5720761",
"0.5620428",
... | 0.71153736 | 0 |
Walk the UI element tree and yield both the element and the level that the element is at relative to the root. | def each_with_level &block
# @todo A bit of a hack that I would like to fix one day...
@root.children.each do |element|
recursive_each_with_level element, 1, block
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_level\n\t\t\t(1..max_level).each do |level|\n\t\t\t\tyield level if block_given?\n\t\t\tend\n\t\tend",
"def traverse\n nodes = [self]\n until nodes.empty?\n node = nodes.pop\n yield node\n nodes += node.children.reverse unless node.children.empty?\n ... | [
"0.613398",
"0.5979982",
"0.58198833",
"0.5812456",
"0.5802623",
"0.5767848",
"0.5717725",
"0.5697178",
"0.5691375",
"0.56369627",
"0.56151986",
"0.5604932",
"0.5591666",
"0.5590262",
"0.5586226",
"0.5566984",
"0.55543494",
"0.55434054",
"0.551596",
"0.54902464",
"0.54895365"... | 0.65315753 | 0 |
Move Type : Random | def move_type_random
# Branch by random numbers 0-5
case rand(6)
when 0..3 # Random
move_random
when 4 # 1 step forward
move_forward
when 5 # Temporary stop
@stop_count = 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end",
"def move_type_random\r\n case rand(6)\r\n when 0..3 th... | [
"0.84111667",
"0.8373886",
"0.8287242",
"0.7962197",
"0.7686068",
"0.7665775",
"0.7588728",
"0.72014666",
"0.71434295",
"0.71078825",
"0.68968934",
"0.6854173",
"0.684082",
"0.6796851",
"0.6792258",
"0.6792258",
"0.6788306",
"0.6781348",
"0.67789924",
"0.67696035",
"0.6750464... | 0.8413802 | 0 |
named time_of_day that, given a boolean as an argument, prints "It's daytime!" if the boolean is true and "It's nighttime!" if it's false. Pass daylight into the method as the argument to determine whether it's day or night. | def time_of_day(boolean)
if boolean
puts 'It\'s daytime!'
else
puts 'It\'s nighttime!'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_of_day(daylight)\n puts daylight ? \"It's daytime!\" : \"It's nighttime!\"\nend",
"def time_of_day(daylight)\n if daylight\n puts \"It's daytime!\"\n else\n puts \"It's nighttime!\"\n end\nend",
"def time_of_day(boolean)\n boolean ? \"It's daytime!\" : \"It's nighttime!\"\nend",
"def time... | [
"0.86398226",
"0.85886496",
"0.8555661",
"0.8377729",
"0.8012684",
"0.7759926",
"0.7624842",
"0.69855124",
"0.6936706",
"0.64183193",
"0.6396416",
"0.6281224",
"0.62576693",
"0.6242626",
"0.62422526",
"0.6143916",
"0.6132214",
"0.60186327",
"0.59646827",
"0.5925429",
"0.59078... | 0.88642395 | 0 |
write document to file using specified method (i.e. append, overwrite) | def write_to_file(filename, method)
File.open(filename, method) do |file|
file.write(@doc)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_file(path,document) \n File.open(path,'w') do|file|\n file.write(document) if document\n end\nend",
"def write_to(doc);end",
"def write file, text\n File.open file, \"w\" do |file|\n file.write text\n end\n end",
"def write(fp)\n @doc.write(fp, 0, false, false)\n ... | [
"0.7315428",
"0.7202254",
"0.6464857",
"0.6411057",
"0.63603026",
"0.6295385",
"0.6248576",
"0.62244284",
"0.61938155",
"0.6125205",
"0.6125205",
"0.61158",
"0.6106679",
"0.6079572",
"0.60237837",
"0.6021184",
"0.60188633",
"0.6006282",
"0.60008955",
"0.5982154",
"0.59248483"... | 0.7826594 | 0 |
iterates over each term in document, returning root form | def each_term
self.to_terms.each do |term|
yield term.stem
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend",
"def extract_indexterms(terms)\n terms.each_with_object({}) do |t, v|\n ... | [
"0.625824",
"0.6083704",
"0.60710657",
"0.6026844",
"0.5969619",
"0.596253",
"0.596253",
"0.5916645",
"0.59010553",
"0.58889383",
"0.58698255",
"0.5865402",
"0.5832342",
"0.57765305",
"0.574076",
"0.5720611",
"0.5713681",
"0.57082546",
"0.5707052",
"0.5694691",
"0.5674997",
... | 0.7059886 | 0 |
removes all html, scripts, and style tags from document | def sanitize!
@doc.downcase!
@doc.gsub!(/<style.*?\/style>/m, '')
@doc.gsub!(/<script.*?\/script>/m, '')
@doc.gsub!(/<.*?>/m, ' ')
@doc.gsub!(/\s+/, ' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean()\n #strip all illegal content here. (scripts, shit that will break layout, etc.)\n end",
"def strip_style_tag (s)\ns.gsub(/<style.*<\\/style>/i, '');\nend",
"def clean_html(doc)\n\n # Remove font tags\n doc.xpath('//font').each do |node|\n node.children.each do |child|\n child.... | [
"0.72936016",
"0.70623153",
"0.698195",
"0.6925828",
"0.6871941",
"0.68394434",
"0.6827795",
"0.6817713",
"0.6706685",
"0.66718614",
"0.6658169",
"0.66246045",
"0.66191643",
"0.65817",
"0.65715104",
"0.6524747",
"0.65203404",
"0.6501249",
"0.650105",
"0.6494635",
"0.6481369",... | 0.7389875 | 0 |
1. downcase 2. strip tags and extra whitespace 3. remove non az characters 4. remove words shorter than 3 chars or longer than 20 5. stem terms 6. remove stems less than 2 chars long 7. remove stopwords | def strip_to_stems
str = self.sanitize_tags
terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')
terms = terms_a.reject do |term|
((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)
end
terms.collect! {|term| term.stem}
terms = terms.select {|term| term.length > 1}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(s)\nterms = s.gsub(/(\\s|\\d|\\W)+/u,' ').rstrip.strip.downcase.split(' ')\nterms.reject!{|term| @@stop_words.include?(term) || term.length < 3}\nterms\nend",
"def remove_w_words(sentence)\n \nend",
"def make_terms(text, lang)\n if !text\n return []\n end\n \n text = clean_text(tex... | [
"0.69674313",
"0.67399794",
"0.66827965",
"0.6680278",
"0.66602063",
"0.65746063",
"0.6568846",
"0.6562217",
"0.65338075",
"0.6501315",
"0.6490482",
"0.6477964",
"0.6454411",
"0.63950986",
"0.63940483",
"0.63770676",
"0.63743186",
"0.6369483",
"0.6357797",
"0.634627",
"0.6345... | 0.8165128 | 0 |
Returns a value for the field. field holds the value given by the user, if any. latitude_or_longitude is the current overall value for the latitude or longitude. current is a lambda which shows the part of the overall latitude or longitude value appropriate for the field. width is the number of characters for the field... | def field_value(field, latitude_or_longitude, current, width = 1, pad_if_blank = true)
padded = lambda { |x| x.to_s.rjust width, '0' }
if field
if field.blank?
pad_if_blank ? padded[field] : field
else
padded[field]
end
elsif latitude_or_long... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(field, column_width, space = '')\n case type\n when :left\n \"%-#{column_width}s#{space}\" % field.to_s\n when :right\n \"%#{column_width}s#{space}\" % field.to_s\n when :center\n center_align field, column_width, space\n end\... | [
"0.5344612",
"0.5158378",
"0.5093592",
"0.50661963",
"0.5061428",
"0.50172204",
"0.48974442",
"0.4879578",
"0.48051783",
"0.47931263",
"0.47852972",
"0.47785714",
"0.47682786",
"0.4761176",
"0.47577935",
"0.47577935",
"0.47302583",
"0.47184193",
"0.4699594",
"0.46972978",
"0.... | 0.8690888 | 0 |
Constructs a floatingpoint latitude from the constituent parts. If they are all blank, we don't bother. | def construct_latitude
unless [@latitude_degrees, @latitude_minutes, @latitude_milli_minutes, @latitude_hemisphere].all? { |attr| attr.blank? }
default_to_zero :@latitude_minutes, :@latitude_milli_minutes
lat_deg = to_bounded_float @latitude_degrees, 90, :@latitude_degrees_inva... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latitude\n latitude_times_1000000.nil? ? nil : latitude_times_1000000 / 1_000_000.0\n end",
"def parse_lat_long(raw)\n m = raw.match(/(\\d+)\\s+(\\d+\\.?\\d*)\\s*([NS])\\s+(\\d+)\\s+(\\d+\\.?\\d*)\\s*([WE])/i)\n if m.nil? || m.size != 5\n return nil\n else\n # Parse out degre... | [
"0.64518535",
"0.62678456",
"0.61421615",
"0.61384445",
"0.60906863",
"0.5970197",
"0.5806644",
"0.5806644",
"0.5717782",
"0.57111037",
"0.5692492",
"0.56759715",
"0.5674027",
"0.56639147",
"0.5652133",
"0.56509453",
"0.563484",
"0.5605773",
"0.5566235",
"0.55584455",
"0.5551... | 0.7658738 | 0 |
Constructs a floatingpoint longitude from the constituent parts. If they are all blank, we don't bother. | def construct_longitude
unless [@longitude_degrees, @longitude_minutes, @longitude_milli_minutes, @longitude_hemisphere].all? { |attr| attr.blank? }
default_to_zero :@longitude_minutes, :@longitude_milli_minutes
long_deg = to_bounded_float @longitude_degrees, 180, :@longitude_de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longitude\n longitude_times_1000000.nil? ? nil : longitude_times_1000000 / 1_000_000.0\n end",
"def parse_lat_long(raw)\n m = raw.match(/(\\d+)\\s+(\\d+\\.?\\d*)\\s*([NS])\\s+(\\d+)\\s+(\\d+\\.?\\d*)\\s*([WE])/i)\n if m.nil? || m.size != 5\n return nil\n else\n # Parse out de... | [
"0.7082505",
"0.65603966",
"0.65415156",
"0.6534537",
"0.6340597",
"0.6177311",
"0.6104121",
"0.5988006",
"0.5963586",
"0.58882326",
"0.58852375",
"0.5860462",
"0.58164805",
"0.57984024",
"0.5790103",
"0.5774035",
"0.5763569",
"0.57456475",
"0.57415885",
"0.57398516",
"0.5706... | 0.7710985 | 0 |
GET /custom_forms GET /custom_forms.json | def index
@custom_forms = CustomForm.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_json\n render template: 'utils/form_json'\n end",
"def index\n\t\t@forms = @client.forms.all\n\n\t\trespond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @forms }\n \tend\n\tend",
"def index\n @filled_forms = FilledForm.all\n\n respond_to do ... | [
"0.7028254",
"0.70077384",
"0.65585953",
"0.6538985",
"0.64795554",
"0.64547145",
"0.6442662",
"0.62540936",
"0.6236245",
"0.6230786",
"0.619939",
"0.6178205",
"0.6134579",
"0.6113574",
"0.6110217",
"0.60923314",
"0.6084574",
"0.6065018",
"0.6040203",
"0.6009912",
"0.6009912"... | 0.71785396 | 0 |
POST /custom_forms POST /custom_forms.json | def create
@custom_form = CustomForm.new(custom_form_params)
respond_to do |format|
if @custom_form.save
format.html { redirect_to @custom_form, notice: 'Custom form was successfully created.' }
format.json { render :show, status: :created, location: @custom_form }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_json\n render template: 'utils/form_json'\n end",
"def setup_form\n form = {\n schema: {\n type: 'object',\n properties: {\n array: {\n title: 'You have not configured your schema form',\n type: 'array',\n... | [
"0.6857409",
"0.63903254",
"0.603047",
"0.6007486",
"0.5957643",
"0.59299767",
"0.5923248",
"0.5920819",
"0.59155184",
"0.59063315",
"0.5887094",
"0.58827573",
"0.586955",
"0.58608645",
"0.58579105",
"0.5804654",
"0.58024246",
"0.57974255",
"0.57844806",
"0.574829",
"0.571289... | 0.72329867 | 0 |
PATCH/PUT /custom_forms/1 PATCH/PUT /custom_forms/1.json | def update
respond_to do |format|
if @custom_form.update(custom_form_params)
format.html { redirect_to @custom_form, notice: 'Custom form was successfully updated.' }
format.json { render :show, status: :ok, location: @custom_form }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @customf.update(customf_params)\n format.html { redirect_to @customf, notice: 'Customf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @custo... | [
"0.6180117",
"0.6085872",
"0.6038922",
"0.6013113",
"0.6013113",
"0.60054266",
"0.59896415",
"0.5986659",
"0.5945226",
"0.59022355",
"0.589317",
"0.5875549",
"0.5847044",
"0.58407515",
"0.5791404",
"0.57888556",
"0.5786433",
"0.5783831",
"0.5783831",
"0.5761291",
"0.57581645"... | 0.6805807 | 0 |
DELETE /custom_forms/1 DELETE /custom_forms/1.json | def destroy
@custom_form.destroy
respond_to do |format|
format.html { redirect_to custom_forms_url, notice: 'Custom form was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_form(id)\n @client.raw('delete', \"/content/forms/#{id}\")\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @filled_form = FilledForm.find(params[:id])\n @filled_form.destroy\n\n respond_to do |for... | [
"0.74428135",
"0.7141463",
"0.7124073",
"0.709309",
"0.7072965",
"0.70483327",
"0.7027119",
"0.7026537",
"0.7015027",
"0.7010163",
"0.70052063",
"0.6982619",
"0.6934369",
"0.6919716",
"0.68937993",
"0.68874073",
"0.6882722",
"0.68816984",
"0.68657416",
"0.68653345",
"0.684819... | 0.74479955 | 0 |
Private: Sends the metadata to Searchisko. Returns nothing. | def send_to_searchisko(metadata, page, site, converted_html)
metadata[:searchisko_id] = Digest::SHA1.hexdigest(metadata[:title])[0..7]
metadata[:searchisko_type] = 'jbossdeveloper_quickstart'
searchisko_hash = {
:sys_title => metadata[:title],
:level => metadata[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_to_searchisko(searchisko, metadata, page, site, converted_html)\n metadata[:searchisko_id] = metadata[:id]\n metadata[:searchisko_type] = 'jbossdeveloper_demo'\n\n\n output_url = page.output_path.split('/index.html')[0]\n searchisko_hash = {\n :sys_title => m... | [
"0.6916405",
"0.62576663",
"0.58629775",
"0.5406813",
"0.5371258",
"0.5359314",
"0.5356668",
"0.53106624",
"0.52163976",
"0.5201614",
"0.5198865",
"0.5190909",
"0.5190909",
"0.5190909",
"0.5190909",
"0.51898474",
"0.51898474",
"0.51798826",
"0.5170534",
"0.5170534",
"0.517053... | 0.662435 | 1 |
Private: Adds the contributing page of the repository to the site. Returns nothing. | def add_contributing(site)
if File.exist? "#{@repo}/CONTRIBUTING.md"
contribute = add_to_site site, "#{@repo}/CONTRIBUTING.md"
metadata = extract_metadata("#{@repo}/CONTRIBUTING.md")
# Little bit of C&P to change the output path, probably a better way
page_pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(... | [
"0.6190811",
"0.59784794",
"0.5797804",
"0.5628141",
"0.5616597",
"0.5563601",
"0.5272507",
"0.5120878",
"0.51113766",
"0.50518024",
"0.50132585",
"0.50023097",
"0.5000356",
"0.4986056",
"0.4975214",
"0.49745145",
"0.49611214",
"0.4948214",
"0.49452475",
"0.4932346",
"0.49245... | 0.75469434 | 0 |
Private: Makes use of the sepcial Kramdown parser in aweplug to pull out metadata from the README files. file The String file path (relative or absolute) to parse. Returns a Hash of the metadata retrieved. | def extract_metadata(file)
document = parse_kramdown(file)
toc = ::Kramdown::Converter::Toc.convert(document.root)
toc_items = toc[0].children.select { |el| el.value.options[:level] == 2 }.map do |t|
{:id => t.attr[:id], :text => t.value.children.first.value}
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_page_file\n raise \"File not found: #{@pointer['realpath']}\" unless File.exist?(@pointer['realpath'])\n\n page = File.open(@pointer['realpath'], 'r:UTF-8') {|f| f.read }\n\n begin\n front_matter = page.match(FMregex)\n rescue => e\n raise \"Error trying to read meta-dat... | [
"0.6914688",
"0.6364826",
"0.6346403",
"0.6266259",
"0.62364286",
"0.61390996",
"0.588307",
"0.5844633",
"0.58181554",
"0.5791439",
"0.57836103",
"0.57537574",
"0.57104236",
"0.56957424",
"0.5632826",
"0.5615778",
"0.56020665",
"0.5572739",
"0.5538208",
"0.55379623",
"0.55202... | 0.72919804 | 0 |
Private: Depth first traversal of Kramdown tree to find images. el Kramdown::Element images Array of image sources | def find_images el, images = Set.new
el.children.each {|elem| find_images elem, images}
if el.type == :img
images << el.attr['src']
end
images
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def images\n @images ||=\n search('img').map { |node| Image.new(node, self) }\n end",
"def images\n @images ||=\n search('img').map { |node| Image.new(node, self) }\n end",
"def get_all_image_paths(markdown)\n document = Kramdown::Document.new(markdown)\n document_descendants = []\n... | [
"0.6841924",
"0.6841924",
"0.6437288",
"0.6330638",
"0.62354714",
"0.6230007",
"0.6201398",
"0.6013814",
"0.5979105",
"0.59082836",
"0.5897273",
"0.5868554",
"0.5861685",
"0.5759141",
"0.57236135",
"0.57181954",
"0.56661755",
"0.56383616",
"0.56342554",
"0.56342554",
"0.56264... | 0.70540845 | 0 |
Private: Adds the Page to the site. site The Site from awestruct. file The String file path (relative or absolute) to parse. Returns the newly constructed Page | def add_to_site(site, file)
page_path = Pathname.new file
page = site.engine.load_site_page file
page.layout = @layout
page.output_path = File.join @output_dir, page_path.relative_path_from(Pathname.new @repo).dirname, 'index.html'
site.pages << page
page
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_site(site, path, content)\n page = ::Awestruct::Page.new(site,\n ::Awestruct::Handlers::LayoutHandler.new(site,\n ::Awestruct::Handlers::TiltHandler.new(site,\n ::Aweplug::Handlers::SyntheticHandler.new(site, content, path))))\n ... | [
"0.71238816",
"0.64927894",
"0.6238482",
"0.6235618",
"0.6191604",
"0.6177491",
"0.61726326",
"0.61427164",
"0.61091554",
"0.602894",
"0.6013827",
"0.59111136",
"0.5909333",
"0.5908584",
"0.5859825",
"0.5846412",
"0.57955194",
"0.5790332",
"0.5717454",
"0.5706358",
"0.5694421... | 0.80814826 | 0 |
Private: Adds the image to the site. site The Site from awestruct. file The String of the image path Returns nothing | def add_image_to_site(site, image)
page_path = Pathname.new image
page = site.engine.load_site_page image
page.output_path = File.join @output_dir, page_path.relative_path_from(Pathname.new @repo).dirname, File.basename(image)
site.pages << page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_site(site, file)\n page_path = Pathname.new file\n page = site.engine.load_site_page file\n page.layout = @layout\n page.output_path = File.join @output_dir, page_path.relative_path_from(Pathname.new @repo).dirname, 'index.html'\n site.pages << page\n ... | [
"0.64884084",
"0.64307594",
"0.64220977",
"0.6213309",
"0.61550057",
"0.6110464",
"0.5890653",
"0.5862465",
"0.58356893",
"0.5775867",
"0.57631314",
"0.57594776",
"0.57429427",
"0.5732929",
"0.57206124",
"0.5717544",
"0.5715304",
"0.57061005",
"0.57001096",
"0.5698162",
"0.56... | 0.7650103 | 0 |
Private: Parses the file through Kramdown. file The String file path (relative or absolute) to parse. Returns the parsed Kramdown Document. | def parse_kramdown(file)
::Kramdown::Document.new File.readlines(file).join, :input => 'QuickStartParser'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(path_to_file)\n file = self.class.get_file(path_to_file)\n\n parser = Parser.new(file)\n @title = parser.get_title\n @authors = parser.get_authors\n @abstract = parser.get_abstract\n @content = parser.get_content\n @references = parser.get_references.map do |r|\n Reference.new(r... | [
"0.70750386",
"0.69077224",
"0.6719481",
"0.6710939",
"0.66257066",
"0.6613336",
"0.65553343",
"0.6498186",
"0.6433202",
"0.64183277",
"0.64183277",
"0.64183277",
"0.64183277",
"0.64183277",
"0.64183277",
"0.63843787",
"0.63403964",
"0.63025635",
"0.63025635",
"0.62822115",
"... | 0.8227839 | 0 |
GET /game_items GET /game_items.json | def index
@game_items = GameItem.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @item = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM items \n WHERE iid = #{params[:id]} \n LIMIT 1\").first\n\n @games = ActiveRecord::Base.connection.execute(\"\n SELECT g.*\n FROM games g\n JOIN game_items gi\n ON g.gid = gi.gid\n WHER... | [
"0.7304611",
"0.69836855",
"0.6944618",
"0.68680584",
"0.68284124",
"0.6796882",
"0.6771409",
"0.66710573",
"0.6607486",
"0.66043407",
"0.65843636",
"0.6577977",
"0.6577777",
"0.6577777",
"0.6577777",
"0.6577777",
"0.65636027",
"0.6547761",
"0.65364015",
"0.6526816",
"0.64929... | 0.7314543 | 0 |
POST /game_items POST /game_items.json | def create
@game_item = GameItem.new(game_item_params)
respond_to do |format|
if @game_item.save
format.html { redirect_to @game_item, notice: 'Game item was successfully created.' }
format.json { render :show, status: :created, location: @game_item }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @game = Game.new(game_params)\n @game.user_id = params[:game][:user].first[:id]\n @game.item_id = params[:game][:item].first[:id]\n\n if @game.save\n render json: @game, status: :created, location: @game\n else\n render json: @game.errors, status: :unprocessable_entity\n en... | [
"0.7126625",
"0.7037513",
"0.6892144",
"0.6767697",
"0.6644726",
"0.6618971",
"0.66135854",
"0.65655667",
"0.6563421",
"0.6538577",
"0.64822364",
"0.6459002",
"0.64586526",
"0.6394681",
"0.6378494",
"0.6378431",
"0.6378431",
"0.6378431",
"0.6378431",
"0.6378431",
"0.6378431",... | 0.7320229 | 0 |
PATCH/PUT /game_items/1 PATCH/PUT /game_items/1.json | def update
respond_to do |format|
if @game_item.update(game_item_params)
format.html { redirect_to @game_item, notice: 'Game item was successfully updated.' }
format.json { render :show, status: :ok, location: @game_item }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.... | [
"0.71457493",
"0.69824016",
"0.67589325",
"0.6747936",
"0.67096883",
"0.6705945",
"0.6687673",
"0.66290617",
"0.65759593",
"0.656366",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563",
"0.6526563"... | 0.71776235 | 0 |
DELETE /game_items/1 DELETE /game_items/1.json | def destroy
@game_item.destroy
respond_to do |format|
format.html { redirect_to game_items_url, notice: 'Game item was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @gitem = Gitem.find(params[:id])\n @gitem.destroy\n\n respond_to do |format|\n format.html { redirect_to gitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])... | [
"0.7531235",
"0.7191204",
"0.71591544",
"0.7150519",
"0.71346694",
"0.7132265",
"0.7130567",
"0.7121621",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
"0.7121324",
... | 0.7574548 | 0 |
Define assessment component for the check whether the component is defined. | def component
current_component_host[:course_assessments_component]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def component_present\n if component.nil?\n errors.add(:component, 'is not valid.')\n end\n end",
"def set_component\n # Loads a Component object with associated rules, reviews,\n # descriptions, checks and additional answers where ID is equal to params id.\n @component = Component.eager_loa... | [
"0.6001023",
"0.56778985",
"0.56570387",
"0.56200296",
"0.5462435",
"0.5439843",
"0.5433902",
"0.5354247",
"0.5353602",
"0.5293449",
"0.5293449",
"0.5251661",
"0.5241908",
"0.51846975",
"0.51449746",
"0.5113889",
"0.50942814",
"0.50781256",
"0.50481373",
"0.5024392",
"0.50187... | 0.5844497 | 1 |
create job dir before job is started | def create_job_dir
begin
path = "#{FILE_SERVER_ROOT}/#{self.project.user.login}/#{self.project_id}/#{self.id}/"
logger.error("Creating job dir: #{path}")
FileUtils.mkdir(path)
FileUtils.chmod_R(0777, path)
rescue
logger.error("An error occurred creating job dir for job: #{self.id}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_jobdir\n @target + unique_dir\n end",
"def job_dir(base_dir, job_name)\n # All this flow is working under assumption that all task jobs called\n # in same order. We store counter for each job in Task instance and\n # it updated throug all task live time. Each time task inst... | [
"0.7752001",
"0.71690077",
"0.6797262",
"0.6655147",
"0.6421048",
"0.6334965",
"0.61536676",
"0.60903656",
"0.60804886",
"0.6062633",
"0.60582364",
"0.5981275",
"0.59761626",
"0.59743077",
"0.59359425",
"0.593135",
"0.5913424",
"0.5884279",
"0.5882433",
"0.5873379",
"0.586777... | 0.74635255 | 1 |
delete job dir after destroyed | def delete_job_dir
PoyService.delete(self.job_code) unless self.job_code.nil?
path = "#{FILE_SERVER_ROOT}/#{self.project.user.login}/#{self.project_id}/#{self.id}/"
FileUtils.rm_r(path) if File.exist?(path)
if self.status == "Running"
self.stop
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @status = nil\n FileUtils.rm_rf(job_folder) if Dir.exist?(job_folder)\n end",
"def worker_modifications\n remove_dir \"app/jobs\"\n empty_directory_with_keep_file \"app/workers\"\nend",
"def delete_dir\n FileUtils.rm_rf(@server_dir)\n @queue = []\n end",
"def del... | [
"0.7080068",
"0.703784",
"0.69793564",
"0.68270564",
"0.6806392",
"0.67330587",
"0.67235225",
"0.669544",
"0.66530937",
"0.66348207",
"0.6608065",
"0.65479404",
"0.65464085",
"0.65457344",
"0.65035146",
"0.6485026",
"0.64753056",
"0.64746183",
"0.64741486",
"0.64735067",
"0.6... | 0.80589575 | 0 |
Instance Methods Validates that `attribute`'s `value` on `record` is `Array` which is the only valid type signature for serialized parameters. | def validate_each(record, attribute, value)
if value.is_a? Array
value.each_with_index do |element, index|
if element.is_a? Array
if element.length != 2
extreme = :few
if element.length > 2
extreme = :many
end
length_error = len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_array(_record, attribute, value)\n errors.add(attribute, 'not an array.') unless value.is_a? Array\n end",
"def verify_attribute_value(value, attribute)\n null_allowed = attribute.respond_to?(:opts) && !!attribute.opts[:null]\n if value.nil?\n null_allowed ? [] : wrong_type_error(valu... | [
"0.8315856",
"0.6757222",
"0.66917086",
"0.6627838",
"0.6448331",
"0.63968587",
"0.63350993",
"0.6149604",
"0.61206996",
"0.6117519",
"0.59793305",
"0.59282863",
"0.590373",
"0.58691853",
"0.5858477",
"0.5843824",
"0.5772037",
"0.5755472",
"0.5712557",
"0.56295884",
"0.562705... | 0.6997528 | 1 |
GET /footnotes GET /footnotes.json | def index
@footnotes = Footnote.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_footnotes\n filename = 'Footnote.doc'\n remote_name = 'TestGetFootnotes.docx'\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_requ... | [
"0.69696444",
"0.67105263",
"0.6700892",
"0.613191",
"0.6060958",
"0.6036356",
"0.6028897",
"0.5985244",
"0.5960674",
"0.5959031",
"0.58982205",
"0.58827746",
"0.5832394",
"0.5816133",
"0.57827",
"0.5742777",
"0.5739348",
"0.57297015",
"0.57060546",
"0.57006115",
"0.5699503",... | 0.7130209 | 0 |
PATCH/PUT /footnotes/1 PATCH/PUT /footnotes/1.json | def update
respond_to do |format|
if @footnote.update(footnote_params)
format.html { redirect_to @footnote, notice: 'Footnote was successfully updated.' }
format.json { render :show, status: :ok, location: @footnote }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch(path, **args); end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n ... | [
"0.66027343",
"0.62854",
"0.6252046",
"0.6186379",
"0.6179339",
"0.6072025",
"0.6052541",
"0.6016942",
"0.60005665",
"0.59810203",
"0.59805423",
"0.5969053",
"0.59295243",
"0.59039056",
"0.59039056",
"0.5903303",
"0.58973294",
"0.5896871",
"0.5874965",
"0.5864026",
"0.5849904... | 0.69493306 | 0 |
DELETE /footnotes/1 DELETE /footnotes/1.json | def destroy
@footnote.destroy
respond_to do |format|
format.html { redirect_to analyze_path(Post.find(Draft.find(@footnote.draft_id).post_id)), notice: 'Footnote was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_footnote\n filename = 'Footnote.doc'\n remote_name = 'TestDeleteFootnote.docx'\n index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_a... | [
"0.68368423",
"0.6732048",
"0.67030174",
"0.6680045",
"0.6680045",
"0.6680045",
"0.6680045",
"0.6597074",
"0.65805876",
"0.6570335",
"0.65627635",
"0.6560862",
"0.6560862",
"0.6553835",
"0.6551999",
"0.65481687",
"0.6531863",
"0.6529851",
"0.6515199",
"0.65013707",
"0.6490942... | 0.72433513 | 0 |
setting some actions(or all) to use cache. given block will be used to decide which requests will use cache and which will not. if block returns any positive value, cache will be returned if block returns :update [Symbol], cache will be updated then returned otherwise a fresh version of action will be returned. | def cache *actions, &proc
if proc && configurable? # prohibit updates after controller mounted
actions = ['*'] if actions.size == 0
actions.each { |a| @cache[a] = proc }
end
action = actions.first
@setup['%s::%s' % [:cache, action]] ||= @cache[action] ||
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache(key, action, cache_store)\n binding.pry\n cache_key = key.to_s + \"_\" + action.to_s\n if cache_store[cache_key]\n return cache_store[cache_key]\n else\n result = yield # run the block\n cache_store[cache_key] = result # store it in our cache\n return result\n end\nend",
"def assert_ca... | [
"0.7469471",
"0.71108747",
"0.69945306",
"0.69636405",
"0.68674684",
"0.67981976",
"0.67128754",
"0.6678056",
"0.6638422",
"0.6551136",
"0.6461653",
"0.64555633",
"0.6420357",
"0.6358786",
"0.6356193",
"0.63182247",
"0.626342",
"0.6192193",
"0.6183496",
"0.6170436",
"0.615357... | 0.76679426 | 0 |
Allow passing a `:resources` option or a ransack search hash to filter exported resources If the provided :search option is a string, we consider it to be a query string and try parsing it with Rack::Utilsparse_nested_query | def resources
@resources ||= if options[:resources]
options[:resources]
elsif options[:search]
if options[:search].is_a?(String)
options[:search] = Rack::Utils.parse_nested_query(options[:search])
end
model.ransack(options[:search]).result
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _search options\n if params[:q].blank? #or params[:q]==\"undefined\"\n parent? ? parent.send(resource_name) : (resource_class.nil? ? nil : find_all_resources(options))\n else\n find_resources_queried options\n end\n end",
"def search\n # all available URL query parameters\n query_ke... | [
"0.66122776",
"0.62757957",
"0.590296",
"0.57904416",
"0.57780755",
"0.5765872",
"0.5761729",
"0.57293266",
"0.5715747",
"0.55688536",
"0.55528224",
"0.5544916",
"0.55420125",
"0.5527916",
"0.5491197",
"0.5488382",
"0.5461725",
"0.5427069",
"0.54175776",
"0.54136777",
"0.5408... | 0.68022907 | 0 |
look for digitalocean string in dmi bios data | def has_do_dmi?
begin
# detect a vendor of "DigitalOcean"
if dmi[:bios][:all_records][0][:Vendor] == "DigitalOcean"
logger.trace("Plugin DigitalOcean: has_do_dmi? == true")
return true
end
rescue NoMethodError
# dmi[:bios][:all_records][0][:Vendor] may not exist
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dmi_data\n return @dmi_data if @dmi_data\n\n case Facter.value(:kernel)\n when 'Linux'\n return nil unless FileTest.exists?(\"/usr/sbin/dmidecode\")\n\n output=%x{/usr/sbin/dmidecode 2>/dev/null}\n when 'FreeBSD'\n return nil unless FileTest.exists?(\"/usr/local/sbin/dmidecode\")... | [
"0.5842469",
"0.528623",
"0.52120215",
"0.5138358",
"0.5080682",
"0.50708085",
"0.5068595",
"0.5065937",
"0.50562537",
"0.5036898",
"0.5020798",
"0.50195533",
"0.49935973",
"0.4983719",
"0.49828988",
"0.4958036",
"0.49566758",
"0.495562",
"0.49528515",
"0.49506998",
"0.494690... | 0.6134274 | 0 |
Renders the search results partial within +app/views/alchemy/search/_results.html+ | def render_search_results(options = {})
default_options = {
show_result_count: true,
show_heading: true,
}
render "alchemy/search/results", options: default_options.merge(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_search_results(options={})\n default_options = {\n :show_result_count => true,\n :show_heading => true\n }\n render 'alchemy/search/results', :options => default_options.merge(options)\n end",
"def results\n get_results(true)\n render :partial => (para... | [
"0.8144036",
"0.782197",
"0.7396615",
"0.738027",
"0.73361886",
"0.7195622",
"0.71287376",
"0.7094495",
"0.7066708",
"0.70600784",
"0.7029734",
"0.69991577",
"0.6990728",
"0.69853616",
"0.6967332",
"0.692771",
"0.69177973",
"0.6877878",
"0.68708205",
"0.6855792",
"0.67891884"... | 0.80872476 | 1 |
Add a module +m+ to the dynamically included module list. | def dynamic_include(m, lib)
if m.library != lib
message = "dynamically included module #{m.name} should be defined in the module #{lib.name}"
raise InvalidLibrary, message
end
dynamically_included().push m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(module_object)\n @additional_modules << module_object\n end",
"def dynamic_extend(m, lib)\n if m.library != lib\n message = \"dynamically extended module #{m.name} should be defined in the module #{lib.name}\"\n raise InvalidLibrary, message\n end\n dynamically_extend... | [
"0.6798561",
"0.67638236",
"0.6557907",
"0.6368349",
"0.6367593",
"0.6273395",
"0.6261199",
"0.6260431",
"0.6178164",
"0.6176329",
"0.60478127",
"0.6020733",
"0.5955886",
"0.5920669",
"0.5909894",
"0.59024686",
"0.5898508",
"0.57949555",
"0.5749919",
"0.57491255",
"0.57475024... | 0.70140743 | 0 |
Add a module +m+ to the dynamically extended module list. | def dynamic_extend(m, lib)
if m.library != lib
message = "dynamically extended module #{m.name} should be defined in the module #{lib.name}"
raise InvalidLibrary, message
end
dynamically_extended().push m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(module_object)\n @additional_modules << module_object\n end",
"def add_module_by_normal_module(mod)\n add_class_or_module mod, @modules, @store.modules_hash\n end",
"def extend(mod)\n @modules << mod\n super(mod)\n end",
"def add_module(module_name, options = T.unsafe(n... | [
"0.69855285",
"0.6869313",
"0.6792868",
"0.6485486",
"0.6423917",
"0.63439566",
"0.6325446",
"0.6277999",
"0.6252114",
"0.6238303",
"0.6152398",
"0.6059418",
"0.5947123",
"0.5896555",
"0.5884456",
"0.5871591",
"0.58242804",
"0.57589626",
"0.5731588",
"0.5719529",
"0.57140946"... | 0.73297524 | 0 |
Add a alias +c+ to the alias list. | def alias(c)
aliases().push c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_alias( name )\n\t\t\t@aliases << name\n\t\tend",
"def alias(name)\n @aliases << convert(name)\n end",
"def alias(name)\n @aliases << convert(name)\n end",
"def add_alias!(aka)\n @aliases << aka if !@aliases.include?(aka)\n self\n end",
"def add_alias!(aka)\n @aliases << ak... | [
"0.66758776",
"0.64890283",
"0.64890283",
"0.64244205",
"0.64244205",
"0.63067675",
"0.61738443",
"0.6152927",
"0.6011227",
"0.59998196",
"0.5961189",
"0.58521384",
"0.5811287",
"0.5757248",
"0.56987363",
"0.56942624",
"0.5682436",
"0.5667569",
"0.56559217",
"0.5619821",
"0.5... | 0.8871815 | 0 |
GET /sob_classes GET /sob_classes.json | def index
@sob_classes = SobClass.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n ... | [
"0.6620667",
"0.65302306",
"0.6368851",
"0.62821543",
"0.62397",
"0.61796254",
"0.6021757",
"0.58681315",
"0.58574945",
"0.58527637",
"0.5830189",
"0.5757606",
"0.5723929",
"0.5660438",
"0.5660438",
"0.56594634",
"0.56566966",
"0.5637809",
"0.5636792",
"0.56245875",
"0.559867... | 0.73295885 | 0 |
POST /sob_classes POST /sob_classes.json | def create
@sob_class = SobClass.new(sob_class_params)
respond_to do |format|
if @sob_class.save
format.html { redirect_to @sob_class, notice: 'Sob class was successfully created.' }
format.json { render action: 'show', status: :created, location: @sob_class }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @s_class = SClass.new(s_class_params)\n\n respond_to do |format|\n if @s_class.save\n format.html { redirect_to @s_class, notice: 'S class was successfully created.' }\n format.json { render :show, status: :created, location: @s_class }\n else\n format.html { rende... | [
"0.60025775",
"0.5994927",
"0.56445396",
"0.55708116",
"0.5569722",
"0.54121053",
"0.53465414",
"0.5345267",
"0.5332416",
"0.5234682",
"0.52320194",
"0.52093786",
"0.5207143",
"0.5193912",
"0.5188216",
"0.51865935",
"0.51848704",
"0.5135365",
"0.51351213",
"0.51124424",
"0.51... | 0.69588846 | 0 |
PATCH/PUT /sob_classes/1 PATCH/PUT /sob_classes/1.json | def update
respond_to do |format|
if @sob_class.update(sob_class_params)
format.html { redirect_to @sob_class, notice: 'Sob class was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @sob_class... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @s_class.update(s_class_params)\n format.html { redirect_to @s_class, notice: 'S class was successfully updated.' }\n format.json { render :show, status: :ok, location: @s_class }\n else\n format.html { render :edit }\n format.json {... | [
"0.669527",
"0.6652689",
"0.6600181",
"0.6535367",
"0.6489561",
"0.633411",
"0.6228649",
"0.6228649",
"0.6224147",
"0.6223032",
"0.6191073",
"0.6183345",
"0.6165919",
"0.61573976",
"0.6149081",
"0.6122096",
"0.61051464",
"0.6088136",
"0.60867417",
"0.6084083",
"0.6080915",
... | 0.7203164 | 0 |
DELETE /sob_classes/1 DELETE /sob_classes/1.json | def destroy
@sob_class.destroy
respond_to do |format|
format.html { redirect_to sob_classes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @s_class.destroy\n respond_to do |format|\n format.html { redirect_to s_classes_url, notice: 'S class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climb_class.destroy\n respond_to do |format|\n format.html { redirect_... | [
"0.72422045",
"0.69438994",
"0.6931475",
"0.6905005",
"0.686788",
"0.68368256",
"0.6834666",
"0.6810723",
"0.6786547",
"0.676681",
"0.6727932",
"0.6725845",
"0.6722657",
"0.66894436",
"0.66779196",
"0.6609199",
"0.6569843",
"0.65421593",
"0.6539786",
"0.6527967",
"0.6525073",... | 0.7763508 | 0 |
Frees the reference to this object (Problably a good idea if you want Lua's GC to get rid of it later). | def free
Lib.luaL_unref(@pointer, LUA_REGISTRYINDEX, @ref)
@ref = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispose\n call Memory.deAlloc(self)\n end",
"def dispose\n call Memory.deAlloc(self)\n end",
"def free\n\n self.class.free(@pointer)\n @pointer = nil\n end",
"def dealloc\n end",
"def free\n cache.clear\n nil\n end",
"def unref\n UV.unref(@pointer)\n\n self\n ... | [
"0.7714594",
"0.7714594",
"0.72763115",
"0.7131148",
"0.69994617",
"0.6992261",
"0.6992261",
"0.69712204",
"0.6878548",
"0.6860497",
"0.68526596",
"0.6752213",
"0.6752213",
"0.6736078",
"0.67333394",
"0.6718604",
"0.6699654",
"0.6677379",
"0.6663566",
"0.6660015",
"0.66534084... | 0.8133088 | 0 |
Brings the referenced object on top of the stack (will probably then take part in a method call). | def load_onto_stack
raise RuntimeError.new(
"#{self.class} got freed, cannot re-access it directly"
) unless @ref
stack_load_ref(@ref)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_stack(obj)\n stack.push(obj)\n end",
"def push(obj)\n if @top.nil?\n @top = Node.new(obj)\n else\n old_top = @top\n @top = Node.new(obj)\n @top.next = old_top\n end\n end",
"def top\n copy = self.deep_copy\n copy.parent = nil\n copy\n end",
"def stack_to... | [
"0.682854",
"0.64280725",
"0.63037086",
"0.6209673",
"0.6157004",
"0.6119209",
"0.60721356",
"0.60120505",
"0.6007011",
"0.60021937",
"0.5995215",
"0.5980652",
"0.5970171",
"0.58500063",
"0.5808806",
"0.5779699",
"0.5758831",
"0.5742772",
"0.5718166",
"0.57134306",
"0.5703399... | 0.66008383 | 1 |
Returns the string status of the coroutine : suspended/running/dead/normal | def status
bottom = stack_top
fetch_library_method('coroutine.status').load_onto_stack
load_onto_stack
pcall(bottom, 1, nil, nil, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n if waiting?\n :waiting\n elsif running?\n :running\n elsif done?\n :done\n end\n end",
"def current_status\n if done?\n failed? ? 'Error' : 'Completed'\n else\n 'Running'\n end\n end",
"def status\n status_async.value!\n end",... | [
"0.7276057",
"0.71194994",
"0.69982505",
"0.6948897",
"0.6855534",
"0.6802234",
"0.6775947",
"0.67278147",
"0.67274785",
"0.67272234",
"0.6624797",
"0.6596935",
"0.65625244",
"0.65047705",
"0.6493414",
"0.6438724",
"0.643588",
"0.64252037",
"0.6381254",
"0.6357478",
"0.635747... | 0.7189562 | 1 |
=begin rdoc Return the toplevel directory of the repo (the parent of .git). =end | def top_level
git.git_dir.chomp(GIT_DIR)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repository_root\n File.expand_path(@repo.path + \"/../\")\n end",
"def top_level\n git.git_dir.chomp(GIT_DIR)\n end",
"def repo_path\n @repo_path ||= Pathname.new(Dir.pwd).descend { |p| break p if (p + '.git').directory? }\n end",
"def repo_dir; end",
"def git_dir; end",
"def ... | [
"0.80332124",
"0.7958031",
"0.79378444",
"0.7818344",
"0.77484477",
"0.7709745",
"0.761529",
"0.76108646",
"0.75943244",
"0.75882167",
"0.75514674",
"0.74465793",
"0.7442939",
"0.7354705",
"0.72857225",
"0.7277165",
"0.7274465",
"0.7272213",
"0.72603184",
"0.716561",
"0.70989... | 0.8084921 | 0 |
=begin rdoc Return a cleanedup version of the tag name, suitable for use as a filename. Replaces all nonalphanumeric characters (except ".,") with "_". =end | def clean_tag(name)
name.gsub( /[^-.,_[:alnum:]]/, '_' )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_filename\n doc_file_name.gsub!(' ', '_')\n end",
"def to_valid_tag(name)\n name.gsub(/[^a-zA-Z_\\-\\:\\.\\d\\/]/, \"__\")\n end",
"def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end",
"def sanitize_filename\n name = self.strip\n #--- get only the filename, not the whole pa... | [
"0.7711798",
"0.7498002",
"0.74619824",
"0.7385735",
"0.71249264",
"0.7032009",
"0.7009344",
"0.69596356",
"0.69575334",
"0.6954613",
"0.6844603",
"0.6840982",
"0.68145573",
"0.681158",
"0.6790041",
"0.676248",
"0.67560226",
"0.67495596",
"0.6717894",
"0.67142403",
"0.6712169... | 0.81283045 | 0 |
=begin rdoc Return the Head object for the specified branch =end | def branch(tag=@current_branch)
get_head(tag)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head\n git.get_head(branch)\n end",
"def head\n git.get_head(branch)\n end",
"def get_Head()\n return @head\n end",
"def set_head(project, branch)\n url = \"/projects/#{project}/HEAD\"\n body = {\n ref: 'refs/heads/' + branch\n }\n put(url, body)\n end... | [
"0.7471617",
"0.7471617",
"0.6749056",
"0.6665028",
"0.6610195",
"0.65340674",
"0.65318584",
"0.63892055",
"0.6359507",
"0.63534755",
"0.63451564",
"0.63425463",
"0.63281655",
"0.62754357",
"0.6234511",
"0.62279147",
"0.6190683",
"0.618944",
"0.6182095",
"0.6144364",
"0.60615... | 0.78699636 | 0 |
=begin rdoc Creates a branch in refs/heads and associates it with the specified commit. If sha is nil, the latest commit from 'master' is used. The canonical name of the tag is returned. =end | def create_branch( tag=next_branch_tag(), sha=nil )
if not sha
sha = commits.last.id
#sha = branches.first.commit.id if not sha
end
name = clean_tag(tag)
update_ref(name, sha)
name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end",
"def commit!(sha)\n parent_shas = begin\n [gitrepo.head.target]\n rescue Rugged::ReferenceError\n # this is the first commit\n []\n end\n\n authorship = author.merge(:time => Time.now)\n\n... | [
"0.711963",
"0.704919",
"0.69577175",
"0.68803215",
"0.6854536",
"0.65250397",
"0.63661754",
"0.6353883",
"0.62830967",
"0.62671936",
"0.62452215",
"0.62387764",
"0.6229699",
"0.62236154",
"0.6137763",
"0.6093488",
"0.6085482",
"0.60724396",
"0.6062456",
"0.60123974",
"0.6010... | 0.84823924 | 0 |
=begin rdoc Sets the current branch to the specified tag. This changes the default branch for all repo activity and sets HEAD. =end | def set_branch( tag, actor=nil )
# allow creating of new branches via -b if they do not exist
opt = (is_head? tag) ? '' : '-b'
# Save staging index for current branch
@saved_stages[@current_branch] = self.staging if staging?
exec_git_cmd( "git checkout -q -m #{opt} '#{tag}'", actor )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_head(project, branch)\n url = \"/projects/#{project}/HEAD\"\n body = {\n ref: 'refs/heads/' + branch\n }\n put(url, body)\n end",
"def branch(tag=@current_branch)\n get_head(tag)\n end",
"def merge_branch( tag=@current_branch, actor=nil )\n raise \... | [
"0.7432263",
"0.7142239",
"0.65434164",
"0.6437558",
"0.6437558",
"0.6389874",
"0.6308938",
"0.62257165",
"0.6175007",
"0.6172989",
"0.6115458",
"0.6005285",
"0.5969276",
"0.5952476",
"0.5950313",
"0.58677363",
"0.5859942",
"0.58340126",
"0.58293664",
"0.5813853",
"0.580642",... | 0.74126315 | 1 |
=begin rdoc Merge specified branch into master. =end | def merge_branch( tag=@current_branch, actor=nil )
raise "Invalid branch '#{tag}'" if not is_head?(tag)
tag.gsub!(/['\\]/, '')
# switch to master branch
set_branch(DEFAULT_BRANCH, actor)
# merge target branch to master branch
rv = nil
begin
rv = exec_git_cmd("git me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_branch_to_master(branch, tag, message, repo_path)\n\tDir.chdir(repo_path) do |path|\n\t\tcmds = [\n\t\t\t\t\"git checkout master\",\n\t\t\t\t\"git merge --no-ff -Xtheirs #{branch}\",\n\t\t\t\t\"git tag -a -f #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.insert(0, \"git branch master origin/master\") unle... | [
"0.717438",
"0.6942775",
"0.6897226",
"0.6806632",
"0.6773125",
"0.6770589",
"0.6709053",
"0.662541",
"0.6503292",
"0.640228",
"0.6394969",
"0.6366951",
"0.6260679",
"0.6197395",
"0.6197395",
"0.6157526",
"0.6157526",
"0.6138431",
"0.6122278",
"0.6088796",
"0.6088242",
"0.6... | 0.71449286 | 1 |
=begin rdoc Return the staging index for the repo. =end | def staging
# TODO: mutex
@staging_index ||= StageIndex.read(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def staging=(idx)\n # TODO: mutex\n @staging_index = idx\n end",
"def staging?\n @staging_index != nil\n end",
"def index\n env[INDEX] ||= Index.new(File.join(git.work_dir, 'refs', git.branch, 'index'))\n end",
"def batch(&block)\n # NOTE: the use of 'self.staging' is quite ... | [
"0.6880868",
"0.6466067",
"0.63058144",
"0.62126255",
"0.6113677",
"0.6094807",
"0.5984888",
"0.59104586",
"0.5883875",
"0.5804236",
"0.5772052",
"0.57541496",
"0.5731192",
"0.5695794",
"0.56878877",
"0.56747466",
"0.5654584",
"0.56391203",
"0.5633706",
"0.56212306",
"0.56212... | 0.7943525 | 0 |
=begin rdoc Set the staging index. This can be used to clear the staging index, or to use a specific index as the staging index. =end | def staging=(idx)
# TODO: mutex
@staging_index = idx
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def staging\n # TODO: mutex\n @staging_index ||= StageIndex.read(self)\n end",
"def batch(&block)\n # NOTE: the use of 'self.staging' is quite important in this method.\n\n # write current index to git-staging-index\n idx = self.staging? ? self.staging : nil\n idx.sync if idx\n\n... | [
"0.7322977",
"0.6407661",
"0.61988974",
"0.597817",
"0.59747475",
"0.578907",
"0.57842225",
"0.5634511",
"0.5634088",
"0.5608956",
"0.5593842",
"0.557912",
"0.5557744",
"0.5552342",
"0.55266887",
"0.55245507",
"0.5517792",
"0.55147374",
"0.5508251",
"0.55031365",
"0.55008125"... | 0.8059719 | 0 |
=begin rdoc Return true if a staging index is active. =end | def staging?
@staging_index != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def staging?\n status == \"STAGING\"\n end",
"def staging\n # TODO: mutex\n @staging_index ||= StageIndex.read(self)\n end",
"def staging?\n self.environment == ENV_STAGE\n end",
"def indexed?\n @index_file and File.exist?(@index_file)\n end",
"def index_exists?\n ... | [
"0.70066535",
"0.67731637",
"0.6624139",
"0.64793587",
"0.63897496",
"0.6282405",
"0.6258595",
"0.6172334",
"0.61521256",
"0.6147276",
"0.61234283",
"0.60854185",
"0.60712934",
"0.6067391",
"0.60636395",
"0.60213184",
"0.6019817",
"0.60164016",
"0.60164016",
"0.5990924",
"0.5... | 0.8340843 | 0 |
=begin rdoc Yield staging index to the provided block, then write the index when the block returns. This allows the Git staging index to be modified from within Ruby, with all changes being visible to the Git commandline tools. Returns staging index for chaining purposes. =end | def stage(&block)
idx = self.staging
rv = yield idx
idx.build
rv
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch(&block)\n # NOTE: the use of 'self.staging' is quite important in this method.\n\n # write current index to git-staging-index\n idx = self.staging? ? self.staging : nil\n idx.sync if idx\n\n # replace current index with an in-mem staging index\n unstage\n self.staging=S... | [
"0.8337766",
"0.6907688",
"0.6855421",
"0.647235",
"0.64433366",
"0.6188806",
"0.59824574",
"0.5752064",
"0.5700475",
"0.5614602",
"0.5597377",
"0.5584219",
"0.55564994",
"0.5524945",
"0.5499522",
"0.54550576",
"0.5439768",
"0.5423972",
"0.54141915",
"0.53516674",
"0.52987295... | 0.7324662 | 1 |
=begin rdoc Add a DB entry at the filesystem path 'path' with contents 'data'. If 'on_fs' is true, the file is created in the filesystem as well. This uses the staging index. =end | def add(path, data='', on_fs=false)
self.stage { |idx| idx.add(path, data, on_fs) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(path, data='', on_fs=false)\n exec { index.add(path, data, on_fs) }\n end",
"def fast_add(path, data='', on_fs=false)\n # TODO: verify that this will suffice\n index.add(path, data, on_fs)\n end",
"def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts... | [
"0.7748042",
"0.7536489",
"0.6448138",
"0.6057684",
"0.5925426",
"0.5921847",
"0.58531463",
"0.57095534",
"0.56128055",
"0.54917",
"0.5462658",
"0.5461775",
"0.54298836",
"0.53949535",
"0.5376057",
"0.5342863",
"0.5342706",
"0.53295213",
"0.5301802",
"0.5297447",
"0.5290148",... | 0.7756111 | 0 |
=begin rdoc Fetch the contents of a DB or FS object from the object database. This uses the staging index. Note: This returns nil if path is a Tree instead of a blob =end | def object_data(path)
blob = path_to_object(path)
return nil if (not blob) || (blob.kind_of? Grit::Tree)
blob.kind_of?(Grit::Blob) ? blob.data : blob
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_to_object(path)\n treeish = (@staging_index ? staging.sha : @current_branch)\n tree = self.tree(treeish, [path])\n return tree.blobs.first if tree && (not tree.blobs.empty?)\n return tree.trees.first if tree && (not tree.trees.empty?)\n\n # check staging index in case object has n... | [
"0.76505643",
"0.6304427",
"0.63003546",
"0.6278215",
"0.6238801",
"0.6103715",
"0.6088066",
"0.6085736",
"0.6034375",
"0.5930104",
"0.5919011",
"0.5868047",
"0.5792913",
"0.57132363",
"0.57086945",
"0.5688837",
"0.55096203",
"0.5468332",
"0.5463809",
"0.5463809",
"0.54604125... | 0.68279016 | 1 |
=begin rdoc The Tree object for the given treeish reference +treeish+ is the reference (default Repocurrent_branch) +paths+ is an optional Array of directory paths to restrict the tree (default []) Uses staging index if present and provides wrapper for nil treeish. Examples repo.tree('master', ['lib/']) Returns Grit::T... | def tree(treeish=nil, paths = [])
begin
if staging? && (not treeish)
@staging_index.sync
super(@staging_index.current_tree.id, paths)
else
treeish = @current_branch if not treeish
super
end
rescue Grit::GitRuby::Repository::NoSuchPath
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree(treeish = 'master', paths = [])\n raise InvalidDbError if @stale\n super\n end",
"def tree(path)\n root.tree(path)\n end",
"def ls_tree(treeish)\n sandbox do |git,w,i|\n git.run('', :ls_tree, '', {:r => true, :name_only => true}, [treeish]).split(\"\\n\")\n end\n e... | [
"0.67700857",
"0.6612291",
"0.65958095",
"0.6575381",
"0.6549117",
"0.64875513",
"0.6240376",
"0.6169161",
"0.5859339",
"0.5833166",
"0.5757628",
"0.57490844",
"0.56732136",
"0.56721765",
"0.5656945",
"0.55975515",
"0.55719703",
"0.55573463",
"0.5514815",
"0.54791325",
"0.546... | 0.68346757 | 0 |
=begin rdoc Return the SHA1 of 'path' in repo. Uses staging index if present. =end | def path_to_sha(path, head=@current_branch)
# Return the root of the repo if no path is specified
return root_sha(head) if (not path) || (path.empty?)
if staging?
@staging_index.sync
head = @staging_index.current_tree.id
end
dir = tree(head, [path])
(dir && dir.cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_sha_for(path)\n website.git_repository.git_sha path\n end",
"def get_sha1(path)\n return @cache_sha1 unless @cache_sha1.nil?\n sha1 = \"\"\n if File.exist?(path)\n Dir.chdir(path) do\n sha1 = %x(git rev-parse HEAD).delete(\"\\n\")\n end\n end\n\n @cache... | [
"0.7887053",
"0.74658",
"0.69509095",
"0.64290327",
"0.639768",
"0.63682956",
"0.63163066",
"0.6282681",
"0.62680924",
"0.6244858",
"0.6223498",
"0.6215851",
"0.62142843",
"0.6198534",
"0.6165278",
"0.6121941",
"0.6112335",
"0.6105035",
"0.60897905",
"0.60123074",
"0.59673256... | 0.7733472 | 1 |
=begin rdoc Return the SHA of the root Tree in the repository. Uses the staging index if it is active. =end | def root_sha(head=@current_branch)
if staging?
@staging_index.sync
return @staging_index.sha
end
(self.commits.count > 0) ? self.commits.last.tree.id : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tree_sha\n sha = nil\n trees = get_json(\"#{@git_data_trees}/#{@branch}\")\n trees['tree'].find{|t| t['path'] == 'src'}['sha']\n end",
"def get_tree_sha(dir)\n get_trees['tree'].find { |t| t['path'] == dir }['sha']\n end",
"def get_tree_sha\n sha = nil\n trees = open('https://api.gi... | [
"0.7384918",
"0.7203023",
"0.7053274",
"0.70211047",
"0.66790026",
"0.6614542",
"0.6608221",
"0.64713657",
"0.6374672",
"0.63325197",
"0.631398",
"0.61963946",
"0.6156399",
"0.6148319",
"0.6146829",
"0.606552",
"0.60351634",
"0.6021538",
"0.6005537",
"0.60015",
"0.5969869",
... | 0.8176249 | 0 |
=begin rdoc Return a Hash of the contents of 'tree'. The key is the filename, the value is the Grit object (a Tree or a Blob). =end | def tree_contents(tree)
return {} if not tree
tree.contents.inject({}) { |h,item| h[item.name] = item; h }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree(root = '')\n build_hash(files(root), root)\n end",
"def hash_from_git(tree)\n ({}).tap do |objs|\n tree.each do |b|\n objs[b.name] = (\n case b\n when Grit::Tree\n hash_from_git(b.contents)\n when Grit::Blob\n ... | [
"0.7668888",
"0.7334702",
"0.6787827",
"0.6725409",
"0.6688521",
"0.66414696",
"0.6521547",
"0.640774",
"0.63290274",
"0.63290274",
"0.6267135",
"0.62665933",
"0.62402993",
"0.6228402",
"0.6213286",
"0.62060267",
"0.61176336",
"0.6117108",
"0.6110964",
"0.6107316",
"0.6060547... | 0.753974 | 1 |
=begin rdoc Return Hash of all Blob child objects at 'path'. =end | def list_blobs(path='')
list(path).delete_if { |k,v| not v.kind_of?(Grit::Blob) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_blob_data(sha, path)\n commit = barerepo.lookup sha\n tree = barerepo.lookup commit.tree_id\n blob = tree.path path\n blobdata = barerepo.read(blob[:oid]).data\n image = {\n name: blob[:name],\n data: blobdata\n }\n [image , commit]\n end",
"def [](path,... | [
"0.66908807",
"0.648901",
"0.63908374",
"0.63908374",
"0.62495303",
"0.62419844",
"0.61837244",
"0.6074427",
"0.60134137",
"0.6003395",
"0.598352",
"0.5983234",
"0.5949787",
"0.5907249",
"0.5878925",
"0.5858503",
"0.584846",
"0.58304226",
"0.5808571",
"0.57881606",
"0.5759592... | 0.678847 | 0 |
=begin rdoc Returns the raw (git catfile) representation of a tree. =end | def raw_tree(path, recursive=false)
# Note: to construct recursive tree:
# Tree.allocate.construct_initialize(repo, treeish, output)
# from repo.git.ls_tree or raw_tree
sha = path_to_sha(path)
sha ? git.ruby_git.get_raw_tree( sha, recursive ) : ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree\n # Caution: use only for small projects, don't use in root.\n $title = \"Full Tree\"\n $files = `zsh -c 'print -rl -- **/*(#{$sorto}#{$hidden}M)'`.split(\"\\n\")\nend",
"def tree_root\n repo.tree\n end",
"def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)",
"def tree(dir=... | [
"0.6508571",
"0.64682",
"0.63387305",
"0.6335973",
"0.6158909",
"0.6101083",
"0.6014128",
"0.59854525",
"0.59832084",
"0.59653544",
"0.59436244",
"0.5940279",
"0.59290725",
"0.5915772",
"0.58931977",
"0.58818585",
"0.58390105",
"0.58184063",
"0.5810738",
"0.57847154",
"0.5772... | 0.71653706 | 0 |
=begin rdoc Fetch an object from the repo based on its path. If a staging index exists, its tree will be used; otherwise, the tree Repocurrent_branch will be used. The object returned will be a Grit::Blob, a Grit::Tree, or the raw data from the staging index. =end | def path_to_object(path)
treeish = (@staging_index ? staging.sha : @current_branch)
tree = self.tree(treeish, [path])
return tree.blobs.first if tree && (not tree.blobs.empty?)
return tree.trees.first if tree && (not tree.trees.empty?)
# check staging index in case object has not been wri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree(treeish=nil, paths = [])\n begin \n if staging? && (not treeish)\n @staging_index.sync\n super(@staging_index.current_tree.id, paths)\n else\n treeish = @current_branch if not treeish\n super\n end\n rescue Grit::GitRuby::Repository::NoSuc... | [
"0.63084483",
"0.6040596",
"0.5986124",
"0.5985767",
"0.5963144",
"0.5946417",
"0.58536816",
"0.5849197",
"0.56993353",
"0.5685264",
"0.5675985",
"0.56674117",
"0.5649755",
"0.5644573",
"0.56434095",
"0.5616399",
"0.55948204",
"0.5576232",
"0.55596983",
"0.55555856",
"0.55475... | 0.7736284 | 0 |
Hide each of the given methods from being callable as actions. | def hide_action(*names)
write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect { |n| n.to_s })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_action(*names)\n self._hidden_actions = self._hidden_actions | names.map { |n| n.to_s }\n end",
"def hide_methods(mod, except_defaults, *stuff)\n options = stuff.last.is_a?(Hash) ? stuff.pop : {}\n include_ancestors = options.fetch(:ancestors){false}\n except = Array(... | [
"0.716033",
"0.68042916",
"0.6786592",
"0.67469865",
"0.6706047",
"0.66386926",
"0.66309667",
"0.6615529",
"0.65969336",
"0.65533096",
"0.65533096",
"0.6552591",
"0.64469427",
"0.642742",
"0.6377909",
"0.62689334",
"0.62593544",
"0.6226238",
"0.62128246",
"0.6190714",
"0.6174... | 0.70661426 | 1 |
Dispatches a PartController. Use like: :list %> will instantiate a new TodoPart controller and call the :list action invoking the Part's before and after filters as part of the call. returns a string containing the results of the Part controllers dispatch You can compose parts easily as well, these two parts will stil ... | def part(opts={})
res = opts.inject([]) do |memo,(klass,action)|
memo << klass.new(self).dispatch(action)
end
res.size == 1 ? res[0] : res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render\n TasksController.new.show_string(self)\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def render\n parts.map(&:content)\n end",
"def part_status\n if can?(:>, \"4\")\n @part_list = Kitting::KitBomBulkOperation.where(\" operation_type = ? and customer_id IN ... | [
"0.5263037",
"0.5203837",
"0.5203837",
"0.5203837",
"0.51112896",
"0.50757957",
"0.50570107",
"0.5042841",
"0.50142896",
"0.4995522",
"0.49790853",
"0.4941233",
"0.49119076",
"0.49117061",
"0.48985577",
"0.48901996",
"0.4859094",
"0.4851267",
"0.48461336",
"0.480361",
"0.4798... | 0.5606381 | 0 |
Override this to modify the environment after the response has finished. Calls the `parse` method if defined | def on_complete(env)
if respond_to? :parse
env[:body] = parse(env[:body]) unless [204,304].index env[:status]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_response!; end",
"def on_complete(env)\n assert_response_ok(env[:status], env[:body])\n env[:body] = case env[:status]\n when 204\n {\n :data => {},\n :errors => [],\n :metadata => {},\n }\n else\n parse(env[:body])... | [
"0.66197675",
"0.6421427",
"0.6307337",
"0.6277229",
"0.62713224",
"0.62358344",
"0.621353",
"0.62049574",
"0.62049574",
"0.6168677",
"0.60211927",
"0.6018223",
"0.5880072",
"0.5867355",
"0.58621055",
"0.5858659",
"0.5754898",
"0.57452124",
"0.57443637",
"0.5694048",
"0.56857... | 0.6840416 | 0 |
GET /wall/statistics def new_wall_statistics render "new_wall_dates" end GET /wall/summary | def new_wall_summary
render "new_wall_summary"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detailed_statistics\n @detailed_statistics = Statistics::PersonStatistics.new @filtered_ratings.ratings, @filtered_ratings.ratings_older\n @should_switch = (@interval != 'all')\n respond_to do |format|\n format.html { render_404 }\n format.js { render partial: \"dashboard/charts/statistics\"... | [
"0.7139253",
"0.65197223",
"0.64176315",
"0.64139795",
"0.63886917",
"0.63684005",
"0.63441235",
"0.6299546",
"0.6293435",
"0.6281052",
"0.62775815",
"0.6183761",
"0.6149145",
"0.61454076",
"0.61378044",
"0.6136985",
"0.6116294",
"0.6071264",
"0.60543627",
"0.60149276",
"0.60... | 0.8007768 | 0 |
Sends the batch to the provider. Useful to check transaction status before sending any data (consistency, validation, etc.) | def send_batch
if @payment_initiation.valid?
do_send_batch
else
raise InvalidWireTransactionError,
"invalid wire transfer: #{@payment_initiation.error_messages}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_batch(batch)\n return if batch.empty?\n\n logger.debug(\"#{self.class.name}: sending batch of #{batch.size} to Solr\")\n\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n\n begin\n resp = @http_client.post solr_update_url_with_query(@solr_update_args), json_package, \"Cont... | [
"0.6919012",
"0.6823963",
"0.6750669",
"0.67227536",
"0.6716918",
"0.6600491",
"0.6531989",
"0.63972926",
"0.6315346",
"0.6217484",
"0.6168129",
"0.61568516",
"0.6149892",
"0.6121116",
"0.6068019",
"0.60295177",
"0.60059917",
"0.5981809",
"0.59317845",
"0.5931464",
"0.5914102... | 0.75248456 | 0 |
Displays a morning, afternoon, or evening message | def get_time_message()
t = Time.now
#string_date = t.strftime("%A %B %d, %Y")
if t.hour < 12
time_message = "Good Morning"
elsif t.hour > 12 && t.hour < 17
time_message = "Good Afternoon"
else
time_message = "Good Evening"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greeting_message()\n greeting_message = case Time.now.hour\n when 6..11 then \"Buen dia\"\n when 12..20 then \"Buenas tardes\"\n else \"Buenas noches\"\n end\n end",
"def mayday\n\tprint \"Les ennemis attaquent \"\n\t\t3.times do\n\t\tsleep(0.2)\n\t\tprint \".\"\n\tend\n\tpr... | [
"0.665388",
"0.65814364",
"0.6545098",
"0.6530642",
"0.64578235",
"0.6424007",
"0.6418503",
"0.6417879",
"0.6386928",
"0.6339719",
"0.63292235",
"0.6271302",
"0.62180537",
"0.61703765",
"0.61452335",
"0.61292285",
"0.6128297",
"0.61047435",
"0.6066425",
"0.6061361",
"0.605258... | 0.7492195 | 0 |
since we can access and edit the pin which doesnot belong to the current log in user We ahve to stop the access of the edit of that pin | def correct_user
@pin = current_user.pins.find_by(id: params[:id])
redirect_to pins_path, notice: "Not authorized to edit this pin "if@pin.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n @pin=current_user.pins.find_by(id: params[:id])\n redirect_to pins_path, notice: \"Not authorized to edit this pin\" if @pin.nil?\nend",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your b... | [
"0.70066595",
"0.6326352",
"0.62976456",
"0.6268142",
"0.6267655",
"0.62186116",
"0.62091786",
"0.617591",
"0.6155811",
"0.606262",
"0.6042587",
"0.5937515",
"0.589366",
"0.5877261",
"0.5877261",
"0.58547187",
"0.58392245",
"0.5834943",
"0.5800381",
"0.57934386",
"0.57900053"... | 0.67641765 | 1 |
which fields can be scheduled | def schedulable_fields
schedulable_type.constantize.send(:column_names).sort - ["id", "created_at", "updated_at", "cached_slug"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheduled\n @scheduled ||= count('scheduled')\n end",
"def evaulate_schedule\n true\n end",
"def design_billable_time_entries\n @_design_billable_time_entries ||= billable_time_entries.select { |time_entry| time_entry.dig('task', 'name') == 'Design' }\n end",
"def reservation_... | [
"0.60551566",
"0.5920668",
"0.58299774",
"0.5749626",
"0.57354975",
"0.56452256",
"0.56159496",
"0.55783564",
"0.5561712",
"0.55318934",
"0.55288786",
"0.5525301",
"0.5501767",
"0.5491128",
"0.54457545",
"0.54116905",
"0.5409379",
"0.5386586",
"0.53757226",
"0.5349053",
"0.53... | 0.66363823 | 0 |
Return error if doc name has error, otherwise return nil | def error_for_new_doc_name(filename, extension)
full_file_name = filename + "." + extension
if !(1..20).cover?(filename.size)
return "File name must be between 1 and 20 characters"
elsif find_by_name(full_file_name)
return "File name must be unique"
elsif (filename =~ /(^[A-Za-z][A-Za-z0-9_]+)$/).nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error; state == 'failed' ? @doc['error'] : nil; end",
"def error\n doc['error']\n end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error(msg)\n raise RDoc::Error, msg\n end",
"def validate(doc)\n\t\tre... | [
"0.6857404",
"0.6216936",
"0.60305107",
"0.60305107",
"0.59999293",
"0.5929174",
"0.58909774",
"0.5848427",
"0.5697329",
"0.5697329",
"0.56590575",
"0.56590575",
"0.56590575",
"0.5651983",
"0.5645728",
"0.5637855",
"0.55331004",
"0.5493984",
"0.5472588",
"0.54380876",
"0.5419... | 0.65412045 | 1 |
Update/Create all customers revenue in Nucleus for a given nucleus_contact_id Update/Create all customers revenue in Nucleus for a given nucleus_contact_id | def create_or_update_accounting_customer_revenue(nucleus_contact_id, start_date, opts = {})
data, _status_code, _headers = create_or_update_accounting_customer_revenue_with_http_info(nucleus_contact_id, start_date, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update_accounting_customer_revenue_with_http_info(nucleus_contact_id, start_date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountingApi.create_or_update_accounting_customer_revenue ...'\n end\n # verify the required parameter ... | [
"0.6057952",
"0.5926193",
"0.56506747",
"0.55388033",
"0.5514534",
"0.5437751",
"0.54375553",
"0.54278207",
"0.5394664",
"0.5362474",
"0.5328629",
"0.5320777",
"0.5318849",
"0.5309178",
"0.53060824",
"0.529527",
"0.5293809",
"0.52841157",
"0.5267704",
"0.5234734",
"0.5208719"... | 0.62623966 | 0 |
Update/Create all customers revenue in Nucleus for a given nucleus_contact_id Update/Create all customers revenue in Nucleus for a given nucleus_contact_id | def create_or_update_accounting_customer_revenue_with_http_info(nucleus_contact_id, start_date, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountingApi.create_or_update_accounting_customer_revenue ...'
end
# verify the required parameter 'nucleus_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update_accounting_customer_revenue(nucleus_contact_id, start_date, opts = {})\n data, _status_code, _headers = create_or_update_accounting_customer_revenue_with_http_info(nucleus_contact_id, start_date, opts)\n data\n end",
"def update_contact_in_salesforce\n \tsf = Salesforce::API.co... | [
"0.62618786",
"0.59202754",
"0.5651773",
"0.55360377",
"0.5511169",
"0.5435946",
"0.543499",
"0.5424849",
"0.5392567",
"0.5360912",
"0.53267497",
"0.5321514",
"0.5314947",
"0.53051275",
"0.53026164",
"0.52908665",
"0.529054",
"0.5280779",
"0.52713823",
"0.52300113",
"0.520677... | 0.605775 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.