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 |
|---|---|---|---|---|---|---|
p order("thi2s is3 my1 fake4 sente5nce") 8/14/20 | def basic_op(operator, value1, value2)
case operator
when "+"
value1 + value2
when "-"
value1 - value2
when "*"
value1 * value2
when "/"
value1 / value2
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order; end",
"def order; end",
"def order(words)\n words.split.sort_by{ |w| w[/\\d/] }.join(' ')\n end",
"def order(words)\n # sorted = words.split(\" \")\n # sorted.sort_by { |word| word.scan[/\\d/]first.to_i}.join(\" \")\n words.split.sort_by { |word| word[/\\d/] }.join(\" \")\nend",
"de... | [
"0.67575085",
"0.67575085",
"0.66465443",
"0.66266197",
"0.65725607",
"0.6556531",
"0.6535251",
"0.6460699",
"0.64294547",
"0.6390125",
"0.63133955",
"0.62997556",
"0.6274113",
"0.62516403",
"0.623181",
"0.62142724",
"0.61715513",
"0.615837",
"0.60974026",
"0.6066713",
"0.602... | 0.0 | -1 |
Callbacks by intranets, Set intranet by profile current_user | def set_intranets
ids = current_v1_user.profiles.map(&:intranet).compact.map(&:id)
@intranets = Intranet::Intranet.where(id: ids)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_profile\n @profile = current_user\n end",
"def set_profile\n @user = current_user\n @profile = @user.profile\n end",
"def set_user_profile\n @user_profile = current_user.user_profile\n end",
"def set_profile\n\t\t@profile = current_user.profile\n\tend",
"def set_profile\n @pr... | [
"0.6774466",
"0.65443784",
"0.6538091",
"0.64204985",
"0.6391844",
"0.6366328",
"0.6366328",
"0.6366328",
"0.6366328",
"0.6274153",
"0.6258212",
"0.6230826",
"0.6224803",
"0.6134728",
"0.60856146",
"0.6071408",
"0.6053262",
"0.60189456",
"0.6000672",
"0.59842736",
"0.598234",... | 0.6493263 | 3 |
GET /character_categories GET /character_categories.json | def index
@character_categories = CharacterCategory.order(:position)
respond_to do |format|
format.turbo_stream { render "shared/index", locals: { object: CharacterCategory.new, objects: @character_categorys } }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"O... | [
"0.7224495",
"0.7083244",
"0.6915345",
"0.6722281",
"0.6609513",
"0.6576626",
"0.65210867",
"0.6479078",
"0.6465492",
"0.6435114",
"0.64255226",
"0.6379369",
"0.636275",
"0.63604695",
"0.6352822",
"0.63514954",
"0.6351195",
"0.6329721",
"0.62918395",
"0.6228505",
"0.62210214"... | 0.60757965 | 30 |
GET /character_categories/1 GET /character_categories/1.json | def show
respond_to do |format|
format.turbo_stream { render "shared/show", locals: { object: @character_category } }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"O... | [
"0.69732356",
"0.69547045",
"0.67990625",
"0.6654774",
"0.660069",
"0.6471855",
"0.64698416",
"0.6443954",
"0.6354913",
"0.632305",
"0.6188869",
"0.61506367",
"0.6142966",
"0.61197215",
"0.6117542",
"0.6113341",
"0.6098654",
"0.60972524",
"0.6096071",
"0.6094928",
"0.6076056"... | 0.5943846 | 48 |
POST /character_categories POST /character_categories.json | def create
@character_category = CharacterCategory.new(character_category_params)
respond_to do |format|
if @character_category.save
@character_categories = CharacterCategory.order(:position)
# format.html { redirect_to @character_category, notice: 'Character category was successfully created.' }
format.json { render :show, status: :created, character_category: @character_category }
flash.now[:notice] = "Character Category was successfully created."
format.turbo_stream { render "shared/index", locals: { object: CharacterCategory.new, objects: @character_categorys } }
else
format.html { render :new }
format.json { render json: @character_category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_character_category\n @character_category = CharacterCategory.find(params[:id])\n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def character_category_params\n params.require(:character_category).permit... | [
"0.6746363",
"0.66302836",
"0.65671545",
"0.6556862",
"0.65519035",
"0.63658243",
"0.6336254",
"0.63280183",
"0.6323292",
"0.63019747",
"0.6253988",
"0.624035",
"0.62127656",
"0.61863524",
"0.6180824",
"0.6113236",
"0.61086196",
"0.60563236",
"0.6055909",
"0.6032771",
"0.6022... | 0.639758 | 5 |
PATCH/PUT /character_categories/1 PATCH/PUT /character_categories/1.json | def update
@short = params[:short]
@character_categories = CharacterCategory.order(:position)
respond_to do |format|
if @character_category.update(character_category_params)
# format.html { redirect_to @character_category, notice: 'Character category was successfully updated.' }
format.json { render :show, status: :ok, character_category: @character_category }
flash.now[:notice] = "Character Category was successfully updated."
format.turbo_stream { render "shared/update", locals: { object: @character_category, short: @short } }
else
format.html { render :edit }
format.json { render json: @character_category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update(category,category_params, Category)\n end",
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def set_character_category\n @character_category = CharacterCategory.find(params[:id])\n ... | [
"0.69924784",
"0.68481165",
"0.6632147",
"0.6515468",
"0.64430386",
"0.6409123",
"0.6386521",
"0.63790834",
"0.63765526",
"0.6348501",
"0.63356376",
"0.6300674",
"0.62855613",
"0.6282746",
"0.6278531",
"0.62684494",
"0.62504846",
"0.6246416",
"0.6219416",
"0.6218673",
"0.6196... | 0.634365 | 10 |
DELETE /character_categories/1 DELETE /character_categories/1.json | def destroy
@character_category = CharacterCategory.includes([{ character_attributes: :character_values }]).find(params[:id])
@character_category.destroy
@character_categories = CharacterCategory.order(:position)
respond_to do |format|
# format.html { redirect_to character_categories_url, notice: 'Character category was successfully destroyed.' }
format.json { head :no_content }
flash.now[:now] = "Character Category was successfully destroyed."
format.turbo_stream { render "shared/destroy", locals: { object: CharacterCategory.new } }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @charity_category = CharityCategory.find(params[:id])\n @charity_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_charity_categories_url }\n format.json { head :no_content }\n end\n end",
"def deleteCat()\n if(!authenticateAdmin(params[:admin_... | [
"0.7211144",
"0.71531445",
"0.7078443",
"0.7070869",
"0.70329547",
"0.7031141",
"0.6989265",
"0.69890136",
"0.69701314",
"0.69635767",
"0.69630635",
"0.69630635",
"0.6960321",
"0.6959866",
"0.69557655",
"0.6949104",
"0.693986",
"0.6926604",
"0.69252425",
"0.6901399",
"0.68921... | 0.70393205 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_character_category
@character_category = CharacterCategory.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def character_category_params
params.require(:character_category).permit(:name, :position)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
tomas vaisar 1 invoice invoice list | def webmock_1_invoice
stub_request(:get, "https://tomas%40vaisar.cz:heslo@tomvaisar.billapp.cz/invoices.xml").
with(:headers => {'Accept'=>'application/xml', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
to_return(:status => 200, :body => '<?xml version="1.0" encoding="UTF-8"?>
<invoices type="array">
<invoice>
<account-id type="integer">7104</account-id>
<client-id type="integer">58547</client-id>
<created-at type="datetime">2015-04-09T11:08:04+02:00</created-at>
<currency>CZK</currency>
<due-date type="date">2015-04-19</due-date>
<has-vat type="boolean">false</has-vat>
<id type="integer">99941</id>
<issue-date type="date">2015-04-09</issue-date>
<notes></notes>
<number>201500001</number>
<paid-on type="date" nil="true"></paid-on>
<status>sent</status>
<tax-amount type="decimal">0.0</tax-amount>
<total-amount type="decimal">30000.0</total-amount>
<updated-at type="datetime">2015-04-09T11:08:05+02:00</updated-at>
<lines type="array">
<line type="InvoiceLine">
<description>Kupa sena</description>
<item-id type="integer" nil="true"></item-id>
<quantity type="decimal">1.0</quantity>
<unit-price type="decimal">30000.0</unit-price>
<vat type="decimal">0.0</vat>
</line>
<line type="InvoiceLine">
<description>Kupa hnoje</description>
<item-id type="integer" nil="true"></item-id>
<quantity type="decimal">1.0</quantity>
<unit-price type="decimal">5000.0</unit-price>
<vat type="decimal">0.0</vat>
</line>
</lines>
</invoice>
</invoices>', :headers => {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def index\n @invoice_rows = @invoice.invoice_rows\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Inv... | [
"0.7627276",
"0.7355583",
"0.7004345",
"0.7004345",
"0.7004345",
"0.7004345",
"0.7004345",
"0.7004345",
"0.7004345",
"0.7004345",
"0.7004345",
"0.6988138",
"0.69772595",
"0.69270957",
"0.6887792",
"0.68617105",
"0.6856547",
"0.6827599",
"0.6805184",
"0.6789681",
"0.67860144",... | 0.0 | -1 |
Name: eclair (ESX Command Line Automation In Ruby) Version: 0.1.8 Release: 1 License: CCBA (Creative Commons By Attrbution) Group: System Source: N/A URL: Distribution: ESX(i) Vendor: UNIX | def install_gem(gem_name)
if gem_name.match(/getopt/)
install_name = "getopt"
else
install_name = gem_name.gsub(/\//,"-")
end
puts "Information:\tInstalling #{install_name}"
%x[gem install #{install_name}]
Gem.clear_paths
require "#{gem_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help\n puts \"ECTD Checker v: 0.0.1\"\n puts \"Licensed under GPLv2\"\n puts \"Contact Russell Osborne of Scilucent LLC for other uses rposborne {at} scilucent.com\"\n puts \"Usage: checkectd path\"\n exit\nend",
"def print_version()\n puts\n file_array = IO.readlines $0\n version = file_array.gre... | [
"0.59110063",
"0.5780312",
"0.576191",
"0.55955946",
"0.5575128",
"0.5551818",
"0.552487",
"0.552487",
"0.552487",
"0.5487959",
"0.54858345",
"0.5485254",
"0.54796934",
"0.5420284",
"0.5405631",
"0.540134",
"0.5399737",
"0.5360424",
"0.53589565",
"0.5294576",
"0.52881384",
... | 0.0 | -1 |
Get version information fro script header | def get_version(script)
file_array = IO.readlines script
version = file_array.grep(/^# Version/)[0].split(":")[1].gsub(/^\s+/,'').chomp
packager = file_array.grep(/^# Packager/)[0].split(":")[1].gsub(/^\s+/,'').chomp
name = file_array.grep(/^# Name/)[0].split(":")[1].gsub(/^\s+/,'').chomp
return version,packager,name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version\n p\n version = File.read(HOSTER_PATH+\"/hoster.version\")\n puts PROGNAME + \" version \" + version\nend",
"def head\n\tversion\n end",
"def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + ... | [
"0.7233129",
"0.71779484",
"0.7145044",
"0.7128102",
"0.7111412",
"0.69726837",
"0.6943024",
"0.6943024",
"0.6942169",
"0.6912498",
"0.6890659",
"0.68609536",
"0.685398",
"0.6845138",
"0.6807919",
"0.67428887",
"0.67421657",
"0.6719577",
"0.6712592",
"0.66859573",
"0.665732",... | 0.75336057 | 0 |
Print script version information | def print_version(script)
(version,packager,name) = get_version(script)
puts name+" v. "+version+" "+packager
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_version_info()\n puts \"Versão: \" + $version_info[:version].to_s + \" \" + $version_info[:date].to_s\n puts \"-----\"\nend",
"def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend",
"def output_version\n puts \"#{File.basena... | [
"0.81295234",
"0.80750614",
"0.80475426",
"0.8008392",
"0.7920358",
"0.79156303",
"0.78828067",
"0.7792445",
"0.7748762",
"0.7537776",
"0.75151557",
"0.7493945",
"0.7371569",
"0.73033905",
"0.7293732",
"0.7252025",
"0.7252025",
"0.7249999",
"0.72111785",
"0.7184966",
"0.71448... | 0.8526889 | 0 |
Create password file Routine to check a file exists If just given a patch number it tries to determine if a file that matches the patch number is available in the repository. | def check_file(filename,patchdir)
if !filename.match(/\//)
patch_list = Dir.entries(patchdir)
filename = patch_list.grep(/#{filename}/)[0].chomp
filename = patchdir+"/"+filename
end
if !File.exist?(filename)
puts "File: "+filename+" does not exist"
exit
else
puts "File: "+filename
end
return filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_safe\n if !File.file? @pwfile\n puts \"No password safe detected, creating one at #@pwfile\"\n FileUtils.touch @pwfile\n write_safe\n end\n end",
"def create(file=@file)\n if self.legacy?\n return unless @password.send(:to_file, self) \n end\n super\n... | [
"0.6534288",
"0.6047215",
"0.5733062",
"0.57083285",
"0.5613965",
"0.55775124",
"0.5566907",
"0.5559951",
"0.5435748",
"0.54085934",
"0.5354389",
"0.5351252",
"0.53510135",
"0.53495955",
"0.53432316",
"0.53342646",
"0.5279542",
"0.5271947",
"0.5237949",
"0.52373517",
"0.52342... | 0.60512733 | 1 |
Get the local version of update installed on and ES host | def get_local_version(ssh_session,filename)
(ssh_session,local_version) = ssh_session_exec(ssh_session,"esxcli software vib list |grep 'esx-base' |awk '{print $2}'")
local_version = local_version.chomp
if $verbose_mode == true
puts "vSphere release: "+local_version
end
return ssh_session,local_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end",
"def g... | [
"0.6788689",
"0.6641447",
"0.650903",
"0.64845985",
"0.64226377",
"0.6369421",
"0.6329697",
"0.6306639",
"0.6291421",
"0.6281827",
"0.62810355",
"0.6204334",
"0.61908257",
"0.61739254",
"0.6150741",
"0.6150741",
"0.6136378",
"0.6133345",
"0.61302423",
"0.61302423",
"0.6118454... | 0.644294 | 4 |
Get the local version of OS installed on and ES host | def get_os_version(ssh_session)
(ssh_session,os_version) = ssh_session_exec(ssh_session,"uname -r")
os_version = os_version.chomp
if $verbose_mode == true
puts "vSphere version: "+os_version
end
return ssh_session,os_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_os; end",
"def host_os; end",
"def osver\n return `uname -r`.chomp\n end",
"def get_os\n system=`/usr/bin/sw_vers -productVersion`.chomp.split(\".\").slice(1).to_i\n if system==4 then\n return \"tiger\"\n else\n return \"leo\"\n end\nend",
"def fetch_linux_os_version\n `ls... | [
"0.75478494",
"0.75478494",
"0.73919857",
"0.72414607",
"0.718036",
"0.715276",
"0.714223",
"0.70816725",
"0.7078483",
"0.7055699",
"0.7001272",
"0.6951143",
"0.69368136",
"0.69331515",
"0.69317985",
"0.6924176",
"0.69213796",
"0.6894251",
"0.6894251",
"0.6889743",
"0.6879684... | 0.6898361 | 17 |
Get the latest version of update available on the VMware site or in local repository | def get_depot_version(ssh_session,filename,depot_url,os_version)
if !filename.match(/[A-z]/)
(ssh_session,output) = ssh_session_exec(ssh_session,"esxcli network firewall ruleset set -e true -r httpClient")
(ssh_session,depot_version) = ssh_session_exec(ssh_session,"esxcli software sources vib list -d #{depot_url} 2>&1 | grep '#{os_version}' |grep 'esx-base' |grep Update |awk '{print $2}' |tail -1")
if !depot_version
(ssh_sessionm,depot_version) = ssh_session_exec(ssh_session,"esxcli software sources vib list -d #{depot_url} 2>&1 | grep '#{os_version}' |grep 'esx-base' |grep Installed |awk '{print $2}' |tail -1")
end
depot_version = depot_version.chomp
else
tmp_dir = "/tmp/esxzip"
if !File.directory?(tmp_dir)
Dir.mkdir(tmp_dir)
end
%x[unzip -o #{filename} metadata.zip -d #{tmp_dir}]
depot_version = %x[unzip -l #{tmp_dir}/metadata.zip |awk '{print $4}' |grep '^profiles' |grep standard].chomp
depot_version = depot_version.split(/\//)[1].split("-")[0..-2].join("-")
end
if $verbose_mode == true
puts "Depot release: "+depot_version
end
return ssh_session,depot_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @prop... | [
"0.72323287",
"0.72175324",
"0.7150379",
"0.7132441",
"0.7036124",
"0.6967382",
"0.6967382",
"0.694494",
"0.69123834",
"0.68673235",
"0.6849338",
"0.6847948",
"0.6847948",
"0.68231934",
"0.67789704",
"0.6774102",
"0.67662513",
"0.67556065",
"0.6675809",
"0.66673505",
"0.66508... | 0.59940326 | 72 |
Compare the local version of update installed on the ESX host with what is available on the VMware site on in the local repository | def compare_versions(local_version,depot_version,mode)
if local_version.match(/-/)
local_version = local_version.split(/-/)[1]
end
if depot_version.match(/-/)
depot_version = depot_version.split(/-/)[1]
end
puts "Current: "+local_version
puts "Available: "+depot_version
if mode =~ /up|check/
avail_fw = compare_ver(local_version,depot_version)
if avail_fw.to_s != local_version.to_s
puts "Depot patch level is newer than installed version"
update_available = "y"
else
update_available = "n"
puts "Local patch level is up to date"
end
else
if depot_version.to_i < local_version.to_i
puts "Depot patch level is lower than installed version"
update_available = "y"
else
update_available = "n"
puts "Local patch level is up to date"
end
end
if mode == "check"
exit
end
return update_available
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_build_vers(loc_ver,rem_ver)\n if loc_ver.to_s.match(/No/)\n result = 0\n else\n if rem_ver.to_s.match(/-/) and !rem_ver.to_s.match(/beta/)\n if $verbose == 1\n puts \"Local build date: \"+loc_ver.to_s\n puts \"Remote build date: \"+rem_ver.to_s\n end\n if rem_ver.t... | [
"0.6665512",
"0.6642946",
"0.6418579",
"0.63920516",
"0.6340101",
"0.6238183",
"0.62295026",
"0.6143434",
"0.614024",
"0.60848033",
"0.60819983",
"0.60695463",
"0.606392",
"0.6058078",
"0.6020928",
"0.6005245",
"0.6002382",
"0.59853417",
"0.59444743",
"0.5873058",
"0.58576035... | 0.65907806 | 2 |
download file from server | def download_server_file(hostname,username,password,remote_file,local_file)
Net::SCP.download!(hostname, username, remote_file, local_file, :ssh => { :password => password })
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download\n open(download_url, \"rb\")\n end",
"def download\n\t\tsend_file(params[:path])\n end",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t... | [
"0.8048897",
"0.79085284",
"0.7806977",
"0.7798298",
"0.7795136",
"0.7784914",
"0.7723394",
"0.7707462",
"0.7677759",
"0.7662762",
"0.76559585",
"0.758604",
"0.7578518",
"0.75215286",
"0.7472933",
"0.7463746",
"0.7422779",
"0.7406889",
"0.73621476",
"0.7346558",
"0.73106706",... | 0.6731478 | 99 |
upload file from server | def upload_server_file(hostname,username,password,remote_file,local_file)
Net::SCP.upload!(hostname, username, remote_file, local_file, :ssh => { :password => password })
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file\n #TODO\n end",
"def upload\r\n \r\n end",
"def upload(remote_path, contents)\n end",
"def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end",
"def upload(file, someone)... | [
"0.8092561",
"0.7674807",
"0.7561956",
"0.75126386",
"0.7448915",
"0.7418306",
"0.7418306",
"0.7328556",
"0.73192906",
"0.7302073",
"0.72908854",
"0.72907037",
"0.7287167",
"0.725957",
"0.7214837",
"0.7191229",
"0.7126393",
"0.71184003",
"0.7055871",
"0.70551306",
"0.70431304... | 0.67094576 | 57 |
Actual routine to Update/Downgrade ESX host software | def update_software(ssh_session,hostname,username,password,local_version,depot_version,filename,mode,doaction,depot_url,reboot)
update_available = compare_versions(local_version,depot_version,mode)
if update_available == "y" and mode != "check"
if filename.match(/[A-z]/)
patch_file = File.basename(filename)
depot_dir = "/scratch/downloads"
depot_file = depot_dir+"/"+patch_file
(ssh_session,output) = ssh_session_exec(ssh_session,"mkdir #{depot_dir}")
puts "Copying local file "+filename+" to "+hostname+":"+depot_file
Net::SCP.upload!(hostname, username, filename, depot_file, :ssh => { :password => password })
else
depot_file = depot_url
end
if doaction != "y"
while doaction !~ /y|n/
print "Install update [y,n]: "
doaction = gets.chomp
end
end
if doaction == "y"
puts "Installing "+depot_version+" from "+depot_file
(ssh_session,output) = ssh_session_exec(ssh_session,"esxcli software vib update -d=#{depot_file}")
else
puts "Performing Dry Run - No updates will be installed"
(ssh_session,output) = ssh_session_exec(ssh_session,"esxcli software vib update -d=#{depot_file} --dry-run")
end
puts output
if output.match(/Reboot Required: true/) and reboot == "y"
puts "Rebooting"
(ssh_session,output) = ssh_session_exec(ssh_session,"reboot")
end
end
return ssh_session
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_esxi(hostname,username,password,filename,mode,doaction,depot_url,reboot)\n if $verbose_mode == true\n puts \"Connecting to: \"+hostname\n end\n begin\n Net::SSH.start(hostname, username, :password => password, :verify_host_key => false) do |ssh_session|\n (ssh_session,os_version) = get_... | [
"0.66525567",
"0.6328391",
"0.6041793",
"0.5899714",
"0.585793",
"0.5824168",
"0.5821141",
"0.5797364",
"0.5714601",
"0.56984246",
"0.56775594",
"0.56438196",
"0.56101614",
"0.5597819",
"0.5586436",
"0.55593616",
"0.5558743",
"0.5556639",
"0.55555815",
"0.55443674",
"0.552651... | 0.6313995 | 2 |
Run a command on the server | def control_server(hostname,username,password,command)
if $verbose_mode == true
puts "vSphere Server: "+hostname
puts "vSphere Command: "+command
end
begin
Net::SSH.start(hostname, username, :password => password, :verify_host_key => false) do |ssh_session|
(ssh_session,output) = ssh_session_exec(ssh_session,command)
return output
end
rescue Net::SSH::HostKeyMismatch => host
puts "Existing key found for "+hostname
if doaction != "y"
while doaction !~ /y|n/
print "Update host key [y,n]: "
doaction = gets.chomp
end
end
if doaction == "y"
puts "Updating host key for "+hostname
host.remember_host!
else
exit
end
retry
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(host, command, options = {})\n execute(__method__, host, command, options)\n end",
"def execute(cmd)\n send(*cmd)\n end",
"def run(command)\n execute command\n listen_user\n end",
"def run(command, *args)\n send(command, *args)\n end",
"def exec(command, options={})\n ... | [
"0.7507802",
"0.74974227",
"0.74416643",
"0.74383986",
"0.73961335",
"0.7333973",
"0.73024946",
"0.72134274",
"0.72134274",
"0.7182626",
"0.71493",
"0.7093452",
"0.7063414",
"0.7047557",
"0.70363003",
"0.70356727",
"0.7022871",
"0.6998967",
"0.6998967",
"0.69798595",
"0.69766... | 0.0 | -1 |
Main routing called to Update/Downgrade ESX software | def update_esxi(hostname,username,password,filename,mode,doaction,depot_url,reboot)
if $verbose_mode == true
puts "Connecting to: "+hostname
end
begin
Net::SSH.start(hostname, username, :password => password, :verify_host_key => false) do |ssh_session|
(ssh_session,os_version) = get_os_version(ssh_session)
(ssh_session,local_version) = get_local_version(ssh_session,filename)
(ssh_session,depot_version) = get_depot_version(ssh_session,filename,depot_url,os_version)
exit
ssh_session = update_software(ssh_session,hostname,username,password,local_version,depot_version,filename,mode,doaction,depot_url,reboot)
end
rescue Net::SSH::HostKeyMismatch => host
puts "Existing key found for "+hostname
if doaction != "y"
while doaction !~ /y|n/
print "Update host key [y,n]: "
doaction = gets.chomp
end
end
if doaction == "y"
puts "Updating host key for "+hostname
host.remember_host!
else
exit
end
retry
end
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_upgrade\n run_package_action(:upgrade)\n end",
"def firmware_upgrade(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Firmware Upgrade\" page.\n begin\n @ff.link(:text, 'Firmware Upgrade').click\n self.msg(r... | [
"0.5809121",
"0.55472666",
"0.54537743",
"0.5421024",
"0.5420499",
"0.540168",
"0.53861994",
"0.5367969",
"0.5336378",
"0.5332426",
"0.53279465",
"0.53160745",
"0.53054965",
"0.5287602",
"0.52790993",
"0.52507925",
"0.523152",
"0.5190644",
"0.5177012",
"0.51671827",
"0.515170... | 0.5145805 | 21 |
Get a list of patches in the local repository | def list_local_patches(patchdir)
if File.directory?(patchdir)
file_list = Dir.entries(patchdir)
file_list.each do |local_file|
if local_file.match(/zip$/)
puts local_file
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patches\n 'http://rpm5.org/cvs/patchset?cn=16840'\n end",
"def patches\n \"https://gist.github.com/fredrikw/5858168/raw/e4b5899e781d5707f5c386e436b5fc7810f2010d/ob-2-3-2-patch.diff\"\n end",
"def get_patches(workdir)\n unless @patches.empty?\n patchdir = File.join(workdir, \"patches\")\... | [
"0.7295675",
"0.7124069",
"0.7084951",
"0.70736265",
"0.7040523",
"0.69136405",
"0.68966186",
"0.6857976",
"0.6723834",
"0.6691025",
"0.6627657",
"0.6578715",
"0.6535001",
"0.65340763",
"0.65322006",
"0.6502743",
"0.65011233",
"0.64775395",
"0.6455501",
"0.6425157",
"0.642515... | 0.64927185 | 17 |
Get a list of the available patches on the vmware site and put them into a hash Need to send dropdown box seletions twice to ensure they stick Need to search for button to click via src tag due to malformed HTML | def get_vmware_patch_info(login_url,product_url,username,password,release)
update_list = {}
update = ""
options = Selenium::WebDriver::Firefox::Options.new
options.add_argument('--headless')
driver = Selenium::WebDriver.for :firefox
driver.get(login_url)
driver.find_element(:id => "username").send_keys(username)
driver.find_element(:id => "password").send_keys(password)
driver.find_element(:id => "button-login").click
driver.get(product_url)
driver.find_element(:name => "product").find_element(:css,"option[value='ESXi (Embedded and Installable)']").click
driver.find_element(:name => "product").find_element(:css,"option[value='ESXi (Embedded and Installable)']").click
driver.find_element(:name => "product").find_element(:css,"option[value='ESXi (Embedded and Installable)']").click
driver.find_element(:name => "version").send_keys(release)
driver.find_element(:name => "version").send_keys(release)
driver.find_element(:xpath,"//*[@src='/patchmgr/resources/images/support_search_button.gif']").click
page = driver.page_source
page = Nokogiri::HTML.parse(page)
info = page.css("span").css("input")
info.each do |download|
value = download["value"]
if !value.match(/http/)
update = value
else
if value.match(/ESX/)
update_list[update] = value
end
end
end
return update_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patches\n { :p0 =>\n \"https://trac.macports.org/export/90549/trunk/dports/shells/pdksh/files/patch-siglist.sh.diff\"\n }\n end",
"def patches\n 'http://rpm5.org/cvs/patchset?cn=16840'\n end",
"def patches\n {:p0 => [\n 'https://trac.macports.org/export/yeah/we/often/steal/a/patch.diff',\... | [
"0.6606082",
"0.65096223",
"0.6361676",
"0.6087836",
"0.5940204",
"0.5936022",
"0.5855564",
"0.58265173",
"0.5729929",
"0.5705728",
"0.5624776",
"0.55520815",
"0.5550643",
"0.55493456",
"0.5545869",
"0.55401194",
"0.5497746",
"0.54522884",
"0.5424221",
"0.5422096",
"0.539403"... | 0.6371663 | 2 |
Process the hash of patches returned from the VMware site and check they are in the local repository, if the download option is given download the patches if they are not in the local repository | def process_vmware_patch_info(patch_list,download,patchdir)
patch_list.each do |patch_no, patch_url|
puts "Update: "+patch_no
puts "Download: "+patch_url
local_file = patch_url.split(/\?/)[0]
local_file = File.basename(local_file)
local_file = patchdir+"/"+local_file
missing = "n"
if File.exist?(local_file)
puts "Present: "+local_file
missing = "n"
else
puts "Missing: "+local_file
missing = "y"
end
if download == "y" and missing == "y"
%x[wget "#{patch_url}" -O "#{local_file}"]
end
end
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n fetch unless exist?\n return unless has_patches?\n dont_debug { patched_location.rmtree if patched_location.exist? } # Make sure that no previous patched copy exists\n dont_debug { @local_path.ditto patched_location }\n @local_path = patched_location\n # Download patches\n... | [
"0.63793683",
"0.60227096",
"0.59161913",
"0.58101416",
"0.57832694",
"0.5757501",
"0.5742843",
"0.56581795",
"0.5619128",
"0.5588215",
"0.55691946",
"0.55411917",
"0.54587364",
"0.54585236",
"0.5439132",
"0.53890103",
"0.538286",
"0.5326587",
"0.53188217",
"0.5308764",
"0.52... | 0.7595301 | 0 |
Update ESX password file | def update_esx_passwd_file(esx_hostname,esx_username,esx_password)
esx_passwd_file = Dir.home+"/.esxpasswd"
FileUtils.touch(esx_passwd_file)
File.chmod(0600,esx_passwd_file)
output_text = esx_hostname+":"+esx_username+":"+esx_password
File.open(esx_passwd_file, 'a') { |file| file.write(output_text) }
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_legacy\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n begin\n File.open(password_hash_file, 'w') { |f| f.write(resource[:password_sha1])}\n rescue Errno::EACCES => detail\n raise(\"Could not write to password hash file: #... | [
"0.6768886",
"0.6590949",
"0.62284476",
"0.62039435",
"0.6147517",
"0.612656",
"0.6112074",
"0.60669583",
"0.602999",
"0.59805864",
"0.5935827",
"0.59078074",
"0.58873576",
"0.5859276",
"0.583886",
"0.58231294",
"0.5817646",
"0.5811424",
"0.57976913",
"0.5787691",
"0.5774321"... | 0.8247754 | 0 |
If a ~/,esxpasswd doesn't exist ask for details | def get_esx_details(esx_hostname)
esx_passwd_file = Dir.home+"/.esxpasswd"
esx_host_found = false
esx_info_change = false
if !File.exist?(esx_passwd_file)
esx_username = get_esx_username()
esx_password = get_esx_password()
update_esx_passwd_file(esx_hostname,esx_username,esx_password)
else
esx_data = File.readlines(esx_passwd_file)
esx_data.each do |line|
line.chomp
if line.match(/^#{esx_hostname}:/)
esx_host_found = true
esx_details = line.split(/:/)
esx_username = esx_details[1]
if esx_username !~/[A-Z]|[a-z]/
esx_username = get_esx_username()
esx_info_change = true
end
esx_password = esx_details[2]
if esx_password !~/[A-Z]|[a-z]|[0-9]/
esx_password = get_esx_password()
esx_info_change = true
end
if esx_info_change == true
update_esx_passwd_file(esx_hostname,esx_username,esx_password)
end
end
end
if esx_host_found == false
esx_username = get_esx_username()
esx_password = get_esx_password()
update_esx_passwd_file(esx_hostname,esx_username,esx_password)
end
end
return esx_username,esx_password
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crack_user(host)\n\tFile.open($userlist, 'r').each_line do |u|\n\t\tu=u.strip\n\t\tFile.open($passwdlist, 'r').each_line do |p|\n\t\t\tp=p.strip\n\t\t\tbegin\n\t\t\t\tputs \"\\e[1;33m[-]\\e[00m trying user: #{u} - password: #{p}\" if $debugFlag\n\t\t\t\tNet::SSH.start(host,u, :password => p)\n\t\t\trescue Net:... | [
"0.60456973",
"0.5992189",
"0.5891593",
"0.57796997",
"0.57780105",
"0.57780105",
"0.5681908",
"0.561676",
"0.5490022",
"0.54736865",
"0.5465857",
"0.5455261",
"0.54518276",
"0.5450844",
"0.5450844",
"0.5428254",
"0.54176694",
"0.5380144",
"0.5377673",
"0.53582704",
"0.535736... | 0.6798888 | 0 |
ready only attr_writer (write only) attr_accessor (read and write) | def initialize(title, author)
@title = title
@author = author
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_... | [
"0.73332155",
"0.72241217",
"0.72119504",
"0.716963",
"0.713116",
"0.6865538",
"0.6812521",
"0.6812521",
"0.6812521",
"0.67368287",
"0.6663339",
"0.66309774",
"0.6614178",
"0.6563606",
"0.65452665",
"0.65031856",
"0.6456601",
"0.645083",
"0.6447228",
"0.6440242",
"0.6440242",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_personaje
@personaje = Personaje.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def personaje_params
params.require(:personaje).permit(:imagen, :nombre, :edad, :peso, :historia)
#params.fetch(:personaje, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
artificial attributes that must be created before save. | def tinyfyurl
self.tinyurl = Tools.tinyfy(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def create_attributes\n {}\n end"... | [
"0.68925554",
"0.68925554",
"0.6885348",
"0.6882935",
"0.68119055",
"0.67902714",
"0.66948843",
"0.66320986",
"0.6621393",
"0.65784454",
"0.65784454",
"0.65784454",
"0.65784454",
"0.65784454",
"0.65784454",
"0.65784454",
"0.65784454",
"0.65651304",
"0.64928913",
"0.64744014",
... | 0.0 | -1 |
from URL obtain metatag data, and store. | def store_metadata
html = HTMLParse.new(url)
self.meta_title = html.title
self.meta_desc = html.desc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(url)\n response = Curl::Easy.http_get(url)\n results = parse_seo(response.body_str)\n results.update({\n :url => url,\n :robots => extract_robots(url),\n :headers => response.headers,\n :cookies => response.cookies,\n :size => response.downloaded_bytes,\n :... | [
"0.6174685",
"0.6101482",
"0.607088",
"0.5932842",
"0.591747",
"0.59161",
"0.5874031",
"0.586488",
"0.58348334",
"0.58348334",
"0.5807356",
"0.5662974",
"0.564846",
"0.56435573",
"0.56109995",
"0.55952114",
"0.55745655",
"0.55598783",
"0.55527395",
"0.5537637",
"0.55299675",
... | 0.75018334 | 0 |
The generated barcode used for automated checkin | def barcode(args={})
self.bare_barcode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ismn\n generate_barcode('barcode.ismn')\n end",
"def barcode\n return if not_registered\n barcode_string.to_i(2)\n end",
"def barcode_generator\n require 'barby'\n require 'barby/barcode/code_128'\n require 'barby/outputter/png_outputter'\n\n code = @package.barcode_pac... | [
"0.78083724",
"0.77648854",
"0.75469685",
"0.7435509",
"0.7360646",
"0.73502994",
"0.72460145",
"0.7240317",
"0.7157903",
"0.7040166",
"0.69575834",
"0.6932808",
"0.69248056",
"0.6830992",
"0.6793209",
"0.6610214",
"0.657214",
"0.6559031",
"0.6543408",
"0.6520329",
"0.6493342... | 0.7449982 | 3 |
The generated code used for automated checkin | def login_code
self.login.login
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkin\n end",
"def generate_checkin_code\n source = \"RE|#{self.current_alias}|#{Time.now.to_i}\"\n login_code = sprintf \"%08x\", Zlib.crc32(source)\n return login_code\n end",
"def generate; end",
"def generate; end",
"def generate_checkincode\n sai_words = %w(sisters chapter formal... | [
"0.64497983",
"0.6398794",
"0.6244429",
"0.6244429",
"0.6181258",
"0.60924125",
"0.60635114",
"0.596848",
"0.588558",
"0.5821951",
"0.5812581",
"0.575955",
"0.5698439",
"0.56957746",
"0.5676196",
"0.56759465",
"0.5673174",
"0.56541353",
"0.56408405",
"0.5629051",
"0.5604887",... | 0.0 | -1 |
Generate a sufficiently unique checkin code short enough to type, but not just straight current_alias (which can change) | def generate_checkin_code
source = "RE|#{self.current_alias}|#{Time.now.to_i}"
login_code = sprintf "%08x", Zlib.crc32(source)
return login_code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_checkincode\n sai_words = %w(sisters chapter formal music business sigma alpha iota)\n sai_words[rand(sai_words.length)]+(rand(89)+10).to_s()\n end",
"def generate_unique_code\n begin\n new_code = generate_code(self.code_length)\n end until !active_code?... | [
"0.622695",
"0.59114957",
"0.5903624",
"0.5775091",
"0.56575453",
"0.5550682",
"0.55433756",
"0.55230457",
"0.5509584",
"0.55059433",
"0.54821604",
"0.5474405",
"0.5436239",
"0.5419366",
"0.54062474",
"0.53470236",
"0.5328191",
"0.53209364",
"0.53197235",
"0.52974904",
"0.528... | 0.66330826 | 0 |
Does this client have unresolved flags? | def is_flagged?
return self.flags.unresolved.count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_flags; end",
"def complain_about_bad_flags?\n @complain_about_bad_flags\n end",
"def flags?\n !@flags.empty?\n end",
"def not_found?\n @flags.empty?\n end",
"def complete_flags?\n @complete_flags\n end",
"def complain_about_bad_flags!\n @complain_ab... | [
"0.6988277",
"0.68872935",
"0.6623877",
"0.6539396",
"0.65055525",
"0.640846",
"0.63605106",
"0.6290086",
"0.6133121",
"0.6072967",
"0.60640377",
"0.60420805",
"0.6018637",
"0.6001679",
"0.6001679",
"0.6001679",
"0.5991963",
"0.5991963",
"0.5975472",
"0.5973324",
"0.5973324",... | 0.6907298 | 1 |
Can this client make purchases? | def can_shop?
if self.flags.unresolved.where(can_shop: false).count > 0
return false
end
return true unless self.has_shopped?
now = Time.now
if self.last_shopped_at < now.beginning_of_week
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_request_purchase?\n true # TODO: Should this be !virginia_borrower? ?\n end",
"def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #User... | [
"0.74240476",
"0.70387715",
"0.6922657",
"0.68380684",
"0.67637026",
"0.6739366",
"0.6684861",
"0.6669302",
"0.6665087",
"0.6576154",
"0.65721023",
"0.6555109",
"0.65437436",
"0.6513454",
"0.65067005",
"0.65059936",
"0.64887357",
"0.64811015",
"0.6472341",
"0.64200276",
"0.63... | 0.0 | -1 |
Should this client be blocked from entry? | def is_blocked?
return self.flags.unresolved.where(is_blocking: true).count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blocked?\n false\n end",
"def blocked?\n (status == BLOCKED)\n end",
"def blocking?\n false\n end",
"def blocked?\n @blocked\n end",
"def blocked?(subscriber)\n false\n end",
"def non_blocking?()\n #This is a stub, used for indexing\n end",
"def blocked?\n !self... | [
"0.7482291",
"0.71099275",
"0.68098223",
"0.6749615",
"0.662777",
"0.6522422",
"0.64686304",
"0.64324415",
"0.6359309",
"0.6326081",
"0.62449586",
"0.6242677",
"0.6232747",
"0.6217804",
"0.6214055",
"0.6178594",
"0.6173756",
"0.61455667",
"0.61196333",
"0.6085783",
"0.6063759... | 0.6349683 | 9 |
Have I ever shopped? | def has_shopped?
self.points_entries.purchases.count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_shop?\n if self.flags.unresolved.where(can_shop: false).count > 0\n return false\n end\n\n return true unless self.has_shopped?\n\n now = Time.now\n if self.last_shopped_at < now.beginning_of_week\n return true\n end\n\n return false\n end",
"def bought?\n # paym\n end... | [
"0.70499337",
"0.69857574",
"0.6858565",
"0.6741924",
"0.6687104",
"0.66203624",
"0.6579179",
"0.65571296",
"0.6555076",
"0.65266746",
"0.6443979",
"0.6423447",
"0.6422633",
"0.6394627",
"0.6384813",
"0.6374675",
"0.6344562",
"0.63122886",
"0.62974584",
"0.6256082",
"0.620670... | 0.7291975 | 0 |
When was my last completed shopping trip? | def last_shopped_at
if self.has_shopped?
self.points_entries.purchases.last.performed_on.to_time
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_checkin; end",
"def last_invoiced\n processed_orders.last.try(:Created)\n end",
"def getTripPlannedTime()\n return @tripPlannedTimeList.last() ;\n end",
"def lead_time\n if completed_at\n completed_at - created_at\n else\n 0.0\n end\n end",
"def recent_goal_item... | [
"0.65681773",
"0.64122885",
"0.6399062",
"0.6307167",
"0.62673575",
"0.62419176",
"0.62371075",
"0.6223866",
"0.62141496",
"0.6183026",
"0.61499757",
"0.61396235",
"0.61258197",
"0.6118555",
"0.6091903",
"0.6063084",
"0.60464305",
"0.60464305",
"0.60464305",
"0.60464305",
"0.... | 0.72360545 | 0 |
Renders the specified template as ERB using the options. Options: locals:: a hash of local variables used in the template The filename used to identify errors in an erb template to a specific | def render(path, options={})
# render template
template = File.read(path)
# assign locals to the render binding
# this almost surely may be optimized...
locals = options[:locals]
binding = empty_binding
locals.each_pair do |key, value|
@assignment_value = value
eval("#{key} = remove_instance_variable(:@assignment_value)", binding)
end if locals
erb = ERB.new(template, nil, "<>")
erb.filename = path
erb.result(binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _render_template(options); end",
"def _render_template(options); end",
"def render_template(options)\n @assigns_added = nil\n template, layout, partial = options.values_at(:_template, :_layout, :_partial)\n _render_template(template, layout, options, partial)\n end",
"def render_templat... | [
"0.72688437",
"0.72688437",
"0.7212902",
"0.72050226",
"0.71687865",
"0.7027697",
"0.6986233",
"0.69515795",
"0.69263417",
"0.68715835",
"0.6814399",
"0.67708087",
"0.6755984",
"0.67473114",
"0.6736381",
"0.67206895",
"0.6676382",
"0.6656536",
"0.66188544",
"0.66144025",
"0.6... | 0.7282986 | 0 |
Dumps the object to io using obj.inspect | def dump(obj, io)
template_path = env.class_path(dir, obj, path) do |file|
File.file?(file)
end
unless template_path
raise "no template for: #{obj.class}"
end
io.puts render(template_path, :locals => {:obj => obj})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump(obj, io)\n io.puts obj.send(inspect_method)\n end",
"def inspect() \"~#{@obj.inspect}~\" ; end",
"def dump(object)\n adapter_dump(object)\n end",
"def dump( obj, &block )\n f = File.open( get_unique_filename, 'w' )\n\n serialized = serialize( obj )\n ... | [
"0.9052849",
"0.723121",
"0.70513",
"0.6994065",
"0.6978458",
"0.69686025",
"0.69068086",
"0.6860474",
"0.6770501",
"0.6759573",
"0.66596913",
"0.66033256",
"0.6548236",
"0.65401155",
"0.65371966",
"0.6531837",
"0.6531837",
"0.6519755",
"0.6519755",
"0.65000767",
"0.64788514"... | 0.70533353 | 2 |
Generates an empty binding to self without any locals assigned. | def empty_binding # :nodoc:
binding
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_binding\n Object.new.instance_exec { binding }\n end",
"def nilBinding; ProcFactory.new.create.binding end",
"def generate_binding(a_binding=binding)\n a_binding.local_variables do |local_var|\n a_binding.local_variable_set local_var, nil\n end\n @bound_procs.each_with_i... | [
"0.83416456",
"0.70997685",
"0.6844097",
"0.65755594",
"0.62122905",
"0.62122905",
"0.61568123",
"0.61568123",
"0.6146589",
"0.59061044",
"0.5897088",
"0.58058435",
"0.5760215",
"0.5738878",
"0.56849694",
"0.5683088",
"0.56639934",
"0.56571686",
"0.5646038",
"0.5616761",
"0.5... | 0.8047649 | 1 |
Do not instantiate directly. This is an abstract base class from which all other manager classes should subclass, and call super within their own constructors. The possible options to the constructor are: subscription_id Your Azure subscription ID. If no subscription is specifified, then information for all subscriptions will be collected. resource_group The resource group within the subscription. If no resource group is specified, then information for all resource groups will be gathered. client_id Your Azure client ID. Mandatory. client_key The key (secret) for your client ID. Mandatory. tenant_id Your Azure tenant ID. Mandatory. api_version The REST API version to use for internal REST calls. The default is '20150101'. You will typically not set this as it could cause breakage. | def initialize(options = {})
# Mandatory params
@client_id = @@client_id || options.fetch(:client_id)
@client_key = @@client_key || options.fetch(:client_key)
@tenant_id = @@tenant_id || options.fetch(:tenant_id)
# Optional params
@subscription_id = @@subscription_id || options[:subscription_id]
@resource_group = @@resource_group || options[:resource_group]
@api_version = @@api_version || options[:api_version] || '2015-01-01'
@grant_type = @@grant_type || options[:grant_type] || 'client_credentials'
# The content-type used for all internal http requests
@content_type = @@content_type || 'application/json'
# Call the get_token method to set this.
@token = @@token || options[:token]
# Base URL used for REST calls. Modify within method calls as needed.
@base_url = Azure::Armrest::RESOURCE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @tenantId = MyAzure.get_tenant_id\n @clientId = MyAzure.get_client_id\n @clientSecret = MyAzure.get_client_secret\n \n # Generate bearer token.\n @bearerToken = auth_bearer_aad\n ... | [
"0.7391691",
"0.73246986",
"0.70433754",
"0.69876564",
"0.6951663",
"0.69485605",
"0.6931709",
"0.6845692",
"0.6821664",
"0.67048615",
"0.666662",
"0.666662",
"0.6651363",
"0.66056335",
"0.65894216",
"0.65845543",
"0.65259975",
"0.6510582",
"0.6497767",
"0.64946705",
"0.64865... | 0.8349037 | 0 |
Gets an authentication token, which is then used for all other methods. This will also set the subscription_id to the first subscription found if you did not set it in the constructor. If you did not call the the ArmrestManager.configure method then you must call this before calling any other methods. | def get_token
return self if @@token || @token
token_url = Azure::Armrest::AUTHORITY + @tenant_id + "/oauth2/token"
resp = RestClient.post(
token_url,
:grant_type => @grant_type,
:client_id => @client_id,
:client_secret => @client_key,
:resource => Azure::Armrest::RESOURCE
)
@token = 'Bearer ' + JSON.parse(resp)['access_token']
@@token = @token
unless @subscription_id
@subscription_id = subscriptions.first['subscriptionId']
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_authentication_token\n self.authentication_token = generate_authentication_token\n end",
"def auth_token\n AuthToken.new payload: { sub: user.id }\n end",
"def get_auth_token(path, subscription_key)\n headers = {\n \"Ocp-Apim-Subscription-Key\": subscription_key\n }\n ... | [
"0.68266743",
"0.6813067",
"0.66928357",
"0.66182894",
"0.6539477",
"0.650867",
"0.6485337",
"0.6459727",
"0.6459727",
"0.64556587",
"0.6444068",
"0.6437173",
"0.6425329",
"0.63804656",
"0.63802385",
"0.6376763",
"0.63285744",
"0.6327681",
"0.63082933",
"0.6268479",
"0.626236... | 0.7985378 | 0 |
Returns a list of the available resource providers. | def providers
url = url_with_api_version(@base_url, 'providers')
resp = rest_get(url)
JSON.parse(resp.body)["value"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suitable_providers\n return @suitable_providers if @suitable_providers\n @suitable_providers = []\n [\n @resource.class.defaultprovider,\n @resource.class.suitableprovider,\n ].flatten.uniq.each do |provider_class|\n if service_provider_enabled? provider_class\n @suitable_... | [
"0.7911249",
"0.7860005",
"0.76218224",
"0.7482208",
"0.7421391",
"0.7335711",
"0.72909695",
"0.71703285",
"0.71406937",
"0.7028185",
"0.6966724",
"0.6925868",
"0.6868146",
"0.6841431",
"0.66528744",
"0.662752",
"0.66228336",
"0.64284354",
"0.64284354",
"0.6350045",
"0.634739... | 0.7867028 | 1 |
Returns a list of subscriptions for the tenant. | def subscriptions
url = url_with_api_version(@base_url, 'subscriptions')
resp = rest_get(url)
JSON.parse(resp.body)["value"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def subscriptions\n ::Syncano::QueryBuilder.new... | [
"0.8075315",
"0.77875173",
"0.77151656",
"0.7529095",
"0.74096155",
"0.7292884",
"0.72880816",
"0.72692645",
"0.72611177",
"0.7203803",
"0.71848273",
"0.71765417",
"0.7112571",
"0.70355886",
"0.69495726",
"0.69301724",
"0.68974406",
"0.6867643",
"0.6729529",
"0.6640842",
"0.6... | 0.72969097 | 5 |
Return information for the specified subscription ID, or the subscription ID that was provided in the constructor if none is specified. | def subscription_info(subscription_id = @subscription_id)
url = url_with_api_version(@base_url, 'subscriptions', subscription_id)
resp = rest_get(url)
JSON.parse(resp.body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end",
"def read_subscription(subscription_id)\n raise NotImplementedError\n end",
"def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end",
"def read_subscription(subscripti... | [
"0.73136383",
"0.7286895",
"0.7253292",
"0.7231049",
"0.71079975",
"0.69544023",
"0.6708797",
"0.6588019",
"0.6585168",
"0.6549681",
"0.65456563",
"0.64765424",
"0.6469702",
"0.6468537",
"0.6403395",
"0.6399219",
"0.63667846",
"0.6347806",
"0.6339541",
"0.62984216",
"0.628803... | 0.7170185 | 4 |
Returns a list of resource groups for the given subscription. | def resource_groups(subscription_id = @subscription_id)
url = url_with_api_version(@base_url, 'subscriptions', subscription_id, 'resourcegroups')
resp = rest_get(url)
JSON.parse(resp.body)["value"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_groups\n @client.resource_groups.list\n end",
"def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end",
"def subscriber_groups(identifier)\n connection.get(\"subscribers/#{identifier}/groups\")\n end",
"def resource_groups\n retur... | [
"0.67134786",
"0.6640033",
"0.66386193",
"0.65129876",
"0.62544453",
"0.60759974",
"0.605129",
"0.60438037",
"0.5943117",
"0.5894926",
"0.5860366",
"0.5860366",
"0.57391924",
"0.5669349",
"0.5658725",
"0.5658725",
"0.56570566",
"0.56334573",
"0.5608563",
"0.55772406",
"0.5566... | 0.84246725 | 0 |
Returns information the specified resource group, or the resource group specified in the constructor if none is provided. | def resource_group_info(resource_group = @resource_group)
url = url_with_api_version(@base_url, 'subscriptions', subscription_id, 'resourcegroups', resource_group)
resp = rest_get(url)
JSON.parse(resp.body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_resource\n return @group_resource if @group_resource\n @group_resource = Chef::Resource::Group.new(new_resource.group, run_context)\n @group_resource\n end",
"def display_resource(group)\n \"Group ##{group.to_param}\"\n end",
"def get(group)\n url = build_url(group)\n ... | [
"0.69005996",
"0.6860535",
"0.67563236",
"0.64519167",
"0.6429085",
"0.63841504",
"0.62808853",
"0.6209031",
"0.6096868",
"0.60373086",
"0.6027299",
"0.6011708",
"0.5996558",
"0.59907746",
"0.5965093",
"0.5955016",
"0.59446543",
"0.5940443",
"0.5916476",
"0.5916476",
"0.58935... | 0.696795 | 0 |
Take an array of URI elements and join the together with the API version. | def url_with_api_version(*paths)
path = File.join(*paths) << "?api-version=#{api_version}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_version_url(version)\n\t\turl_parts = self.url.split(\"-\")\n\t\tunless url_parts.size < 3\n\t\t\tcase version\n\t\t\twhen \"major\"\n\t\t\t\turl_parts[url_parts.size - 2] = self.maj_version += 1\n\t\t\twhen \"minor\" \n\t\t\t\turl_parts[url_parts.size - 1] = self.min_version += 1\n\t\t\tend\n\t\telse\n\t\... | [
"0.6210689",
"0.61557657",
"0.59607565",
"0.58612424",
"0.583276",
"0.5746455",
"0.5718169",
"0.57037187",
"0.56993985",
"0.5654009",
"0.5562935",
"0.55245996",
"0.55095744",
"0.55052745",
"0.54675126",
"0.54003066",
"0.5381432",
"0.53613436",
"0.5339341",
"0.53314644",
"0.52... | 0.625198 | 0 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.schedule_mailer.new_schedule_notification.subject | def new_schedule_notification(schedule)
@schedule = schedule
mail to: schedule.person.email, subject: "Your new schedule : #{schedule.service.name} - #{schedule.role.name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_subject=(value)\n @message_subject = value\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject\n self['subject'] ||... | [
"0.7066224",
"0.700163",
"0.6967742",
"0.6912564",
"0.677285",
"0.67610115",
"0.6743959",
"0.67354757",
"0.66398466",
"0.6631659",
"0.66225886",
"0.65291214",
"0.65042686",
"0.6492185",
"0.6395706",
"0.63807493",
"0.63807493",
"0.63807493",
"0.63807493",
"0.63738674",
"0.6373... | 0.6423881 | 14 |
returns true if the identity can access the location through its group_memberships | def accessible_by?(identity_id)
group_ids = GroupMembership.where(identity_id: identity_id).map(&:group_id)
!GroupLocation.where('location_id = ? AND group_id in (?)', self.id, group_ids).limit(1).empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_permission(location)\n if @logged_in_user.is_admin?\n return true\n end\n if not @logged_in_user.nil?\n groups = @logged_in_user.groups\n groups.each do |g|\n g.rights.detect {|right| \n if right.area == location\n return true\n ... | [
"0.7511494",
"0.7321334",
"0.687715",
"0.68630403",
"0.6852648",
"0.67852694",
"0.6689118",
"0.66299313",
"0.6532759",
"0.65260315",
"0.6422895",
"0.6416161",
"0.6412766",
"0.6303084",
"0.6268809",
"0.62505734",
"0.6238906",
"0.6233635",
"0.6192032",
"0.6162623",
"0.6158002",... | 0.76691765 | 0 |
Returns true if the current user is following the other user. | def reporting?(other_position)
reporting.include?(other_position)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n ... | [
"0.8531212",
"0.8511795",
"0.8511795",
"0.8511795",
"0.84812903",
"0.84812903",
"0.84812903",
"0.84812903",
"0.84237736",
"0.84133893",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
"0.83408505",
... | 0.0 | -1 |
For example, give the letter (p,o) and length of 3, produce the following output(in any order you want, not just my example order): ppp ppo poo pop opp opo oop ooo another example would be given (a,b) and length 2: ab aa bb ba | def print_perms(letters, length, current_perm="")
if current_perm.size == length
puts current_perm
else
letters.each do |letter|
print_perms(letters, length, current_perm + letter)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_letters( length )\n ('A'..'Z').to_a.sample( length ).join\n end",
"def sort3(strings, length)\n (length - 1).downto(0) do |i|\n buckets = Array.new(26) { [] }\n strings.each do |string|\n letter = string[i]\n buckets[letter.ord - \"a\".ord] << string\n end\n\n strings = []... | [
"0.6337036",
"0.6318054",
"0.61028737",
"0.60700434",
"0.606004",
"0.60472155",
"0.5978337",
"0.5961633",
"0.59573275",
"0.59304565",
"0.5926839",
"0.5919337",
"0.5908232",
"0.58919215",
"0.5880907",
"0.58797646",
"0.5857994",
"0.5848376",
"0.5837844",
"0.5833082",
"0.5827839... | 0.6151954 | 2 |
GET /baths GET /baths.json def lat | def home
@baths= Bath.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locations\n @client.get('/BikePoint')\n end",
"def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] ... | [
"0.6722877",
"0.6542949",
"0.65039796",
"0.64637846",
"0.64497703",
"0.64225566",
"0.63297534",
"0.6320258",
"0.6306818",
"0.6278679",
"0.6258798",
"0.6219768",
"0.6163303",
"0.61466426",
"0.6124698",
"0.60830575",
"0.6054126",
"0.5966692",
"0.596348",
"0.59355384",
"0.593185... | 0.0 | -1 |
GET /baths/1 GET /baths/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { re... | [
"0.66234994",
"0.6480573",
"0.64239186",
"0.63437206",
"0.6329771",
"0.6294864",
"0.6269025",
"0.62613773",
"0.6246213",
"0.62302166",
"0.61860824",
"0.61698484",
"0.6140966",
"0.6140966",
"0.6121232",
"0.61051756",
"0.6098193",
"0.6083659",
"0.59948486",
"0.5990519",
"0.5970... | 0.0 | -1 |
POST /baths POST /baths.json | def create
@bath = Bath.new(bath_params)
respond_to do |format|
if @bath.save
format.html { redirect_to @bath, notice: 'Bath was successfully created.' }
format.json { render :show, status: :created, location: @bath }
else
format.html { render :new }
format.json { render json: @bath.errors, status: :unprocessable_entity }
end
# redirect_to root_path(lat: @lat)
# redirect_to root_path(lon: @lon)
end
# if lat = Bath.authenticate(params[:lat])
# session[:lat] = lat.id
# redirect_to root_url
# end
# if lon = Bath.authenticate(params[:lon])
# session[:lon] = lon.id
# redirect_to root_url
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bath_params\n params.require(:bath).permit(:name, :lat, :lon, :clean, :handicapped, :near, :supplies)\n end",
"def create\n @bathroom = Bathroom.new(bathroom_params.except(:stalls))\n num_stalls = bathroom_params[:stalls].to_i\n\n respond_to do |format|\n if @bathroom.save\n (0..... | [
"0.62531585",
"0.61091125",
"0.6097368",
"0.60010916",
"0.5998295",
"0.5869956",
"0.5817903",
"0.57387155",
"0.57075244",
"0.5507706",
"0.54544336",
"0.54441226",
"0.54238147",
"0.54213744",
"0.5418949",
"0.5378204",
"0.53703755",
"0.5361459",
"0.53613716",
"0.53610915",
"0.5... | 0.6112568 | 1 |
PATCH/PUT /baths/1 PATCH/PUT /baths/1.json | def update
respond_to do |format|
if @bath.update(bath_params)
format.html { redirect_to @bath, notice: 'Bath was successfully updated.' }
format.json { render :show, status: :ok, location: @bath }
else
format.html { render :edit }
format.json { render json: @bath.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @bounty.u... | [
"0.6706215",
"0.6553027",
"0.64037347",
"0.63753486",
"0.6347375",
"0.62899774",
"0.62549984",
"0.62536937",
"0.6246279",
"0.6246279",
"0.6246279",
"0.62150705",
"0.62150705",
"0.61714995",
"0.6154515",
"0.6141454",
"0.6140306",
"0.6138284",
"0.61379",
"0.61335886",
"0.610786... | 0.7200796 | 0 |
DELETE /baths/1 DELETE /baths/1.json | def destroy
@bath.destroy
respond_to do |format|
format.html { redirect_to baths_url, notice: 'Bath was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete path\n make_r... | [
"0.6944753",
"0.6924554",
"0.6819134",
"0.6680867",
"0.667135",
"0.6668269",
"0.6627257",
"0.6623494",
"0.66123474",
"0.6604807",
"0.6604696",
"0.6604696",
"0.6561852",
"0.65612125",
"0.65564895",
"0.6534128",
"0.6534128",
"0.6534128",
"0.6534128",
"0.65328044",
"0.65132385",... | 0.7295414 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bath
@bath = Bath.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def bath_params
params.require(:bath).permit(:name, :lat, :lon, :clean, :handicapped, :near, :supplies)
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.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
There is a 'git' gem, but I didn't want to figure out how to call it to get the functionality I needed. The following methods were first tested on the command line, and originally came from this blog post: find git branches whose latest commit hasn't been checked into svn | def local_branches(repo_path)
result = []
`(cd "#{repo_path}" && git branch | cut -c3-)`.split("\n").each do |branch|
result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def branches_containing_commit(commit_ref); end",
"def branches_containing_commit(commit_ref); end",
... | [
"0.7183806",
"0.6947454",
"0.6946321",
"0.6825869",
"0.67499006",
"0.67458063",
"0.6572372",
"0.64593273",
"0.640996",
"0.6403035",
"0.6381615",
"0.6335782",
"0.6313428",
"0.62977266",
"0.62781626",
"0.62755996",
"0.626448",
"0.62020683",
"0.61985856",
"0.61875004",
"0.618624... | 0.68443775 | 3 |
return the git commit sha for the newest commit that has been checked into svn | def newest_svn_commit_on_branch(repo_path, branch)
`(cd "#{repo_path}" && git rev-list -n1 #{branch} --grep=git-svn-id:)`.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_commit(js_name)\n sha1 = `git log --pretty=%H -1 #{js_name}` \nend",
"def sha\n @commit.sha\n end",
"def find_svn_rev_for_commit(repo_path, commit)\n `(cd \"#{repo_path}\" && git svn find-rev #{commit})`.strip\n end",
"def git_current_commit_sha\n `git rev-parse HEAD`\n end",
... | [
"0.7696653",
"0.76744074",
"0.7551928",
"0.7449641",
"0.743757",
"0.7383907",
"0.7371201",
"0.73378253",
"0.7314951",
"0.7296915",
"0.71597695",
"0.7139703",
"0.7138473",
"0.7134743",
"0.70930326",
"0.7085833",
"0.70815927",
"0.7063487",
"0.704865",
"0.7017823",
"0.69880605",... | 0.7582864 | 2 |
return the svn revision number corresponding to a git commit sha | def find_svn_rev_for_commit(repo_path, commit)
`(cd "#{repo_path}" && git svn find-rev #{commit})`.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revision(revision)\n revision = 'HEAD' if revision =~ /head/i\n \"`#{git_cmd} rev-parse #{revision}`\"\n end",
"def fetch_revision(commit)\n `git rev-parse #{commit}`.tr(\"\\n\", '')\n end",
"def find_commit_for_svn_rev(repo_path, svn_rev, base_branch)\n `(cd \"#{repo_path}\" && git rev-list ... | [
"0.78587484",
"0.77503794",
"0.77395904",
"0.7575406",
"0.7500504",
"0.7492109",
"0.7427374",
"0.7410837",
"0.7344839",
"0.7235199",
"0.7228235",
"0.71098506",
"0.7091305",
"0.7031823",
"0.7021273",
"0.7011295",
"0.7010571",
"0.7004014",
"0.6969621",
"0.6905622",
"0.69032466"... | 0.80990005 | 0 |
return the git commit sha for the commit corresponding to an svn revision | def find_commit_for_svn_rev(repo_path, svn_rev, base_branch)
`(cd "#{repo_path}" && git rev-list #{base_branch} --grep="git-svn-id:.*@#{svn_rev}")`.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_svn_rev_for_commit(repo_path, commit)\n `(cd \"#{repo_path}\" && git svn find-rev #{commit})`.strip\n end",
"def sha\n @commit.sha\n end",
"def fetch_svn_commit(rev)\n url_str = bot.config['svn_root_url']\n commit = []\n begin\n @log.info \"checking #{url_str} for new commit.... | [
"0.7888736",
"0.7447012",
"0.72738856",
"0.7197159",
"0.71878743",
"0.7164911",
"0.7125586",
"0.7089789",
"0.70773655",
"0.7068989",
"0.69525796",
"0.69286704",
"0.69218904",
"0.6921712",
"0.6917458",
"0.6888482",
"0.6878429",
"0.68636173",
"0.6829889",
"0.6818481",
"0.678571... | 0.78552854 | 1 |
create a branch on a git repo from a certain git commit and checkout that branch | def create_branch_and_checkout(repo_path, commit, branch)
`(cd "#{repo_path}" && git checkout -b #{branch} #{commit})`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def create_branch(branch)\n client.create_ref rep... | [
"0.7719875",
"0.73987097",
"0.72941196",
"0.7197268",
"0.7133667",
"0.70893675",
"0.7068334",
"0.6961461",
"0.69613343",
"0.6935615",
"0.68808067",
"0.6828167",
"0.6816667",
"0.6786742",
"0.67224556",
"0.6702633",
"0.6700605",
"0.659341",
"0.6482469",
"0.6476167",
"0.6439064"... | 0.86425835 | 0 |
return a patch containing every commit in a branch on a repo, starting from a certain commit | def create_patch(repo_path, commit, branch)
`(cd "#{repo_path}" && git format-patch --stdout #{commit}..#{branch})`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_patch(repo_path, patch)\n `(cd \"#{repo_path}\" && echo #{patch} | git am)`\n end",
"def copy_branch_commits(src_repo_path, src_branch, src_branch_point, dest_repo_path)\n `(cd \"#{src_repo_path}\" && git format-patch --stdout #{src_branch_point}..#{src_branch}) | (cd \"#{dest_repo_path}\" && gi... | [
"0.61559623",
"0.61515826",
"0.5972779",
"0.57273823",
"0.5663175",
"0.56617117",
"0.5660137",
"0.56442803",
"0.5616272",
"0.5606789",
"0.560365",
"0.55868375",
"0.55863297",
"0.55255246",
"0.549067",
"0.54858285",
"0.5470355",
"0.54309213",
"0.5428185",
"0.5411081",
"0.54050... | 0.7420467 | 0 |
apply a patch to the current branch of a repo | def apply_patch(repo_path, patch)
`(cd "#{repo_path}" && echo #{patch} | git am)`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_patch(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git format-patch --stdout #{commit}..#{branch})`\n end",
"def apply_patch(patch_path)\n raise ApplyPatchError.new(\"Please make sure file exist!\") unless File.exist?(patch_path)\n init_git_repo if @git.nil?\n\n befor... | [
"0.73138964",
"0.68971",
"0.6710138",
"0.6667912",
"0.6472524",
"0.647064",
"0.6444484",
"0.64004046",
"0.6119551",
"0.6113659",
"0.60566",
"0.6051799",
"0.6002721",
"0.59629",
"0.5930831",
"0.589748",
"0.58969784",
"0.5878865",
"0.586247",
"0.585828",
"0.5817343",
"0.57721... | 0.801848 | 0 |
create a patch from the src repo and apply it to the dest repo | def copy_branch_commits(src_repo_path, src_branch, src_branch_point, dest_repo_path)
`(cd "#{src_repo_path}" && git format-patch --stdout #{src_branch_point}..#{src_branch}) | (cd "#{dest_repo_path}" && git am)`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_patch(repo_path, patch)\n `(cd \"#{repo_path}\" && echo #{patch} | git am)`\n end",
"def patch\n fetch unless exist?\n return unless has_patches?\n dont_debug { patched_location.rmtree if patched_location.exist? } # Make sure that no previous patched copy exists\n dont_debug { @... | [
"0.6826868",
"0.67437965",
"0.650419",
"0.63976383",
"0.63280934",
"0.5933653",
"0.5924863",
"0.5913394",
"0.57603025",
"0.57500464",
"0.5628313",
"0.5613324",
"0.5601624",
"0.5578456",
"0.5572204",
"0.55411595",
"0.5530018",
"0.55139905",
"0.54855627",
"0.5475539",
"0.546754... | 0.6681872 | 2 |
This way, we keep these methods separated from other potential parts of the program | def find(id)
# Your code Here
@candidates.each do |el|
# logic to check if id match else null
if el[:id] == id
puts 'found match'
return el
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def internal; end",
"def operations; end",
"def operations; end",
"def schubert; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; ... | [
"0.740674",
"0.67963177",
"0.662946",
"0.662946",
"0.6364545",
"0.63562936",
"0.63562936",
"0.6273603",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6270173",
"0.6259613",
"0.6256892",
"0.62166345",
"0.6194234",
... | 0.0 | -1 |
More methods will go below | def ordered_by_qualifications(candiates)
# Candidates with the most experience are at the top
return candiates.sort_by { | obj | [obj[:years_of_experience], obj[:github_points]] }
# return candiates.sort! { |a, b| b[:years_of_experience] <=> a[:years_of_experience] }
# return candiates.sort_by {|:years_of_experience, :github_points|[ :github_points, :years_of_experience]}
# return candiates.sort { | a, b | }
# array.sort { |a,b| [ a[1], a[0] ] <=> [ b[1], b[0] ] }
# For Candidates that have the same years of experience,
#they are further sorted by their number of Github points (highest first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def operations; end",
"def operations; end",
"def who_we_are\r\n end",
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"... | [
"0.76361305",
"0.712518",
"0.712275",
"0.712275",
"0.69998705",
"0.69102776",
"0.6905015",
"0.6905015",
"0.6905015",
"0.6905015",
"0.6874812",
"0.6826144",
"0.6826144",
"0.6641111",
"0.65634865",
"0.65353763",
"0.65353763",
"0.65353763",
"0.65353763",
"0.65170616",
"0.6491241... | 0.0 | -1 |
Collects various methods that unlock new features of the game. | def unlock_features
create_shovel
create_key
unlock_armoire
create_phone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fight_methods\n self.class.instance_methods(false).\n reject{|a| a == :choose_attack || a == :fight_methods }\n end",
"def unregister_capabilities(methods); end",
"def register_capabilities(methods); end",
"def methods() end",
"def append_features(context) # :nodoc:\n context.class_eval... | [
"0.639041",
"0.62876904",
"0.6057804",
"0.5976238",
"0.59110075",
"0.589709",
"0.5762629",
"0.57072425",
"0.5691796",
"0.5691669",
"0.56702477",
"0.56702477",
"0.56452405",
"0.56452405",
"0.56452405",
"0.56452405",
"0.5534604",
"0.5509518",
"0.53974754",
"0.53956234",
"0.5393... | 0.5962772 | 4 |
If satchel contains all fragments, display message and add shovel to the shed. | def create_shovel
if @satchel.contents.include?("fragment1") && @satchel.contents.include?("fragment2") && @satchel.contents.include?("fragment3")
@house.last_move_message = "You've collected all three paper fragments. When you put them all together, you see this message: 'Buried in the garden.' Oh! A gust of wind just carried away all your fragments."
@house.create_item("shovel", "This shovel is pretty darn heavy.", 0)
@house.find_room(:shed).inventory << "shovel"
@satchel.contents.delete_if {|x| ["fragment1", "fragment2", "fragment3"].include?(x)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_stripwells_in_analyzer\n show do \n title \"Arrange stripwells in fragment analyzer\"\n note \"Arrange the stripwells in the fragment analyzer in the EXACT SAME ORDER as they are arranged in the green tube rack.\"\n note \"Close the lid on the machine.\"\n end\n end",
"def start_mes... | [
"0.5185431",
"0.5153116",
"0.50376594",
"0.49704006",
"0.49162775",
"0.48935497",
"0.48316604",
"0.48186",
"0.47688064",
"0.4746269",
"0.47451425",
"0.4733458",
"0.47059232",
"0.4705552",
"0.47019434",
"0.4685038",
"0.4685038",
"0.46665472",
"0.46605137",
"0.46479338",
"0.464... | 0.60902035 | 0 |
If shovel is unpacked in the garden, a key appears in the garden. | def create_key
if @house.find_room(:garden).inventory.include?("shovel") && (@level == 0)
@house.create_item("key", "It's a key, but what's it for?", 10)
@house.find_room(:garden).inventory << "key"
@house.last_move_message = "You dug up a key in the garden! What's it for?"
@level+=1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scard(key); end",
"def scard(key); end",
"def all_there?(recipe, on_hand)\n recipe.keys.each do |ingredient|\n return false if !(on_hand.keys.include? ingredient)\n end\n\n true\nend",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); en... | [
"0.5695774",
"0.5695774",
"0.53906834",
"0.5354154",
"0.5354154",
"0.5354154",
"0.5354154",
"0.5354154",
"0.5354154",
"0.5241395",
"0.5219834",
"0.52076644",
"0.5207019",
"0.5191972",
"0.51741326",
"0.51708496",
"0.5162459",
"0.5153201",
"0.5152065",
"0.514806",
"0.514806",
... | 0.62498057 | 0 |
If player has key, display unlocked armoire message, replace locked armoire with unlocked armoire, and create link to secret room. | def unlock_armoire
if @house.find_room(:bedroom).inventory.include?("key") && (@level == 1)
@house.delete_item("armoire")
@house.create_item("armoire", "This armoire is unlocked. Hey, when you look inside it, you see a secret room extending to the west. Spooky.", 30)
@house.find_room(:bedroom).links[:west] = :secret_room
@house.last_move_message = "You took the key out of your pack and it fit the armoire!"
@level+=1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_unlock_instructions; end",
"def lock\n @privkey = nil\n @locked = true\n end",
"def unlock(key, admin = false)\n if @lockable and @locked and (@keys.include? key or admin)\n @locked = false\n\n if self.can? :connected_to\n other = $manager.find self.connected_to\n ... | [
"0.59144354",
"0.5575079",
"0.53869534",
"0.5350398",
"0.5340355",
"0.52554643",
"0.5243598",
"0.5209638",
"0.5150146",
"0.5149847",
"0.5129373",
"0.51172245",
"0.51009566",
"0.5080429",
"0.5066652",
"0.504487",
"0.5027661",
"0.5014655",
"0.4984328",
"0.49816588",
"0.49196672... | 0.6715307 | 0 |
If player has catnip, replace MonsterCat with HappyCat. Put phone in secret_room inventory. | def create_phone
if @house.find_room(:secret_room).inventory.include?("catnip") && (@level == 2)
@house.find_room(:secret_room).inventory.delete("monster_cat")
@house.find_room(:secret_room).inventory << "happy_cat" << "phone"
@house.last_move_message = "Your catnip has soothed the angry cat. Now that fur is no longer flying, you see an obect on the floor. Is that a phone?"
@level += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catch_fish\n inventory[:fish] += @skills[:fish]\n end",
"def give_pet_up_to_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets - 1\n @pets.delete(animal_name)\n shelter_instance_name.animals[animal_name] = animal_instance_name\n end",
"def se... | [
"0.5800559",
"0.5576071",
"0.55737597",
"0.55394447",
"0.5501929",
"0.5474428",
"0.5463071",
"0.54570985",
"0.54357874",
"0.54227096",
"0.5399173",
"0.5398183",
"0.53931737",
"0.5383622",
"0.5370907",
"0.53576124",
"0.5347994",
"0.5308377",
"0.530752",
"0.5301656",
"0.5277714... | 0.6533715 | 0 |
Convert a letter to the corresponding array index | def letter_to_index(letter)
ALPHA26.index(letter.upcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_to_index(letter)\n alphabet_array.index(letter.upcase)\n end",
"def index_to_letter(index)\n alphabet_array[index]\n end",
"def index_to_letter(index)\n ALPHA26[index]\n end",
"def letter_index(letter)\n @places = []\n @split_word.each_with_index do |char, index|\n if char =... | [
"0.84788364",
"0.78607553",
"0.7447792",
"0.7339922",
"0.72362953",
"0.70460224",
"0.70404255",
"0.7030043",
"0.70159626",
"0.6986334",
"0.69348335",
"0.6839326",
"0.68358153",
"0.68136716",
"0.670647",
"0.6682442",
"0.6642986",
"0.66122",
"0.65824896",
"0.6522413",
"0.652209... | 0.8046173 | 1 |
Convert an array index to the corresponding letter of the alphabet | def index_to_letter(index)
ALPHA26[index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_to_letter(index)\n alphabet_array[index]\n end",
"def index_to_letter(idx)\n letter = \"\"\n while true\n idx -= 1\n r = idx % 26\n idx /= 26\n letter = (r + 97).chr + letter\n break if idx <= 0\n end\n letter\n end",
"def letter_to_index(letter)\n alphabe... | [
"0.90681833",
"0.8049885",
"0.75753367",
"0.717383",
"0.7087908",
"0.6947372",
"0.6845467",
"0.68077564",
"0.67702085",
"0.6752533",
"0.6740123",
"0.66804326",
"0.66629374",
"0.6640071",
"0.6623495",
"0.6621155",
"0.66014373",
"0.65782374",
"0.65688246",
"0.65637594",
"0.6550... | 0.85447747 | 1 |
Checks if a string is a number | def is_number?(string)
true if Float(string) rescue false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_nu... | [
"0.8710541",
"0.8686866",
"0.86309665",
"0.86309665",
"0.862524",
"0.8617337",
"0.8610184",
"0.850376",
"0.8498442",
"0.8479916",
"0.84713453",
"0.8422545",
"0.8422545",
"0.83629763",
"0.82696426",
"0.8251029",
"0.8251029",
"0.8230439",
"0.8215512",
"0.82066685",
"0.81989795"... | 0.855818 | 7 |
Converts alpha numerical location to an Array of coordinates | def convert_location_to_coordinates(alpha)
coord = []
alpha.split(/(\d+)/).each do |ch|
if is_number?(ch)
coord.push(ch.to_i)
else
coord.push(letter_to_index(ch))
end
end
coord
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_position_to_array(position)\n\t\t@coordinate = position.chars\n\t\ttemp = @coordinate[0]\n\t\tx = @coordinate[1]\n\t\tx = (8 - position[1].to_i )\n\t\tconvert_y = { a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6 , h: 7 }\n\t\ty= convert_y.values_at(temp.to_sym)\n\t\t@coordinate[0]=x\n\t\t@coordinate[1]= y[0]... | [
"0.672229",
"0.66640437",
"0.65403223",
"0.64741117",
"0.6425672",
"0.6415189",
"0.6375913",
"0.631177",
"0.6290777",
"0.6277493",
"0.6272495",
"0.62668604",
"0.6243056",
"0.62344193",
"0.62161124",
"0.6209263",
"0.61788404",
"0.6158331",
"0.6137393",
"0.6115954",
"0.60818213... | 0.8339741 | 0 |
Finds a part from an alpha numerical string location(e.g. A1, B1) TODO Move to krill | def get_part(collection, location)
row, column = convert_location_to_coordinates(location)
collection.part(row, column)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_part(reg_exp, string = address_parts)\n string.find { |line| reg_exp.match line.downcase }\n end",
"def alpha_search(str)\r\n\r\nend",
"def part_of_word\n @str[@first_letter..@last_letter]\n end",
"def ABCheck(str)\n letter_a_index = str.rindex('a')\n letter_b_index = str.rindex('b')\n ... | [
"0.6678195",
"0.64286804",
"0.63947195",
"0.63825154",
"0.6307374",
"0.6276043",
"0.6273124",
"0.6250003",
"0.61820674",
"0.6179755",
"0.6155893",
"0.61512583",
"0.6149341",
"0.61328876",
"0.61269814",
"0.61252016",
"0.60446775",
"0.6019609",
"0.6011815",
"0.59876764",
"0.597... | 0.0 | -1 |
DEPRECIATED Returns the exact location of an Part in a collection. Will return the location of only that part | def find_item_in_collection(collection:, item:)
collection.find(item)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_part(collection, location)\n row, column = convert_location_to_coordinates(location)\n collection.part(row, column)\n end",
"def locate part_name\n @parts[part_name]\n end",
"def parts_from_sample(collection, sample)\n part_location = collection.find(sample)\n parts = []\n part_... | [
"0.76352006",
"0.6768798",
"0.62164146",
"0.6128466",
"0.59222424",
"0.5856453",
"0.5776101",
"0.5733183",
"0.56931126",
"0.56121725",
"0.55709964",
"0.5519996",
"0.5489192",
"0.5465383",
"0.54397535",
"0.5422718",
"0.5409527",
"0.53877413",
"0.5385932",
"0.5364988",
"0.53383... | 0.52003086 | 27 |
DEPRECIATED Converts an array of coordinates to alpha numerical locations | def convert_coordinates_to_location(coordinates)
index_to_letter(coordinates[0]) + coordinates[1].to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_location_to_coordinates(alpha)\n coord = []\n alpha.split(/(\\d+)/).each do |ch|\n if is_number?(ch)\n coord.push(ch.to_i)\n else\n coord.push(letter_to_index(ch))\n end\n end\n coord\n end",
"def convert_to_piece_position(coordinates)\n alpha = ('a'..'h')... | [
"0.66715026",
"0.6094185",
"0.5978215",
"0.5949377",
"0.5894391",
"0.5864307",
"0.58422804",
"0.569368",
"0.5678587",
"0.5655195",
"0.56251556",
"0.5604844",
"0.5582608",
"0.55596775",
"0.55104333",
"0.5504596",
"0.5482888",
"0.54660696",
"0.5465542",
"0.5461614",
"0.5441866"... | 0.5616847 | 11 |
Use callbacks to share common setup or constraints between actions. | def set_charge
@charge = Charge.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def charge_params
params[:charge].permit(:reward_id, :token)
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.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
move module? (included in Piece?) | def nav(vector) # called in :turn > active_piece.nav()
# check vector*1
# is on board?
# if vacant, move
# else check vector*2 (jump) --> jump if vacant
# remove jumped piece from board
# add jumped piece to captured array?
# move again or set jump? true
# check for :crown --> make king?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move; end",
"def move; end",
"def move\n\n end",
"def move\n \n end",
"def move\n \n end",
"def moves\n # overridden in slideable/stepable modules\n end",
"def move_piece(from, to)\n raise 'needs implementation'\n end",
"def move_piece(org,dest)\n # remove catured piece if... | [
"0.80482274",
"0.80482274",
"0.77815163",
"0.7630407",
"0.7630407",
"0.7458778",
"0.7418271",
"0.7235065",
"0.7186372",
"0.71771914",
"0.71266216",
"0.712317",
"0.712317",
"0.7079616",
"0.6980106",
"0.6980106",
"0.69659984",
"0.6964238",
"0.6958012",
"0.6938763",
"0.69174165"... | 0.0 | -1 |
move module? (included in Piece?) | def move(dest, crown?) # called in :turn > active_piece.move()
# updates dest in board array
# updates piece with new coordinates
# updates jumped pieces?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move; end",
"def move; end",
"def move\n\n end",
"def move\n \n end",
"def move\n \n end",
"def moves\n # overridden in slideable/stepable modules\n end",
"def move_piece(from, to)\n raise 'needs implementation'\n end",
"def move_piece(org,dest)\n # remove catured piece if... | [
"0.80482274",
"0.80482274",
"0.77815163",
"0.7630407",
"0.7630407",
"0.7458778",
"0.7418271",
"0.7235065",
"0.7186372",
"0.71771914",
"0.71266216",
"0.712317",
"0.712317",
"0.7079616",
"0.6980106",
"0.6980106",
"0.69659984",
"0.6964238",
"0.6958012",
"0.69174165",
"0.68944466... | 0.6938763 | 19 |
GET /reservations GET /reservations.json | def index
@reservations = Reservation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: reservations\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n... | [
"0.80166954",
"0.77868253",
"0.77868253",
"0.76421547",
"0.759504",
"0.75205106",
"0.7353185",
"0.727885",
"0.7248716",
"0.7229633",
"0.7209536",
"0.7209536",
"0.7209536",
"0.7209536",
"0.7209536",
"0.7209536",
"0.7192237",
"0.7182924",
"0.7156286",
"0.71245193",
"0.70824015"... | 0.77406347 | 13 |
GET /reservations/1 GET /reservations/1.json | def show
@reservation = Reservation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: reservations\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n... | [
"0.77576584",
"0.74549264",
"0.74549264",
"0.7452395",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",... | 0.70854115 | 30 |
This error was analyzed in the README file. error FIXED | def cartman_hates(thing)
while true
puts "What's there to hate about #{thing}?"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_error; end",
"def original_error; end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end"... | [
"0.5884786",
"0.5884786",
"0.57253516",
"0.57253516",
"0.5612547",
"0.5612547",
"0.5612547",
"0.5612547",
"0.5612547",
"0.5612547",
"0.5612547",
"0.5604784",
"0.5591743",
"0.5515763",
"0.5456442",
"0.54290646",
"0.5425237",
"0.5404118",
"0.5372444",
"0.53721976",
"0.53721976"... | 0.0 | -1 |
1. What is the line number where the error occurs? 36 2. What is the type of error message? Name error 3. What additional information does the interpreter provide about this type of error? undefined local variable or method `south_park' 4. Where is the error in the code? 'south_park' 5. Why did the interpreter give you this error? Because a new variable was called without giving it an assignment error FIXED | def cartman(input)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def south_park\nend",
"def south_park\n\nend",
"def yeast; end",
"def setupLocation(_map) \n raise \"not defined\" ;\n end",
"def test_driver_setLocation_hillman\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 1 #museum to hillman\n\t\tassert_equal d.getLocation, 2\n\tend",
"def winter_pa... | [
"0.74433684",
"0.72542506",
"0.5940453",
"0.586496",
"0.57187265",
"0.567975",
"0.56374747",
"0.56374747",
"0.5636699",
"0.5636699",
"0.5636699",
"0.5636699",
"0.557281",
"0.5510277",
"0.5486102",
"0.5480498",
"0.5467287",
"0.54601777",
"0.5445104",
"0.5426055",
"0.53678983",... | 0.0 | -1 |
1. What is the line number where the error occurs? 52 2. What is the type of error message? No method error 3. What additional information does the interpreter provide about this type of error? undefined method `cartman' 4. Where is the error in the code? cartman() 5. Why did the interpreter give you this error? Because a method was called that was not defined error FIXED | def cartmans_phrase
puts "I'm not fat; I'm big-boned!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cartman()\nend",
"def cartman()\nend",
"def cartman()\nend",
"def cartman()\nend",
"def cartman()\nend",
"def cartman()\nend",
"def cartman()\n \nend",
"def cartman()\n\tputs \"Hella cool!\"\nend",
"def cartman(input)\nend",
"def cartman(kenny)\n\nend",
"def create_cart\n\tend",
"def car... | [
"0.77253765",
"0.77253765",
"0.77253765",
"0.77253765",
"0.77253765",
"0.77230877",
"0.75821507",
"0.69522446",
"0.660862",
"0.6572757",
"0.60198444",
"0.59087723",
"0.5903878",
"0.57665926",
"0.5707675",
"0.5681449",
"0.5681449",
"0.5681449",
"0.5681449",
"0.5681449",
"0.568... | 0.57285297 | 20 |
1. What is the line number where the error occurs? 68 2. What is the type of error message? Argument error 3. What additional information does the interpreter provide about this type of error? wrong number of arguments (1 for 0) 4. Where is the error in the code? after cartmans_phrase 5. Why did the interpreter give you this error? The method is being called with an input of string but was not created to allow inputs error FIXED | def cartman_says(offensive_message)
puts offensive_message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cartmans_phrase phrase\n puts phrase\nend",
"def cartmans_phrase(arg1)\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartmans_phrase(argument)\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cartman(input)\nend",
"def cartmans_phrase\n puts \"I'm not fat; I'm big-boned!\"\nend",
"def cart... | [
"0.69928646",
"0.6924693",
"0.6859854",
"0.67401475",
"0.6556952",
"0.6556952",
"0.6556952",
"0.6556952",
"0.6556952",
"0.6556952",
"0.6556952",
"0.6481577",
"0.63962954",
"0.63511777",
"0.62144417",
"0.6159472",
"0.57656807",
"0.5703528",
"0.5655698",
"0.56429255",
"0.562352... | 0.616065 | 27 |
Alternative way of doing it | def run2
@is_present = Browser.get(target.homepage_url).body =~ /scan/ ? true : false
output('scan_word')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def suivre; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def stderrs; end",
"def formation; end",
"def anchored; end",
"def terpene; end",... | [
"0.6505502",
"0.5951762",
"0.5947757",
"0.5824057",
"0.579341",
"0.579341",
"0.579341",
"0.579341",
"0.56170297",
"0.56170297",
"0.5573239",
"0.5566254",
"0.5543244",
"0.55065113",
"0.5420411",
"0.54196036",
"0.54196036",
"0.5412713",
"0.53875315",
"0.53676313",
"0.53418785",... | 0.0 | -1 |
Provides inspection details for the current receiver. | def inspect
"#<#{self.class} #{@manager.host}@#{@manager.community}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect_details\n ''\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n @info.inspect\n end",
"def inspect\n inspection = self.info.keys.map { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.compact.join(\", \")\n \"#<#{self.class}:0x#{self.obje... | [
"0.59087265",
"0.58344793",
"0.58344793",
"0.58301073",
"0.5798084",
"0.5790733",
"0.5786579",
"0.57298726",
"0.55996174",
"0.5594942",
"0.55744445",
"0.5559301",
"0.5522653",
"0.5505883",
"0.54993004",
"0.5476017",
"0.5468971",
"0.5466947",
"0.5466947",
"0.5466947",
"0.53820... | 0.52308995 | 67 |
Creates and returns a new instance of a Ropian::Control::Generic class. | def initialize(ip_addr, community, version = :SNMPv2c)
@manager = SNMP::Manager.new(:Host => ip_addr,
:Community => community, :Version => version)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def control\n NewRelic::Control.instance\n end",
"def control\n NewRelic::Control.instance\n end",
"def control\n NewRelic::Control.instance\n end",
"def create_base\n @base = UI::GenericBase.new(@viewport, BUTTON_TEXTS.collect { |txt| get_text(txt) }, BUTTON_KEYS... | [
"0.56665975",
"0.56665975",
"0.5590808",
"0.55807686",
"0.5554862",
"0.5513421",
"0.5434701",
"0.5402005",
"0.5399282",
"0.53945833",
"0.53717536",
"0.5338447",
"0.5286389",
"0.52853113",
"0.5245906",
"0.5219997",
"0.5154318",
"0.5154318",
"0.5154318",
"0.5154318",
"0.5154318... | 0.0 | -1 |
Sets the power state of the specified port(s) to ON | def turn_on(port_index)
set_state(:on, port_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_power(port, state)\n\t\tstate = state ? 1 : 0\n\t\t\n\t\tdo_send(\"\\eP#{port}*#{state}DCPP\")\n\t\t# Response: DcppP_port*portstatus 0 == off, 1== on\n\tend",
"def switch_on port=-1\n run(:func => \"relayWrite\", :port => port, :value => 1)\n end",
"def turn_on!\n set_power!(:on)\n ... | [
"0.7881567",
"0.6766991",
"0.6681114",
"0.6608425",
"0.6300905",
"0.62512",
"0.6162218",
"0.61408025",
"0.60755897",
"0.6061583",
"0.6043452",
"0.6036357",
"0.5957646",
"0.5939415",
"0.5937107",
"0.58890074",
"0.58554304",
"0.57540184",
"0.5740408",
"0.57274395",
"0.5678799",... | 0.70247966 | 1 |
Sets the power state of the specified port(s) to OFF | def turn_off(port_index)
set_state(:off, port_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_off port=-1\n run(:func => \"relayWrite\", :port => port, :value => 0)\n end",
"def turn_off!\n set_power!(:off)\n end",
"def set_power(port, state)\n\t\tstate = state ? 1 : 0\n\t\t\n\t\tdo_send(\"\\eP#{port}*#{state}DCPP\")\n\t\t# Response: DcppP_port*portstatus 0 == off, 1== on... | [
"0.73775816",
"0.69071543",
"0.68449354",
"0.6800767",
"0.6790189",
"0.676798",
"0.669187",
"0.6507065",
"0.64984053",
"0.6488552",
"0.63760424",
"0.6336826",
"0.62247443",
"0.6133895",
"0.6120749",
"0.6070662",
"0.60201424",
"0.6012922",
"0.600302",
"0.59553665",
"0.59509313... | 0.7021267 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.