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 |
|---|---|---|---|---|---|---|
Returns an array of news articles relating to an entity or an array of multiple entities | def articles_related_to(entities)
if(entities.is_a? Entity)
articles = articles_for(entities)
else
articles = []
entities.each do |entity|
articles = articles | articles_for(entity) # set union to remove duplication
articles.sort! { |x, y| x.published_at <=> y.pub... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles\n return @articles\n end",
"def articles\r\n ARTICLE[@climate_service.clothes]\r\n end",
"def related_articles\n respond_to?(:relatedArticle) ? relatedArticle : []\n end",
"def get_news_of_person(uri)\n articles = []\n q = \"SELECT *\n ... | [
"0.690334",
"0.68482924",
"0.6820671",
"0.67080224",
"0.6677761",
"0.6627015",
"0.65274453",
"0.6472954",
"0.64380336",
"0.64162946",
"0.64106184",
"0.63643193",
"0.6350653",
"0.63280463",
"0.6281869",
"0.6277887",
"0.6248998",
"0.62484306",
"0.6233128",
"0.62251675",
"0.6199... | 0.71961224 | 0 |
wraps video.id_public to prevent failure if video is nil | def video_id_public
if video
video.id_public
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_id\n nil\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def id_public\n id\n end",
"def video_id\n values[:video_id]\n end",
"def set_video_id\n send(\"#{provider}_video_id\")\n end",
"def default_public_id\n nil\n end",
"def st... | [
"0.7022461",
"0.65194863",
"0.64513445",
"0.6403575",
"0.63691175",
"0.6333743",
"0.63094157",
"0.62833613",
"0.61724377",
"0.6118846",
"0.60798913",
"0.6074645",
"0.6058841",
"0.60237074",
"0.60024077",
"0.5976478",
"0.5950297",
"0.5933376",
"0.59190047",
"0.5918018",
"0.590... | 0.83430403 | 0 |
wraps video.title to prevent failure if video is nil | def video_title
if video
video.title
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title\n if @title == nil\n \"Movie not found!\"\n else\n @title\n end\n end",
"def set_title \n write_attribute(:title, File.basename(file_name, '.mp4')) if title.blank?\n end",
"def check_title\n if self.title.blank? && st = (url && Site.by_link(self.url))\n self.title = (s... | [
"0.7630717",
"0.6992068",
"0.6978534",
"0.6960185",
"0.692989",
"0.69162655",
"0.6854898",
"0.68278766",
"0.68231016",
"0.67977625",
"0.6767174",
"0.6719786",
"0.66940165",
"0.6681788",
"0.66747266",
"0.66587126",
"0.6649974",
"0.66490316",
"0.66472113",
"0.664093",
"0.663565... | 0.84528005 | 0 |
updated_at wraps keyword.title to prevent failure if keyword is nil | def keyword_title
if keyword
keyword.title
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @published_at = args[:published_at] if args.key?(:published_at)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @published_at = args[:published_at] if args.key?(:published_at)\n @title = args[:title] if args.key?(:... | [
"0.5741159",
"0.57160395",
"0.56932044",
"0.5667632",
"0.5433471",
"0.5427725",
"0.5380622",
"0.53540087",
"0.5340665",
"0.5322677",
"0.52935076",
"0.5286293",
"0.5277529",
"0.52562845",
"0.5255229",
"0.524723",
"0.5236925",
"0.5188843",
"0.5171678",
"0.5165693",
"0.513972",
... | 0.5964641 | 1 |
Read formants from Praat generated file. | def readFormants(file)
f1, f2 = [], []
fs = []
File.open(file, "r") do |f|
# 9 useless lines
9.times { f.gets }
while !f.eof?
#Each block starts with the number of formants found
f.gets
how_many = f.gets.to_i
#We are only interested in the first two formants
f1 = f.gets... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_form( filename )\n\t\tdatafile = MIMEPARSER_DATADIR + filename\n\t\treturn datafile.open( 'r', encoding: 'ascii-8bit' )\n\tend",
"def read\n file\n end",
"def read\n $t1 = Time.now # Init procedure timestamp\n person = []\n IO.foreach(\"data_500.txt\") do |line| # Get all pat... | [
"0.58913386",
"0.57341796",
"0.5714656",
"0.56500244",
"0.55601555",
"0.5437235",
"0.5391405",
"0.5280107",
"0.5268663",
"0.5258003",
"0.5217466",
"0.5184513",
"0.51805425",
"0.51804554",
"0.5140469",
"0.5136689",
"0.5124376",
"0.51160824",
"0.51107985",
"0.5105336",
"0.51038... | 0.6499469 | 0 |
Executes a block when a file is accesible | def when_accesible(filename, &block)
until accesible(filename)
sleep(0.01)
end
yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accesible(f)\n begin\n File.open(f,\"r\")\n true\n rescue\n false\n end\nend",
"def analyze_file!\n rp = retrieval_path\n unless rp\n raise FsException::Action,\n \"Retrieval path is not set when analyzing file '#{path}' '#{file_name}'. Does gid #{current_gid... | [
"0.6568822",
"0.5939678",
"0.5840327",
"0.57921445",
"0.57917815",
"0.572857",
"0.56534314",
"0.5623684",
"0.5586158",
"0.557826",
"0.55513495",
"0.55470705",
"0.55285186",
"0.549781",
"0.5481024",
"0.5471707",
"0.5452685",
"0.54445547",
"0.5432485",
"0.5420831",
"0.5419519",... | 0.79927623 | 0 |
Check whether an HTML page actually contains a link to the given profile | def links_to(profile)
load_page
return false if @page.nil?
@page.search("a,link").each do |link|
rels = (link.attribute("rel").to_s || '').split(/ /)
if rels.include?('me') || rels.include?('authorization_endpoint') || rels.include?('pgpkey')
if link.attribute('href')
thislin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_own_page(u)\n login_as(u, scope: :user)\n check_profile_enabled(u)\n\n # Can access profile page from menu bar\n visit root_path\n assert page.has_link?('Your Profile', href: user_path(u))\n end",
"def url_matches_profile pathname\n (pathname.to_s).include? \"profile/\"\n end",
"d... | [
"0.6872924",
"0.6650284",
"0.65094507",
"0.64112014",
"0.63073915",
"0.6095451",
"0.607662",
"0.60748607",
"0.60595435",
"0.60312545",
"0.6030482",
"0.5999592",
"0.5991976",
"0.59632874",
"0.59599185",
"0.59489363",
"0.59363174",
"0.59310824",
"0.5923877",
"0.59221226",
"0.59... | 0.81612843 | 0 |
Reset the currently set client | def reset_client!
@client = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_client\n @client = nil\n init_client\n end",
"def reset\n @client = nil\n end",
"def reset\n @client = nil\n return self\n end",
"def reset!\n client.reset!\n end",
"def wipe_client!\n @client = nil\n end",
"def reset\n ... | [
"0.87517864",
"0.8736074",
"0.8186559",
"0.8137769",
"0.77072084",
"0.76896954",
"0.7549886",
"0.70227873",
"0.69930655",
"0.6978461",
"0.6885977",
"0.687883",
"0.6771747",
"0.6714413",
"0.66908336",
"0.6680447",
"0.66633993",
"0.6635549",
"0.6571607",
"0.6557704",
"0.6516877... | 0.88035196 | 0 |
Initializes a new OAuth2Client object | def oauth2_client(token, params = {})
@oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad... | [
"0.7729352",
"0.7528907",
"0.7514238",
"0.75080746",
"0.7465173",
"0.7377697",
"0.7357733",
"0.73490196",
"0.7332098",
"0.7305326",
"0.72943234",
"0.71745163",
"0.71742904",
"0.71468395",
"0.7144428",
"0.7109091",
"0.70877457",
"0.7048883",
"0.70169383",
"0.70116115",
"0.7004... | 0.7787525 | 0 |
Reset the currently set OAuth2 client | def reset_oauth2_client!
@oauth2_client = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_client\n @client = nil\n init_client\n end",
"def reset_client!\n @client = nil\n end",
"def reset\n @client = nil\n end",
"def reset\n self.adapter = DEFAULT_ADAPTER\n self.client_id = DEFAULT_CLIENT_ID\n self.client_secret = DEFAULT_CLIENT_SEC... | [
"0.7710724",
"0.7610686",
"0.7407043",
"0.71857387",
"0.70050067",
"0.695505",
"0.6724023",
"0.66813403",
"0.6679105",
"0.66399026",
"0.66092783",
"0.6537921",
"0.65284747",
"0.65173304",
"0.64233947",
"0.63928723",
"0.63684654",
"0.63610864",
"0.63447183",
"0.63347715",
"0.6... | 0.9203551 | 0 |
Details: Write a function triple_double(num1, num2) which takes numbers num1 and num2 and returns 1 if there is a straight triple of a number at any place in num1 and also a straight double of the same number in num2. If this isn't the case, return 0 Examples triple_double(451999277, 41177722899) == 1 num1 has straight... | def triple_double(num1,num2)
n = num1.digits.each_cons(3).select { |i| p i[0] == i[1] && i[0] == i[2] }
n.any? && num2.to_s.include?(n[0][1..-1].join) ? 1 : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triple_double(num1, num2)\n str1 = num1.to_s\n str2 = num2.to_s\n str1.match?(/(.)\\1\\1/) && str2.match?(/(.)\\1/) ? 1 : 0\nend",
"def triple_double(num1, num2)\n num1, num2 = num1.to_s, num2.to_s\n num1.each_char.with_index do |digit, idx|\n next if idx >= num1.size - 2\n if num1[idx + 1] == dig... | [
"0.83646744",
"0.8271404",
"0.8043986",
"0.80193275",
"0.6668386",
"0.65226865",
"0.6401406",
"0.63589555",
"0.63063663",
"0.625162",
"0.61454916",
"0.6114301",
"0.6054233",
"0.6047073",
"0.6034642",
"0.6027533",
"0.6025076",
"0.5977927",
"0.5976311",
"0.59762937",
"0.5962031... | 0.8432433 | 0 |
Returns a string of javascript for instantiating a SWFUpload uploader object | def swfupload_uploader_javascript(options = {})
uploader_js = ""
uploader_js << javascript_include_tag("uploader/swfupload.and.speed.min")
uploader_js << javascript_tag("
$(function() {
var new_video = #{@media_type == 'video'};
var percent_uploaded = 0;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploader_javascript(options = {})\n uploader_js = \"\"\n uploader_js << javascript_include_tag(\"plupload/plupload.full\") \n uploader_js << javascript_tag(\"\n $(function() { \n var plupload_max_file_size = '#{options[:max_filesize] / 1048576} MB';\n var new_video = #{o... | [
"0.6952339",
"0.67879236",
"0.61309004",
"0.60508424",
"0.60464007",
"0.58749014",
"0.572677",
"0.5707579",
"0.56889164",
"0.56338376",
"0.5609455",
"0.55826914",
"0.5580363",
"0.5506233",
"0.5498172",
"0.54851294",
"0.5454663",
"0.5452649",
"0.5430343",
"0.5426353",
"0.54117... | 0.7687212 | 0 |
Generates a random string for a temporary image upload (prior to processing the image) | def filename_for_image_upload
random_token = Digest::SHA2.hexdigest("#{Time.now.utc}--#{current_user.id.to_s}").first(15)
"temp_upload_#{random_token}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_default_image\n Random.new.rand(1..6).to_s + '.jpg'\n end",
"def generateRandomString ()\n return SecureRandom.hex(4)\nend",
"def random_name\n SecureRandom.hex(20)\n end",
"def filename()\n @name ||= \"#{SecureRandom.hex()}.png\"\n end",
"def random_product_image_filename\n [\"img... | [
"0.68009293",
"0.66688746",
"0.6646873",
"0.6633438",
"0.6613243",
"0.65805",
"0.65765536",
"0.6571192",
"0.654352",
"0.6459233",
"0.6452812",
"0.6413991",
"0.6413778",
"0.6375129",
"0.6372675",
"0.6345193",
"0.63149154",
"0.6300653",
"0.6285632",
"0.62468237",
"0.62164855",
... | 0.7468967 | 1 |
Sets the standard mappings | def mappings=(hash)
fail ArgumentError unless hash.is_a?(Hash)
@standard_mappings = hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_map\n # Sets locations on the map\n @map = [\n ['Enumerable Canyon', 'Duck Type Beach', 'Monkey Patch City'],\n ['Duck Type Beach', 'Enumerable Canyon', 'Matzburg'],\n ['Monkey Patch City', 'Nil Town', 'Enumerable Canyon', 'Matzburg'],\n ['Nil Town', 'Monkey Patch City', 'Hash Cro... | [
"0.6477691",
"0.6362721",
"0.62634504",
"0.61450565",
"0.6139099",
"0.60420775",
"0.602431",
"0.5975998",
"0.5962018",
"0.5960936",
"0.5939453",
"0.5881349",
"0.58569217",
"0.58069927",
"0.57782626",
"0.5774103",
"0.5717906",
"0.5706662",
"0.56961495",
"0.5645882",
"0.5641433... | 0.6863736 | 0 |
GET /student_users/1 GET /student_users/1.json | def show
@student_user = StudentUser.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @student_user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @student = User.find params[:id]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n respond_to do |format|\n format.json {\n\n @student = User.find_by_id(params[:id])\n\n ... | [
"0.7683755",
"0.7384104",
"0.7337157",
"0.7332599",
"0.732166",
"0.7155681",
"0.71442103",
"0.6911637",
"0.6876414",
"0.6862821",
"0.6839369",
"0.68024546",
"0.679831",
"0.6776444",
"0.671755",
"0.6709628",
"0.6701236",
"0.6701236",
"0.6701236",
"0.6701236",
"0.6701236",
"0... | 0.7621072 | 1 |
GET /student_users/new GET /student_users/new.json | def new
@student_user = StudentUser.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @student_user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n ... | [
"0.7809587",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.76912344",
"0.7683908",
"0.7682993",
"0.7648816",
"0.75999737",
"0.7581421",
"0.7581421",
"0.7561575",
"0.7542264",
"0.7... | 0.8082891 | 0 |
PUT /student_users/1 PUT /student_users/1.json | def update
@student_user = StudentUser.find(params[:id])
respond_to do |format|
if @student_user.update_attributes(params[:student_user])
format.html { redirect_to @student_user, notice: 'Student user was successfully updated.' }
format.json { head :no_content }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @student = User::Student.find(params[:id])\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to user_student_path(@user, @student), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: user_stud... | [
"0.7178333",
"0.71711177",
"0.6853307",
"0.6780668",
"0.67519313",
"0.6749138",
"0.673469",
"0.67298883",
"0.67140603",
"0.67125505",
"0.6710548",
"0.6689709",
"0.6685654",
"0.6685654",
"0.66747546",
"0.66747546",
"0.66747546",
"0.66747546",
"0.66747546",
"0.6668299",
"0.6582... | 0.7258039 | 0 |
DELETE /student_users/1 DELETE /student_users/1.json | def destroy
@student_user = StudentUser.find(params[:id])
@student_user.destroy
respond_to do |format|
format.html { redirect_to student_users_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to user_students_url(@user), notice: 'Student was suc... | [
"0.7486583",
"0.73683155",
"0.7358514",
"0.7353348",
"0.73424715",
"0.7327636",
"0.73159635",
"0.7315733",
"0.7315733",
"0.7315733",
"0.7315733",
"0.7315733",
"0.7315733",
"0.7315733",
"0.7315733",
"0.7293258",
"0.7292501",
"0.7292501",
"0.7292501",
"0.7292501",
"0.72874135",... | 0.77138263 | 0 |
GET /rules GET /rules.xml | def index
@account = Account.find(params[:account_id])
@rules = @account.rules
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @rules }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @rules = Rule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end",
"def rules\n @rules=get_endpoint('rule').keys\n end",
"def get_rules\r\n @rules\r\n end",
"def show\n @rule = Rule.find(params[:... | [
"0.7250645",
"0.7044982",
"0.6743425",
"0.66153324",
"0.65767336",
"0.6531562",
"0.6531562",
"0.6531562",
"0.6531562",
"0.647005",
"0.64286435",
"0.63842726",
"0.63710135",
"0.63696283",
"0.63509977",
"0.62966985",
"0.6217632",
"0.6189221",
"0.6184007",
"0.612221",
"0.6114195... | 0.7351449 | 0 |
Description: I love Fibonacci numbers in general, but I must admit I love some more than others. I would like for you to write me a function that when given a number (n) returns the nth number in the Fibonacci Sequence. For example: nth_fibonacci(4) == 2 Because 2 is the 4th number in the Fibonacci Sequence. For refere... | def nth_fibonacci(n)
if n == 1
return 0
elsif n == 2
return 1
end
return nth_fibonacci(n-1) + nth_fibonacci(n-2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nth_fib(n)\n if n == 0 || n == 1\n return 0\n elsif n == 2\n return 1\n else\n return get_nth_fib(n-1) + get_nth_fib(n-2)\n end\n\nend",
"def get_nth_fib(n)\n if n == 2\n return 1\n elsif n == 1\n return 0\n else\n return get_nth_fib(n - 1) + get_nth_fib(n - 2)\... | [
"0.8942209",
"0.89182395",
"0.8887808",
"0.87931436",
"0.8749849",
"0.8712168",
"0.8646092",
"0.86059946",
"0.86050284",
"0.8577575",
"0.8577575",
"0.8577575",
"0.8577575",
"0.85387534",
"0.85178554",
"0.84856594",
"0.84606886",
"0.8431879",
"0.84287494",
"0.8428314",
"0.8422... | 0.9015303 | 0 |
Packaged distributions still require development libraries so that Chef can build gems for providers to access the PDNS database. | def pdns_package_module_requirements
modules = node['pdns']['authoritative']['package']['backends']
required_packages = []
modules.each do |mod|
case mod
when 'gmysql'
required_packages << 'pdns-backend-mysql'
when 'gpgsql'
required_packages << 'pdns-backend-pgsql'
when 'gsqlite3'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_management\n # Needed to play with the configuration database.\n package 'debconf'\n package 'debconf-utils'\n\n # Keys for Debian packages.\n package 'debian-archive-keyring'\n\n # Fetch files via HTTP.\n package 'curl'\n package 'wget'\n\n package 'dpkg-dev' # Builds packa... | [
"0.64149016",
"0.640983",
"0.63676494",
"0.6266776",
"0.6227249",
"0.6209247",
"0.61475223",
"0.60765964",
"0.6059821",
"0.60194975",
"0.60035056",
"0.5997046",
"0.59957534",
"0.59844285",
"0.598374",
"0.5926704",
"0.5909439",
"0.59038794",
"0.5902721",
"0.58942235",
"0.58507... | 0.6797543 | 0 |
Returns an absolute path to the root of the repository. We do this ourselves rather than call `git revparse showtoplevel` to solve an issue where the .git directory might not actually be valid in tests. | def repo_root
@repo_root ||=
begin
result = execute(%w[git rev-parse --show-toplevel])
unless result.success?
raise Overcommit::Exceptions::InvalidGitRepo,
'Unable to determine location of GIT_DIR. ' \
'Not a recognizable Gi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_path\n @root_path ||= `git rev-parse --show-toplevel`.chomp\n end",
"def repository_root\n return unless available?\n root = Licensed::Shell.execute(\"git\", \"rev-parse\", \"--show-toplevel\", allow_failure: true)\n return nil if root.empty?\n root\n end",
"de... | [
"0.8319979",
"0.8106133",
"0.77184194",
"0.7496427",
"0.7248833",
"0.71326077",
"0.69958967",
"0.69860977",
"0.69380087",
"0.6847315",
"0.67319137",
"0.6723093",
"0.6622198",
"0.65885794",
"0.6563326",
"0.65438825",
"0.65336794",
"0.65177035",
"0.6516283",
"0.65152156",
"0.64... | 0.821397 | 1 |
Returns an absolute path to the .git directory for a repo. | def git_dir
@git_dir ||=
begin
cmd = %w[git rev-parse]
cmd << (GIT_VERSION < '2.5' ? '--git-dir' : '--git-common-dir')
result = execute(cmd)
unless result.success?
raise Overcommit::Exceptions::InvalidGitRepo,
'Unable to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_path\n @repo_path ||= Pathname.new(Dir.pwd).descend { |p| break p if (p + '.git').directory? }\n end",
"def get_git_dir(path)\n get_dir(path, '', '.git')\n end",
"def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end",
"def git_path\n if bare\n \"#{path}\"\n else\n ... | [
"0.8398955",
"0.8144985",
"0.8027634",
"0.77209646",
"0.76910543",
"0.76602757",
"0.7581918",
"0.7573941",
"0.7518724",
"0.75101364",
"0.75028163",
"0.7455564",
"0.74136186",
"0.73613185",
"0.7296386",
"0.7247347",
"0.71897316",
"0.71819997",
"0.7162448",
"0.7128055",
"0.7125... | 0.84107876 | 0 |
Returns a list of supported hook classes (PreCommit, CommitMsg, etc.) | def supported_hook_type_classes
supported_hook_types.map do |file|
file.split('-').map(&:capitalize).join
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supported_hook_type_classes; end",
"def supported_hook_types; end",
"def supported_hook_types\n Dir[File.join(HOOK_DIRECTORY, '*')].\n select { |file| File.directory?(file) }.\n reject { |file| File.basename(file) == 'shared' }.\n map { |file| File.basename(file).tr('_', '... | [
"0.7392861",
"0.7094238",
"0.68840134",
"0.65820146",
"0.621069",
"0.60620266",
"0.60424435",
"0.60128707",
"0.5967056",
"0.5961026",
"0.59339726",
"0.5914149",
"0.58949715",
"0.58471036",
"0.58286124",
"0.57530445",
"0.57374763",
"0.57049304",
"0.56971955",
"0.569298",
"0.56... | 0.78079265 | 0 |
Return the parent command that triggered this hook run | def parent_command
# When run in Docker containers, there may be no parent process.
return if Process.ppid.zero?
if OS.windows?
`wmic process where ProcessId=#{Process.ppid} get CommandLine /FORMAT:VALUE`.
strip.
slice(/(?<=CommandLine=).+/)
elsif OS.cy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_command; end",
"def get_parent(keyword)\n\n get_parents().each do |findcommand|\n\n if ( findcommand.commandName == keyword)\n return findcommand\n end\n end\n raise(\"#{keyword} parent not defined!\")\n\n end",
"def parent\n SideJob.find(S... | [
"0.80060697",
"0.65029216",
"0.6445875",
"0.6246655",
"0.61959064",
"0.61942846",
"0.6191912",
"0.61583614",
"0.613599",
"0.6131659",
"0.6111205",
"0.6109961",
"0.61055213",
"0.6081512",
"0.605335",
"0.6051469",
"0.60399115",
"0.6021128",
"0.6011664",
"0.6011664",
"0.6011664"... | 0.6659495 | 1 |
Execute a command in a subprocess, capturing exit status and output from both standard and error streams. This is intended to provide a centralized place to perform any checks or filtering of the command before executing it. The `args` option provides a convenient way of splitting up long argument lists which would oth... | def execute(initial_args, options = {})
if initial_args.include?('|')
raise Overcommit::Exceptions::InvalidCommandArgs,
'Cannot pipe commands with the `execute` helper'
end
result =
if (splittable_args = options.fetch(:args) { [] }).any?
debug(ini... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec(args)\n cmd = if args.kind_of?(Array)\n Shellwords.join(args)\n else\n args\n end\n\n exec_command(cmd)\n end",
"def run_shell_cmd(args)\n system(*args)\n raise \"command exited with a nonzero status code #{$?.exitstatus} (command: #{args.join(' ')})\" if !$?.success?\n ... | [
"0.60908425",
"0.60071695",
"0.5982208",
"0.59149235",
"0.5888409",
"0.57807446",
"0.5767641",
"0.5755184",
"0.57215303",
"0.57109743",
"0.563872",
"0.56247467",
"0.5598176",
"0.55957925",
"0.5574563",
"0.55350447",
"0.5528172",
"0.5526044",
"0.5509991",
"0.5496437",
"0.54779... | 0.70766234 | 0 |
Return the number of processors used by the OS for process scheduling. | def processor_count # rubocop:disable all
@processor_count ||=
begin
if Overcommit::OS.windows?
require 'win32ole'
result = WIN32OLE.connect('winmgmts://').ExecQuery(
'select NumberOfLogicalProcessors from Win32_Processor'
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processor_count\n @processor_count ||= begin\n os_name = RbConfig::CONFIG[\"target_os\"]\n if os_name =~ /mingw|mswin/\n require 'win32ole'\n result = WIN32OLE.connect(\"winmgmts://\").ExecQuery(\n \"select NumberOfLogicalProcessors from Win32_Processor\")\n ... | [
"0.8358202",
"0.80391645",
"0.79512495",
"0.7920639",
"0.79087245",
"0.79058564",
"0.79005367",
"0.7882441",
"0.7815873",
"0.78136694",
"0.77945226",
"0.7776431",
"0.7556806",
"0.7515953",
"0.7508546",
"0.75026697",
"0.74074906",
"0.73477083",
"0.73372126",
"0.72634864",
"0.7... | 0.83085954 | 1 |
Returns whether a file is a broken symlink. | def broken_symlink?(file)
# JRuby's implementation of File.exist? returns true for broken
# symlinks, so we need use File.size?
Overcommit::Utils::FileUtils.symlink?(file) && File.size?(file).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symlink?(file_name)\n symlink_windows?(file_name)\n end",
"def symlink?(path)\n GLib.g_file_test(path, GLib::GFileTest::G_FILE_TEST_IS_SYMLINK)\n end",
"def symlink?(file_name); end",
"def symlink?\n false\n end",
"def symlink?\n @symlink\n end",
"def symlink?(entry)\n si... | [
"0.8186944",
"0.81114775",
"0.81083375",
"0.77088344",
"0.7648387",
"0.7636627",
"0.75686747",
"0.7538307",
"0.75333077",
"0.74964327",
"0.7493421",
"0.7412002",
"0.73850375",
"0.7373797",
"0.73186326",
"0.7298722",
"0.72664475",
"0.72664475",
"0.72664475",
"0.72664475",
"0.7... | 0.86945915 | 0 |
Convert a glob pattern to an absolute path glob pattern rooted from the repository root directory. | def convert_glob_to_absolute(glob)
File.join(repo_root, glob)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_glob_to_absolute(glob); end",
"def translate_glob iss_glob\n raise \"Can't expand path #{iss_glob}\" if iss_glob.include?('**')\n prefix = flags.include?('recursesubdirs') ? \"**/\" : \"\"\n \"#{prefix}#{iss_glob}\"\n end",
"def glob(pattern)\n root = self.root\n Pat... | [
"0.80818915",
"0.69767076",
"0.6924174",
"0.69000816",
"0.67394763",
"0.65724474",
"0.64122707",
"0.6403964",
"0.6401816",
"0.63169956",
"0.63153327",
"0.6307957",
"0.61870104",
"0.6035096",
"0.6035096",
"0.6024517",
"0.6010387",
"0.5978166",
"0.59078354",
"0.5891922",
"0.589... | 0.83751744 | 0 |
SshCredential used for a live session. This is set in ShellSession::ssh and should not be modified anywhere else. | def live_ssh_credential=(new_live_ssh_credential)
unless new_record?
raise "Please don't mess with live_ssh_credential="
end
@live_ssh_credential = new_live_ssh_credential
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials\n if Rails.env.test? || Rails.env.development?\n Rugged::Credentials::SshKeyFromAgent.new(username: username)\n else\n Rugged::Credentials::SshKey.new(username: 'git', publickey: SETTINGS['ssh_public_key'], privatekey: SETTINGS['ssh_private_key'])\n ... | [
"0.67162263",
"0.65163946",
"0.6237718",
"0.60337955",
"0.590704",
"0.58931154",
"0.5812079",
"0.57931805",
"0.57628006",
"0.57588464",
"0.5755444",
"0.57305837",
"0.5709966",
"0.5664968",
"0.5642334",
"0.55657834",
"0.55278516",
"0.5512296",
"0.55075884",
"0.55075884",
"0.54... | 0.69234425 | 0 |
Executes a command. Args: command:: the command to be executed input:: optional data to be fed to the program's stdin Returns a CommandResult with the result of the command's execution. Blocks until the command is executed. | def exec(command, input = nil)
result = command_results.build
result.start! command, input
exit_code = nil
ssh_channel = @net_ssh.open_channel do |channel|
channel.exec command do |_, success|
if success
channel.send_data input if input
channel.eof!
channel.on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_command(command, input)\n command.new(self, input).process\n end",
"def execute_command(command)\n @stdin.puts command\n end",
"def execute(command)\n invoke_command(command, nil)\n end",
"def execute(command)\n if valid_command?(command)\n apply_command(command)\n else... | [
"0.7747841",
"0.7272154",
"0.7200194",
"0.7159516",
"0.7159065",
"0.70622337",
"0.6979795",
"0.68857676",
"0.68055373",
"0.6795605",
"0.6787882",
"0.6762287",
"0.6734847",
"0.6707285",
"0.6676281",
"0.66472524",
"0.65991056",
"0.658828",
"0.6583609",
"0.6583453",
"0.65714127"... | 0.7793796 | 0 |
Executes a sudo command, using the password in the session credentials. sudo is special because it requires a terminal session (pty), and it may prompt for the password of the logged in user. This method sets up the pty correctly, and supplies the password if and only if prompted for it. Args: command:: the command to ... | def sudo_exec!(command, input = nil)
stdout = String.new
sudo_prompt = nil
input_sent = !input
ssh_channel = @net_ssh.open_channel do |channel|
channel.request_pty do |_, success|
raise "Failed to get pty (interactive ssh session)" unless success
end
channel.exec command d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_sudo_command_via_ssh(command, password)\n result = {}\n channel = session.open_channel do |cha| # channel = cha = ch = _c\n # \"on_data\" is called when the process writes something to stdout\n cha.on_data do |c, data|\n if data =~ /^\\[sudo\\] password for /\n c... | [
"0.7466301",
"0.7349206",
"0.7349206",
"0.7153677",
"0.6929229",
"0.6883282",
"0.6874443",
"0.6810807",
"0.66836387",
"0.6614999",
"0.66095084",
"0.64408934",
"0.64019525",
"0.6206172",
"0.61574227",
"0.6149552",
"0.61410904",
"0.611635",
"0.6052398",
"0.59948564",
"0.5982568... | 0.7716556 | 0 |
GET /events/1 GET /events/1.json GET /events/1.csv | def show
@event = Event.find(params[:id])
@page_title = "Event"
respond_to do |format|
format.html # show.html.erb
format.json { render json: @event }
format.csv
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @events = Event.filter(params.slice(:Data, :Time, :Location, :CompletionStatus))\n respond_to do |format|\n format.html\n format.csv { send_data @events.to_csv }\n end\n end",
"def index\n if params[:format] == 'csv'\n headers.merge!({\n 'Cache-Control' => 'must-rev... | [
"0.73487204",
"0.70165867",
"0.67989546",
"0.67941815",
"0.67642784",
"0.67569184",
"0.6681132",
"0.66760445",
"0.6673093",
"0.65929544",
"0.6582249",
"0.65673894",
"0.6564603",
"0.6537319",
"0.6535555",
"0.65286976",
"0.6528086",
"0.6528086",
"0.65101445",
"0.6509255",
"0.64... | 0.7400584 | 0 |
PAGE: index survey logics | def index
@survey_questions = get_survey_questions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @responses = @survey.responses\n @questions = Question.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Surv... | [
"0.7258169",
"0.71899426",
"0.71899426",
"0.71899426",
"0.71899426",
"0.71899426",
"0.71899426",
"0.7093866",
"0.7076741",
"0.7053576",
"0.70505995",
"0.7039096",
"0.7036788",
"0.7026446",
"0.70154756",
"0.7008627",
"0.69725573",
"0.69552195",
"0.6946165",
"0.6934374",
"0.681... | 0.72686046 | 1 |
AJAX: destory a logic by its index | def destroy
render_json_auto @survey.delete_logic_control_rule(params[:id].to_i) and return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(index)\n end",
"def remove_entry(params)\n index = params[:index].to_i\n @puzzle[index] = \".\"\n return JSON.generate({removed: true})\n end",
"def clear_index\n @index = nil\n end",
"def delete_at_index(index)\n \n end",
"def delete_at_without_hooks( index )\n\n @w... | [
"0.65477306",
"0.6334167",
"0.63043904",
"0.6233275",
"0.6217747",
"0.6200371",
"0.6192815",
"0.61286026",
"0.61105883",
"0.6078361",
"0.60638446",
"0.60638446",
"0.60638446",
"0.60638446",
"0.6052564",
"0.60423714",
"0.603949",
"0.6014849",
"0.6006156",
"0.6004304",
"0.59983... | 0.6442471 | 1 |
AJAX: update s logic by its index | def update
render_json_auto @survey.update_logic_control_rule(params[:id].to_i, params[:logic]) and return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit(index, params)\n question.update(question: params[:questions][\"question_#{index + 1}\".to_sym])\n choice_num = 1\n @choices.select { |choice| choice.question_id == question.id}.each do |choice|\n choice.update(choice: params[\"choice_#{choice_num}\".to_sym])\n choice_num += 1\n end\... | [
"0.6007363",
"0.58269376",
"0.58255976",
"0.5786661",
"0.57538384",
"0.57538384",
"0.57538384",
"0.57538384",
"0.57529324",
"0.5748502",
"0.5736684",
"0.5721812",
"0.56816864",
"0.56816864",
"0.56816864",
"0.56816864",
"0.5643759",
"0.5624847",
"0.5618123",
"0.56095093",
"0.5... | 0.6072158 | 0 |
AJAX: create a new logic | def create
render_json_auto @survey.add_logic_control_rule(params[:logic]) and return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n self.done_add_button\n wait_for_ajax\n end",
"def ajax_add_node\n\n # Create a new Node Instance\n node = Node.new\n\n # Update the fields of Node Instance\n node.app_id = params[:app_id]\n node.funnel_id = params[:funnel_id]\n\n if params[:email_template_id] == '0'\n #... | [
"0.65168154",
"0.6388513",
"0.6228914",
"0.62230337",
"0.6196126",
"0.61948264",
"0.60636014",
"0.6035024",
"0.603262",
"0.5970443",
"0.5948347",
"0.594574",
"0.59270775",
"0.5920155",
"0.59141356",
"0.59103376",
"0.59094006",
"0.5898454",
"0.58981264",
"0.5896494",
"0.589254... | 0.6742326 | 0 |
Returns true if +commit+ introduced changes to +path+, using commit trees to make that determination. Uses the history simplification rules that `git log` uses by default, where a commit is omitted if it is TREESAME to any parent. | def commit_touches_path?(commit, walker)
entry = tree_entry(commit)
num_treesame = 0
if commit.parents.empty?
# This is the root commit, return true if it has +path+ in its tree
return !entry.nil?
end
commit.parents.each do |parent|
parent_entry = tree_entry(paren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entry_changed?(path, commit = @commit)\n entry = get_entry_hash(path, commit)\n # if at a root commit, consider it changed if we have this file;\n # i.e. if we added it in the initial commit\n parents = commit.parents\n if parents.empty?\n return !entry.nil?\n end\n # check each paren... | [
"0.70218015",
"0.6791313",
"0.5764153",
"0.56638473",
"0.5617764",
"0.55812025",
"0.55794775",
"0.5541895",
"0.5541895",
"0.55224925",
"0.5502291",
"0.54954875",
"0.54001176",
"0.53514665",
"0.53241515",
"0.5300258",
"0.52995664",
"0.52411085",
"0.52378935",
"0.52040106",
"0.... | 0.7382216 | 0 |
Find the entry for +path+ in the tree for +commit+ | def tree_entry(commit)
pathname = Pathname.new(path)
tmp_entry = nil
pathname.each_filename do |dir|
if tmp_entry.nil?
tmp_entry = commit.tree[dir]
else
tmp_entry = rugged.lookup(tmp_entry[:oid])
return nil unless tmp_entry.type == :tree
tmp_ent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rugged_tree_entry(path)\n rugged_commit.tree.path(path)\n rescue Rugged::TreeError\n nil\n end",
"def get_entry(path, commit = @commit)\n entry_hash = get_entry_hash(path, commit)\n if entry_hash.nil?\n entry = nil\n else\n entry = @repo.lookup(entry_hash[:o... | [
"0.7487713",
"0.7408593",
"0.6653961",
"0.66286224",
"0.649394",
"0.6407717",
"0.6407717",
"0.6302623",
"0.6274697",
"0.62139946",
"0.61941427",
"0.6137931",
"0.60993433",
"0.6048166",
"0.6026136",
"0.601696",
"0.5982323",
"0.5981449",
"0.5960814",
"0.5952821",
"0.59137654",
... | 0.7846004 | 0 |
ChannelMembership.new(member: member, channel: channel) | def initialize(args)
@channel = args[:channel]
@member = args[:member]
@@all << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel_account_for(channel)\n ca = ChannelAccount.new(:user_id => id, :channel_id => channel.id)\n ca.save\n self.channel_accounts << ca\n end",
"def create\n @membership = Membership.new(params[:membership])\n @membership.user_id = current_user.id\n if @membership.save\n end\n end",
... | [
"0.65935147",
"0.6565593",
"0.6462045",
"0.6423679",
"0.63934296",
"0.6381364",
"0.6342551",
"0.6307169",
"0.6305253",
"0.63018745",
"0.6266125",
"0.62659276",
"0.62659276",
"0.62659276",
"0.62659276",
"0.622075",
"0.62110347",
"0.6189942",
"0.6124055",
"0.6113007",
"0.608491... | 0.6824609 | 0 |
takes a InputEventcode and returns a String representing the keycode value | def event_code_to_keycode_str(event_code)
"keycode#{event_code}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dom_code(event_code, dom_key_value)\n keycode_name = KEYCODES[event_code]\n \n ret_code = if dom_key_value =~ /^[a-z]$/i\n \"Key#{dom_key_value.upcase}\"\n elsif dom_key_value =~ /^[0-9]$/\n if keycode_name =~ /^KEY_KP/\n \"Numpad#{dom_key_value}\"\n else\n ... | [
"0.67349315",
"0.6520207",
"0.6163",
"0.6122176",
"0.6049315",
"0.6011697",
"0.60069954",
"0.5950979",
"0.5890599",
"0.58720654",
"0.58356225",
"0.5835582",
"0.5823344",
"0.5789515",
"0.57781416",
"0.5777532",
"0.5741588",
"0.572518",
"0.56992656",
"0.5683242",
"0.5655002",
... | 0.86062485 | 0 |
takes a keycode_name and returns a common location string if available | def location_str_from_keycode_name(keycode_name)
if loc = keycode_name.to_s.gsub('KP', 'NUMPAD').scan(/LEFT|RIGHT|NUMPAD/i).first
loc.downcase.tap {|obj| obj[0] = obj[0].upcase }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dom_location(keycode_name)\n ::VDOM::Utils.common_str_to_dom_location(\n keycode_name.to_s.gsub(/(KEY_)?((KP)|(R)IGHT|(L)EFT)(.*)/, '\\3\\4\\5')\n )\n end",
"def modifier_keymap_name(keycode_name)\n if (keycode_name) =~ /caps|shift|alt|c(on)?tro?l/i\n if keycode_name == :KEY_C... | [
"0.6877637",
"0.6549404",
"0.65404785",
"0.6128962",
"0.61015993",
"0.5991614",
"0.5975373",
"0.56562227",
"0.5585093",
"0.5566879",
"0.5558208",
"0.55455494",
"0.55429184",
"0.55409086",
"0.5525333",
"0.5524785",
"0.55234814",
"0.54706246",
"0.5464708",
"0.54501206",
"0.5441... | 0.85775715 | 0 |
takes a keycode name and returns the keymap modifier name | def modifier_keymap_name(keycode_name)
if (keycode_name) =~ /caps|shift|alt|c(on)?tro?l/i
if keycode_name == :KEY_CAPSLOCK
'capsshift'
else
keycode_name.to_s.gsub(/KEY_/, '').split(/ight|eft/i).reverse.join.downcase
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key_name(name)\n key_id = GameKeys[name.downcase]\n return GameKeys[0] unless key_id\n key_value = Input::Keys[key_id][0]\n return \"J#{-(key_value + 1) / 32 + 1}K#{(-key_value - 1) % 32}\" if key_value < 0\n keybd = Input::Keyboard\n keybd.constants.each do |key_name|\n ... | [
"0.6726313",
"0.65518224",
"0.6404393",
"0.63279927",
"0.605002",
"0.60177445",
"0.59426355",
"0.5841328",
"0.58115023",
"0.5780138",
"0.5712798",
"0.56989574",
"0.5656175",
"0.5647977",
"0.56336534",
"0.5612567",
"0.56050235",
"0.5566211",
"0.5566211",
"0.5547585",
"0.553815... | 0.86565435 | 0 |
Deletes all existing metafiles | def destroy
all.each { |file| FileUtils.rm_f(file) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end",
"def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n e... | [
"0.7159791",
"0.7132363",
"0.70362467",
"0.6938477",
"0.69104534",
"0.68190324",
"0.6788575",
"0.6652798",
"0.6630885",
"0.66009957",
"0.65916604",
"0.6564608",
"0.6547084",
"0.6506138",
"0.6490592",
"0.6476369",
"0.645015",
"0.64292157",
"0.637992",
"0.6358719",
"0.6355145",... | 0.74951625 | 0 |
def test_sum_disk1 assert_equal 251, weight_disk(TOWER, "ugml") end def test_sum_disk2 assert_equal 243, weight_disk(TOWER, "padx") end def test_sum_disk3 assert_equal 243, weight_disk(TOWER, "fwft") end | def test_sum_disk4
assert_equal 243, weight_disk(TOWER, first_disk(TOWER))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_provided_weight_example\n assert_equal 60, @system.corrected_tower.weight\n end",
"def test_weight_of_items_in_bays\n result = weight_of_items_in_bays(@warehouse_data,[:c7,:b4,:b3])\n assert_equal(11,result)\n\nend",
"def test_total_weight\n assert_equal(0 , @wp00.total_weight)\n ... | [
"0.71360505",
"0.7112454",
"0.6824631",
"0.63521767",
"0.6273109",
"0.62691355",
"0.61865294",
"0.61031055",
"0.60503215",
"0.6022828",
"0.60218394",
"0.5942744",
"0.5930742",
"0.59084964",
"0.58963454",
"0.5893572",
"0.5880658",
"0.586956",
"0.58559126",
"0.58459955",
"0.579... | 0.87878823 | 0 |
Sequences without repetition. n^k' Also called 'failing factorial' | def permutations(n,k)
binding.pry
return 1 if k==0
return n if k==1
return factorial(n) if k==n
(((n-k+1)..n).inject(1) {|ac,v| ac * v})
#factorial(x).quo(factorial(x-n))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutations(n,k)\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"def factorial n\n if n == 0\n return 1\n end\n return (1..n).inject(:*)\nend",
"def nck_factorial(n... | [
"0.7344181",
"0.71925557",
"0.7150599",
"0.7149486",
"0.71271855",
"0.7113163",
"0.7113163",
"0.71043694",
"0.71016824",
"0.70674974",
"0.7029868",
"0.702318",
"0.7014553",
"0.7000949",
"0.6993661",
"0.6980911",
"0.69715065",
"0.6969497",
"0.6961998",
"0.69504476",
"0.6947098... | 0.73936087 | 0 |
GET /fridges/new GET /fridges/new.json | def new
@fridge = Fridge.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @fridge }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end",
"def new\n @badge = Badge.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @badge }\n en... | [
"0.6878143",
"0.68495053",
"0.6791383",
"0.67855555",
"0.6733858",
"0.6713783",
"0.669521",
"0.66813827",
"0.66784203",
"0.66006",
"0.6599026",
"0.6599026",
"0.65899616",
"0.6583448",
"0.6556125",
"0.6551971",
"0.6547283",
"0.65392447",
"0.6523415",
"0.6521448",
"0.65123886",... | 0.73968333 | 0 |
POST /fridges POST /fridges.json | def create
@fridge = Fridge.new(params[:fridge])
respond_to do |format|
if @fridge.save
format.html { redirect_to @fridge, notice: 'Fridge was successfully created.' }
format.json { render json: @fridge, status: :created, location: @fridge }
else
format.html { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bridges_create(params = {})\n post \"bridges\", params\n end",
"def create\n @lounges = Lounge.new(params[:lounge])\n if @lounges.save\n CustomLogger.debug(\"Lounge created\")\n CustomLogger.debug(\"--------------\") \n to_log(@lounges) \n @lounges = L... | [
"0.5361984",
"0.53516495",
"0.5216125",
"0.5177988",
"0.51523364",
"0.5117171",
"0.50974834",
"0.5085655",
"0.50838894",
"0.504699",
"0.5005812",
"0.4989179",
"0.49784407",
"0.49600086",
"0.4874188",
"0.48658925",
"0.48577812",
"0.48334336",
"0.48184398",
"0.48164418",
"0.480... | 0.5658794 | 0 |
PUT /fridges/1 PUT /fridges/1.json | def update
@fridge = Fridge.find(params[:id])
respond_to do |format|
if @fridge.update_attributes(params[:fridge])
format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n ... | [
"0.6113732",
"0.6064507",
"0.5803344",
"0.5493162",
"0.54924476",
"0.5487459",
"0.54833627",
"0.5466385",
"0.54575413",
"0.5395798",
"0.53630626",
"0.5335688",
"0.53308356",
"0.53305674",
"0.53236324",
"0.53231555",
"0.52896446",
"0.52895504",
"0.52800196",
"0.52666825",
"0.5... | 0.6234098 | 0 |
DELETE /fridges/1 DELETE /fridges/1.json | def destroy
@fridge = Fridge.find(params[:id])
@fridge.destroy
respond_to do |format|
format.html { redirect_to fridges_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.65876204",
"0.6435968",
"0.6432345",
"0.64272594",
"0.6391776",
"0.63831323",
"0.6382737",
"0.6360882",
"0.635376",
"0.6337652",
"0.6335419",
"0.6333423",
"0.63096577",
"0.6243697",
"0.6204068",
"0.6181101",
"0.61766034",
"0.61745304",
"0.6174439",
"0.6169415",
"0.6169415"... | 0.70539296 | 0 |
_Parameters_ +eth_type+:: integer : Ethernet type +ipv4_destination+:: string : IPv4 Destination IP address +ipv4_source+:: string : IPv4 Source IP address +ipv6_source+:: string : IPv6 Source IP address +ipv6_destination+:: string : IPv6 Destination IP address +ipv6_flabel+:: string : IPv6 Flow Label +ipv6_ext_header+... | def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil,
ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil,
ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil,
in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil,
ip_ecn: nil, tcp_sourc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def packet_params\n params.require(:packet).permit(:user_id, :packet_number, :vendor_number, :requested_date, :due_date, :completed, :company_name, :company_type, :dba, :address_1, :address_2, :city, :zip, :state, :cntry_code, :ship_address_1, :ship_address_2, :ship_city, :ship_zip, :ship_state, :primary_cont... | [
"0.6323946",
"0.61624235",
"0.60457283",
"0.6036289",
"0.5925253",
"0.5870547",
"0.5806679",
"0.57816166",
"0.57217366",
"0.57187223",
"0.5711121",
"0.570022",
"0.56980854",
"0.56877476",
"0.5663521",
"0.56576014",
"0.5654832",
"0.56365025",
"0.5626196",
"0.5621042",
"0.56113... | 0.7296021 | 0 |
Creates an event in the calendar for the game call sheet | def gcmake_event
Event.create :user_id => self.user_id, :gamecall_tag => self.id, :installgc_event_id => self.event_id, :title => self.title, :start_time => self.start_time, :end_time => self.end_time, :event_type => "Gamecall"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_events\n end",
"def create_google_calendar_event(params)\n event = cal.create_event do |e|\n e.title = params[:title]\n e.start_time = params[:start_time]\n e.end_time = params[:end_time]\n end\n end",
"def create_event( event )\n body = {:summary => event.summary.for... | [
"0.6933991",
"0.68369746",
"0.66774035",
"0.65030265",
"0.6465303",
"0.64312035",
"0.6407094",
"0.6358017",
"0.63282496",
"0.6327208",
"0.6251199",
"0.6244646",
"0.62335426",
"0.6229534",
"0.6205881",
"0.6185859",
"0.6175497",
"0.61596113",
"0.6141646",
"0.61189353",
"0.61148... | 0.7245773 | 0 |
Deletes the calendar event when the game call sheet is deleted | def gcdelete_event
cal_event = Event.find_by(gamecall_tag: self.id)
cal_event.destroy if cal_event
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_google_calendar\n result = Gandalf::GoogleApiClient.delete_google_calendar(self.apps_cal_id)\n result.data\n end",
"def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end",
"def delete_calendar(calendar_id)\n end",
"def destroy\n if @default_line_calendar.destroy\n ... | [
"0.7382291",
"0.727872",
"0.7249316",
"0.67508686",
"0.6719423",
"0.66139567",
"0.6556948",
"0.6536241",
"0.6502674",
"0.6399392",
"0.6391661",
"0.6349724",
"0.6343821",
"0.63284457",
"0.632514",
"0.63027394",
"0.62795424",
"0.62752473",
"0.62719333",
"0.6270719",
"0.6248625"... | 0.7681372 | 0 |
Fetches all the valid tags for repository branch. Validates if the version name conforms to v. | def fetch_tags (arg, regex=/\A[v]\d+[.]\d+\z/)
clean_tags = []
tag(arg).split("\n").each { |vtag|
clean_tags.push(vtag) if vtag.match(regex) }
# contains tags that conform to format : discuss
return clean_tags unless clean_tags.length < 1
raise ImqsGitError, "no tags were found that matches th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_tags\n tags = git(\"tag\", \"-l\").lines.map(&:strip).select do |tag|\n version_part = tag_mapper.call(tag)\n version_part && version_part.version?\n end\n tags.sort_by { |t| Gem::Version.new(tag_mapper.call(t).version_number) }\n end",
"def update_tags\n return i... | [
"0.6654571",
"0.63620996",
"0.61020476",
"0.60737276",
"0.6060329",
"0.6003095",
"0.5797461",
"0.5786495",
"0.56875646",
"0.56792164",
"0.5619672",
"0.5600917",
"0.55968046",
"0.5560721",
"0.5546863",
"0.5526526",
"0.54947597",
"0.5479752",
"0.54469126",
"0.5443874",
"0.54410... | 0.63871187 | 1 |
GET /image_galleries/1 GET /image_galleries/1.json | def show
@image_gallery = ImageGallery.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @image_gallery }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gallery\r\n\t\t\timages = ProjectImage.where(project_id: params[:id]).reorder('\"order\" asc')\r\n\r\n\t\t\trender json: { status: 0, result: images.map { |image| { id: image.id, small: image.image.url(:thumb), original: image.image.url, description: image.description } } }\r\n\t\tend",
"def show\n @i... | [
"0.79268515",
"0.7688818",
"0.7687127",
"0.7687127",
"0.7687127",
"0.76392096",
"0.75061643",
"0.74478686",
"0.74117315",
"0.74109316",
"0.7405893",
"0.73313725",
"0.7329658",
"0.7257795",
"0.7257795",
"0.7257795",
"0.7257795",
"0.7257795",
"0.7246729",
"0.7195083",
"0.719304... | 0.77485454 | 1 |
GET /image_galleries/new GET /image_galleries/new.json | def new
@image_gallery = ImageGallery.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @image_gallery }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @gallery = Gallery.new(:public => true)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json... | [
"0.8031071",
"0.80102307",
"0.80102307",
"0.78835666",
"0.7720878",
"0.77095467",
"0.76426655",
"0.7640564",
"0.7526036",
"0.7463064",
"0.74599683",
"0.74476904",
"0.74476904",
"0.74476904",
"0.74476904",
"0.74476904",
"0.74476904",
"0.74448335",
"0.742235",
"0.74141926",
"0.... | 0.82235 | 0 |
DELETE /image_galleries/1 DELETE /image_galleries/1.json | def destroy
@image_gallery = ImageGallery.find(params[:id])
@image_gallery.destroy
respond_to do |format|
format.html { redirect_to image_galleries_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_gallery.destroy\n respond_to do |format|... | [
"0.76864314",
"0.768174",
"0.76802164",
"0.7664009",
"0.76527417",
"0.76527417",
"0.76430094",
"0.76335365",
"0.7611981",
"0.76036376",
"0.7572928",
"0.7517285",
"0.75167155",
"0.7498568",
"0.7452797",
"0.7452797",
"0.7452797",
"0.74202734",
"0.74098563",
"0.7400404",
"0.7393... | 0.8012878 | 0 |
PATCH/PUT /api/tasks/1 PATCH/PUT /api/tasks/1.json | def update
respond_to do |format|
if @api_task.update(api_task_params)
format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }
format.json { render :show, status: :ok, location: @api_task }
else
format.html { render :edit }
format.json { render jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.up... | [
"0.71203303",
"0.71203303",
"0.71050173",
"0.70365363",
"0.68501335",
"0.6815654",
"0.68118423",
"0.67917985",
"0.67670304",
"0.67574954",
"0.6685184",
"0.66642714",
"0.66479313",
"0.6627824",
"0.65861815",
"0.65836024",
"0.65836024",
"0.65836024",
"0.65836024",
"0.65836024",
... | 0.7127897 | 0 |
DELETE /api/tasks/1 DELETE /api/tasks/1.json | def destroy
@api_task.destroy
respond_to do |format|
format.html { redirect_to api_tasks_url, notice: 'Task was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_task id\n request :delete, \"ta... | [
"0.76316106",
"0.76199824",
"0.7618439",
"0.7589574",
"0.75890523",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.75698686",
"0.7547202",
"0.7547202",
... | 0.79704094 | 0 |
GET /marmitas/1 GET /marmitas/1.xml | def show
@marmita = Marmita.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @marmita }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @manutencao = Manutencao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @manutencao }\n end\n end",
"def show\n @musica = Musica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f... | [
"0.665325",
"0.6623435",
"0.65459985",
"0.65334195",
"0.6490598",
"0.6477542",
"0.6454072",
"0.64267653",
"0.6409835",
"0.6391722",
"0.6391722",
"0.6363026",
"0.63529575",
"0.63235176",
"0.6314962",
"0.6313704",
"0.63050634",
"0.62999916",
"0.62792796",
"0.6247276",
"0.624559... | 0.71628016 | 0 |
GET /marmitas/new GET /marmitas/new.xml | def new
@marmita = Marmita.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @marmita }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @muestra = Muestra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @muestra }\n end\n end",
"def new\n ... | [
"0.7473568",
"0.743045",
"0.7336552",
"0.7312698",
"0.7312698",
"0.7298703",
"0.72478175",
"0.7230679",
"0.720255",
"0.71971744",
"0.71907216",
"0.71843356",
"0.7159412",
"0.7159412",
"0.7158549",
"0.7158549",
"0.71547407",
"0.7152704",
"0.71525747",
"0.7147824",
"0.71418124"... | 0.7770885 | 0 |
POST /marmitas POST /marmitas.xml | def create
@marmita = Marmita.new(params[:marmita])
respond_to do |format|
if @marmita.save
format.html { redirect_to(@marmita, :notice => 'Marmita was successfully created.') }
format.xml { render :xml => @marmita, :status => :created, :location => @marmita }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end",
"def create\n @marca = Marca.new(marca_params)\n\n respond_to do |format|\n if @marca.save\n format.html ... | [
"0.606738",
"0.60401255",
"0.603964",
"0.60361105",
"0.5901353",
"0.58186716",
"0.5803491",
"0.57879215",
"0.57878464",
"0.5776409",
"0.5769356",
"0.5730033",
"0.5684653",
"0.56751686",
"0.56601167",
"0.5641266",
"0.56341964",
"0.5625878",
"0.56117094",
"0.560939",
"0.5607242... | 0.67061466 | 0 |
PUT /marmitas/1 PUT /marmitas/1.xml | def update
@marmita = Marmita.find(params[:id])
respond_to do |format|
if @marmita.update_attributes(params[:marmita])
format.html { redirect_to(@marmita, :notice => 'Marmita was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def upd... | [
"0.6077777",
"0.60168123",
"0.5980069",
"0.59167624",
"0.590698",
"0.5867446",
"0.583585",
"0.58315545",
"0.57638764",
"0.57636553",
"0.5757922",
"0.57480717",
"0.57437205",
"0.5734175",
"0.57275635",
"0.57132155",
"0.5690143",
"0.5685167",
"0.56790304",
"0.56772256",
"0.5624... | 0.6527464 | 0 |
DELETE /marmitas/1 DELETE /marmitas/1.xml | def destroy
@marmita = Marmita.find(params[:id])
@marmita.destroy
respond_to do |format|
format.html { redirect_to(marmitas_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end",
"def destro... | [
"0.7052469",
"0.6977547",
"0.6801861",
"0.6796095",
"0.6770499",
"0.6752447",
"0.674233",
"0.6717112",
"0.6694987",
"0.66885483",
"0.6656679",
"0.66557574",
"0.66439676",
"0.66397583",
"0.6633954",
"0.6631511",
"0.6607676",
"0.6606701",
"0.65826094",
"0.65744156",
"0.6573157"... | 0.6990022 | 1 |
Sets the attributes to their default values, marking only those values with defaults as being dirty. | def set_default_attributes
self.attributes = default_attributes
self.attributes.each do |key, value|
# Scrub the attributes if there's no value
attr_clean!(key) unless value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_nil_attributes_to_default\n nil_attributes = self.class.non_nil_attributes.find_all do |name|\n !instance_variable_defined?(\"@#{name}\") || instance_variable_get(\"@#{name}\").nil?\n end\n\n nil_attributes.each do |attribute|\n default = self.default_value attribute\n\n value = c... | [
"0.74714607",
"0.7204189",
"0.72039896",
"0.7151527",
"0.70529264",
"0.69971114",
"0.6931485",
"0.69298685",
"0.69122237",
"0.67889804",
"0.6727553",
"0.67070967",
"0.66709757",
"0.6643008",
"0.65700495",
"0.6569777",
"0.65509844",
"0.65047246",
"0.64774173",
"0.6458219",
"0.... | 0.8488072 | 0 |
Returns the hash of currentlydirty attributes complete with values | def dirty_attributes
o = {}
@dirty_attribute_keys ||= []
@dirty_attribute_keys.each do |key|
o[key] = attr_get(key)
end
o
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end",
"def hash\n @attrs\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def dirty_attribute_keys\n @... | [
"0.76418936",
"0.7448861",
"0.72501767",
"0.72501767",
"0.72501767",
"0.69140077",
"0.68982095",
"0.6888262",
"0.6854437",
"0.68466115",
"0.68455404",
"0.68382335",
"0.68317634",
"0.67571014",
"0.67444116",
"0.6730989",
"0.670894",
"0.6700917",
"0.6686381",
"0.6668858",
"0.66... | 0.75261825 | 1 |
Clears the array of dirty attribute keys | def clean_dirty_attributes!
@dirty_attribute_keys = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty_attribute_keys\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys\n end",
"def attr_clean!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys.delete_if {|k| k == key.to_sym }\n end",
"def attr_dirty!(key)\n @dirty_attribute_keys ||= []\n ... | [
"0.80151886",
"0.78073597",
"0.7719293",
"0.744392",
"0.72848886",
"0.7076082",
"0.69219965",
"0.6898585",
"0.689567",
"0.67419446",
"0.67021775",
"0.6652273",
"0.6650535",
"0.6633849",
"0.65413445",
"0.652476",
"0.6496647",
"0.6448001",
"0.64107513",
"0.6408416",
"0.6406904"... | 0.84530616 | 0 |
Returns an array of keys for attributes that are currently dirty | def dirty_attribute_keys
@dirty_attribute_keys ||= []
@dirty_attribute_keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty_attributes\n o = {}\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys.each do |key|\n o[key] = attr_get(key)\n end\n o\n end",
"def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end",
"def attribute_ke... | [
"0.8012323",
"0.7671233",
"0.7602805",
"0.7133555",
"0.71200126",
"0.710961",
"0.7107922",
"0.7050577",
"0.699303",
"0.69385386",
"0.69304526",
"0.69167334",
"0.68888897",
"0.6881066",
"0.68145066",
"0.67853516",
"0.67514443",
"0.67514443",
"0.67514443",
"0.67514443",
"0.6739... | 0.85849 | 0 |
POST /tv_series POST /tv_series.json | def create
@tv_series = TvSeries.new(tv_series_params)
respond_to do |format|
if @tv_series.save
format.html { redirect_to root_path, notice: 'Сериал создан!' }
format.json { render :index, status: :created, location: root_path }
else
format.html { render :new }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tv_series = TvSerie.new(tv_series_params)\n\n respond_to do |format|\n if @tv_series.save\n format.html { redirect_to @tv_series, notice: \"Tv serie was successfully created.\" }\n format.json { render :show, status: :created, location: @tv_series }\n else\n forma... | [
"0.74889904",
"0.6913443",
"0.68667865",
"0.68324745",
"0.6822452",
"0.67640513",
"0.67256355",
"0.6686579",
"0.6556743",
"0.6507921",
"0.65072435",
"0.64940697",
"0.6412737",
"0.64052886",
"0.63790363",
"0.635445",
"0.63346845",
"0.63320255",
"0.6330655",
"0.62825006",
"0.62... | 0.7627816 | 0 |
PATCH/PUT /tv_series/1 PATCH/PUT /tv_series/1.json | def update
respond_to do |format|
if @tv_series.update(tv_series_params)
format.html { redirect_to root_path, notice: 'Сериал отредактирован!' }
format.json { render :index, status: :ok, location: root_path }
else
format.html { render :edit }
format.json { render json: @t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @tv_series.update(tv_series_params)\n format.html { redirect_to @tv_series, notice: \"Tv serie was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tv_series }\n else\n format.html { render :edit, status: :unp... | [
"0.731569",
"0.6935574",
"0.691584",
"0.67568266",
"0.6736777",
"0.6721244",
"0.6721244",
"0.66286844",
"0.6558803",
"0.65210664",
"0.6408831",
"0.63190967",
"0.613972",
"0.6069182",
"0.6060832",
"0.60412097",
"0.602346",
"0.59924185",
"0.5989049",
"0.5983169",
"0.59393865",
... | 0.7255116 | 1 |
DELETE /tv_series/1 DELETE /tv_series/1.json | def destroy
@tv_series.destroy
respond_to do |format|
format.html { redirect_to tv_series_index_url, notice: 'Сериал удален!' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tv_series.destroy\n respond_to do |format|\n format.html { redirect_to tv_series_url, notice: \"Tv serie was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to ... | [
"0.74196965",
"0.7350128",
"0.73403823",
"0.73059076",
"0.7290685",
"0.7071283",
"0.70540154",
"0.7040053",
"0.6936863",
"0.6862558",
"0.6819368",
"0.6802609",
"0.6790185",
"0.67650366",
"0.673282",
"0.6703245",
"0.6703073",
"0.6694583",
"0.66852444",
"0.6679132",
"0.66646767... | 0.7464621 | 0 |
Parse the default backup rss file to be able to combine the old items with the new ones | def parse_rss_file backup_file
xml_file = backup_file
@logger.info "Parsing old feed items from " + xml_file
content = ""
begin
open(xml_file) { |f| content = f.read }
rescue Exception
@logger.error "Backup file is not where I thought it should be."
end
RSS::Parser.parse(content,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_feed\n remove_previous_entries\n @items = @content[\"rss\"][\"channel\"][\"item\"]\n if !@items.nil?\n for item in @items do\n item[\"pubDate\"] ||= \"\"\n item[\"creator\"] ||= \"\"\n item[\"guid\"] ||= \"\"\n item[\"title\"] ||= \"\"\n item[\"d... | [
"0.6316659",
"0.60471344",
"0.587346",
"0.5870756",
"0.57830596",
"0.57405674",
"0.5589162",
"0.5561127",
"0.55565506",
"0.54780006",
"0.54739416",
"0.5425828",
"0.5331433",
"0.52928257",
"0.5276314",
"0.52594507",
"0.52551585",
"0.522411",
"0.52117115",
"0.52086157",
"0.5198... | 0.8205373 | 0 |
Defines store on this model. +store_name+ The name of the store. ==== Options The following options are accepted: +coder+ The coder of the store. +accessors+ An array of the accessors to the store. Examples: class User < ActiveRecord::Base store :settings, accessors: [:color, :homepage, login_at: :datetime], coder: JSO... | def store(store_name, options = {})
accessors = options.delete(:accessors)
_orig_store(store_name, options)
store_accessor(store_name, *accessors) if accessors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store options = {}, &block\n @store ||= store_clazz.new\n @store.adapter_class ||= default_adapter_class\n @store.default_options = options\n yield @store if block_given?\n @store\n end",
"def store=(store)\n @store = store\n end",
"def store name = nil\n... | [
"0.6906644",
"0.67376",
"0.6709074",
"0.65375304",
"0.6483019",
"0.64782053",
"0.6423003",
"0.62611514",
"0.6168388",
"0.6150662",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6066246",
"0.6044794",
"0.60055923",
... | 0.83620113 | 0 |
Adds additional accessors to an existing store on this model. +store_name+ The name of the store. +keys+ The array of the accessors to the store. +typed_keys+ The keytotype hash of the accesors with type to the store. Examples: class SuperUser < User store_accessor :settings, :privileges, login_at: :datetime end | def store_accessor(store_name, *keys, **typed_keys)
keys = keys.flatten
typed_keys = typed_keys.except(keys)
_define_accessors_methods(store_name, *keys)
_prepare_local_stored_attributes(store_name, *keys)
typed_keys.each do |key, type|
store_attribute(store_name, ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store(store_name, options = {})\n accessors = options.delete(:accessors)\n _orig_store(store_name, options)\n store_accessor(store_name, *accessors) if accessors\n end",
"def store_attribute(store_name, name, type, **options)\n _define_accessors_methods(store_name, name)\n\n ... | [
"0.67801887",
"0.64135987",
"0.5676017",
"0.55881244",
"0.5491694",
"0.5471547",
"0.5469563",
"0.53683144",
"0.53443533",
"0.52659684",
"0.52570575",
"0.51703686",
"0.5085852",
"0.5080277",
"0.50262016",
"0.4991896",
"0.49834993",
"0.49813044",
"0.493182",
"0.49261504",
"0.48... | 0.8553235 | 0 |
Adds additional accessors with a type to an existing store on this model. Type casting occurs every time you write data through accessor or update store itself and when object is loaded from database. Note that if you update store explicitly then value isn't type casted. +store_name+ The name of the store. +name+ The n... | def store_attribute(store_name, name, type, **options)
_define_accessors_methods(store_name, name)
_define_predicate_method(name) if type == :boolean
decorate_attribute_type(store_name, "typed_accessor_for_#{name}") do |subtype|
Type::TypedStore.create_from_type(subtype, name, type, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store(store_name, options = {})\n accessors = options.delete(:accessors)\n _orig_store(store_name, options)\n store_accessor(store_name, *accessors) if accessors\n end",
"def store_accessor(store_name, *keys, **typed_keys)\n keys = keys.flatten\n typed_keys = typed_key... | [
"0.65719914",
"0.6303445",
"0.56906074",
"0.548469",
"0.5474168",
"0.53121626",
"0.5185635",
"0.5096026",
"0.50728303",
"0.50480545",
"0.5025042",
"0.5020678",
"0.501104",
"0.50079197",
"0.4992714",
"0.49729574",
"0.49656537",
"0.49465933",
"0.49345326",
"0.48683664",
"0.4863... | 0.74140173 | 0 |
Internal: The default mass of this object | def mass
10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass\n @mass\nend",
"def mass\n @ob.get_exact_mass - (@ob.get_total_charge * Rubabel::MASS_E)\n end",
"def mass\n (detail[:area] * material.thickness * material.density / 1000).ceil\n end",
"def weight\n return nil if mass.nil?\n mass / 1000.0\n end",
"def default_size\n @t... | [
"0.7178745",
"0.7139268",
"0.6964887",
"0.6425265",
"0.6325614",
"0.62961644",
"0.6189032",
"0.6155222",
"0.61076975",
"0.6091716",
"0.6083217",
"0.60238844",
"0.601413",
"0.6000954",
"0.5970449",
"0.5936833",
"0.59357184",
"0.5816031",
"0.58092606",
"0.5759648",
"0.5742884",... | 0.7621194 | 0 |
PATCH/PUT /borrowed_books/1 PATCH/PUT /borrowed_books/1.json | def update
respond_to do |format|
if @borrowed_book.update(borrowed_book_params)
format.html { redirect_to @borrowed_book, notice: 'The book was successfully checked in.' }
format.json { render :show, status: :ok, location: @borrowed_book }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"de... | [
"0.70329165",
"0.69740707",
"0.6909123",
"0.68988836",
"0.6891652",
"0.68729234",
"0.66897804",
"0.666608",
"0.66582465",
"0.6651168",
"0.66371775",
"0.6625734",
"0.6599018",
"0.65957075",
"0.6594833",
"0.6594833",
"0.6589327",
"0.6583934",
"0.6563837",
"0.6561633",
"0.655814... | 0.7117798 | 0 |
Returns the team description depending on the access level. | def team_description_for(team)
i18n_scope = "descriptions.teams"
scope = if team.admin_privileges
"admin_html"
else
"default_html"
end
t("#{i18n_scope}.#{scope}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_names\n game = Game.find(self.game_id)\n type = self.bet_type\n if over_under?\n return \"#{game.away_team} vs #{game.home_team}\"\n elsif type == \"lay\"\n if game.spread <= 0\n return game.home_team\n else\n return game.away_team\n end\n else\n if ga... | [
"0.631013",
"0.62912494",
"0.6131733",
"0.6078422",
"0.6078422",
"0.6078422",
"0.6078422",
"0.6045764",
"0.6034943",
"0.6033833",
"0.5999393",
"0.59592324",
"0.5908189",
"0.58915263",
"0.5871894",
"0.58537",
"0.58517",
"0.58113307",
"0.57893676",
"0.5779895",
"0.5777637",
"... | 0.75574523 | 0 |
Below code give the lvalue from Look up table. | def lookup_lvalue(id)
v = CompanyLookup.find_by_id(id)
v.lvalue if v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookuplawfirm_lvalue(id)\n CompanyLookup.find_by_id(id).lvalue\n end",
"def lookup(obj, pos); end",
"def lookup(name)\n loc = nil # TODO: Periodic refresh of location database table\n=begin\n loc = IlsLocationList.lookup(name)\n=end\n return loc.name, loc.code if loc.present?\n end",
"def v... | [
"0.7575978",
"0.6005302",
"0.5429707",
"0.5425719",
"0.53940153",
"0.53808296",
"0.53188354",
"0.52872753",
"0.52569604",
"0.52475643",
"0.52475643",
"0.52475643",
"0.5214127",
"0.5166118",
"0.5142027",
"0.5124417",
"0.50960994",
"0.5083751",
"0.50814617",
"0.5077265",
"0.507... | 0.76545596 | 0 |
Below code give the lvalue from Look up table. | def lookuplawfirm_lvalue(id)
CompanyLookup.find_by_id(id).lvalue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_lvalue(id)\n v = CompanyLookup.find_by_id(id)\n v.lvalue if v\n end",
"def lookup(obj, pos); end",
"def lookup(name)\n loc = nil # TODO: Periodic refresh of location database table\n=begin\n loc = IlsLocationList.lookup(name)\n=end\n return loc.name, loc.code if loc.present?\n end",... | [
"0.7654763",
"0.6007927",
"0.54319793",
"0.5427377",
"0.5394267",
"0.53809255",
"0.53210944",
"0.5287806",
"0.5256924",
"0.5249058",
"0.5249058",
"0.5249058",
"0.52137375",
"0.51685935",
"0.5142515",
"0.51238227",
"0.5097414",
"0.5085026",
"0.50830126",
"0.508009",
"0.5071815... | 0.75762343 | 1 |
truncate_hover_with_created_at commented as was used only for accounts which are deactivated. As per feature 8879 REMOVED THESE METHODS AS NOT IN USE. DO NOT ADD AGAIN. SUPRIYA SURVE 31 JAN 2012 This Helper generates the action links(comment,history,edit...) for contact index page parameter : contact > its a contact ob... | def contact_action_links(contact)
msg,confirm=contact.checkassociation(t(:label_Account))
if msg.present? && confirm.blank?
link=link_to('Delete',"#", :onclick=> "alert(#{msg.to_json})")
elsif msg.blank? && confirm.blank?
link=link_to('Delete',deactivate_contact_contact_path(contact.id,:mode_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncate_hover_contacts_link(str, length, url, title, preference, created_at, department)\n mouse_over_detail_info(str, title, preference, created_at, department)\n strng = h(str)\n if str.length > length \n strng = truncate(h(str), :length => length)\n end\n new_tooltip_div_code(link_... | [
"0.61769646",
"0.5867497",
"0.5782112",
"0.57673883",
"0.56847274",
"0.5680301",
"0.55634964",
"0.5533635",
"0.551735",
"0.54932356",
"0.54836357",
"0.54164195",
"0.5390342",
"0.53819",
"0.5350178",
"0.5346239",
"0.5341032",
"0.5333046",
"0.5323535",
"0.531227",
"0.5311049",
... | 0.7081052 | 0 |
livia_date_effect and livia_date_time_effect can be combined | def livia_date_effect(new_date)
if new_date
days= (Time.zone.now.to_date - new_date.to_date).to_i
weekend = new_date.wday
add_class = ((weekend == 0) || (weekend == 6))? "weekend" : ""
if days ==0
return %Q{
<span style="color: #F88158" class="blink #{add_class}">#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intermediate_effect(_effects); end",
"def time_category\n # ActionController::Base.helpers.time_ago_in_words Groupify.groupify([self], Proc.new {|ep| ep.aired_at || ep.phile.file_created_at })[0][0]\n ActionController::Base.helpers.time_ago_in_words self.aired_at\n end",
"def acts_like_time?\n tr... | [
"0.5556332",
"0.5420921",
"0.52652633",
"0.5263801",
"0.5234915",
"0.51318526",
"0.50735545",
"0.4953895",
"0.49484885",
"0.49458513",
"0.4945277",
"0.4930047",
"0.49042407",
"0.48945764",
"0.4876804",
"0.4865378",
"0.48616564",
"0.48476064",
"0.48361817",
"0.48136014",
"0.48... | 0.6148859 | 0 |
product_licence_assign_action_links REMOVED THESE METHODS AS NOT IN USE. DO NOT ADD AGAIN. SUPRIYA SURVE 31 JAN 2012 Product Actions links | def product_action_links(product)
return %Q{
#{link_to(image_tag('/images/livia_portal/icon_edit.gif',{:alt =>"Edit", :title=>"Edit", :border => 0, :hspace => "0"}), edit_product_path(:id=>product.id))}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links\n return {} unless current_user\n\n # rubocop:disable Metrics/BlockLength\n super.tap do |links|\n links[:show] = \"/files/#{object.uid}\"\n links[:user] = user_path(object.user.dxuser)\n links[:track] = track_path(id: object.uid)\n links[:space] = space_path if object.in_spa... | [
"0.6162307",
"0.6026942",
"0.58584774",
"0.5777534",
"0.5640971",
"0.5625942",
"0.5514563",
"0.5460493",
"0.5450316",
"0.5339669",
"0.5334936",
"0.5311958",
"0.5308817",
"0.52867633",
"0.5273111",
"0.5255645",
"0.5229829",
"0.52237743",
"0.5212596",
"0.5194854",
"0.5168201",
... | 0.6892925 | 0 |
Adds first and last page link to the pagination and call javascript which will show only 5 page links, the links are AJAX based. | def paginate_for_five_remote_links(totalpages, update_div, url_hash, page=nil)
fpage = lpage = nil
fpage = escape_javascript link_to_remote("", {:update => update_div, :method => :get, :url => url_hash.merge(:page=>1), :before =>"jQuery('#perpage_loader').show();", :complete=>"jQuery('#perpage_loader').hide();"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate_for_five_links(totalpages, options, page=nil)\n return %Q{\n <script type=\"text/javascript\">\n jQuery(document).ready(function() {\n paginate_for_five_links(#{totalpages}) \n jQuery(\".willpaginate:first, .bottom-pagination:first\").before('#{link_to_unless( (page.nil? || pag... | [
"0.7928142",
"0.7293527",
"0.69907194",
"0.68156105",
"0.6774155",
"0.6698465",
"0.6668818",
"0.6644221",
"0.664208",
"0.6631274",
"0.6565606",
"0.65543073",
"0.6546185",
"0.6527812",
"0.6509933",
"0.6501097",
"0.6411486",
"0.6397989",
"0.63951594",
"0.638329",
"0.6344887",
... | 0.7840847 | 1 |
added first and last page link to the pagination and call javascript which will show only 5 page links Supriya | def paginate_for_five_links(totalpages, options, page=nil)
return %Q{
<script type="text/javascript">
jQuery(document).ready(function() {
paginate_for_five_links(#{totalpages})
jQuery(".willpaginate:first, .bottom-pagination:first").before('#{link_to_unless( (page.nil? || page.eql?(1)),"",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate_for_five_remote_links(totalpages, update_div, url_hash, page=nil)\n fpage = lpage = nil\n fpage = escape_javascript link_to_remote(\"\", {:update => update_div, :method => :get, :url => url_hash.merge(:page=>1), :before =>\"jQuery('#perpage_loader').show();\", :complete=>\"jQuery('#perpage_loade... | [
"0.7577137",
"0.7381513",
"0.68827164",
"0.6852554",
"0.6837937",
"0.6837351",
"0.68113804",
"0.68087816",
"0.68039966",
"0.6795415",
"0.6763031",
"0.6757147",
"0.6736357",
"0.6714331",
"0.66994447",
"0.6630697",
"0.65937173",
"0.65932125",
"0.6574331",
"0.6565937",
"0.655786... | 0.7989497 | 0 |
custom_user_setting for new UI please use 'truncate_hover_link' helper Supriya Surve This is used in matter clients | def truncate_hover_link_blue_tooltip(str,length,url)
strng = str
if str.length > length
strng = truncate(str, :length => length)
end
return %Q{
<span class="liviadashboardview">
#{link_to(strng, url)}
<span class="livia_dashboardroller" style="display:none;">
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_user_link\n name.truncate(17)\n end",
"def longer_mailto_link(user)\n content_tag(:span,nice_mailto_link(user, :short_to_s),:class=>'small')\n end",
"def truncate_hover_blue_tooltip(str,length)\n unless str.nil?\n if str.length > length\n return %Q{\n <span class=\"liv... | [
"0.7122751",
"0.62296224",
"0.6089264",
"0.59271294",
"0.59070855",
"0.5816932",
"0.58055794",
"0.56822413",
"0.56816226",
"0.56712157",
"0.55431795",
"0.55151737",
"0.54923576",
"0.5480485",
"0.5468842",
"0.5443735",
"0.54434156",
"0.54347837",
"0.5404041",
"0.53810865",
"0.... | 0.6294877 | 1 |
for new UI please use 'truncate_hover' helper Supriya | def truncate_hover_blue_tooltip(str,length)
unless str.nil?
if str.length > length
return %Q{
<span class="liviadashboardview">
#{truncate(str,:length => length)}
<span class="livia_dashboardroller" style="display:none;">
#{str}
</span>
</spa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncated_text_with_hover text, args = {:truncate => 40}\n \"<div title='#{text.length > args[:truncate] ? text : nil}'>#{text.truncate(args[:truncate])}</div>\".html_safe\n end",
"def truncate_hover_link_blue_tooltip(str,length,url)\n strng = str\n if str.length > length\n strng = truncate(st... | [
"0.8323002",
"0.77738637",
"0.7347375",
"0.6756726",
"0.65738815",
"0.6489334",
"0.6417068",
"0.6416603",
"0.63827974",
"0.6305929",
"0.6283134",
"0.62713444",
"0.62699646",
"0.62647146",
"0.6188176",
"0.61739445",
"0.61730653",
"0.616351",
"0.6153192",
"0.61467826",
"0.61411... | 0.8055664 | 1 |
Radio button for reports matterrevenue Ketki 10/5/2011 | def radios_for_revenue_matter_rpt(opts)
return %Q{
<div class="fl">
<table>
<tr>
<td><input type="radio" name="get_records" id="get_records" value="Basic" #{opts[:basic_checked]} /></td>
<td>Basic</td>
<td> </td>
<td><input name="get_records" type="radi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpt_matter_revenue_helper(radiobtn)\n opts = {}\n if params[:date_selected]\n opts[:style] = \"margin:0px\"\n opts[:checked] = \"checked\"\n else\n opts[:style] = \"display:none; margin:0px\"\n opts[:checked] = \"\"\n end\n if radiobtn == \"Basic\"\n opts[:basic_checked]... | [
"0.7293055",
"0.6550615",
"0.6302884",
"0.615086",
"0.6144182",
"0.5906035",
"0.55878764",
"0.5578514",
"0.5545366",
"0.54923624",
"0.54796326",
"0.54791754",
"0.54628456",
"0.54600674",
"0.5427574",
"0.54257",
"0.5403079",
"0.5394643",
"0.5368303",
"0.5346771",
"0.534416",
... | 0.6551723 | 1 |
Called whenever a Jermon should forget a move. It should return 1 if the selection is canceled, or 0 to 3 to indicate the move to forget. The function should not allow HM moves to be forgotten. | def pbForgetMove(pkmn,move)
return 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forget; opt('forget'); end",
"def on_cancel_select\n @tb_item = nil\n $game_temp.tb_item = nil\n move_pos_off\n end",
"def cancel_move\n @cursor.active = true\n @active_battler.moveto(@pre_x, @pre_y)\n clear_tr_sprites\n draw_ranges(@active_battler, 3)\n end",
"def invalid_move\r\n... | [
"0.5788678",
"0.5662735",
"0.55917454",
"0.55915993",
"0.553147",
"0.5468674",
"0.53621435",
"0.5227669",
"0.5172452",
"0.5168248",
"0.5136967",
"0.51342124",
"0.5127218",
"0.51167786",
"0.5100903",
"0.5070315",
"0.50649303",
"0.5048444",
"0.5048444",
"0.5021684",
"0.5009107"... | 0.6488672 | 1 |
This method is called whenever a Jermon's HP changes. Used to animate the HP bar. | def pbHPChanged(pkmn,oldhp,anim=false)
hpchange=pkmn.hp-oldhp
if hpchange<0
hpchange=-hpchange
PBDebug.log("[HP change] #{pkmn.pbThis} lost #{hpchange} HP (#{oldhp}=>#{pkmn.hp})")
else
PBDebug.log("[HP change] #{pkmn.pbThis} gained #{hpchange} HP (#{oldhp}=>#{pkmn.hp})")
end
pbRefr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateHpBar\n return if self.disposed?\n # updates the current state of the HP bar\n zone = 0\n zone = 1 if self.hp <= @battler.totalhp*0.50\n zone = 2 if self.hp <= @battler.totalhp*0.25\n @sprites[\"hp\"].bitmap.blt(0,0,@colors,Rect.new(zone*2,0,2,6))\n hpbar = @battler.totalhp == 0 ? 0 ... | [
"0.74511224",
"0.7135872",
"0.7036206",
"0.6508805",
"0.6464928",
"0.6462398",
"0.64242303",
"0.6401614",
"0.6354141",
"0.6281059",
"0.6247362",
"0.6216143",
"0.61824995",
"0.6156257",
"0.6123317",
"0.6102434",
"0.6051983",
"0.601549",
"0.60026616",
"0.59467083",
"0.5917075",... | 0.7458564 | 0 |
Use this method to choose a new Jermon for the enemy The enemy's party is guaranteed to have at least one choosable member. | def pbChooseNewEnemy(index,party)
@battle.pbDefaultChooseNewEnemy(index,party)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_enemy\n\t\t@has_enemy = rand(1..2)==1 ? true : false\n\t\t#need an enemy value for the room.\n\tend",
"def decide_random_target_for_enemy\n # Diverge with effect scope\n if for_one_friend_hp0?\n battler = $game_troop.random_target_enemy_hp0\n elsif for_one_friend?\n battler = $game_... | [
"0.631329",
"0.62326",
"0.6203829",
"0.61049694",
"0.6066705",
"0.6064357",
"0.6054861",
"0.6008414",
"0.59298176",
"0.59121853",
"0.587064",
"0.5812323",
"0.58044153",
"0.5751519",
"0.5737136",
"0.56836116",
"0.56794375",
"0.5678826",
"0.5630736",
"0.5626355",
"0.5612563",
... | 0.6499904 | 0 |
Use this method to choose a new Jermon for the enemy The enemy's party is guaranteed to have at least one choosable member. | def pbChooseNewEnemy(index,party)
@battle.pbDefaultChooseNewEnemy(index,party)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_enemy\n\t\t@has_enemy = rand(1..2)==1 ? true : false\n\t\t#need an enemy value for the room.\n\tend",
"def decide_random_target_for_enemy\n # Diverge with effect scope\n if for_one_friend_hp0?\n battler = $game_troop.random_target_enemy_hp0\n elsif for_one_friend?\n battler = $game_... | [
"0.631329",
"0.62326",
"0.6203829",
"0.61049694",
"0.6066705",
"0.6064357",
"0.6054861",
"0.6008414",
"0.59298176",
"0.59121853",
"0.587064",
"0.5812323",
"0.58044153",
"0.5751519",
"0.5737136",
"0.56836116",
"0.56794375",
"0.5678826",
"0.5630736",
"0.5626355",
"0.5612563",
... | 0.6499904 | 1 |
Called whenever a Jermon should forget a move. It should return 1 if the selection is canceled, or 0 to 3 to indicate the move to forget. The function should not allow HM moves to be forgotten. | def pbForgetMove(pkmn,move)
return 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forget; opt('forget'); end",
"def on_cancel_select\n @tb_item = nil\n $game_temp.tb_item = nil\n move_pos_off\n end",
"def cancel_move\n @cursor.active = true\n @active_battler.moveto(@pre_x, @pre_y)\n clear_tr_sprites\n draw_ranges(@active_battler, 3)\n end",
"def invalid_move\r\n... | [
"0.57879215",
"0.566275",
"0.5591555",
"0.5588911",
"0.55296004",
"0.5469328",
"0.53636575",
"0.52266794",
"0.5172337",
"0.5166398",
"0.5137951",
"0.5134303",
"0.5125917",
"0.5118659",
"0.50996494",
"0.5071535",
"0.5064788",
"0.50478065",
"0.50478065",
"0.50226885",
"0.500731... | 0.64863765 | 0 |
This method is called whenever a Jermon's HP changes. Used to animate the HP bar. | def pbHPChanged(pkmn,oldhp,anim=false)
hpchange=pkmn.hp-oldhp
if hpchange<0
hpchange=-hpchange
PBDebug.log("[HP change] #{pkmn.pbThis} lost #{hpchange} HP (#{oldhp}=>#{pkmn.hp})")
else
PBDebug.log("[HP change] #{pkmn.pbThis} gained #{hpchange} HP (#{oldhp}=>#{pkmn.hp})")
end
pbRefr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateHpBar\n return if self.disposed?\n # updates the current state of the HP bar\n zone = 0\n zone = 1 if self.hp <= @battler.totalhp*0.50\n zone = 2 if self.hp <= @battler.totalhp*0.25\n @sprites[\"hp\"].bitmap.blt(0,0,@colors,Rect.new(zone*2,0,2,6))\n hpbar = @battler.totalhp == 0 ? 0 ... | [
"0.7451632",
"0.71363384",
"0.7036642",
"0.6507871",
"0.64641094",
"0.6461523",
"0.6422987",
"0.640128",
"0.6352915",
"0.6280601",
"0.62458855",
"0.6214552",
"0.6180159",
"0.6155903",
"0.61228824",
"0.61021924",
"0.60515594",
"0.6014462",
"0.6000976",
"0.5945118",
"0.5915446"... | 0.74582785 | 1 |
Validates if transaction timestamp is within accepted range | def ensure_on_time!
time_diff_sec = timestamp.to_i - Time.now.to_i
unless DEADLINE_RANGE.cover?(time_diff_sec)
if time_diff_sec < 0
fail(TransactionTimestampTooOld, REPORT_DEADLINE_PAST)
else
fail(TransactionTimestampTooNew, REPORT_DEADLINE_FUTURE)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_timestamp?(timestamp)\n (timestamp.is_a?(Integer) ||\n (timestamp.is_a?(String) && timestamp.match(/^\\d+$/))) &&\n timestamp.to_i > 946_684_800 &&\n timestamp.to_i < (Time.now.to_i + 31_557_600)\n end",
"def validate_temporal_sanity\n errors.add(:end_time, \"Must be a... | [
"0.68207663",
"0.6815875",
"0.6686589",
"0.66179365",
"0.65075797",
"0.64924043",
"0.6420309",
"0.6411608",
"0.6351542",
"0.6319642",
"0.6289271",
"0.6269607",
"0.62605685",
"0.62531954",
"0.6245454",
"0.62450653",
"0.62397957",
"0.62255913",
"0.6200175",
"0.61246467",
"0.612... | 0.7087083 | 0 |
Returns current user's solved problems to ajax calls | def retrieve_solved
render json: @@problems_solved_shared
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def problems(current_user=nil)\n user = current_user || self.corresponding_author\n\n list = []\n \n page_valid?(:general) or list << 'Complete the General Info page.'\n page_valid?(:coauthors) or list << 'Complete the Co-Authors page.'\n page_valid?(:reviewers) or list << 'Complete the Revi... | [
"0.6394135",
"0.6334796",
"0.624148",
"0.61160034",
"0.60229933",
"0.59368193",
"0.5922571",
"0.58792645",
"0.5748931",
"0.5715017",
"0.56583536",
"0.5641379",
"0.5634243",
"0.5615702",
"0.5592304",
"0.5580205",
"0.55668443",
"0.5544846",
"0.55330545",
"0.55237293",
"0.551948... | 0.6848017 | 0 |
Returns current user's attempted contests to ajax calls | def retrieve_attempted
render json: @@contests_attempted_shared
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attempts\n @course_ids = current_user_or_anonymous_user.challenge_responses.select(:course_id).group(:course_id).map(&:course_id).compact\n\n render json: @course_ids\n end",
"def show\n if params[:user_id]\n @user = User.find(params[:user_id])\n else\n @user = current_user\n end\n \n i... | [
"0.6291132",
"0.6177421",
"0.6133038",
"0.611806",
"0.6004914",
"0.5965474",
"0.58087873",
"0.579054",
"0.57067984",
"0.57008404",
"0.5604116",
"0.5594083",
"0.5585936",
"0.55738604",
"0.5492758",
"0.5464409",
"0.5439469",
"0.5435239",
"0.54073787",
"0.5388855",
"0.5381843",
... | 0.7343186 | 0 |
Passes path to cancel.png to javascript functions | def retrieve_cancel_icon_path
path = ActionController::Base.helpers.asset_path("cancel.png")
render html: path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_cancel_js_popup(title)\n click_button_popup(title, \"Cancel\")\nend",
"def click_cancel_file_dialog_popup(title)\n click_button_popup(title, \"Cancel\")\nend",
"def cancel_button_clicked\n\t\t\t@path = nil\n\t\t\tclose_and_cleanup\n\t\tend",
"def cancel\n end",
"def cancel\n end",
"def canc... | [
"0.64250207",
"0.63514125",
"0.63348794",
"0.6236371",
"0.6236371",
"0.6094517",
"0.6072594",
"0.6072594",
"0.60469395",
"0.6044143",
"0.6007935",
"0.59767455",
"0.5971033",
"0.58287823",
"0.58147246",
"0.5746859",
"0.5723807",
"0.5709023",
"0.5706031",
"0.5638366",
"0.563720... | 0.70449746 | 0 |
first you create an empty array to fill with the passed sentence string, and then an empty array (reversed_words) to then fill with enumerated (all elements worked upon) 'array_of_split_string'. Then, you have split the passed sentence into a an array with .split turning each word into an element. Next, you have used t... | def reverse_each_word(sentence)
array_of_split_string = []
reversed_words = []
array_of_split_string = sentence.split
array_of_split_string.collect {|words| reversed_words << words.reverse!}
reversed_words.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_each_word(sentence)\n sentence_array = []\n split_sentence = sentence.split\n \n split_sentence.collect do |element|\n reverse = element.reverse\n sentence_array << reverse\n \n end\nreverse_sentence = sentence_array.join(\" \")\nreverse_sentence\nend",
"def reverse_each_word(sentence)\... | [
"0.86690456",
"0.85153425",
"0.84844416",
"0.84624344",
"0.8453023",
"0.8446418",
"0.84210265",
"0.84138066",
"0.841347",
"0.840664",
"0.84008884",
"0.83954257",
"0.83753467",
"0.8373354",
"0.8370907",
"0.83497745",
"0.83483076",
"0.83436984",
"0.83393085",
"0.83385575",
"0.8... | 0.8758897 | 0 |
This is where a setup block is actually evaluated and the +topic+ tracked. | def setup(&block)
@_topic = self.instance_eval(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n topics.map do |t|\n topic_name = t[:name] || t['name']\n sub_opts = t.reject { |k, _| k.to_sym == :name }\n PubSubClient.upsert_subscription(topic_name, subscription_name(topic_name), sub_opts)\n end\n end",
"def auto_initialize!\n client\n ... | [
"0.69566804",
"0.64509773",
"0.63741326",
"0.6354821",
"0.6354821",
"0.6354821",
"0.6354821",
"0.6354821",
"0.63289154",
"0.63289154",
"0.6317236",
"0.6212696",
"0.6186785",
"0.61569536",
"0.6155349",
"0.6149959",
"0.6129792",
"0.61284137",
"0.60917705",
"0.6090444",
"0.60880... | 0.8348093 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.