query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
build source path to the block | def source_path
sp = []
Tml.session.block_options_queue.each do |opts|
next unless hash_value(opts, :source)
sp << hash_value(opts, :source)
end
sp = sp.reverse
sp.unshift(Tml.session.current_source)
sp.join(Tml.config.source_separator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_path; end",
"def source_location\n [@block.file.to_s, @block.line]\n end",
"def source_path\n source[:path]\n end",
"def source_path\n Pathname.new(config[:source_path])\n end",
"def source_path\n Pathname.new(self.config[:source_path])\n end",
"def source_location;... | [
"0.7229168",
"0.70297205",
"0.68027806",
"0.6757386",
"0.6650656",
"0.65648556",
"0.6534453",
"0.64195764",
"0.63538504",
"0.6319287",
"0.63155353",
"0.63035005",
"0.6289511",
"0.62771094",
"0.6271495",
"0.62394863",
"0.62192357",
"0.6201563",
"0.61980504",
"0.6197895",
"0.61... | 0.6919628 | 2 |
name used in responses | def name
base = config[:name]
@formatted ? "#{base} (#{@formatted})" : base
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name; self.respondent_name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name... | [
"0.73245",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
"0.69498724",
... | 0.0 | -1 |
return the number of hosts with data in the given set of results | def hosts_with_data(resultset)
resultset.count { |_host, values| !values['data'].empty? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end",
"def hosts_count\r\n return @hosts.length\r\n end",
"def number_of_results(results)\n printf(\"\\n%<results>d results found.\\n\\n\", results: results.length)\n end",
"def count\n\t\tputs \"Counting number of entrie... | [
"0.6818821",
"0.6660779",
"0.665279",
"0.6531802",
"0.6526675",
"0.651243",
"0.6426067",
"0.6374182",
"0.6292269",
"0.62783587",
"0.6274059",
"0.61943907",
"0.6139796",
"0.60989094",
"0.60948235",
"0.608476",
"0.6083916",
"0.6080407",
"0.6034406",
"0.60202575",
"0.6015177",
... | 0.7927199 | 0 |
type:: :warning or :critical Return alert if required | def check(type, results)
# #YELLOW
num_hosts = hosts_with_data(results)
return unless config[type] && threshold_crossed?(type, num_hosts)
msg = hosts_threshold_message(config[:target], num_hosts, type)
send(type, msg)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def alert_warning(statement, question = nil)\n ui.alert_warning statement, question\n end",
"def alert!\n self.severity = :ALERT\n end",
"def alert?\n severity == :ALERT\n end",
"def alert; end",
"def a... | [
"0.6930633",
"0.6930633",
"0.6930633",
"0.6917166",
"0.67601705",
"0.6725182",
"0.6627311",
"0.6627311",
"0.65044",
"0.6502074",
"0.6405409",
"0.63893163",
"0.6324633",
"0.6309835",
"0.628101",
"0.62143654",
"0.6211948",
"0.6146463",
"0.6114743",
"0.6104937",
"0.6104937",
"... | 0.0 | -1 |
Check if value is below defined threshold | def below?(type, val)
config[:below] && val < config[type]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def below_threshold?\n coverage < threshold\n end",
"def threshold\n @threshold || 95\n end",
"def health_below_threshold?\n (plugins[Character].current_health.to_f / plugins[Character].total_health.to_f) * 100 < @health_threshold_percentage\n end",
"def exceeded?\n count >= thresh... | [
"0.7738828",
"0.7427956",
"0.7111183",
"0.70002",
"0.69792426",
"0.6957932",
"0.69438136",
"0.68931544",
"0.68841237",
"0.6847475",
"0.6838761",
"0.6758051",
"0.66271496",
"0.65865153",
"0.6581845",
"0.6578861",
"0.64967984",
"0.6485348",
"0.6479387",
"0.64440405",
"0.6440582... | 0.62638193 | 33 |
Check is value is above defined threshold | def above?(type, val)
!config[:below] && (val > config[type])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def below_threshold?\n coverage < threshold\n end",
"def threshold\n @threshold || 95\n end",
"def threshold(x)\n\t\tx > 0 ? 1.0 : 0.0\n\tend",
"def test_execute_threshold(value = 1)\n if value == @threshold\n then return true\n end\n return false\n end",
... | [
"0.75974053",
"0.7409622",
"0.70143086",
"0.69849795",
"0.6887331",
"0.688083",
"0.6879305",
"0.6841979",
"0.68315",
"0.6782716",
"0.6661299",
"0.66530097",
"0.6644699",
"0.65552247",
"0.6544957",
"0.6537799",
"0.6537786",
"0.6531908",
"0.65223026",
"0.6482919",
"0.6481006",
... | 0.6152373 | 40 |
Converts the instance to string format. | def to_s
"<Edurange::Instance name:#{@name} ami_id: #{@ami_id} ip: #{@ip_address} key: #{@key_pair} running: #{@running} instance_id: #{@instance_id}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n Formatter::ToString.format(self)\n end",
"def to_s\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n self\n end",
"def to_s\n @object.to_s\n end",
"def to_s\n @to_s ||= format(to_h)\n end",
"def to_s\n self.inspect\n en... | [
"0.8115662",
"0.8046935",
"0.8031831",
"0.78588694",
"0.7851559",
"0.78440315",
"0.7777644",
"0.7757611",
"0.77421325",
"0.773726",
"0.7711313",
"0.76868826",
"0.7677893",
"0.7677893",
"0.76714593",
"0.7661583",
"0.76420045",
"0.7629126",
"0.7612691",
"0.7612691",
"0.7612691"... | 0.0 | -1 |
1. Commit 2 Pseudocode input: Intger 5 299 1818 99999999 output: String "5" "299" "1,818" "9,999,999" Steps 1 Start at the end of the number 2 Count three numbers over. If the number is greater than four digits over, add a comma between the third and fourth digit from the right. 3 Repeat the process until you get to a ... | def add_commas(number)
original = number.to_s
length = original.length
result = ""
index = 0
while index < length
result = "," + result if index % 3 == 0 && index != 0
index += 1
result = original[ length - index ] + result
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_comma (number)\n a = number.to_s.chars.to_a.reverse\n b = a.count/3\n if a.count < 4\n return number.to_s\n elsif a.count == 6\n a.insert(3, \",\")\n return a.join.reverse\n elsif\n c = 3\n b.times do |n|\n a.insert(c, \",\")\n c = c +4\n end\n return a.join.reverse... | [
"0.8105282",
"0.80488884",
"0.7868916",
"0.7818026",
"0.77832484",
"0.7753528",
"0.7745677",
"0.7655598",
"0.7650021",
"0.76281035",
"0.762677",
"0.7604074",
"0.76002544",
"0.7560199",
"0.754123",
"0.7488914",
"0.7479544",
"0.74788165",
"0.74783045",
"0.7465402",
"0.7449258",... | 0.6797114 | 86 |
NOTE: We aren't leveraging Capybara because it loads all of our other test helpers and such, which in turn Configures coverband making it impossible to test the configuration error | def setup_server
ENV["RAILS_ENV"] = "test"
require "rails"
fork do
exec "cd test/rails#{Rails::VERSION::MAJOR}_dummy && COVERBAND_TEST=test bundle exec rackup config.ru -p 9999 --pid /tmp/testrack.pid"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_saucelabs\n end",
"def common_configuration_for_sauce_web(args)\n\n # Assign the applications path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :sauce_web do |app|\n Capybara::Selenium::Driver.new(\n ... | [
"0.66453266",
"0.66038704",
"0.6434681",
"0.63073003",
"0.5933964",
"0.59139234",
"0.57928324",
"0.5779604",
"0.576268",
"0.5753099",
"0.5753099",
"0.5753099",
"0.5753099",
"0.5753099",
"0.5753099",
"0.5753099",
"0.5697434",
"0.56829387",
"0.56485593",
"0.5527981",
"0.5518760... | 0.0 | -1 |
If you have extra params to permit, append them to the sanitizer. | def configure_sign_in_params
devise_parameter_sanitizer.permit(:sign_in, keys: [:email, :password])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6... | 0.0 | -1 |
puts "mooooo..."number_of_moos 'yellow submarine' end def double_this num num_times_2 = num2 puts num.to_s+' doubled is '+num_times_2.to_s end double_this 44 x = say_moo 3 puts x.capitalize + ', dude...' puts x | def ask question
while true
puts question
reply = gets.chomp.downcase
if (reply == 'yes' || reply || 'no')
if reply == 'yes'
return true
else
return false
end
break
else
puts 'Please answer "yes" or "no".'
end
end
answer #this is what is returned
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def double_this num\n num_times_2 = num*2\n puts num.to_s+ ' doubled is '+num_times_2.to_s\nend",
"def double_this num\n\tnum_times_2 = num * 2\n\tputs num.to_s + ' doubled is ' + num_times_2.to_s\nend",
"def double_this num\r\n\tnum_times_2 = num * 2\r\n\tputs num.to_s + \" doubled is \" + num_times_2.to_s\... | [
"0.794889",
"0.7877816",
"0.7810772",
"0.78102505",
"0.7757404",
"0.7695507",
"0.74146426",
"0.7257787",
"0.72435147",
"0.7182029",
"0.71698356",
"0.7153814",
"0.71123326",
"0.71073174",
"0.7103585",
"0.70601964",
"0.7006132",
"0.6997462",
"0.6995913",
"0.6988121",
"0.6987653... | 0.0 | -1 |
The Sufia::UsersControllerBehavior method was anemic. Copied from Called when CanCan::AccessDenied is caught | def deny_access(exception)
# For the JSON message, we don't want to display the default CanCan messages,
# just custom Hydra messages such as "This item is under embargo.", etc.
json_message = exception.message if exception.is_a? Hydra::AccessDenied
if current_user && current_user.persisted?
respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_denied\n\n end",
"def access_denied\n end",
"def access_denied\n redirect_to controller: :users, action: :login\n end",
"def user_not_authorized(exception)\n case exception.query\n when 'approve?',\n 'can_add_attachment?',\n /^add_response_to_flagged_case/,\n 'u... | [
"0.68761533",
"0.6876142",
"0.6344986",
"0.63358104",
"0.6080667",
"0.607135",
"0.6067495",
"0.60171527",
"0.6015151",
"0.60105556",
"0.5982993",
"0.5980694",
"0.59636164",
"0.59407526",
"0.5920635",
"0.5919611",
"0.5908646",
"0.58849585",
"0.5878449",
"0.5859964",
"0.5840128... | 0.5863375 | 19 |
the index action is called automatically when no other action is specified | def index(paste_id = nil)
if paste_id and paste_id.to_s.match(/\d+/)
redirect(R(:view, paste_id))
end
@title = "Recent Pastes"
paste_entry_data = PasteEntry.order(:id.desc).filter("paste_body is not null and private is false and created_at > now()-'30 days'::text::interval")
@paste_entries = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\r\n end",
"def index\r\n end",
"def index\r\n end",
"def index\r\n end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
... | [
"0.8098796",
"0.8088572",
"0.8088572",
"0.8088572",
"0.8062029",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"0.8061396",
"... | 0.0 | -1 |
the string returned at the end of the function is used as the html body if there is no template for the action. if there is a template, the string is silently ignored | def notemplate
"there is no 'notemplate.xhtml' associated with this action"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template \n puts \"What will we return here?\"\nend",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template_text\n self.to_html ? self.body_html : self.body\n end",
"def getText\n... | [
"0.7177157",
"0.705872",
"0.705872",
"0.705872",
"0.705872",
"0.705872",
"0.705872",
"0.705872",
"0.6908892",
"0.68556553",
"0.6850684",
"0.6828222",
"0.669902",
"0.6689651",
"0.6588814",
"0.65661997",
"0.65554065",
"0.65531707",
"0.65151757",
"0.64963317",
"0.64811486",
"0... | 0.6506059 | 24 |
GET /api/ratings/:id Get a specific rating | def show
rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first
render json: rating
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n re... | [
"0.7776716",
"0.76358616",
"0.76358616",
"0.76358616",
"0.75636536",
"0.75022197",
"0.7483233",
"0.7449961",
"0.7449961",
"0.7449961",
"0.74045944",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165",
"0.7361165... | 0.7831392 | 0 |
rating /api/ratings Add a new rating | def create
rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])
if rating.save
render json: rating
else
render json: { error: "Rating creating error" }, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { r... | [
"0.790934",
"0.7838245",
"0.7838245",
"0.7742525",
"0.75701",
"0.7485486",
"0.7485486",
"0.7485486",
"0.746192",
"0.7459808",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.74554425",
"0.7447667... | 0.78171647 | 3 |
PATCH /api/ratings/:id Update a specific rating | def update
rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first
if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])
render json: rating
else
render json: { error: rating.errors }, status: :unpr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\"... | [
"0.81622773",
"0.8145361",
"0.79606605",
"0.7873815",
"0.7745205",
"0.7721162",
"0.74717146",
"0.74486",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7363444",
"0.7354384",
"0.7350564",
"0.7350564",
... | 0.783707 | 4 |
searcher_class allows spree extension writers to provide their own Search class | def searcher_travel_class
@searcher_travel_class ||= Spree::Core::Search::SpreeTravelBase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_provider\n return @search_provider unless @search_provider.nil?\n return nil unless @search_provider_class.is_a?(Class)\n\n @search_provider = @search_provider_class.new(index_name, self, custom_mapping, scopes)\n end",
"def chef_query_class\n @chef_query_class ||= ::Chef::Sea... | [
"0.68732744",
"0.6622242",
"0.6576343",
"0.65575665",
"0.64445996",
"0.64368004",
"0.633507",
"0.63296187",
"0.6319426",
"0.6130889",
"0.610271",
"0.6084452",
"0.6061483",
"0.6041214",
"0.5897044",
"0.5878436",
"0.58601457",
"0.5857578",
"0.5839915",
"0.5829295",
"0.58217365"... | 0.744503 | 0 |
The prerelease version, if any | def pre
@pre ||= _to_a[3]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prerelease?\n unless instance_variable_defined? :@prerelease\n @prerelease = !!(@version =~ /[a-zA-Z]/)\n end\n @prerelease\n end",
"def prerelease?\n @prerelease ||= @version =~ /[a-zA-Z]/\n end",
"def prerelease?\n @prerelease || requirement.prerelease?\n end",
"def prereleas... | [
"0.7862836",
"0.7703366",
"0.73232275",
"0.72026944",
"0.71647155",
"0.71244067",
"0.7108804",
"0.70989865",
"0.7091358",
"0.7073256",
"0.70519423",
"0.6967226",
"0.69490206",
"0.69236887",
"0.6922175",
"0.6896592",
"0.6881659",
"0.6854046",
"0.68360627",
"0.68228453",
"0.681... | 0.0 | -1 |
The version number as a hash | def to_h
@to_h ||= {
major: major,
minor: minor,
patch: patch,
pre: pre
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_guid\n \"#{digest_type}:#{checksum}\"\n end",
"def hash\n name.hash ^ version.hash\n end",
"def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end",
"def version_id\n \"#{size}+#{timestamp}-#{md5}\"\n end",
"def version_hex\n @version_he... | [
"0.7739018",
"0.77285063",
"0.73343813",
"0.731303",
"0.7172094",
"0.7125328",
"0.68157643",
"0.67685634",
"0.66726446",
"0.6628384",
"0.6628384",
"0.66030467",
"0.6584606",
"0.65817565",
"0.655414",
"0.6546133",
"0.65307105",
"0.6494262",
"0.6472294",
"0.6447075",
"0.6441124... | 0.0 | -1 |
The version number as an array of cast values | def to_a
@to_a ||= [major, minor, patch, pre]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_array(version)\n array = version.split(\".\").map {|n| (n =~ /^\\d+$/) ? n.to_i : n }\n if array.last =~ /(\\d+)([\\-\\+])/\n array[array.length-1] = $1.to_i\n array << $2\n end\n array\n end",
"def to_array(version)\n array = version.split(\".\").map {|n| (n =~ /... | [
"0.76227087",
"0.76227087",
"0.75668967",
"0.70162535",
"0.6968763",
"0.687807",
"0.687807",
"0.6810403",
"0.6681561",
"0.6460556",
"0.63290286",
"0.6323845",
"0.6323508",
"0.6323508",
"0.6323508",
"0.6323508",
"0.6323508",
"0.61841995",
"0.6183344",
"0.6178107",
"0.6128775",... | 0.64095074 | 10 |
The version number as an array of strings | def _to_a
@_to_a = self::VERSION.split('.')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_array(version)\n array = version.split(\".\").map {|n| (n =~ /^\\d+$/) ? n.to_i : n }\n if array.last =~ /(\\d+)([\\-\\+])/\n array[array.length-1] = $1.to_i\n array << $2\n end\n array\n end",
"def to_array(version)\n array = version.split(\".\").map {|n| (n =~ /... | [
"0.7634456",
"0.7634456",
"0.7271181",
"0.707183",
"0.6929575",
"0.68120956",
"0.6802117",
"0.6741433",
"0.67120963",
"0.6630647",
"0.65989614",
"0.6580644",
"0.6514314",
"0.6490865",
"0.64705753",
"0.6458599",
"0.6457951",
"0.6457951",
"0.6457951",
"0.6457951",
"0.6457951",
... | 0.6756883 | 7 |
Ensure valid credentials, either by restoring from the saved credentials files or intitiating an OAuth2 authorization. If authorization is required, the user's default browser will be launched to approve the request. | def authorize
FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))
client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)
token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)
authorizer = Google::Auth::UserAuthorizer.new(
client_id, SCOPE, token_store)
user_id = 'default... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\r\n user_id = \"default\"\r\n credentials = authorizer.get_credentials use... | [
"0.69307053",
"0.6720696",
"0.66575015",
"0.66501135",
"0.6554498",
"0.652322",
"0.64968324",
"0.649195",
"0.64703053",
"0.6462134",
"0.64549613",
"0.6452876",
"0.6451398",
"0.6449366",
"0.6446952",
"0.64389044",
"0.64363813",
"0.6407274",
"0.63987625",
"0.639332",
"0.6392128... | 0.6377941 | 28 |
initialsze Add plant to plants array | def add_plant(plant)
@plants_planted << plant
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n\t\t@planets = [gallifrey, xander] # initialize hard coded planets\n\t\t#@planets.push(@new_planet) # adds new planets via user input to planets array\n\t\t@number_planets = @planets.length #counts planets by counting array elements\n\t\t@formation_year = rand(-3000000..2015)\n\t\t@age_of_system = ... | [
"0.6078504",
"0.6068726",
"0.60684437",
"0.6063847",
"0.6043799",
"0.5975897",
"0.59607905",
"0.5944912",
"0.5908341",
"0.5874166",
"0.5873401",
"0.58342594",
"0.5829043",
"0.5829043",
"0.5829043",
"0.5829043",
"0.5829043",
"0.58067626",
"0.5783044",
"0.5783044",
"0.57685405"... | 0.6930356 | 0 |
html_data is from google maps page, content starting with inspect sectionpopulartimescontainer, edit as html and copy contents | def update_population_data(html_data)
# Remove old population spec and create new one
create_population_spec
week_days = %w(Monday Tuesday Wednesday Thursday Friday Saturday Sunday)
# parse html
doc = Nokogiri::XML(html_data)
# get first level divs under section-popular-times-c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_data\n @html_data ||= {}\n end",
"def html\n self[\"html\"][0].get_outer_html\n end",
"def copy_html\n str = EventPrinter::HTML::head(@event.printed_name)\n str << (@list.map { |e| e.html }).join\n str << EventPrinter::HTML::foot\n Win32API.push_text_in_clip... | [
"0.5736921",
"0.5661102",
"0.5629109",
"0.5587126",
"0.54373384",
"0.54242295",
"0.53918976",
"0.5371989",
"0.53403866",
"0.53347886",
"0.5326683",
"0.5309606",
"0.52763224",
"0.5246683",
"0.5232946",
"0.5227009",
"0.5182442",
"0.5181953",
"0.5177269",
"0.5170452",
"0.5165089... | 0.5502016 | 4 |
You can pass +display+, +scope+, or +auth_type+ params to the auth request, if you need to set them dynamically. You can also set these options in the OmniAuth config :authorize_params option. | def authorize_params
super.tap do |params|
%w[auth_type display revoke scope state].each do |v|
next unless request.params[v]
params[v.to_sym] = request.params[v]
session["omniauth.state"] = params[:state] if v == "state"
# to support omniauth-oauth2’s ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n\n params[:scope] ||= DEFAULT_SCOPE\n params[:approval_prompt] ||... | [
"0.7211659",
"0.70762247",
"0.68107367",
"0.6398272",
"0.63739735",
"0.62441075",
"0.6208493",
"0.6203307",
"0.61674255",
"0.6103136",
"0.60653716",
"0.6019021",
"0.59466916",
"0.59417653",
"0.5908031",
"0.5906556",
"0.5894904",
"0.5801678",
"0.5796321",
"0.57287747",
"0.5711... | 0.6677007 | 3 |
we need this helper as some Pry::Method objects can wrap Procs | def real_method_object?(code_object)
code_object.is_a?(::Method) || code_object.is_a?(::UnboundMethod)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method(p0) end",
"def instance_method(p0) end",
"def to_proc() end",
"def to_proc() end",
"def to_proc() self ; end",
"def to_proc()\n #This is a stub, used for indexing\n end",
"def to_proc\n method(:call).to_proc\n end",
"def customer_meth(*args, **kargs)\n binding.pr... | [
"0.653143",
"0.6493762",
"0.6312241",
"0.6312241",
"0.6158758",
"0.6048775",
"0.6040444",
"0.60281944",
"0.600068",
"0.5939959",
"0.5937686",
"0.5830758",
"0.5798044",
"0.57859963",
"0.5746559",
"0.57050085",
"0.5677316",
"0.5672069",
"0.5656569",
"0.5643456",
"0.5640083",
... | 0.0 | -1 |
Generate a header (metadata information) for all the code object types: methods, modules, commands, procs... | def header(code_object)
file_name, line_num = code_object.source_file, code_object.source_line
h = "\n#{Pry::Helpers::Text.bold('From:')} #{file_name} "
if real_method_object?(code_object) && code_object.source_type == :c
h << "(C Method):"
else
h << "@ line #{line_num}:"
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hpp rs ## the header is always generated above the impl\n \"#{rs.indentation}#{type.to_cpp(rs) % ''};\"\n end",
"def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end",
"def generate_header_info\n magic = FileMagic.new\n ... | [
"0.6457557",
"0.6154482",
"0.61383456",
"0.6136998",
"0.5972007",
"0.5941158",
"0.59073144",
"0.589171",
"0.58915377",
"0.58677137",
"0.5857848",
"0.5740497",
"0.5740497",
"0.5740497",
"0.5740497",
"0.5740497",
"0.5740497",
"0.5740497",
"0.5717843",
"0.57159597",
"0.56871575"... | 0.66394496 | 0 |
SYSTEM WIDE Determines if Windows platform or not. This will match all windows systems known to me (author). If you find otherwise let me know please. There is one pitful if you are running on jruby it returns "java", as supposedly it it is platform independent. So if you are checking for os and running jruby it will r... | def ruby_platform
case RUBY_PLATFORM
when /win32|mswin|mingw/
# Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller
# Can't match for just 'win' cause it will match darwin as well.
'windows'
when /linux/
# Works on Debian Sarge,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def windows?\n @windows ||= is? /mswin|^win|mingw/\n end",
"def windows?\n RbConfig::CONFIG['host_o... | [
"0.77321666",
"0.76363754",
"0.74978673",
"0.74716693",
"0.74590725",
"0.74569565",
"0.7427375",
"0.7395715",
"0.7395536",
"0.739172",
"0.73820287",
"0.73627776",
"0.73480564",
"0.7328994",
"0.7328994",
"0.7327407",
"0.729404",
"0.72702324",
"0.72699004",
"0.72484297",
"0.724... | 0.66286427 | 63 |
These are just aliases for convinience, I really doubt somebody would use them System Wide on an object for any other purpose. | def windows?
ruby_platform?(:windows)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objects_and_symbols; end",
"def alias_of; end",
"def implausible_common_name; end",
"def aliases; end",
"def aliases; end",
"def aliases; end",
"def alias_names; end",
"def object_name; end",
"def object_name; end",
"def object_name; end",
"def aliased_name; end",
"def plausible_common_na... | [
"0.6642402",
"0.65662974",
"0.64538854",
"0.63783354",
"0.63783354",
"0.63783354",
"0.6351638",
"0.63325185",
"0.63325185",
"0.63325185",
"0.62124103",
"0.6144394",
"0.6141736",
"0.6093737",
"0.59597325",
"0.594053",
"0.58974284",
"0.58750755",
"0.58504647",
"0.5790042",
"0.5... | 0.0 | -1 |
I test and deploy some of the project on jruby this makes it easier to customize my gemfiles. Works for ruby 1.8.7 & 1.9.3 & 1.9.2 on windows( 7 & xp) & linux ( debian Lenny) using rubyinstaller for windows and using mri ruby buillt from source for linux Works for jruby 1.7.0.rc1 and jruby 1.6.3 on windows (7 & xp) At ... | def ruby_implementation
case RUBY_ENGINE
when /java/
'jruby'
when /ruby/
# I'm actually not sure what rubinius or maglev or other implementions would return. I don't use rubies, other than mri or jruby.
'mri'
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on D... | [
"0.7681768",
"0.750649",
"0.7137061",
"0.6937114",
"0.69039565",
"0.68261683",
"0.6752509",
"0.6727103",
"0.6692257",
"0.6656062",
"0.6647527",
"0.6581085",
"0.64481366",
"0.6435035",
"0.64296",
"0.64258295",
"0.6423871",
"0.64076585",
"0.63588756",
"0.63454276",
"0.6321966",... | 0.73573685 | 2 |
In case ruby ever reaches version 19 :) or some 2.19 :) only matching 1.9 at the begining of the line Returns an integer for easy version comparison 200 > 187 ( Version two is newer :) ) if ruby_version > 187 , install new version of the gem. | def ruby_version
RUBY_VERSION.gsub(/[^0-9]/,'').to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruby_version; '2.6.3' end",
"def ruby_version?(cmp, v)\n rv = Gem::Version.create(RUBY_VERSION.dup)\n v = Gem::Version.create(v)\n if cmp.to_sym==:'~>'\n rv = rv.release\n rv >= v && rv < v.bump\n else\n rv.send(cmp, v)\n end\n end",
"def ruby_version\n\t\treturn RUBY_VERSIO... | [
"0.69327414",
"0.6774868",
"0.6739398",
"0.6652264",
"0.6642535",
"0.66419524",
"0.66419524",
"0.66419524",
"0.66419524",
"0.66419524",
"0.66419524",
"0.6604171",
"0.6560447",
"0.6515484",
"0.6492208",
"0.64583427",
"0.6452519",
"0.64296716",
"0.6376046",
"0.6371779",
"0.6369... | 0.6634061 | 11 |
Humanize. to_s returns "true" | def to_human
"yes"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize(normalized)\n\t\t\t\tnormalized.to_s\n\t\t\tend",
"def compute_human_value\n case @value\n when :false\n 'No'\n when :true\n 'Yes'\n when :nil\n \"N/\\A\"\n else\n @value.to_s\n end\n end",
"def human_format?\n @format == :human... | [
"0.74681735",
"0.69688153",
"0.69660187",
"0.69291514",
"0.69007194",
"0.6814812",
"0.67073137",
"0.66572225",
"0.66572225",
"0.66572225",
"0.66572225",
"0.66572225",
"0.66572225",
"0.6637738",
"0.6510483",
"0.64548993",
"0.6439789",
"0.6339031",
"0.62920064",
"0.62743706",
"... | 0.75724626 | 0 |
Really?! Do I need to spell it out to you? | def to_teenager
"Yeah, yeah. Here you go. Did you get what you came for? Now disappear."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buzzword; end",
"def buzzword; end",
"def as_you_like_it_quote; end",
"def silly_adjective; end",
"def two_word_name; end",
"def most_interesting_man_in_the_world; end",
"def who_we_are\r\n end",
"def jack_handey; end",
"def anchored; end",
"def real_name; end",
"def three_word_name; end",... | [
"0.7031144",
"0.7031144",
"0.68552977",
"0.6845447",
"0.67843735",
"0.6749565",
"0.6747736",
"0.6739231",
"0.6733067",
"0.6541809",
"0.65166485",
"0.6457494",
"0.6430954",
"0.63954794",
"0.6376233",
"0.6366004",
"0.63657546",
"0.62627137",
"0.62605244",
"0.6234343",
"0.621739... | 0.0 | -1 |
Humanize. to_s returns "false". | def to_human
"no"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize(normalized)\n\t\t\t\tnormalized.to_s\n\t\t\tend",
"def to_human\n \"yes\"\n end",
"def human_format?\n @format == :human\n end",
"def to_human\n \"\"\n end",
"def humanize(lang = :en)\n to_s\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)... | [
"0.74649066",
"0.7254781",
"0.696381",
"0.6924105",
"0.68799824",
"0.68313783",
"0.68019575",
"0.6512134",
"0.6488025",
"0.6391143",
"0.6358165",
"0.6351193",
"0.6351193",
"0.6351193",
"0.6351193",
"0.6351193",
"0.6351193",
"0.6318804",
"0.6169911",
"0.6120102",
"0.6116245",
... | 0.690533 | 4 |
Humanize. to_s returns "" as well, this is really to be consistent with other classes. | def to_human
""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize(normalized)\n\t\t\t\tnormalized.to_s\n\t\t\tend",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def humanize(lang = :en)\n to_s\n end",
"def to_s\n human_name\n end",
"def to_s\n normalized\n end",
"def to_s\n self.name.humanize\n end",
... | [
"0.8068083",
"0.7834731",
"0.7745445",
"0.7566789",
"0.730312",
"0.72970206",
"0.7234914",
"0.7227547",
"0.70971346",
"0.7048092",
"0.6989921",
"0.69110805",
"0.688408",
"0.6878413",
"0.68620884",
"0.6830861",
"0.6813997",
"0.67363954",
"0.66343623",
"0.66330886",
"0.6584699"... | 0.78784484 | 1 |
A very rude teenager nihilist. | def to_teenager
"Zip! Nada! Babkis! Nothing to see here! Get out of my room!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def donizetti; end",
"def terpene; end",
"def veichles\n ['Bil', 'Moped', 'Motorsykkel', 'Tungt kjøretøy', 'ATV', 'Buss', 'Sykkel']\n end",
"def getNiceList\n\t\ttickets = @tickets.read ['machinename', 'title', 'description']\n\n\t\toutput = \"Tickets:\"\n\t\ttickets.each do |row|\n\t\t\toutput += \"... | [
"0.5741659",
"0.56840956",
"0.566208",
"0.5551654",
"0.55475813",
"0.5546529",
"0.5546529",
"0.5546529",
"0.5546529",
"0.5546529",
"0.55296326",
"0.5518351",
"0.5504832",
"0.5475764",
"0.5436248",
"0.54222",
"0.5419564",
"0.54113126",
"0.54113126",
"0.54113126",
"0.53922397",... | 0.0 | -1 |
p "Enter name" nameGiven=gets.chomp greet(nameGiven) | def multiply(a,b)
p a*b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greet\n print 'Enter your name : '\n name = gets.to_s.chomp\n puts \"Hello #{name}\"\nend",
"def greeting (name)\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{@name}!\"\n end",
"def greeting\n\tputs \"Please enter your name:\"\n\tname = gets.chomp\n\tputs \"Hello\" + \" \"... | [
"0.89879286",
"0.8731043",
"0.8725933",
"0.8661732",
"0.85345167",
"0.8508339",
"0.84084004",
"0.840302",
"0.8351477",
"0.83473736",
"0.8286899",
"0.82281256",
"0.8213776",
"0.8197899",
"0.8183256",
"0.81399196",
"0.8113038",
"0.80442303",
"0.80102044",
"0.7988071",
"0.798407... | 0.0 | -1 |
p "Enter first number" firstNum = gets p "Enter second number" secondNum = gets multiply(firstNum.to_i,secondNum.to_i) | def scream(words)
words = words + "!!!!"
return puts words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply\n puts \"enter first number \"\n a = gets.to_f\n puts \"enter second numb4\ner\"\n b = gets.to_f\n result = a * b\n puts result\nend",
"def multiplication\n\tputs \"which numbers would you like to multiply\"\n\tmult_number_1 = gets.chomp\n\tmult_number_2 = gets.chomp\n\tputs mult_number_1.to_f... | [
"0.82961947",
"0.8221213",
"0.8039843",
"0.78148496",
"0.780672",
"0.7650274",
"0.7585327",
"0.75449914",
"0.75252044",
"0.75101596",
"0.7491886",
"0.74902165",
"0.7472264",
"0.74616605",
"0.7431391",
"0.7425178",
"0.73068535",
"0.7297825",
"0.72613424",
"0.7228168",
"0.72213... | 0.0 | -1 |
cid is always s(:const, scope_sexp_or_nil, :ConstName) | def name_and_base
base, name = cid.children
if base.nil?
[name, '$nesting[0]']
else
[name, expr(base)]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_const(exp)\n resultify(@model.lookup_constant(constify(exp, :const)))\n end",
"def constant_decls; end",
"def process_const(exp)\n name = exp.shift\n return name.to_s\n end",
"def parse_const(expr)\n if expr.first == :var_ref\n expr[1][1]\n elsif expr.first... | [
"0.61672723",
"0.60588",
"0.5998758",
"0.5946222",
"0.58838546",
"0.5803153",
"0.5774117",
"0.574706",
"0.57372576",
"0.5574376",
"0.5560437",
"0.55022913",
"0.5448782",
"0.53978395",
"0.5357277",
"0.5346011",
"0.53456664",
"0.53392345",
"0.5315181",
"0.52958226",
"0.5282307"... | 0.0 | -1 |
TODO: Move this to a better spot | def format_https(url)
url
.delete_prefix('http://')
.delete_prefix('https://')
.prepend('https://')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def formation; end",
"def terpene; end",
"def offences_by; end",
"def suivre; end",
"def refutal()\n end",
"def verdi; end",
"def identify; end",
"... | [
"0.7388396",
"0.66422266",
"0.64792675",
"0.64792675",
"0.64792675",
"0.64792675",
"0.6408579",
"0.61114526",
"0.60252035",
"0.59657484",
"0.59482235",
"0.5942298",
"0.5884608",
"0.5867294",
"0.58481747",
"0.58442384",
"0.5821346",
"0.57978696",
"0.57793355",
"0.5754906",
"0.... | 0.0 | -1 |
si algien lo entiende, que me explique: obtenido de: | def current_user=(user)
@current_user = user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suivre; end",
"def zuruecksetzen()\n end",
"def mi_carrera\n\n\tend",
"def comisiones_asignadas\n asunto.comisiones if asunto\n end",
"def schubert; end",
"def verdi; end",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t... | [
"0.67403114",
"0.60603637",
"0.60453165",
"0.5944456",
"0.5828001",
"0.5776098",
"0.5747304",
"0.56498194",
"0.5609945",
"0.5557737",
"0.55564237",
"0.5542412",
"0.5539769",
"0.55130535",
"0.5494632",
"0.5489691",
"0.5480548",
"0.54774624",
"0.54436696",
"0.5433373",
"0.54110... | 0.0 | -1 |
GET /dynamic_images/new GET /dynamic_images/new.xml | def new
@dynamic_image = DynamicImage.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @dynamic_image }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @img = Img.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @img }\n end\n end",
"def new\n @image_path = ImagePath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_path }\n ... | [
"0.7014308",
"0.69459367",
"0.6871843",
"0.6869033",
"0.6847963",
"0.68287337",
"0.67594916",
"0.66970485",
"0.66939205",
"0.6642637",
"0.66399294",
"0.66359186",
"0.6573449",
"0.65088636",
"0.648705",
"0.64850616",
"0.64850616",
"0.64776707",
"0.643781",
"0.64151186",
"0.639... | 0.7856552 | 0 |
POST /dynamic_images POST /dynamic_images.xml | def create
@dynamic_image = DynamicImage.new(params[:dynamic_image])
respond_to do |format|
if @dynamic_image.save
format.html { redirect_to(@dynamic_image, :notice => 'Image description successfully entered!') }
format.xml { render :xml => @dynamic_image, :status => :created, :location ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end",
"def new\n @dynamic_image = DynamicImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dynamic_image }\n end\... | [
"0.6545989",
"0.6470091",
"0.616402",
"0.60187805",
"0.601001",
"0.593209",
"0.59308857",
"0.5863692",
"0.58403295",
"0.5814136",
"0.57913554",
"0.5740564",
"0.57330316",
"0.5728697",
"0.5701796",
"0.5668584",
"0.56637037",
"0.566127",
"0.5643139",
"0.56328046",
"0.5625736",
... | 0.6713984 | 0 |
Identifier Codes 1 received meetup 2 meetup accepted 3 meetup declined 4 meetup terminated | def generate_notification_for(device, message, friend, identifier)
Grocer::Notification.new(
device_token: device.token,
alert: message,
badge: 1,
category: "meetup",
custom: custom_hash_for(friend, identifier),
expiry: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identifier_code\n 'QuestionnaireResponseID'\n end",
"def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end",
"def... | [
"0.5484311",
"0.5440901",
"0.5354863",
"0.535406",
"0.5336384",
"0.52455103",
"0.5237743",
"0.5089951",
"0.5076318",
"0.5075769",
"0.50708073",
"0.50454736",
"0.4987167",
"0.498599",
"0.49830726",
"0.49802023",
"0.49679103",
"0.49665332",
"0.49373662",
"0.49009657",
"0.490039... | 0.0 | -1 |
if method doesn't denote with any accessor keyword, it is public by default. if a function is out of class, it is private for class attributes and methods. | def hello_world
puts "Hello World"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method4 # and this will be 'public'\r\n\t\t#...\r\n\tend",
"def method4 # and this will be 'public'\n #...\n end",
"def method4 # and this will be 'public'\n #...\n end",
"def method3 # will be 'private'\r\n\t\t# ...\r\n\tend",
"def method3 # will be 'private'\n ... | [
"0.7461146",
"0.7315567",
"0.73002976",
"0.72378623",
"0.71720916",
"0.7170201",
"0.7150756",
"0.714635",
"0.7063617",
"0.7063617",
"0.7042551",
"0.6980449",
"0.69227344",
"0.6922165",
"0.6911987",
"0.6773613",
"0.67082214",
"0.6702999",
"0.6702408",
"0.66190064",
"0.6559915"... | 0.0 | -1 |
Overrides Devise method Facebook users won't need password | def password_required?
super unless has_facebook_auth
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_password\n self.password ||= Devise.friendly_token[0,20]\n end",
"def update_with_password(params = {})\n if has_facebook_profile?\n params.delete(:current_password)\n update_without_password(params)\n else\n super\n end\n end",
"def authenticate(fb_user)\n \n \n ... | [
"0.6846869",
"0.68317527",
"0.6815352",
"0.679718",
"0.67903775",
"0.66671896",
"0.66230184",
"0.659014",
"0.6588076",
"0.6587573",
"0.6555135",
"0.654014",
"0.65369606",
"0.6463311",
"0.6440488",
"0.643722",
"0.6432208",
"0.6430285",
"0.6430285",
"0.63987505",
"0.63897294",
... | 0.8126338 | 0 |
PATCH /api/users/1 PUT /api/users/1 | def update
if @user.update_attributes(user_params)
render json: @user
else
log_modal_errors @user
render json: @user.errors.full_messages, status: :bad_request
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update... | [
"0.7625893",
"0.7299223",
"0.72974515",
"0.72919416",
"0.72544545",
"0.71706384",
"0.7158619",
"0.71187514",
"0.70816904",
"0.70732105",
"0.7059448",
"0.705254",
"0.7045796",
"0.7043827",
"0.70398563",
"0.70398563",
"0.70337695",
"0.7032408",
"0.7032408",
"0.70318544",
"0.702... | 0.0 | -1 |
GET /materials GET /materials.json | def index
@materials = Material.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_materials(materials)\n return unless materials.present?\n\n show do\n title 'Retrieve Materials'\n note 'Please get the following items'\n table create_location_table(materials)\n end\n end",
"def index\n if params[:part_id]\n @materials = Material.find(:all, :condit... | [
"0.7695797",
"0.743726",
"0.70794964",
"0.70794964",
"0.69776964",
"0.69741505",
"0.690023",
"0.68805933",
"0.68805933",
"0.67876697",
"0.67309254",
"0.66969",
"0.66423327",
"0.66420656",
"0.660247",
"0.65912545",
"0.65902853",
"0.6564993",
"0.6548735",
"0.6548735",
"0.654873... | 0.7332059 | 2 |
GET /materials/1 GET /materials/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:part_id]\n @materials = Material.find(:all, :conditions => [\"part_id = ?\", params[:part_id]])\n else\n @materials = Material.all\n end\n respond_to do |format|\n format.html\n format.json { render :json => @materials }\n end\n end",
"def show\n @mat... | [
"0.76282805",
"0.7566031",
"0.7566031",
"0.747292",
"0.739712",
"0.73210233",
"0.7051701",
"0.7013057",
"0.69625676",
"0.69625676",
"0.69545966",
"0.69545966",
"0.69545966",
"0.68746024",
"0.6868861",
"0.6863765",
"0.6797429",
"0.67656976",
"0.66953206",
"0.66789407",
"0.6629... | 0.0 | -1 |
POST /materials POST /materials.json | def create
puts params
puts params
#params.permit(:file,:semester, :branch, :subject, :category, :title)
@material = Material.new(material_params)
filename=params[:material][:file]
File.open(Rails.root.join('public','uploadedfiles',filename.original_filename), 'wb') do |file|
file.write(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @material = Material.new(params[:material])\n\n respond_to do |format|\n if @material.save\n format.html { redirect_to @material, notice: 'Material was successfully created.' }\n format.json { render json: @material, status: :created, location: @material }\n else\n ... | [
"0.72679675",
"0.7215352",
"0.7184485",
"0.7086571",
"0.69078964",
"0.68911815",
"0.68911815",
"0.68234175",
"0.6823253",
"0.67775404",
"0.67538685",
"0.67342216",
"0.6730445",
"0.6721793",
"0.67070293",
"0.6698668",
"0.66520876",
"0.65706325",
"0.6550448",
"0.65416586",
"0.6... | 0.0 | -1 |
PATCH/PUT /materials/1 PATCH/PUT /materials/1.json | def update
respond_to do |format|
if @material.update(material_params)
format.html { redirect_to @material, notice: 'Material was successfully updated.' }
format.json { render :show, status: :ok, location: @material }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @material = Material.find(params[:id])\n\n respond_to do |format|\n if @material.update_attributes(params[:material])\n format.html { redirect_to @material, notice: 'Material was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren... | [
"0.7075448",
"0.7065062",
"0.68074805",
"0.67731375",
"0.676153",
"0.67145574",
"0.6694559",
"0.66622907",
"0.66554576",
"0.66554576",
"0.6618104",
"0.6607203",
"0.6596467",
"0.65722644",
"0.65712434",
"0.65563637",
"0.6536551",
"0.6529569",
"0.648518",
"0.64655447",
"0.63765... | 0.6867137 | 2 |
DELETE /materials/1 DELETE /materials/1.json | def destroy
@material.destroy
respond_to do |format|
format.html { redirect_to materials_url, notice: 'Material was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @material = Material.find(params[:id])\n @material.destroy\n\n respond_to do |format|\n format.html { redirect_to materials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @material = Material.find(params[:id])\n @material.destroy\n\n respond_to do |for... | [
"0.7861632",
"0.78499895",
"0.7751164",
"0.7648878",
"0.7648878",
"0.75665706",
"0.75665706",
"0.7549489",
"0.7477196",
"0.7452359",
"0.74431884",
"0.74037725",
"0.7336595",
"0.72920674",
"0.728547",
"0.72108626",
"0.71896327",
"0.71730804",
"0.71666646",
"0.7129079",
"0.7125... | 0.75623876 | 7 |
Use callbacks to share common setup or constraints between actions. | def set_material
@material = Material.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def material_params
params.require(:material).permit(:semester, :branch, :subject, :category, :title, :file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
try to reset time if auto mode | def restart_timer
if(current_user.timer.mode == 'auto')
reset_timer
start_timer
return get_current_time.merge get_setting_time
else
reset_timer
return {state: get_timer_state}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_timer; end",
"def reset_timer; end",
"def tock\n @minute += 1\n end",
"def setTime\n\t\t\t@time=0\n\tend",
"def need_tock?\n if @second == 60\n @second = 0\n tock\n end\n end",
"def reset(type)\n case type\n when :ten_secs\n initialize_ten_secs\n when ... | [
"0.6892241",
"0.6892241",
"0.68065166",
"0.6790673",
"0.6591867",
"0.6554509",
"0.6503527",
"0.6500259",
"0.6480293",
"0.6412992",
"0.6412992",
"0.6214251",
"0.6137992",
"0.6107386",
"0.60432917",
"0.6020964",
"0.60191387",
"0.60183614",
"0.60103947",
"0.5976026",
"0.5953945"... | 0.64300007 | 9 |
get setting default time | def get_setting_time
return {setting_time: @config.encounter_duration}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_time\n Time.now.utc\n end",
"def default_time_range\n @default_time_range ||= @time_ranges[@config['time_range']]\n end",
"def max_time\n @max_time ||= defaults[:max_time]\n end",
"def base_time\n BASE_TIME\n end",
"def default_run\n self.level = :full\n ... | [
"0.8066709",
"0.70796597",
"0.68788666",
"0.6839228",
"0.6821685",
"0.6821046",
"0.6808895",
"0.6708574",
"0.67032975",
"0.667317",
"0.66372365",
"0.6600309",
"0.6569045",
"0.6541021",
"0.65247273",
"0.6522475",
"0.64931583",
"0.6469236",
"0.6463959",
"0.6462438",
"0.6445042"... | 0.7386523 | 1 |
get current state of the timer | def get_timer_state
return current_user.timer.get_state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_timer; end",
"def state(timer)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if timer.handle.ptr == nil\n raise \"timer is disposed\"\n end\n result = CurrentPaceComponentState.new(Native.CurrentPaceCo... | [
"0.74665105",
"0.71183634",
"0.7045884",
"0.70016354",
"0.694068",
"0.6834536",
"0.6797018",
"0.67680365",
"0.6758726",
"0.67183447",
"0.67139477",
"0.6692657",
"0.6684197",
"0.6595044",
"0.658698",
"0.6561412",
"0.65533966",
"0.65533966",
"0.65533966",
"0.65533966",
"0.65533... | 0.8146646 | 0 |
get break default time | def get_break_time
return {break_time: @config.short_break_duration}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lead_time\n 4\n end",
"def lead_time\n 1\n end",
"def lead_time\n 0\n end",
"def start_time\n return \"1530\";\n end",
"def default_time\n Time.now.utc\n end",
"def prep_time_passed\n return \"7:34\"\n end",
"def base_time\n BASE_TIME\n end",
"def hold_time\n... | [
"0.6892649",
"0.6832678",
"0.6725997",
"0.6657196",
"0.6491631",
"0.6460908",
"0.6429846",
"0.64121133",
"0.6384467",
"0.6381969",
"0.6373108",
"0.63485175",
"0.630588",
"0.63002926",
"0.6286536",
"0.6253622",
"0.6251639",
"0.6243828",
"0.622946",
"0.6203341",
"0.6201403",
... | 0.7767627 | 0 |
extend the current time | def extend_timer
if(@user.timer.mode == 'manual')
current_time = params[:current_time]
new_time = current_time.to_i + @user.config.encounter_extend_duration.to_i
@timer.current_time = new_time
@timer.save
return {new_time: new_time}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend(time)\n self.expires_on += time\n self\n end",
"def addtime\n \n end",
"def extendbyfourteendays\n updated_at = Time.now\n end",
"def from_now(t = Time.now); t + self; end",
"def from_now(t = Time.now); t + self; end",
"def increment_time\n @now += 1.minute\n end",
"def ad... | [
"0.730508",
"0.7126904",
"0.7000792",
"0.69652003",
"0.69652003",
"0.6785347",
"0.67775476",
"0.6542174",
"0.6485007",
"0.6479476",
"0.64554673",
"0.6448226",
"0.6443765",
"0.6436409",
"0.63212883",
"0.6267453",
"0.62561566",
"0.62146294",
"0.61613923",
"0.61363196",
"0.60771... | 0.66604674 | 7 |
Initializes a LoginRadius Account object with an apikey and secret Takes in a hash containing site_name(required), api_key(required), api_secret(required) | def initialize
@site_name = ENV['SITE_NAME']
@api_key = ENV['API_KEY']
@api_secret = ENV['API_SECRET']
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
unless @site_name != '' && @site_name != nil
raise LoginRadius::Error.new, "'a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end",
"def initialize\r\n @apiKey = API_KEY\r\n @secret = SECRET\r\n end",
"def initialize(api_key, account_id, application_id)\n @api_key = api_key\n @account_id = account_id\n ... | [
"0.7111186",
"0.68949986",
"0.6855877",
"0.6827507",
"0.66839147",
"0.6658185",
"0.6655453",
"0.65932786",
"0.6529699",
"0.6500946",
"0.64660937",
"0.6405742",
"0.6395279",
"0.63760966",
"0.63669467",
"0.6365725",
"0.6342815",
"0.6311177",
"0.62972575",
"0.6289757",
"0.624086... | 0.74656534 | 4 |
This API is used to retrieve all of the accepted Policies by the user, associated with their UID. | def get_privacy_policy_history_by_uid(uid)
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
resource_path = 'identity/v2/manage/ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policies_for_user(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListPoliciesForUser'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless... | [
"0.63210607",
"0.6003532",
"0.5991999",
"0.58209604",
"0.57942",
"0.57700145",
"0.56078905",
"0.55722666",
"0.55267286",
"0.55134887",
"0.53528535",
"0.5335705",
"0.52704734",
"0.52458566",
"0.52405626",
"0.5227996",
"0.522288",
"0.5187834",
"0.5154898",
"0.51409066",
"0.5110... | 0.0 | -1 |
This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user. In order to use this API, you need to format a JSON request body with all of the mandatory fields | def create_account(account_create_model, fields = '')
if account_create_model.blank?
raise LoginRadius::Error.new, getValidationMessage('account_create_model')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
unless ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end"... | [
"0.72648185",
"0.70738167",
"0.705828",
"0.7025559",
"0.7008389",
"0.7008389",
"0.7008389",
"0.6925117",
"0.692299",
"0.682725",
"0.68213624",
"0.67858666",
"0.6755928",
"0.67468596",
"0.67090285",
"0.6695001",
"0.6675659",
"0.6668796",
"0.6659103",
"0.66570663",
"0.66169643"... | 0.66012746 | 21 |
This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage. | def get_account_profile_by_email(email, fields = '')
if isNullOrWhiteSpace(email)
raise LoginRadius::Error.new, getValidationMessage('email')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_parameters['email']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_field.size > 0\n\n {:displayName => profile[\"displayName\"]... | [
"0.660311",
"0.64864784",
"0.6151832",
"0.6040862",
"0.6011761",
"0.5997462",
"0.58987975",
"0.5856938",
"0.5847879",
"0.5807799",
"0.5732415",
"0.564169",
"0.5625047",
"0.5611839",
"0.560752",
"0.5603875",
"0.56018764",
"0.56018764",
"0.55903304",
"0.5581047",
"0.5580464",
... | 0.66740316 | 0 |
This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage. | def get_account_profile_by_user_name(user_name, fields = '')
if isNullOrWhiteSpace(user_name)
raise LoginRadius::Error.new, getValidationMessage('user_name')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end",
"def profile(usernames)\n get(\"/1/users/show.json\", :users => [usernames].flatten).users\n end",
"def profile\n\t\t@user = User.where(username: params[:username])[0]\n\t\t@pics =... | [
"0.60781705",
"0.6008381",
"0.59539217",
"0.5926084",
"0.59134233",
"0.59112024",
"0.5882582",
"0.57664096",
"0.57402235",
"0.57121956",
"0.5708959",
"0.57027465",
"0.5676732",
"0.5668676",
"0.56292105",
"0.5598684",
"0.5528204",
"0.548176",
"0.54480654",
"0.5445698",
"0.5430... | 0.5944079 | 3 |
This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage. | def get_account_profile_by_phone(phone, fields = '')
if isNullOrWhiteSpace(phone)
raise LoginRadius::Error.new, getValidationMessage('phone')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_parameters['phone']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def load_profile(token)\n profile = GoogleService.user_info(token)\n ... | [
"0.6218824",
"0.6132166",
"0.5991154",
"0.5978669",
"0.59637356",
"0.5955587",
"0.59078306",
"0.5862103",
"0.58453614",
"0.5845112",
"0.582443",
"0.58106065",
"0.5800484",
"0.5790774",
"0.57507527",
"0.5707099",
"0.56954473",
"0.5690724",
"0.5688381",
"0.5682872",
"0.5675281"... | 0.65400755 | 0 |
This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage. | def get_account_profile_by_uid(uid, fields = '')
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
unless isNullOrWhiteSpace(fields)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_get_info( uid )\n\n # варианты размера аватарок = 'photo_rec, photo_big, photo_medium_rec'\n\n url = URI.encode(\"https://api.vkontakte.ru/method/getProfiles?uid=#{ uid }&fields='photo,photo_medium_rec,'&access_token=#{ OFFLINE_TOKEN }\")\n\n Vk_HTTP.request_api(url)[0]\n\n end",
"def G... | [
"0.65000427",
"0.6446429",
"0.6332895",
"0.63326406",
"0.62994444",
"0.6280731",
"0.6142708",
"0.60660124",
"0.6052381",
"0.6052381",
"0.6045692",
"0.6033571",
"0.598943",
"0.5974705",
"0.5902786",
"0.5891547",
"0.5889921",
"0.5880778",
"0.5830956",
"0.58200294",
"0.5803121",... | 0.6158601 | 6 |
This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section <a href=' for more capabilities. | def update_account_by_uid(account_user_profile_update_model, uid, fields = '', null_support = false)
if account_user_profile_update_model.blank?
raise LoginRadius::Error.new, getValidationMessage('account_user_profile_update_model')
end
if isNullOrWhiteSpace(uid)
raise LoginRadius::Err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(options = {})\n xml = \"<arg0>\"\n xml += get_xml_and_update_attributes options.merge(:storage_id => self.id), [:storage_id, :name, :size, :mount_image_id]\n xml += \"</arg0>\"\n response = Profitbricks.request :update_storage, xml\n return true if response.to_hash[:update_stora... | [
"0.6185852",
"0.61325985",
"0.6127072",
"0.6064848",
"0.60437703",
"0.59440595",
"0.59228516",
"0.59177005",
"0.58629817",
"0.5852809",
"0.58392954",
"0.58346456",
"0.5834059",
"0.5834059",
"0.582018",
"0.5809809",
"0.5799231",
"0.57977617",
"0.5779845",
"0.57582504",
"0.5728... | 0.0 | -1 |
This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process. | def update_phone_id_by_uid(phone, uid, fields = '')
if isNullOrWhiteSpace(phone)
raise LoginRadius::Error.new, getValidationMessage('phone')
end
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_phone(user_id:, number:)\n path = '/users/{userId}/phone'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if number.nil?\n raise Appwr... | [
"0.71954685",
"0.66763026",
"0.65573335",
"0.62561005",
"0.61893517",
"0.61311686",
"0.6130874",
"0.612376",
"0.6053502",
"0.60280406",
"0.60217553",
"0.60217553",
"0.60217553",
"0.60217553",
"0.6020936",
"0.6017502",
"0.60061735",
"0.59945697",
"0.5939156",
"0.5926309",
"0.5... | 0.7307698 | 0 |
This API use to retrive the hashed password of a specified account in Cloud Storage. | def get_account_password_hash_by_uid(uid)
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
resource_path = 'identity/v2/manage/acc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_password_hash\n if account_password_hash_column\n account![account_password_hash_column]\n elsif use_database_authentication_functions?\n db.get(Sequel.function(function_name(:rodauth_get_salt), account ? account_id : session_value))\n else\n # :nocov:\n password_... | [
"0.6743316",
"0.62555045",
"0.61109215",
"0.584328",
"0.58072555",
"0.57813627",
"0.57629746",
"0.5751688",
"0.570367",
"0.5693204",
"0.56616455",
"0.5658652",
"0.5640049",
"0.5619754",
"0.56026965",
"0.5566126",
"0.5558719",
"0.5555914",
"0.55469203",
"0.55303055",
"0.551888... | 0.64416057 | 1 |
This API is used to set the password of an account in Cloud Storage. | def set_account_password_by_uid(password, uid)
if isNullOrWhiteSpace(password)
raise LoginRadius::Error.new, getValidationMessage('password')
end
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_para... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password( password )\n resp = conn.put('/users/'+name+'/', { 'password' => password } )\n\n case resp.code.to_i\n when 204\n return\n when 404\n raise RestAuthUserNotFound.new(resp)\n when 412\n raise RestAuthPreconditionFailed.new(resp)\n else\n raise RestAuthUnknownS... | [
"0.6545616",
"0.6383438",
"0.63475674",
"0.6336146",
"0.63155854",
"0.62926096",
"0.62337416",
"0.6202407",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
"0.61918896",
... | 0.62423986 | 6 |
This API deletes the Users account and allows them to reregister for a new account. | def delete_account_by_uid(uid)
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
resource_path = 'identity/v2/manage/account/' + ui... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_account_user(id)\n post(\"accountuser/#{id}?_method=DELETE\")\n end",
"def destroy\n reset_session\n flash[:success] = \"Account has been deleted.\"\n User.find(params[:id]).destroy\n redirect_to(new_user_path)\n end",
"def delete_account\n @connection.request({\n ... | [
"0.713142",
"0.6869589",
"0.6819221",
"0.6751199",
"0.6666646",
"0.66482335",
"0.66378725",
"0.66366994",
"0.6632372",
"0.6595314",
"0.657943",
"0.65133935",
"0.64152265",
"0.63886786",
"0.63860357",
"0.63854957",
"0.6376426",
"0.6376426",
"0.63662845",
"0.63374984",
"0.63367... | 0.61392254 | 43 |
This API is used to invalidate the Email Verification status on an account. | def invalidate_account_email_verification(uid, email_template = '', verification_url = '')
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_email\n # User reset email sent.\n end",
"def reset\n if request.post? && params[:email].present?\n if account = Account.lookup(params[:email].strip)\n account.send_reset_request\n end\n # Show this flash whether or not the email address exists in our system.\n flash.n... | [
"0.5851892",
"0.58262855",
"0.58238125",
"0.5784435",
"0.5674256",
"0.56335425",
"0.5594804",
"0.55823606",
"0.5564137",
"0.5558024",
"0.5529035",
"0.55195415",
"0.5518225",
"0.5509294",
"0.5452928",
"0.54359746",
"0.5411556",
"0.5399502",
"0.53966737",
"0.5348005",
"0.534367... | 0.7628021 | 0 |
This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body. | def get_forgot_password_token(email, email_template = '', reset_password_url = '', send_email = false)
if isNullOrWhiteSpace(email)
raise LoginRadius::Error.new, getValidationMessage('email')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forgot_password token\n recipients token.user.email\n from SETTING.master_email!\n sent_on Time.now \n subject t(:forgot_password_title, :name => token.user.name, :host => SETTING.master_domain!)\n \n body \\\n :user => token.user,\n :url => reset_password... | [
"0.69385016",
"0.68470114",
"0.6767407",
"0.67423594",
"0.6738281",
"0.6618295",
"0.6601245",
"0.65948343",
"0.65742034",
"0.65287864",
"0.6506191",
"0.6501493",
"0.6481024",
"0.6480666",
"0.64790744",
"0.6454334",
"0.6441207",
"0.64101326",
"0.64101326",
"0.64101326",
"0.641... | 0.70763576 | 0 |
This API Returns an Email Verification token. | def get_email_verification_token(email)
if isNullOrWhiteSpace(email)
raise LoginRadius::Error.new, getValidationMessage('email')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
body_parameters = {}
body_param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_forgot_password_token(email, email_template = '', reset_password_url = '', send_email = false)\n if isNullOrWhiteSpace(email)\n raise LoginRadius::Error.new, getValidationMessage('email')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_paramet... | [
"0.639157",
"0.6368691",
"0.6330614",
"0.62808394",
"0.6230574",
"0.61454993",
"0.6122967",
"0.6113996",
"0.60808355",
"0.6033299",
"0.5971133",
"0.59678936",
"0.59507555",
"0.59449595",
"0.58443147",
"0.583247",
"0.5806952",
"0.57807726",
"0.57524127",
"0.5744226",
"0.574337... | 0.8260554 | 0 |
The API is used to get LoginRadius access token based on UID. | def get_access_token_by_uid(uid)
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_parameters['uid'] = uid
resource_pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end",
"def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[... | [
"0.6668435",
"0.65232337",
"0.62886983",
"0.62585336",
"0.62035805",
"0.6187334",
"0.6160856",
"0.6157034",
"0.61510867",
"0.6131645",
"0.6100283",
"0.6065405",
"0.60356164",
"0.6017993",
"0.60134435",
"0.60100853",
"0.59988576",
"0.5991789",
"0.59813815",
"0.59789014",
"0.59... | 0.7889909 | 0 |
This API is used to add/upsert another emails in account profile by differentdifferent email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array. | def upsert_email(upsert_email_model, uid, fields = '')
if upsert_email_model.blank?
raise LoginRadius::Error.new, getValidationMessage('upsert_email_model')
end
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_profile_email\n user_profile.update_attribute(:email, email) if saved_change_to_email?\n end",
"def update_email(email)\n if email != self.email\n self.update_attributes!(:email=>email)\n #ToDo can be ignored if using association b/w users and profiles\n self.profile.... | [
"0.6142815",
"0.6138855",
"0.6113545",
"0.6096292",
"0.6017583",
"0.5754523",
"0.5675737",
"0.5665212",
"0.5611686",
"0.5581801",
"0.5560928",
"0.55289847",
"0.55289084",
"0.5480019",
"0.5474541",
"0.54599094",
"0.5421848",
"0.53847474",
"0.5376554",
"0.5344552",
"0.53432673"... | 0.61286515 | 2 |
Use this API to Remove emails from a user Account | def remove_email(email, uid, fields = '')
if isNullOrWhiteSpace(email)
raise LoginRadius::Error.new, getValidationMessage('email')
end
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_parameters['api... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_email(*args)\n params = _extract_parameters(args)\n _normalize_params_keys(params)\n params['data'] = [args].flatten\n delete(\"/user/emails\", params)\n end",
"def fRemoveNotificationsFrom (email)\n @users.removeNotificationsFrom(email)\n end",
"def delete(*a... | [
"0.70359206",
"0.68715245",
"0.6815399",
"0.6785238",
"0.67654413",
"0.6641002",
"0.6532686",
"0.6499242",
"0.64823824",
"0.6452147",
"0.63440675",
"0.63010377",
"0.62785137",
"0.6264945",
"0.62059915",
"0.6188158",
"0.6184432",
"0.6163264",
"0.60914814",
"0.6083508",
"0.6074... | 0.6692785 | 5 |
This API is used to refresh an access token via it's associated refresh token. | def refresh_access_token_by_refresh_token(refresh__token)
if isNullOrWhiteSpace(refresh__token)
raise LoginRadius::Error.new, getValidationMessage('refresh__token')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
qu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_access_token!\n @access_token = access_token.refresh!\n end",
"def refresh!\n now = Time.now\n raise RefreshTokenExpired if refresh_token_expires_at&.<= now\n\n data = refresh_token_request!\n\n @access_token = data[\"access_token\"]\n @access_token_expires_at = (now + data[\"e... | [
"0.8653763",
"0.85470533",
"0.8529229",
"0.8510753",
"0.84981215",
"0.83950245",
"0.8316734",
"0.8216186",
"0.8193008",
"0.8192502",
"0.8082493",
"0.8076839",
"0.8021388",
"0.7988081",
"0.79832435",
"0.7872255",
"0.78568316",
"0.78074855",
"0.77935714",
"0.7784782",
"0.777316... | 0.8119661 | 10 |
The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry. | def revoke_refresh_token(refresh__token)
if isNullOrWhiteSpace(refresh__token)
raise LoginRadius::Error.new, getValidationMessage('refresh__token')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_parameters['r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end",
"def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n... | [
"0.83960867",
"0.83960867",
"0.80614656",
"0.8026531",
"0.76425445",
"0.7635041",
"0.7236905",
"0.7222585",
"0.7219258",
"0.7179359",
"0.7031122",
"0.70280725",
"0.70095074",
"0.6964618",
"0.695694",
"0.69444424",
"0.6871374",
"0.68447566",
"0.68361604",
"0.68198293",
"0.6813... | 0.8196624 | 2 |
Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage. | def get_account_identities_by_email(email, fields = '')
if isNullOrWhiteSpace(email)
raise LoginRadius::Error.new, getValidationMessage('email')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_parameters['emai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_ids\n []\n end",
"def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end",
"def identities\n User.where(:provider => provider, :uid => uid)\n end",
"def emails\n respond_with_entity(api.get('/api/v1/profile/em... | [
"0.65854913",
"0.6151015",
"0.60374856",
"0.59914213",
"0.59632087",
"0.58611244",
"0.5844935",
"0.5765561",
"0.57613105",
"0.5745338",
"0.567313",
"0.56500226",
"0.55987036",
"0.5588821",
"0.5573133",
"0.5556099",
"0.5547942",
"0.55197227",
"0.55057776",
"0.5480276",
"0.5443... | 0.6302756 | 1 |
This API is used to delete all user profiles associated with an Email. | def account_delete_by_email(email)
if isNullOrWhiteSpace(email)
raise LoginRadius::Error.new, getValidationMessage('email')
end
query_parameters = {}
query_parameters['apiKey'] = @api_key
query_parameters['apiSecret'] = @api_secret
query_parameters['email'] = email
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(*args)\n arguments(args)\n params = arguments.params\n params['data'] = arguments.remaining unless arguments.remaining.empty?\n\n delete_request(\"/user/emails\", params)\n end",
"def delete_email(*args)\n params = _extract_parameters(args)\n _normalize_params_keys... | [
"0.66582686",
"0.657264",
"0.6464556",
"0.6220725",
"0.6207524",
"0.61014897",
"0.58164984",
"0.5789746",
"0.5781133",
"0.57720214",
"0.57720214",
"0.57720214",
"0.57720214",
"0.57720214",
"0.57720214",
"0.57720214",
"0.57720214",
"0.5766701",
"0.5755655",
"0.574675",
"0.5744... | 0.6185848 | 5 |
This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid. | def account_update_uid(update_uid_model, uid)
if update_uid_model.blank?
raise LoginRadius::Error.new, getValidationMessage('update_uid_model')
end
if isNullOrWhiteSpace(uid)
raise LoginRadius::Error.new, getValidationMessage('uid')
end
query_parameters = {}
query_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_account_user(id, options = {})\n post(\"accountuser/#{id}?_method=POST\", options)\n end",
"def update!\n unless id\n raise \"user can not be updated before it is created.\"\n end\n hash = \"W10=\"\n\n payload = {\n \"id\" => id,\n \"email\" => @ema... | [
"0.6542145",
"0.653726",
"0.65044117",
"0.6439837",
"0.64132756",
"0.6369803",
"0.6356472",
"0.6299202",
"0.62806445",
"0.62790364",
"0.6274034",
"0.62696344",
"0.62677157",
"0.6263394",
"0.62618613",
"0.6253476",
"0.62520695",
"0.62397105",
"0.62375075",
"0.6236774",
"0.6232... | 0.6431921 | 4 |
def teardown SQLite3::Database.open('test/tmp/memory') do |db| db.execute('DROP TABLE IF EXISTS links') db.execute('DROP TABLE IF EXISTS memos') db.execute('DROP TABLE IF EXISTS tasks') end end | def test_note
instance = Note.create('Link')
assert_equal('Link', instance.class.name)
Note.stub(:input_index, 1) do
instance = Note.create
assert_equal('Task', instance.class.name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown\n\t\tActiveRecord::Base.clear_all_connections!\n\t\t#File.delete \"test.sqlite\"\n\tend",
"def teardown\n teardown_db\n end",
"def teardown_test_db\n ActiveRecord::Base.connection.tables.each do |t|\n ActiveRecord::Base.connection.drop_table(t)\n end\nend",
"def teardown\n cleanu... | [
"0.8220524",
"0.79668933",
"0.7952345",
"0.7682028",
"0.7652289",
"0.7652289",
"0.7652289",
"0.7652289",
"0.7296455",
"0.7267696",
"0.7215907",
"0.72126645",
"0.7211326",
"0.71462953",
"0.71222764",
"0.71033525",
"0.70904815",
"0.7083779",
"0.7083779",
"0.7083279",
"0.7067311... | 0.0 | -1 |
The modified lines contains expected text | def includes?(text)
text = [text] unless text.respond_to? :each
lines[4..].select { |l| l.start_with? "+" }.any? { |l| text.any? { |t| l.include? t } }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines_affected\n @lines_affected = line_codes_affected.map {|l| Line.get(l.strip)}\n end",
"def patch_lines\n old_line, new_line = old_start, new_start\n \n old_lines = diff.old_object && diff.old_object.data_lines\n new_lines = diff.new_object && diff.new_object.data_lines\n \n dif... | [
"0.69694984",
"0.6737351",
"0.654181",
"0.65149677",
"0.65149665",
"0.6453301",
"0.63722825",
"0.6370053",
"0.63700294",
"0.6358687",
"0.63009596",
"0.62986606",
"0.6260896",
"0.6250475",
"0.6220424",
"0.6192468",
"0.61723775",
"0.6152328",
"0.6144871",
"0.6094131",
"0.608781... | 0.0 | -1 |
Detect SVN diff lines with particular text | def diff(text)
@diff ||= begin
files = affected(text).uniq
@raw.split("Index: ")
.select { |i| files.any? { |f| i.start_with? f } }
.map { |i| i.split "\n" }
.flatten
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_checker\n `svnlook changed #{@repo} -r #{@revision}`.split(\"\\n\")\n end",
"def extract_change_count_from_git_log(log_text)\n lines = log_text.split(\"\\n\" )\n change_lines=lines.find_all do | line |\n line.include?('changed')\n end\n change_lines.length\nend",
"def changed_paths_ch... | [
"0.6796984",
"0.6697005",
"0.65363455",
"0.6524535",
"0.64144796",
"0.63889825",
"0.62291884",
"0.61862373",
"0.60722995",
"0.604888",
"0.6024779",
"0.5966363",
"0.5949892",
"0.5935408",
"0.58995634",
"0.58701056",
"0.58650345",
"0.5856386",
"0.58391273",
"0.58334893",
"0.582... | 0.6685222 | 2 |
Detect affected files with particular text | def affected(text)
occurrences = lines.each_index.select do |i|
lines[i].start_with?("+") && text.any? { |t| lines[i].include? t }
end
occurrences.map do |occ|
lines[2..occ].reverse.find { |l| l.start_with? "Index: " }[7..]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_in_project phrase_we_have_now\n result_files_with_phrase = []\n path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')\n files_to_check = []\n Dir.glob(path_to_files) do |rb_file|\n files_to_check << rb_file\n end\n raise \"files_to_check is empty !\" if files_to_check.length == 0\n... | [
"0.6498327",
"0.6336268",
"0.63309866",
"0.61712337",
"0.6132193",
"0.6104792",
"0.60484153",
"0.60240716",
"0.6021095",
"0.60014486",
"0.59906864",
"0.59826064",
"0.5932951",
"0.590679",
"0.5904555",
"0.5871225",
"0.58647674",
"0.5815775",
"0.5794358",
"0.5793754",
"0.578649... | 0.5802135 | 18 |
Return the information in config/application.rb after parsing the strings to dates (with Time.zone.parse). | def dates_for(symbol)
date_strings_for(symbol).map{|date_string| Time.zone.parse(date_string)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone_check\n line_num = 0\n config_line = ''\n File.foreach(\"#{Rails.root}/config/application.rb\").with_index do |line, index |\n if line.include? \"config.time_zone\"\n line_num = index + 1\n config_line = line\n end\n break if line_... | [
"0.60430706",
"0.5779661",
"0.55303377",
"0.53511685",
"0.533619",
"0.53265774",
"0.5238977",
"0.5238977",
"0.5238977",
"0.5238977",
"0.5238977",
"0.5238977",
"0.5170896",
"0.5161885",
"0.5127617",
"0.51124775",
"0.51124775",
"0.51124775",
"0.51124775",
"0.51124775",
"0.50899... | 0.5138891 | 14 |
Returns the closest date within the configured dates to the date supplied in the argument. This is useful when you want to automatically change the default timetable page based on today's date. | def closest_date_for(symbol, date)
my_date = date.beginning_of_day
dates = dates_for(symbol)
if dates.include?(my_date)
return my_date
else
my_date < dates.min ?
dates.min :
dates.max
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest(date)\n return nil if !@days_of_week || @days_of_week.empty?\n goal = date\n while goal += IceCube::ONE_DAY\n return self.class.adjust(goal, date) if validate(goal)\n end\n end",
"def closest_date_from(date_and_month, format = DEFAULT_FORMAT)\n DateUtils.closest_date_... | [
"0.73553467",
"0.68528455",
"0.68455505",
"0.60675275",
"0.56942904",
"0.55645794",
"0.55499136",
"0.55183625",
"0.54497695",
"0.54497695",
"0.54264724",
"0.5424373",
"0.5409093",
"0.5330634",
"0.53112787",
"0.5289495",
"0.5267065",
"0.5183614",
"0.5176647",
"0.516649",
"0.51... | 0.7251037 | 1 |
You cannot join a Cult without making a BloodOath!!! | def recruit_follower(date,follower)
BloodOath.new(date, self, follower)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_cult(cult)\n Bloodoath.new(cult, self) \n end",
"def join_cult(cult)\n BloodOath.new(cult, self)\n end",
"def join_cult(cult)\n BloodOath.new(cult, self)\n end",
"def join_cult(new_cult)\n # follows single source of truth: many ~*~connecting~*~ to many via the dongle c... | [
"0.7662074",
"0.7406478",
"0.7406478",
"0.7313897",
"0.70755976",
"0.7065682",
"0.68616194",
"0.68296254",
"0.679037",
"0.609202",
"0.6038332",
"0.6004722",
"0.5841906",
"0.57895994",
"0.57415336",
"0.57294357",
"0.5671894",
"0.5634428",
"0.5554955",
"0.54994756",
"0.5381664"... | 0.0 | -1 |
followers joined through being recruited or by themselves | def cult_population
by_recruite = BloodOath.all.select{|bloodoath| bloodoath.cult == self}.count
by_joining = BloodOath.all.select{|bloodoath| bloodoath.follower == self}.count
total = by_joining + by_recruite
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def followers\n if @activity.user_type == 'User' && @activity.key == 'vote.create'\n ids = (@actor.followers_ids.union(@activity.recipient.voters_ids) - [@activity.recipient_user.id.to_s])\n elsif @activity.user_type == 'School'\n ids = (@actor.followers_ids.union(@activity.recipient.followers_ids)... | [
"0.724809",
"0.720122",
"0.7104708",
"0.7009118",
"0.6998365",
"0.69859344",
"0.6916154",
"0.6907158",
"0.6906602",
"0.6900835",
"0.6802691",
"0.6795357",
"0.67883855",
"0.67825645",
"0.6771864",
"0.67636454",
"0.67458093",
"0.6743193",
"0.67224365",
"0.6711053",
"0.6686593",... | 0.0 | -1 |
since we have cult population, we can use that as the denominator | def average_age
total_age = BloodOath.all.map{|bloodoath|bloodoath.follower.age}.sum
average_age = total_age/cult_population
average_age.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def denominator() end",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end",
"def population_density(population,area)\n return population/area\nend",
"def prolificness\n # prolificness = num_paintings / years_experience... | [
"0.70311254",
"0.68403685",
"0.6752463",
"0.6745501",
"0.66988707",
"0.66908216",
"0.6613078",
"0.660369",
"0.6545177",
"0.65366215",
"0.6518281",
"0.64937294",
"0.64897925",
"0.64614403",
"0.6455833",
"0.6452046",
"0.6424822",
"0.64159375",
"0.63820845",
"0.6360714",
"0.6354... | 0.0 | -1 |
we want to return a changed array | def my_followers_mottos
BloodOath.all.map{|bloodoath|bloodoath.follower.life_motto}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_to_no_change(array)\n return array\nend",
"def map_to_no_change(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index])\n index += 1 \n end\n return array\nend",
"def collect_preserve\n\t\tcopy = @arr.clone[0...@last]\n\tend",
"d... | [
"0.719697",
"0.7029492",
"0.6941043",
"0.680736",
"0.6796047",
"0.6752357",
"0.67391676",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.6685438",
"0.66783667",
"0.66613007",
"0.6650097",
"0.6644647",
... | 0.0 | -1 |
Returns whether the given value is included in the expected value. | def matches?(actual)
@expected.include?(actual)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(value)\n each do |index, list_value|\n return true if list_value == value\n end\n return false\n end",
"def include?(value) \n if value and value != \"\"\n value = value.split(MULTI_VALUES_SEPARATOR) if value.is_a?(String) and value.include?(MULTI_VALUES_SE... | [
"0.73695517",
"0.73131984",
"0.7249924",
"0.72122335",
"0.7143264",
"0.7136313",
"0.70774305",
"0.67800725",
"0.6749785",
"0.6686054",
"0.66687447",
"0.66445214",
"0.6601354",
"0.65655905",
"0.64947915",
"0.649054",
"0.63942546",
"0.639219",
"0.6365802",
"0.63632804",
"0.6349... | 0.5673964 | 77 |
Adds extra information to the error message. | def customise_error_values(values)
values[:expected] = Ward::Errors.format_exclusive_list(@expected)
values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_error_extras(exception)\n extras = super\n extras = extras.merge(:error_identifier => error_identifier) if error_identifier\n extras\n end",
"def custom_error_message\n message = component.dig('errors', schema_key, 'any')\n\n message % error_message_hash if message.present?... | [
"0.65860564",
"0.6491861",
"0.64811397",
"0.6431031",
"0.64137334",
"0.6236611",
"0.6215044",
"0.61701435",
"0.6145852",
"0.6130303",
"0.6121972",
"0.6097543",
"0.6066297",
"0.6066297",
"0.59774286",
"0.59761",
"0.5957249",
"0.59498",
"0.5923067",
"0.59053856",
"0.58809704",
... | 0.0 | -1 |
resource_card helper this helper render a very elegant presentation card for a resource. | def resource_card(&block)
concat(show_section_label, block.binding)
concat('<div class="resource-card">', block.binding)
yield
concat('</div>', block.binding)
concat('<div style="clear:both;"></div>', block.binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @resource = @user\n respond_to do |format|\n format.html do\n @menu_tpl = 'menu'\n @card_sections = {\n sidebar: [\n { tpl: 'avatar' },\n { tpl: 'bcards', opt: { resource: @user.favorites, size: 'sm' }, title: 'Favorites' },\n { tpl: 'ba... | [
"0.65695846",
"0.6461462",
"0.63623846",
"0.62595814",
"0.6232368",
"0.6186093",
"0.61248446",
"0.5973265",
"0.5972765",
"0.5964838",
"0.5919553",
"0.5884906",
"0.5857296",
"0.5856316",
"0.58290917",
"0.58088404",
"0.5803892",
"0.5796688",
"0.5796688",
"0.5796688",
"0.5796688... | 0.8050303 | 0 |
field_block helper Use this helper to set a two column fieldset layout for an admin form. usage: in a _form.html.erb note: this two input boxes will be rendered in a single row | def field_block(cols = 2, &block)
css_class = "float_left"
css_class << "_#{cols}" unless cols == 2
concat('<div class="'+ css_class +'">', block.binding)
yield
concat('</div>', block.binding)
concat('<div style="clear:both;"></div>', block.binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fieldset(&block)\n @template.form_fieldset(&block)\n end",
"def form_fieldset(&block)\n klass = \"fieldset\"\n content_tag(:fieldset, capture(&block), class: klass)\n end",
"def fieldset(&block)\n @g.fieldset(block)\n end",
"def fieldset(options={}, &block)\n @template... | [
"0.71020406",
"0.6752328",
"0.6692469",
"0.6533583",
"0.64592767",
"0.64246863",
"0.6382809",
"0.6226857",
"0.6160018",
"0.6080637",
"0.60175836",
"0.5992851",
"0.59867746",
"0.59736866",
"0.5902214",
"0.5885962",
"0.58522403",
"0.58156705",
"0.581035",
"0.5793872",
"0.578136... | 0.697972 | 1 |
Add a spinner, hidden by default, with the specified id. | def spinner(spinner_id = :spinner, hidden = true)
options = {:id => spinner_id}
options.merge!(:style => 'display:none') if hidden
image_tag('admin_ui/indicator.gif', options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spinner_tag(id = 'ident')\r\n image_tag('web/spinner.gif', :id=>\"#{id}_spinner\", :align => 'absmiddle', :style=> 'display:none;border:none;', :alt => 'loading...')\r\n end",
"def spinner_tag(id = 'ident')\n\t\timage_tag('auth/spinner.gif', :id=>\"#{id}_spinner\", :align => 'absmiddle', :border=> 0, :st... | [
"0.72287184",
"0.71708584",
"0.71348894",
"0.7101286",
"0.67295194",
"0.6270925",
"0.6200048",
"0.5876589",
"0.58330953",
"0.5749677",
"0.57335424",
"0.5543556",
"0.5473395",
"0.5414276",
"0.5369479",
"0.53127843",
"0.51227856",
"0.50661886",
"0.5048335",
"0.4980309",
"0.4966... | 0.79386985 | 0 |
Provide options for ajax helpers with default loading and complete options. ==== Example observe_field(:some_field_id, loading_with_spinner(:spinner_id, :url => update_path, :with => 'value') the loading_with_spinner helper will add loading and complete actions to the observe_field options to show and hide the spinner ... | def loading_with_spinner(spinner_id, options)
options.merge(
:loading => "$('#{spinner_id}').show(); #{options[:loading]}",
:complete => "$('#{spinner_id}').hide(); #{options[:complete]}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inline_javascript(options)\n callbacks = ''\n # :before and :loading get merged into ajax:beforeSend.\n before_send = options.values_at(:before, :loading).compact!\n if options[:data]\n before_send << \"xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded... | [
"0.52799666",
"0.51865983",
"0.51671004",
"0.5131646",
"0.5095544",
"0.50633395",
"0.49090856",
"0.4861206",
"0.4837389",
"0.48155642",
"0.4751156",
"0.47360328",
"0.47148004",
"0.46992272",
"0.46853226",
"0.46791783",
"0.46728125",
"0.46727237",
"0.46678323",
"0.46628064",
"... | 0.6547461 | 0 |
This helper method is inspired by Fudgestudio's bort rails app. | def flash_messages
messages = []
%w(notice warning error).each do |msg|
messages << content_tag(:div, html_escape(flash[msg.to_sym]), :id => "flash-#{msg}") unless flash[msg.to_sym].blank?
end
messages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def berlioz; end",
"def bizet; end",
"def blg; end",
"def weber; end",
"def boiler_status; end",
"def romeo_and_juliet; end",
"def check_bingo\n\t\t\n\tend",
"def schubert; end",
"def bellini; end",
"def long_boro\n case boro\n when /b/ then \"bkln\"\n when /bx/ then \"bronx\"... | [
"0.58509934",
"0.5730612",
"0.55164135",
"0.5497396",
"0.54970783",
"0.54868144",
"0.53879833",
"0.53606",
"0.53021425",
"0.53017116",
"0.52883744",
"0.5276562",
"0.524309",
"0.524309",
"0.524309",
"0.52327746",
"0.52105945",
"0.52021044",
"0.52021044",
"0.51757306",
"0.51699... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.