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 |
|---|---|---|---|---|---|---|
If dontValidateDirs is set, then the directories are not checked to see if they exist, etc. This should be set to true by nondaemon code that is reading the config file. | def load(filename, dontValidateDirs = false)
rc = true
if File.exists?(filename)
File.open(filename){ |fh|
yaml = YAML::load(fh)
return handleYaml(yaml, dontValidateDirs)
}
else
$logger.info "Loading config file failed: file '#{filename}' doesn't exist."
end
rc
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_valid_dirs\n\t\treturn @dirs.find_all do |dir|\n\t\t\tif dir.tainted?\n\t\t\t\tself.log.info \"Discarding tainted directory entry %p\" % [ dir ]\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tpath = Pathname.new( dir )\n\n\t\t\tif ! path.exist?\n\t\t\t\tself.log.debug \"Discarding non-existant path: %s\" % [ path ]\n\... | [
"0.62127835",
"0.6058982",
"0.6041591",
"0.599273",
"0.59096676",
"0.5886441",
"0.58751404",
"0.58604175",
"0.5820083",
"0.5778915",
"0.56670237",
"0.5639315",
"0.563001",
"0.55831397",
"0.5566967",
"0.5559163",
"0.5552213",
"0.55465674",
"0.5487194",
"0.5478426",
"0.54493064... | 0.512645 | 58 |
Regexps over raw HTML | def regexp(exp)
begin
match = exp.match(@data)
yield match if match
rescue ArgumentError # velmi zriedkava UTF8 chyba
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_raw_html(el, &block); end",
"def parse_html(data,tag)\n return data.scan(%r{<#{tag}\\s*.*?>(.*?)</#{tag}>}im).flatten\nend",
"def html(text)\n scan(text, HTML, :html)\n end",
"def html_markup_html(text); end",
"def substitute_markdown_inside_raw_html\n each_element(:raw_html) do |e|\n ... | [
"0.713401",
"0.6881784",
"0.6773556",
"0.6614859",
"0.66133696",
"0.65584064",
"0.6469279",
"0.6446849",
"0.6351006",
"0.6314426",
"0.6281213",
"0.62064385",
"0.618714",
"0.61843973",
"0.6181669",
"0.6181669",
"0.6181669",
"0.61776197",
"0.6173168",
"0.6149219",
"0.6120121",
... | 0.0 | -1 |
irb will throw a exception, the argument should be a symbol or a string | def initialize(front, back)
@front = front
@back = back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arg_sym_check op\n raise TypeError, \"#{op} is not a symbol nor a string\", \"my_inject\" unless\n op.is_a?(Symbol) || op.is_a?(String)\n op\n end",
"def throw(symb, *rest) end",
"def check_feature_is_not_symbol(feature)\n raise ArgumentError, \"#{feature} is not... | [
"0.6850852",
"0.67776364",
"0.65247",
"0.6470134",
"0.6357194",
"0.63310397",
"0.62051153",
"0.6029721",
"0.5957375",
"0.5957375",
"0.59427506",
"0.59427506",
"0.59427506",
"0.59427506",
"0.59427506",
"0.59427506",
"0.59189224",
"0.58855957",
"0.5875557",
"0.5875557",
"0.5875... | 0.0 | -1 |
GET /touchpoints/1 GET /touchpoints/1.xml | def show
@touchpoint = Touchpoint.find(params[:id])
@queue = CallQueue.find(params[:call_queue_id])
@lead = @touchpoint.lead
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @touchpoint }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.... | [
"0.6780821",
"0.6398174",
"0.6235734",
"0.6185593",
"0.61111784",
"0.6027781",
"0.60132974",
"0.59720194",
"0.5953484",
"0.58691007",
"0.5843023",
"0.58357406",
"0.5813542",
"0.58065355",
"0.5766416",
"0.5734189",
"0.5734189",
"0.57335603",
"0.57146996",
"0.5706185",
"0.56956... | 0.6164707 | 4 |
rubocop:enable Metrics/AbcSize rubocop:disable Metrics/AbcSize | def verify_request_issue_contending_decision_issue_not_readded(
page_url,
decision_review,
contested_decision_issues
)
# verify that not modifying a request issue contesting a decision issue
# does not result in readding
visit page_url
expect(page).to have_content(contested_decision_issue... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def refutal()\n end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def used?; end",
"def strategy; end",
"def offences_by; end",
"def isola... | [
"0.7638388",
"0.63625187",
"0.6226631",
"0.6198837",
"0.6198837",
"0.6188607",
"0.6188607",
"0.6188607",
"0.6188607",
"0.6161482",
"0.5995779",
"0.5961236",
"0.59278506",
"0.5858949",
"0.5858949",
"0.5835576",
"0.5819768",
"0.5819768",
"0.5805334",
"0.5805334",
"0.57922316",
... | 0.0 | -1 |
GET /top_standing_entries GET /top_standing_entries.json | def index
@top_standing_entries = TopStandingEntry.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def top_ten\n Rails.cache.fetch('top_ten_resp', expires_in: 1.minutes) do\n conn = Faraday.n... | [
"0.6525258",
"0.627208",
"0.6225961",
"0.61381257",
"0.6041749",
"0.6037698",
"0.6036858",
"0.5945728",
"0.58619833",
"0.5850846",
"0.5844281",
"0.58370143",
"0.58293825",
"0.5779544",
"0.5767252",
"0.57259643",
"0.57112896",
"0.56655556",
"0.56637216",
"0.56598264",
"0.56565... | 0.76462895 | 0 |
GET /top_standing_entries/1 GET /top_standing_entries/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @top_standing_entries = TopStandingEntry.all\n end",
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @entries = En... | [
"0.7510784",
"0.65279806",
"0.6330512",
"0.6198599",
"0.61164266",
"0.6090443",
"0.60047185",
"0.599805",
"0.59663844",
"0.59605175",
"0.59448725",
"0.5936673",
"0.5892009",
"0.5868795",
"0.5860337",
"0.5858342",
"0.5840455",
"0.5825204",
"0.5825204",
"0.58198",
"0.57566893",... | 0.0 | -1 |
POST /top_standing_entries POST /top_standing_entries.json | def create
@top_standing_entry = TopStandingEntry.new(top_standing_entry_params)
respond_to do |format|
if @top_standing_entry.save
format.html { redirect_to @top_standing_entry, notice: 'Top standing entry was successfully created.' }
format.json { render action: 'show', status: :created... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @top_standing_entries = TopStandingEntry.all\n end",
"def top_standing_entry_params\n params.require(:top_standing_entry).permit(:top_standing_id, :rank, :player, :coach, :country, :comments)\n end",
"def set_top_standing_entry\n @top_standing_entry = TopStandingEntry.find(params[:... | [
"0.673805",
"0.6233248",
"0.61333615",
"0.5385642",
"0.5359028",
"0.53329116",
"0.53299475",
"0.5292736",
"0.5233541",
"0.51811844",
"0.5162997",
"0.51428515",
"0.5135412",
"0.51325136",
"0.5115971",
"0.5109287",
"0.50734234",
"0.50633824",
"0.5060462",
"0.5032566",
"0.503233... | 0.64763343 | 1 |
PATCH/PUT /top_standing_entries/1 PATCH/PUT /top_standing_entries/1.json | def update
respond_to do |format|
if @top_standing_entry.update(top_standing_entry_params)
format.html { redirect_to @top_standing_entry, notice: 'Top standing entry was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_top_standing_entry\n @top_standing_entry = TopStandingEntry.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @big_time_entry.update(big_time_entry_params)\n format.html { redirect_to @big_time_entry, notice: 'Big time entry was successfully updated.' }\n f... | [
"0.6259061",
"0.6104654",
"0.59488606",
"0.5935395",
"0.5915131",
"0.58919597",
"0.58798736",
"0.5858852",
"0.5816517",
"0.578581",
"0.5781913",
"0.57511383",
"0.57407784",
"0.5735394",
"0.5735394",
"0.5710904",
"0.57059485",
"0.5691284",
"0.5690392",
"0.56776184",
"0.5653682... | 0.7167438 | 0 |
DELETE /top_standing_entries/1 DELETE /top_standing_entries/1.json | def destroy
@top_standing_entry.destroy
respond_to do |format|
format.html { redirect_to top_standing_entries_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.... | [
"0.6874036",
"0.6758286",
"0.6742914",
"0.6712145",
"0.66613394",
"0.6623446",
"0.6595505",
"0.6595505",
"0.659396",
"0.659396",
"0.65774447",
"0.6543997",
"0.6528615",
"0.6528615",
"0.65143883",
"0.6509416",
"0.6506293",
"0.6491848",
"0.648599",
"0.64826363",
"0.6478507",
... | 0.7777621 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_top_standing_entry
@top_standing_entry = TopStandingEntry.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def top_standing_entry_params
params.require(:top_standing_entry).permit(:top_standing_id, :rank, :player, :coach, :country, :comments)
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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
Add hooks to target that is supervised. | def add(*hooks)
@hooks.push(*hooks)
hooks.map(&:object).uniq.each do |object|
@original_callbacks[object] = proceed(object) unless proceeded?(object)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_features( hooked_instance )\n \n original_append_features( hooked_instance )\n super if defined?( super )\n \n end",
"def hooks\n # ???\n end",
"def add_method_hooks\n eigen_class = @target.singleton_class\n\n if @options[:class_methods]\n return unless @target.is_a... | [
"0.67205966",
"0.6509277",
"0.64331394",
"0.63529044",
"0.62908506",
"0.6177485",
"0.61421406",
"0.61343443",
"0.6064706",
"0.6004944",
"0.59828573",
"0.5979639",
"0.59608495",
"0.5873436",
"0.5870349",
"0.586797",
"0.5863325",
"0.58510494",
"0.58163905",
"0.5798701",
"0.5779... | 0.61192423 | 8 |
Clear the hooks and the objects that is supervising. | def clear
@hooks.clear
define_callbacks(@original_callbacks).clear
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_hooks\n @hook_objects = []\n end",
"def reset_hooks\n @hooks = nil\n end",
"def reset\n self.hooks = {}\n end",
"def clear\n LOCK.synchronize do\n @hooks = nil\n @applied = nil\n @logger = nil\n end\n end",
"def clear_without_h... | [
"0.843998",
"0.7768945",
"0.77226144",
"0.7635048",
"0.7470304",
"0.7189018",
"0.6870279",
"0.6837122",
"0.68069637",
"0.6798549",
"0.677989",
"0.6776374",
"0.67610127",
"0.6691386",
"0.66775733",
"0.6639165",
"0.6612756",
"0.6582856",
"0.6582788",
"0.65807104",
"0.65696484",... | 0.7928756 | 1 |
Run process while circumvent supervision. | def circumvent(&process)
current_callbacks = @original_callbacks.keys.map do |object|
[object, object.method(@callback_name)]
end
define_callbacks(@original_callbacks)
begin
@hooks.circumvent(&process)
ensure
define_callbacks(Hash[current_callbacks])
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n process.on_sigint { stop_supervised }\n process.on_sigquit { stop_supervised }\n process.on_sigterm { stop_supervised }\n run_supervised\n end",
"def run!\n DCell::SupervisionGroup.run!\n end",
"def exp_process\n sleep(@wait_sec.to_f)\n @ssh.process(... | [
"0.6932075",
"0.6440054",
"0.62826246",
"0.6255614",
"0.62038743",
"0.620099",
"0.61752456",
"0.6041075",
"0.60407734",
"0.6024067",
"0.58843637",
"0.5852167",
"0.5845009",
"0.5837941",
"0.5811315",
"0.58059525",
"0.57918644",
"0.57806575",
"0.5760851",
"0.57304984",
"0.57297... | 0.0 | -1 |
Checks if single signon is enabled for this application. | def sso_enabled?
sso_enabled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def using_single_sign_out?\n !(browser_session_id.nil? || browser_session_id == \"\")\n end",
"def allow_sign_up?\n @allow_sign_up\n end",
"def single_session?\n ENV['SINGLE_SESSION'].nil? ? false : ENV['SINGLE_SESSION'].upcase == 'TRUE'\n end",
"def user_signed_in?\n !!curre... | [
"0.632395",
"0.62736696",
"0.62685573",
"0.6249698",
"0.62346905",
"0.62097245",
"0.62073797",
"0.6199907",
"0.6183833",
"0.6183833",
"0.61624265",
"0.61571777",
"0.61544347",
"0.6120382",
"0.61013156",
"0.61013156",
"0.6068561",
"0.6042026",
"0.6039833",
"0.6039434",
"0.5996... | 0.0 | -1 |
Returns an encrypted SSO callback URL for the specified user. | def sso_callback_url_for(user)
sso_token = encrypt_sso_token_for_user(user)
url = sso_callback_url.dup
if sso_callback_url =~ /\?/
url << '&'
else
url << '?'
end
url << "sso_token=#{sso_token}"
url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n ... | [
"0.63828105",
"0.61473715",
"0.6143929",
"0.61065876",
"0.6019062",
"0.5942037",
"0.58728474",
"0.58494186",
"0.5816813",
"0.5742203",
"0.57345223",
"0.5730752",
"0.5683104",
"0.56699944",
"0.56653273",
"0.56648505",
"0.56589895",
"0.5656952",
"0.56436914",
"0.56041676",
"0.5... | 0.8437382 | 0 |
Encrypts a SSO token for the specified user. | def encrypt_sso_token_for_user(user)
sso_token = Encryptor.encrypt(user.id.to_s, key: token)
Base64.urlsafe_encode64(sso_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_token *args\n raw = [\"Ra\", ThreeScale::SSO::VERSION, \"%10.5f\" % Time.now.utc, @expires_at, \"zZ\"]\n raw.insert 3, *args\n @me.encrypt_and_sign raw.join(ThreeScale::SSO::SEPARATOR)\n end",
"def call\n Utils::TokenManager.encode(user_id: user.id) if user\n end",
"de... | [
"0.6577441",
"0.6372308",
"0.60384405",
"0.5924383",
"0.5917336",
"0.5891704",
"0.5873",
"0.58659023",
"0.5756028",
"0.57224464",
"0.5665579",
"0.56650275",
"0.5660968",
"0.56603515",
"0.5635485",
"0.5629396",
"0.5616595",
"0.5611606",
"0.56081784",
"0.56081784",
"0.5591747",... | 0.80330294 | 0 |
Generate the token for this API application. | def generate_token
self.token ||= SecureRandom.hex(16)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def generate_token\n self.token = UniqueToken.generate\n end",
"def gen... | [
"0.8014116",
"0.75330836",
"0.75042385",
"0.7497424",
"0.748026",
"0.7463064",
"0.7442726",
"0.738065",
"0.7376372",
"0.7337197",
"0.73320895",
"0.7320925",
"0.73192006",
"0.73107696",
"0.72917175",
"0.7279533",
"0.7256173",
"0.7252956",
"0.7232091",
"0.7232091",
"0.7224803",... | 0.71901387 | 26 |
how far can you deliver a payload? You can transfer the payload from truck to truck, and you can transfer fuel from truck to truck. Assume all the payload will fit in one truck. Description: Once your 50 trucks have gone 2 miles, there are 100 miles of missing gas; you can redistribute this gas to the other remaining 4... | def trucking(trucks, distance)
running_sum = 0
current_sum = 0
while (trucks > 0)
#strictly greater than is 432. Greater than or equal to is 482.
#actual answer is around 450. Could add with smaller increments and not
#use integers
until (current_sum > distance/trucks)
current_sum += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truckin(trucks, mileage)\n distance = 0\n while trucks >= 1\n distance += (mileage.to_f / trucks)\n trucks -= 1\n end\n distance\nend",
"def calculateFuelCost( distance, distancePerGallon, pricePerGallon )\n # Cost = ( Distance * Price per gallon ) / Efficiency\n cost = ( distance * pricePerGallo... | [
"0.61842746",
"0.5363009",
"0.5324564",
"0.52981687",
"0.52800816",
"0.527593",
"0.5207959",
"0.5176287",
"0.51650673",
"0.5136188",
"0.5136188",
"0.5115635",
"0.50987536",
"0.50987536",
"0.5092399",
"0.5074478",
"0.50678635",
"0.5066742",
"0.5059747",
"0.50526816",
"0.505169... | 0.62022865 | 0 |
Deprecation warning for plugins removal | def deprecation_warning
if this_blog.deprecation_warning != 42
Blog.transaction do
this_blog.deprecation_warning = 42
this_blog.save
end
flash[:error] = "Deprecation warning: please, notice that most plugins have been removed from the main engine in this new version. To download t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def silence_deprecations; end",
"def disabled_warnings; end",
"def raise_deprecations; end",
"def blog_on_upgrade(plugin)\r\n end",
"def silence_deprecations=(_arg0); end",
"def issue_deprecations\n Pkg::Params::DEPRECATIONS.each do |v|\n if self.instance_variable_get(\"@#{v[:var]}\")\n ... | [
"0.729085",
"0.70063204",
"0.6738475",
"0.66334563",
"0.65567225",
"0.6461884",
"0.6413329",
"0.63934195",
"0.63934195",
"0.63934195",
"0.63934195",
"0.63565046",
"0.6337967",
"0.63316804",
"0.63316804",
"0.63316804",
"0.63316804",
"0.63316804",
"0.63316804",
"0.63316804",
"0... | 0.6257636 | 26 |
Public: Get all the runs for this user Returns an array of Fatigue::Run instances. | def runs
#structure = Nokogiri::XML(user_data_xml)
#unit = structure.xpath('.//plusService/userOptions/distanceUnit').
# first.text
structure = Nokogiri::XML(run_list_xml)
structure.xpath('.//plusService/runList/run').inject([]) do |list,xml|
run = Fatigue::Run.new
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @runs = current_user.runs\n end",
"def index\n\t\t@runs = @current_user.runs\n\n\t\trender json: @runs\n\tend",
"def runs\n runs = data(\"runs\") || []\n runs.map { |run| cache.build(run[\"url\"]) }.select { |run| run.upstreams.include?(self) }\n end",
"def index\n @runs... | [
"0.6862441",
"0.6734517",
"0.6590314",
"0.621507",
"0.6100279",
"0.60485524",
"0.59553707",
"0.5731871",
"0.5704324",
"0.5697168",
"0.56789064",
"0.56354415",
"0.56221896",
"0.5579396",
"0.5578253",
"0.5571855",
"0.55509746",
"0.5466843",
"0.5455828",
"0.5442591",
"0.5412536"... | 0.67505586 | 1 |
INTERNAL METHODS Builds the Nike+ XML url and retreives it. Returns a string of the list of your runs in XML format. | def run_list_xml
run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_run_list.jsp?userID='
run_url += @id.to_s
open(run_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runs\n #structure = Nokogiri::XML(user_data_xml)\n #unit = structure.xpath('.//plusService/userOptions/distanceUnit').\n # first.text\n structure = Nokogiri::XML(run_list_xml)\n structure.xpath('.//plusService/runList/run').inject([]) do |list,xml|\n run = Fatigue::Run.... | [
"0.6279924",
"0.58655614",
"0.5845103",
"0.58273876",
"0.56049985",
"0.55716515",
"0.55507714",
"0.5461503",
"0.5452383",
"0.5424054",
"0.53804666",
"0.5373297",
"0.53471184",
"0.5293361",
"0.5290771",
"0.5268976",
"0.5268126",
"0.5258741",
"0.5242482",
"0.5232435",
"0.523007... | 0.7767411 | 0 |
Builds the Nike+ user XML url and retreives it. This has unit data. Returns a string of your account in XML format. | def user_data_xml
run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='
run_url += @id.to_s
open(run_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_user_info(username, xml); end",
"def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n end",
"def users_get_info_response_xml\n <<-X... | [
"0.6695266",
"0.6685688",
"0.6616317",
"0.6496158",
"0.6357065",
"0.608712",
"0.5965587",
"0.5917316",
"0.5808216",
"0.5795684",
"0.5777051",
"0.5773786",
"0.57466114",
"0.5745984",
"0.57371235",
"0.57273346",
"0.56604666",
"0.5658006",
"0.56465554",
"0.5600323",
"0.55753326"... | 0.631487 | 5 |
Parses a line of XML for a given attribute. attribute The node we are searching for. xml The line of XML we should search in. Returns a scalar value of the attribute. | def get_value(attribute,xml)
xml.xpath(".//#{attribute}").first.content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_xml_attr(path, xml, attribute = \"id\") # :doc:\n XML::Parser.parse(xml.body, \"/pairwise/#{path}\", attribute)\n end",
"def find_attribute_value(xml, component, attribute, search_comments=false)\n attr_node = xml.at_xpath(\"//Component[@FQDD='#{component}']//Attribute[@Name='#{attribute}']\... | [
"0.6630523",
"0.6203951",
"0.5804255",
"0.57176864",
"0.5674158",
"0.56621826",
"0.5629558",
"0.56171834",
"0.5554454",
"0.55359596",
"0.55359596",
"0.5395482",
"0.53490114",
"0.5329579",
"0.5282236",
"0.5277046",
"0.5237865",
"0.52343416",
"0.522849",
"0.522238",
"0.51598495... | 0.6600786 | 1 |
This will search a keyword in the Find professional & agencies textbox and click magnifying glass to submit String keyword Return SearchResultPage instance | def search_professional(keyword)
$stdout.puts "Enter " + keyword + " in Find professional & Agencies"
find_textbox.send_keys(keyword)
$stdout.puts "Click magnifying glass button "
search_button.click
@driver.check_captcha
SearchResultPage.new(@driver)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(keyword)\n $logger.info(\"HomePage: search for #{keyword}\")\n search_field.send_keys keyword\n search_field.submit\n FreelancerSearchResultsPage.new(@driver, $logger)\n end",
"def search_for_freelancers(keyword)\n focus_onto_search_input\n search_for_keyword keyword\n wait 1\n ... | [
"0.82452095",
"0.7325649",
"0.7121065",
"0.70523185",
"0.70353115",
"0.701956",
"0.69983315",
"0.6995525",
"0.6970532",
"0.69458616",
"0.69265515",
"0.68999493",
"0.6878701",
"0.68754643",
"0.6862479",
"0.6857503",
"0.68279976",
"0.6823473",
"0.680902",
"0.6764822",
"0.672855... | 0.85358775 | 0 |
Generates the code associated with cpp proxies | def generate
proxy_hpp = Generation.render_template "proxies", "Task.hpp", binding
proxy_cpp = Generation.render_template "proxies", "Task.cpp", binding
file_proxy_hpp = Generation.save_automatic "proxies", "#{task.basename}.hpp", proxy_hpp
file_proxy_cpp ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_proxy_class\n @proxy_class = Class.new Assembler::ProxyBase\n target.const_set :Proxy, @proxy_class\n \n @proxy_class.const_set :Abi, @abi\n @proxy_class.const_set :Isa, @isa\n \n # Capture the ISA and ABI in the closure.\n isa = @isa\n proxy_defines = Proc.new do\n isa.i... | [
"0.6803049",
"0.66853434",
"0.6466713",
"0.63443923",
"0.63443923",
"0.63443923",
"0.62603605",
"0.6027794",
"0.59148544",
"0.5913572",
"0.5885762",
"0.584126",
"0.5837458",
"0.5801943",
"0.5769017",
"0.5708915",
"0.56423014",
"0.5609084",
"0.55524915",
"0.55284506",
"0.55232... | 0.69370604 | 0 |
store given metrics into persistence this method accepts all kinds of metrics, and will sort to the appropriate delegate method (eg. storeEvents, storePeriods) Note that a silent failure approach is taken, metricsKeeper will attempt to store all other metrics, and failure of a given metric to be persisted will be recor... | def store(*metrics)
groups = Hash.new do |h1,mclass|
h1[mclass] = Hash.new do |h2,mtype|
h2[mtype] = Array.new
end
end
metrics.each do |metric|
mtype = metric.metricType
mclass = metric.metricClass
ensured = self.ensureMetricType(mtype,mclass)
unless ensured
self.lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist_metrics\n self.metrics.each(&:save)\n end",
"def merge_metrics(storage, metrics)\n metrics.each do |metric, value|\n storage.store(\n metric.to_s,\n storage[metric.to_s].to_a << value.to_f\n )\n end\n storage\n ... | [
"0.65329546",
"0.59547794",
"0.55192626",
"0.53982073",
"0.52761596",
"0.5214178",
"0.50879776",
"0.50283486",
"0.5014631",
"0.4988632",
"0.4980784",
"0.49227187",
"0.49164832",
"0.4911128",
"0.48803982",
"0.4868014",
"0.48634753",
"0.48499197",
"0.4826706",
"0.48023444",
"0.... | 0.7666009 | 0 |
Renderiza la vista para crear un nuevo job | def new
@job = Job.new
@users = User.select(:id, :name).where('role != ?', 'ADMIN')
@customers = Customer.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job = Job.new(params[:job].reject{|key, value| key == 'jobs_queue_id'})\n @job.user = current_user\n\n respond_to do |format|\n if @job.save\n if @job.r_script.tags.collect{|tag| tag.name}.include?('install script')\n @job.pending \n elsif queue = JobsQueue.find_b... | [
"0.6800934",
"0.66873956",
"0.6649726",
"0.6596133",
"0.65367746",
"0.65307975",
"0.65284795",
"0.6521021",
"0.65022653",
"0.64831686",
"0.6482115",
"0.64804506",
"0.64332616",
"0.64227015",
"0.63881856",
"0.6334715",
"0.63288915",
"0.6295718",
"0.62634224",
"0.62469983",
"0.... | 0.0 | -1 |
Renderiza la vista para actualizar el job | def edit
@job = Job.find(params[:id])
@users = User.select(:id, :name).where('role != ?', 'ADMIN')
@customers = Customer.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_scene() \n create_workers(@subjobs.count) \n EM::run do\n BrB::Service.start_service(:object => self, :host => 'localhost', :port => 5555)\n end \n end",
"def processa\n @codigo = params[:codigo]\n @identificador = rand(1000)\n @nome_arquivo... | [
"0.6215717",
"0.6102208",
"0.6062916",
"0.58696926",
"0.5843714",
"0.57966834",
"0.57595557",
"0.57085484",
"0.5653767",
"0.5574714",
"0.5551523",
"0.5540067",
"0.5537257",
"0.5537083",
"0.5519066",
"0.5512625",
"0.5501725",
"0.54870886",
"0.54860055",
"0.5478232",
"0.5449641... | 0.0 | -1 |
If the token matches and the message didn't come from a bot, it's valid | def is_valid_message?(params)
settings.environment == :development || (params[:token] == ENV['OUTGOING_WEBHOOK_TOKEN'] && params[:bot_id].nil?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_token?\n # we check against a copy invitation object\n match = Invitation.find_by_token(self.token)\n \n if !match\n errors.add :token, 'not found'\n return false\n elsif User.registered.find_by_invitation_id(match)\n errors.add :token, 'already used'\n return false\n ... | [
"0.74263006",
"0.7102092",
"0.7016975",
"0.6947431",
"0.69165707",
"0.6892884",
"0.6824097",
"0.67869073",
"0.6742491",
"0.67016643",
"0.669782",
"0.6675345",
"0.66559416",
"0.66433525",
"0.6636379",
"0.66019017",
"0.6553152",
"0.65401936",
"0.6520738",
"0.6507699",
"0.650680... | 0.69925076 | 3 |
If the bot isn't muted, and the ignore keyword is not invoked, and the reply keyword is invoked or the rand check passes, then the bot will send back a reply. | def should_reply?(params)
!$redis.exists?('snarkov:shush') &&
(settings.ignore_regex.nil? || !params[:text].match(settings.ignore_regex)) &&
(rand <= ENV['RESPONSE_CHANCE'].to_f || (!settings.reply_regex.nil? && params[:text].match(settings.reply_regex)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mention(tweet)\n\n #this is a bot we know\n if @botinfo.key?(tweet.user.screen_name)\n bot = @botinfo[tweet.user.screen_name]\n if bot.should_reply_to()\n #reply to the bot\n bot.replies_left -= 1\n sleep(rand(5..30))\n do_reply(tweet)\n else\n log \"n... | [
"0.6381172",
"0.6318381",
"0.61801255",
"0.6174202",
"0.6066064",
"0.5967502",
"0.5932968",
"0.5922163",
"0.59194344",
"0.5879722",
"0.5808572",
"0.5718681",
"0.5710215",
"0.57010704",
"0.56855667",
"0.56654376",
"0.566158",
"0.5657799",
"0.56436926",
"0.56341076",
"0.5601738... | 0.6844114 | 0 |
If the reply keyword isn't invoked and the ignore keyword isn't invoked, store the message as a markov chain. If the SLACK_USER env variable is set, store only if the message came from that user. | def should_store_message?(params)
(settings.ignore_regex.nil? || !params[:text].match(settings.ignore_regex)) &&
(settings.reply_regex.nil? || !params[:text].match(settings.reply_regex)) &&
(ENV['SLACK_USER'].nil? || ENV['SLACK_USER'] == params[:user_name] || ENV['SLACK_USER'] == params[:user_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def motivate_else(msg, user)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n if !msg.channel? || msg.channel.has_user?(user)\n line = StringUtility.random_line(Variables::Constants::MOTIVATE_PATH)\n @last_motivation = [] if @last_motivation.nil?\n ... | [
"0.51592064",
"0.49834445",
"0.49318662",
"0.48916408",
"0.48396516",
"0.482564",
"0.48105705",
"0.47970036",
"0.4775727",
"0.47521707",
"0.47322655",
"0.47286636",
"0.47013935",
"0.467362",
"0.46677613",
"0.46181053",
"0.46044406",
"0.458349",
"0.4572769",
"0.4568739",
"0.45... | 0.5493713 | 0 |
Returns true if it was actually used to bill something. | def used?
@used
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_be_performed?\n self.research_billing_qty > 0\n end",
"def charge?\n false\n end",
"def purchasing?\n auction.buy_it_now_price == amount\n end",
"def charges?\n true\n end",
"def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : fals... | [
"0.69430625",
"0.6914159",
"0.6685463",
"0.6670444",
"0.6668186",
"0.66440046",
"0.662336",
"0.6617768",
"0.6558158",
"0.6543516",
"0.6513329",
"0.65067697",
"0.64515555",
"0.6434751",
"0.64344245",
"0.64306927",
"0.6416937",
"0.6414396",
"0.6389751",
"0.63745624",
"0.6363867... | 0.6202695 | 45 |
code = Core::Village.pluck(:code).sample(1) Core::Village.find_by_code(code) Core::Village.new.random_one | def random_one
# p Rails.cache.read('all_codes')
codes = read_or_write_all_code
code = codes.sample(1)
return Core::Village.find_by_code(code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend",
"def random_zip_code\n @zip_code_ids ||= ZipCode.all(\n :select => \"id, city, state, zip\", \n :conditions => [ \"city not in (?) and state in (?)\", [\"APO\", \"FPO\"... | [
"0.7169474",
"0.68440634",
"0.681357",
"0.68009615",
"0.6792077",
"0.66672885",
"0.65605396",
"0.64995325",
"0.6495221",
"0.6495221",
"0.6495221",
"0.6495221",
"0.6482367",
"0.6454755",
"0.64377195",
"0.64377195",
"0.6385852",
"0.63734806",
"0.6363914",
"0.6362841",
"0.633329... | 0.8675071 | 0 |
The logger object. If no logger was set via Simple::SQL::Logging.logger = this returns a default logger. | def logger
@logger ||= default_logger
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger\n @logger || default_logger\n end",
"def logger\n @logger || default_logger\n end",
"def logger\n @logger ||= default_logger\n end",
"def logger\n return @logger ||= default_logger\n end",
"def logger\n @logger ||= Logging.get_logger(self)\n end",
"d... | [
"0.82135314",
"0.82135314",
"0.8158782",
"0.8126837",
"0.7982179",
"0.7979708",
"0.79249185",
"0.79064584",
"0.78637594",
"0.785374",
"0.78527415",
"0.7842131",
"0.7842131",
"0.7806446",
"0.7794092",
"0.7723157",
"0.7710822",
"0.76967484",
"0.76534665",
"0.7631599",
"0.763142... | 0.82019675 | 2 |
GET /adresses GET /adresses.json | def index
@adresses = Adress.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addresses\n @client.request('getaddressesbyaccount', name)\n end",
"def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end",
"def show_addresses(**params)\n get('addresses', params)\n end",
"def addresses\n message = { nodes: { item: resource[:name]}}\n transport[w... | [
"0.6942182",
"0.66654825",
"0.6609747",
"0.6552961",
"0.6526261",
"0.6461285",
"0.6404453",
"0.6339402",
"0.62915957",
"0.6285053",
"0.62458235",
"0.6173514",
"0.61523175",
"0.61380553",
"0.61332667",
"0.6130513",
"0.6130513",
"0.611754",
"0.5992826",
"0.5980523",
"0.5979079"... | 0.7359176 | 0 |
GET /adresses/1 GET /adresses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @adresses = Adress.all\n end",
"def show_addresses(**params)\n get('addresses', params)\n end",
"def addresses\n @client.request('getaddressesbyaccount', name)\n end",
"def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end",
"def get_addr... | [
"0.70344114",
"0.6541172",
"0.64972717",
"0.6491291",
"0.6470574",
"0.640893",
"0.63615936",
"0.63005716",
"0.62860125",
"0.62542003",
"0.6252503",
"0.6252503",
"0.6252503",
"0.6250174",
"0.62318873",
"0.62102795",
"0.6202849",
"0.6201957",
"0.6183571",
"0.6139039",
"0.613473... | 0.0 | -1 |
POST /adresses POST /adresses.json | def create
@cliente = Cliente.new id: '300', nome:'David', identificador:'14725836910', telefone:'8735334268', celular:'3698521472', email:'david@gmail.com', senha:'65423'
@cliente.save
@order = @cliente.orders.build(id: '800', menuTitle: 'Senor Froggy', street: 'Elm Street')
@cliente.save
#@adress ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @adresses = Adress.all\n end",
"def add_address(params)\n ad = AnubisNetwork::Model::AddAddress.new\n ad_arr = Array.new\n ad.domain_id = params[:domain_id]\n params[:address].each do |address|\n add = AnubisNetwork::Model::Address.new\n add.address = address\n ... | [
"0.63626206",
"0.58919346",
"0.5887831",
"0.58262646",
"0.57983154",
"0.5785037",
"0.5659587",
"0.56534684",
"0.5650409",
"0.5627136",
"0.5607938",
"0.5522939",
"0.55083275",
"0.54366946",
"0.54181755",
"0.54088634",
"0.5397335",
"0.535147",
"0.53435266",
"0.5340444",
"0.5332... | 0.54399705 | 13 |
PATCH/PUT /adresses/1 PATCH/PUT /adresses/1.json | def update
respond_to do |format|
if @adress.update(adress_params)
format.html { redirect_to @adress, notice: 'Adress was successfully updated.' }
format.json { render :show, status: :ok, location: @adress }
else
format.html { render :edit }
format.json { render json: @ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end",
"def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attribu... | [
"0.66531956",
"0.6537477",
"0.6514203",
"0.6423712",
"0.63397765",
"0.63397545",
"0.63194203",
"0.62909967",
"0.62365943",
"0.62365943",
"0.62365943",
"0.62365943",
"0.6220195",
"0.6206892",
"0.619429",
"0.6180924",
"0.6177069",
"0.61706114",
"0.61665493",
"0.6063577",
"0.605... | 0.59295195 | 28 |
DELETE /adresses/1 DELETE /adresses/1.json | def destroy
@adress.destroy
respond_to do |format|
format.html { redirect_to adresses_url, notice: 'Adress was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @adress = Adresse.find(params[:id])\n @adress.destroy\n\n respond_to do |format|\n format.html { redirect_to adresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tadress.destroy\n respond_to do |format|\n format.html { redirect_to tadress... | [
"0.69950527",
"0.6819986",
"0.67856854",
"0.67754006",
"0.67754006",
"0.67754006",
"0.67754006",
"0.66628844",
"0.663341",
"0.66117764",
"0.66017514",
"0.66017514",
"0.6599271",
"0.65841967",
"0.65623796",
"0.6535783",
"0.65269357",
"0.65063584",
"0.6483512",
"0.6466947",
"0.... | 0.68281895 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_adress
@adress = Adress.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def adress_params
params.require(:adress).permit(:street, :block, :number, :additional_info)
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 |
GET /attestations GET /attestations.json | def index
@attestations = Attestation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\r\n @attestations = Attestation.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @attestations }\r\n end\r\n end",
"def show\r\n @attestation = Attestation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html #... | [
"0.7774498",
"0.7062387",
"0.6825726",
"0.65822464",
"0.6481688",
"0.6334475",
"0.6334283",
"0.6297544",
"0.6192154",
"0.6156926",
"0.61197704",
"0.61025095",
"0.6088861",
"0.60884786",
"0.6073005",
"0.60504663",
"0.6041518",
"0.6035371",
"0.60261035",
"0.5988041",
"0.5987318... | 0.7586245 | 1 |
GET /attestations/1 GET /attestations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\r\n @attestations = Attestation.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @attestations }\r\n end\r\n end",
"def index\n @attestations = Attestation.all\n end",
"def show\r\n @attestation = Attestation.find(params[:id... | [
"0.75309217",
"0.72221315",
"0.7216205",
"0.64516485",
"0.64473933",
"0.6350999",
"0.6316999",
"0.6305277",
"0.6300529",
"0.62532043",
"0.619243",
"0.6057704",
"0.60474926",
"0.6036697",
"0.5990554",
"0.59835124",
"0.5955948",
"0.5952201",
"0.5909998",
"0.5867897",
"0.5859499... | 0.0 | -1 |
POST /attestations POST /attestations.json | def create
@attestation = Attestation.new(attestation_params)
respond_to do |format|
if @attestation.save
format.html { redirect_to @attestation, notice: 'Attestation was successfully created.' }
format.json { render :show, status: :created, location: @attestation }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\r\n @attestation = Attestation.new(params[:attestation])\r\n\r\n respond_to do |format|\r\n if @attestation.save\r\n format.html { redirect_to @attestation, notice: 'Attestation was successfully created.' }\r\n format.json { render json: @attestation, status: :created, location:... | [
"0.7358703",
"0.6361164",
"0.6302606",
"0.6227998",
"0.621351",
"0.61167514",
"0.6114278",
"0.6082942",
"0.60445833",
"0.60396403",
"0.59818757",
"0.5943698",
"0.5917033",
"0.58526975",
"0.5837751",
"0.5786057",
"0.57473093",
"0.57405496",
"0.5704879",
"0.56790227",
"0.567283... | 0.73572075 | 1 |
PATCH/PUT /attestations/1 PATCH/PUT /attestations/1.json | def update
respond_to do |format|
if @attestation.update(attestation_params)
format.html { redirect_to @attestation, notice: 'Attestation was successfully updated.' }
format.json { render :show, status: :ok, location: @attestation }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @attestation = Attestation.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @attestation.update_attributes(params[:attestation])\r\n format.html { redirect_to @attestation, notice: 'Attestation was successfully updated.' }\r\n format.json { head :no_content }\r\n ... | [
"0.6736559",
"0.63374496",
"0.6311761",
"0.6221075",
"0.6090144",
"0.60709184",
"0.60528225",
"0.6036692",
"0.6007806",
"0.5984319",
"0.59417075",
"0.5940051",
"0.59231824",
"0.5922508",
"0.592072",
"0.5905823",
"0.5891066",
"0.5870954",
"0.5851328",
"0.57922894",
"0.57704395... | 0.66847634 | 1 |
DELETE /attestations/1 DELETE /attestations/1.json | def destroy
@attestation.destroy
respond_to do |format|
format.html { redirect_to attestations_url, notice: 'Attestation was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @attestation = Attestation.find(params[:id])\r\n @attestation.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to attestations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @attdatum.destroy\n respond_to do |format|\n ... | [
"0.7408503",
"0.704781",
"0.7024327",
"0.69382733",
"0.67430973",
"0.6707844",
"0.66866755",
"0.6684118",
"0.6643479",
"0.66353834",
"0.66277915",
"0.6626858",
"0.66256076",
"0.6587201",
"0.65792626",
"0.6563915",
"0.65600634",
"0.6543841",
"0.6531248",
"0.652501",
"0.6506554... | 0.72836834 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_attestation
@attestation = Attestation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def attestation_params
params.require(:attestation).permit(:titre_attes, :universite, :date_da, :date_fa)
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 |
Display representation of the resource. | def display_resource(user)
user.email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_resource_content\n resource_content\n end",
"def show\n @resource = find_resource\n end",
"def display_resource(recipe)\n \"Recipe ##{recipe.id} - #{recipe.name}\"\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\n to_h.fetch(:display)\n... | [
"0.74081784",
"0.7045784",
"0.69489604",
"0.6946189",
"0.6946189",
"0.69241875",
"0.6840263",
"0.68391305",
"0.6783423",
"0.67766106",
"0.6707163",
"0.6642892",
"0.66289186",
"0.66277474",
"0.66264486",
"0.66202545",
"0.66113526",
"0.6606066",
"0.6605439",
"0.6605439",
"0.660... | 0.0 | -1 |
Creates a connection to the server. | def connect
@socket = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(@host, @port), OpenSSL::SSL::SSLContext.new)
@socket.sync_close = true
begin
@socket.connect
rescue Exception => e
STDOUT.puts "Error: #{e}"
exit(1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n @connection.create\n end",
"def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end",
"def connect\n Connection.new\n end",
"def connect_to_server\n fail \"connect_server called without remote established\" if @remote.nil?\n host,... | [
"0.7934635",
"0.7410201",
"0.73271096",
"0.73125774",
"0.7290705",
"0.7219585",
"0.7186921",
"0.71780324",
"0.71780324",
"0.71520764",
"0.71303785",
"0.7093724",
"0.70928425",
"0.70799744",
"0.7077021",
"0.70163226",
"0.69711137",
"0.69629174",
"0.69522923",
"0.69463867",
"0.... | 0.0 | -1 |
Listens to the socket and processes input. | def listen
loop do
begin
message = @socket.receive
rescue Exception => e
# If the socket was closed, possiby by another thread, then there's no real error, but we do have to quit.
unless @socket.closed?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run()\n loop do\n s = @sock.gets\n break if s.nil?\n @mutex.synchronize { handle_server_input(s) }\n end\n end",
"def listen\n @inbound = @socket.gets\n puts '>> ' << @inbound\n\n # Stay connected to the server.\n if @inbound =~ /^PING (?<msg>.*)$/\n pong = Regexp.last_... | [
"0.76609397",
"0.7315482",
"0.7128443",
"0.7021705",
"0.6990205",
"0.6933578",
"0.69278073",
"0.6866708",
"0.6844656",
"0.68143654",
"0.67935616",
"0.67935616",
"0.67935616",
"0.6748618",
"0.6737427",
"0.6703369",
"0.6661531",
"0.66539985",
"0.6612336",
"0.6587951",
"0.657691... | 0.65271026 | 21 |
Listens for input on stdin and processes it. | def prompt
print CLI_PROMPT_TEXT
while input = STDIN.gets
input.chomp!
case input
when /^\s*$/
# The user entered an empty line.
next
when /^\/quit$/i
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_handler\n STDIN.read.split(\"\\n\").each do |line|\n process_line(line)\n end\n end",
"def process_stdin\n process_file_handle($stdin)\n end",
"def read_stdin\n open_connection\n $stdin.each_line { |l| call_write(process_line(l.strip), false) }\n close_connection\n ... | [
"0.841944",
"0.80438143",
"0.7333507",
"0.7025278",
"0.6874973",
"0.68210804",
"0.674232",
"0.6668527",
"0.6585505",
"0.6585505",
"0.6569641",
"0.64935607",
"0.64806074",
"0.6436441",
"0.64014655",
"0.63876575",
"0.63634354",
"0.6276556",
"0.62370837",
"0.6213331",
"0.6158494... | 0.0 | -1 |
PATCH/PUT /props/1 PATCH/PUT /props/1.json | def update
respond_to do |format|
if @property.update(property_params)
format.html { redirect_to @property, notice: 'Property was successfully updated.' }
format.json { render :show, status: :ok, location: @property }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"def update\n respond_to do |format|\n if @prop.update(prop_params)\n format.html { redirect_t... | [
"0.6678301",
"0.6635183",
"0.6507511",
"0.64789456",
"0.64789456",
"0.64789456",
"0.64789456",
"0.64789456",
"0.6474363",
"0.6348138",
"0.6309796",
"0.6263543",
"0.623807",
"0.6211834",
"0.61962575",
"0.61821693",
"0.6176697",
"0.61620384",
"0.6149122",
"0.6133082",
"0.610595... | 0.5748094 | 75 |
Use callbacks to share common setup or constraints between actions. | def set_property
@property = Property.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 |
Cree un arreglo con los siguientes valores: John, KB, Oliver, Cory, Matthew, Christopher. Mezcla el arreglo y muestre el nombre de cada persona. Haz que el programa devuelva un arreglo con los nombres que tengan una longitud mayor a 5 caracteres. | def arreglo_de_nombres(arreglo)
seleccion = []
arreglo.shuffle!
arreglo.each do |valor|
puts valor.to_s.to_s
seleccion.push(valor) if valor.length > 5
end
puts "Array con nombres con más de 5 caracteres son: #{seleccion}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def male_name\n\t%w[Aaron Abdul Abe Abel Abraham Abram Adalberto Adam Adan Adolfo Adolph Adrian Agustin Ahmad Ahmed Al Alan Albert Alberto Alden Aldo Alec Alejandro Alex Alexander Alexis Alfonso Alfonzo Alfred Alfredo Ali Allan Allen Alonso Alonzo Alphonse Alphonso Alton Alva Alvaro Alvin Amado Ambrose Amos Anders... | [
"0.6449489",
"0.6400514",
"0.62936574",
"0.61558414",
"0.6097827",
"0.6083326",
"0.59669924",
"0.59086514",
"0.5883626",
"0.5841881",
"0.58073264",
"0.57950366",
"0.57569355",
"0.5712995",
"0.57126486",
"0.5711581",
"0.56996727",
"0.56927836",
"0.56846595",
"0.5672389",
"0.56... | 0.62084436 | 3 |
Genere una cadena aleatoria de 5 caracteres. (Pista (65+rand(26)).chr devuelve un caracter aleatorio). Genere un arreglo con 10 cadenas aleatorias de 5 caracteres cada una. | def cadena_aleatoria()
cadena=""
5.times do
cadena += (65+rand(26)).chr
end
return cadena
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aleatorio(arr)\n puts \"Cadena aleatoria: #{(65+rand(26)).chr*5}\"\n \nend",
"def cadenas(arr)\n 10.times do\n puts \"Cadena aleatoria: #{(65+rand(26)).chr*5}\"\n end\n \nend",
"def generate_string\n (0...6).map{(65+rand(26)).chr}.join\n end",
"def random_str()\n p (0...5).... | [
"0.78103584",
"0.7588081",
"0.7352813",
"0.727759",
"0.71961623",
"0.71844506",
"0.71591",
"0.7049643",
"0.70399404",
"0.7028957",
"0.701188",
"0.69769865",
"0.68605137",
"0.6858994",
"0.67989486",
"0.67989486",
"0.6798788",
"0.6793814",
"0.67223597",
"0.67024034",
"0.6681056... | 0.81131244 | 0 |
Always translate raw json response to ruby Hash | def request(klass, path, data={})
url = url(path)
http = http(url)
req = build_request(klass, url, data)
resp = http.request(req) # send request
load_json(resp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n fail_on_non_200_family_if_specified\n\n if @response['content-type'].nil? || @response['content-type'].include?('json')\n begin\n JSON.parse(@response.body)\n rescue JSON::ParserError\n raise Exceptions::JsonBodyParseError.new(@respons... | [
"0.7159207",
"0.7121831",
"0.71044934",
"0.7048616",
"0.70415306",
"0.7023363",
"0.69603795",
"0.695663",
"0.695663",
"0.695663",
"0.69555753",
"0.69497",
"0.69337505",
"0.6924938",
"0.69074166",
"0.689561",
"0.6883878",
"0.6878179",
"0.68317175",
"0.68317175",
"0.6785203",
... | 0.0 | -1 |
API does not include the /. IE: | def url(path)
"#{API}/#{path}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def web_path\n # 47 char is \"/\"\n return path[0] == 47 ? path : \"/\" + path\n end",
"def fix_api_path(path)\n path.gsub(/^\\/api/,'')\n end",
"def coreApiEP\n\t\tCORE_API_URL_83\n\tend",
"def fix_path_iupui(path)\n # IUPUI CDM no longer provides API on port 445\n # The API is ... | [
"0.59569156",
"0.594461",
"0.59050196",
"0.58295166",
"0.5763609",
"0.5684913",
"0.56773216",
"0.5656762",
"0.5619618",
"0.55665904",
"0.55575854",
"0.55517346",
"0.5533898",
"0.5532616",
"0.5531476",
"0.5517",
"0.5455186",
"0.5420456",
"0.5416873",
"0.5410177",
"0.54062235",... | 0.5550497 | 12 |
Note: 422 is Unprocessable Entity. This means an invalid data payload was sent. We want that to error and raise | def ok?(http_code)
http_code =~ /^20/ ||
http_code =~ /^40/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_code; 422; end",
"def status_code; 422; end",
"def status_code; 422; end",
"def status_code; 422; end",
"def unprocessable_entity(record)\n status 422\n errors = { \"errors\" => record.errors.full_messages }\n\n json errors\n end",
"def expect_unprocessable_status\n is_expected.to... | [
"0.75774765",
"0.75774765",
"0.75774765",
"0.75774765",
"0.712795",
"0.6833083",
"0.6803009",
"0.6721996",
"0.6691881",
"0.6567662",
"0.6530728",
"0.6526387",
"0.6464625",
"0.64340174",
"0.6382589",
"0.63722247",
"0.6343997",
"0.6234786",
"0.6111899",
"0.6106517",
"0.6101455"... | 0.0 | -1 |
return true if two objects overlap | def overlap?(object1, object2)
#upper left corner
lx1 = object1.x
ly1 = object1.y
lx2 = object2.x
ly2 = object2.y
#lower right corner
rx1 = object1.x + object1.class::WIDTH
ry1 = object1.y + object1.class::HEIGHT
rx2 = object2.x + object2.class::WIDTH
ry2 = object2.y + object2.class::HEIGHT
if rx1 - lx2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def crossing?(other)\n return false unless overlaps?(other)\n (@begin_pos <=> other.begin_pos) * (@end_pos <=> other.end_pos) == 1\n end",
"def overlap_ok?\n # if overlap: true\n end",
"def overl... | [
"0.86103153",
"0.86103153",
"0.86103153",
"0.7960069",
"0.7902008",
"0.7879431",
"0.7822977",
"0.7822977",
"0.77344334",
"0.7707891",
"0.7701493",
"0.7691895",
"0.76698625",
"0.7666476",
"0.7533684",
"0.7533684",
"0.752849",
"0.752849",
"0.7502857",
"0.74846876",
"0.7454727",... | 0.8462759 | 3 |
if any flies are near webs, catch them in the web | def catch_flies
@flies.each do |f|
@webs.each do |w|
if overlap?(w, f)
f.caught = true
w.add_fly(f)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_dickheads\n # Defaced the site on 16th Sep 2008\n if !/^122\\.109\\..*/.match(request.remote_addr).nil? ||\n # Probably the same person as above.\n !/^124\\.190\\..*/.match(request.remote_addr).nil? \n # Spammed the site on the 18th Sep 2008, probably same person as above\n # Sit... | [
"0.59160715",
"0.5486042",
"0.5395127",
"0.5263061",
"0.5245172",
"0.52440476",
"0.5209653",
"0.5206104",
"0.5198658",
"0.5187204",
"0.5176291",
"0.5142857",
"0.51421636",
"0.5101174",
"0.5089966",
"0.508258",
"0.50740814",
"0.50694317",
"0.50676996",
"0.506493",
"0.50572467"... | 0.7183832 | 0 |
How can we show the matching rules too? | def to_s
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules_by_name; end",
"def setup_match_rules\n include_match << Regexp.new('.') if @include_match.flatten.size == 0\n $logger.debug \"include match rules:\"\n ... | [
"0.66310793",
"0.66310793",
"0.66310793",
"0.66310793",
"0.66310793",
"0.66310793",
"0.66310793",
"0.6493082",
"0.62992674",
"0.61208117",
"0.61090785",
"0.61090785",
"0.61090785",
"0.6105726",
"0.6070141",
"0.60695875",
"0.60239965",
"0.60239965",
"0.5989508",
"0.5985707",
"... | 0.0 | -1 |
POST notification from the outside. Shall only be Slimpay | def ipn
head :bad_request and return if request.raw_post.blank? || request.raw_post['reference'].blank?
raw_post = JSON.parse(request.raw_post)
mandate = Mandate.find_by(slimpay_order_reference: raw_post['reference'])
head :unprocessable_entity and return if mandate.nil?
mandate.update_from_ipn(raw_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_notification\n\n\n end",
"def send_notification(method, params); end",
"def notify_post\n raise \"not yet implemented\"\n end",
"def notify(params)\n client.post('/notify', params)\n end",
"def notify(data={})\n RestClient::Request.execute(:method => :post, :url => notify_p... | [
"0.7298548",
"0.6947043",
"0.6908865",
"0.6872362",
"0.68377876",
"0.6742104",
"0.67364126",
"0.6707698",
"0.6648881",
"0.6622268",
"0.65911096",
"0.65780646",
"0.6570212",
"0.6514477",
"0.64850134",
"0.6476786",
"0.63494194",
"0.63351744",
"0.6330513",
"0.63157874",
"0.62923... | 0.0 | -1 |
POST from inside app. Creates a Slimpay Order and redirect to Slimpay's approval page. | def sepa
mandate = @user.mandates.last
if mandate.present? && mandate.ready?
redirect_to_for_user_or_admin and return
end
redirect_to mandate.slimpay_approval_url and return if mandate && mandate.waiting?
mandate = Mandate.sign(@user)
if mandate.present?
redirect_to mandate.slimpay_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @sorder = Sorder.new(params[:sorder])\n\n respond_to do |format|\n if @sorder.save\n format.html { redirect_to sites_path, notice: '您的预约申请已提交,请耐心等待回复!' }\n format.json { render json: @sorder, status: :created, location: @sorder }\n else\n format.html { render actio... | [
"0.7134421",
"0.6776088",
"0.67608047",
"0.66631377",
"0.66309303",
"0.66065997",
"0.65969765",
"0.65891486",
"0.64864236",
"0.6485323",
"0.6460436",
"0.64515245",
"0.64439905",
"0.64436847",
"0.64359355",
"0.64228034",
"0.641805",
"0.6408829",
"0.6398645",
"0.63866866",
"0.6... | 0.0 | -1 |
Remove mandate which are not signed yet, so the user can sign a new one | def destroy_pending_mandates
@user.mandates.where(slimpay_order_state: Mandate::SLIMPAY_ORDER_WAITING).first.try(:destroy)
@user.update_attributes(payment_mode: 'cb')
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_sign()\n # TODO\n end",
"def clearsign()\n # TODO\n end",
"def unrevoke_consent!\n update(consent_revoked_at: nil)\n end",
"def destroy\n @digital_signature.hidden = true\n @digital_signature.save\n \n ap @user.digital_signature_uuid\n ap @digital_signature.uuid\... | [
"0.65326756",
"0.62838405",
"0.5989791",
"0.59637487",
"0.5881698",
"0.58059156",
"0.57847357",
"0.5746672",
"0.5746163",
"0.568851",
"0.56677455",
"0.5663229",
"0.56526184",
"0.5642583",
"0.55889904",
"0.5576527",
"0.5542878",
"0.5528131",
"0.5511546",
"0.55074537",
"0.54986... | 0.6112681 | 2 |
before_filter :has_view_permission, :only => [:show, :replies, :reply, :destroy] curl u username:password X POST d 'send_to=34' d 'body=Api call' | def create
@user = User.find(params[:send_to]) if params[:send_to].present?
@message = Message.new(({:body => params[:body] ,:user_id => current_user.id, :user_status => "sent", :message_type => 'sent', :receiver_id => @user.id, :receiver_status => "unread"}))
if @message.save
UserMailer.message_notif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_filters\n set_user\n authorize\n end",
"def authorize\n \t\t#teste http://localhost:3000/products/2/who_bought.atom\n \t\t#ou curl --silent --user dave:secret http://localhost:3000/products/2/who_bought.atom \n \t\treturn if User.count.zero?\n\n \t\tif request.format == Mime[:html]\n \t\t\tus... | [
"0.60828215",
"0.573972",
"0.5717027",
"0.5695388",
"0.5695388",
"0.5597764",
"0.55471414",
"0.5527132",
"0.5527132",
"0.5515662",
"0.55020875",
"0.54927075",
"0.5492394",
"0.54733",
"0.5461139",
"0.5438461",
"0.54235595",
"0.5423505",
"0.53997743",
"0.5399251",
"0.5387927",
... | 0.0 | -1 |
curl u username:password curl u username:password | def index
@message_type = params[:message_type] || "inbox"
if @message_type == "inbox"
sql_query = "select * from messages a where a.user_id in ( select user_id from messages where receiver_id=#{current_user.id}) and id in ( select max(id) from messages b where a.user_id =b.user_id
and a.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_the_get_call(args)\n\tputs \"----- GET: #{args[:url]} -----\"\n\tc = Curl::Easy.new(args[:url]) do |curl|\n\t\tcurl.http_auth_types = :basic\n\t\tcurl.username = args[:user]\n\tend\n\tc.perform\n\tc.body_str\nend",
"def curl(path)\n `curl -k -u '#{username}:#{password}' -X GET -H \"Content-Type: appl... | [
"0.68599474",
"0.6741079",
"0.66243756",
"0.64719534",
"0.6470479",
"0.6386112",
"0.61185485",
"0.6106087",
"0.6054729",
"0.6045106",
"0.6042954",
"0.6042954",
"0.6000492",
"0.59592474",
"0.59290653",
"0.59021676",
"0.59000766",
"0.5829968",
"0.58116454",
"0.580108",
"0.57899... | 0.0 | -1 |
curl u username:password X POST d 'body=reply Api call' | def reply
@user = User.find(params[:id])
@messages_reply = Message.new(:body => params[:body], :user_id => current_user.id, :user_status => "sent", :message_type => 'sent', :receiver_id => @user.id, :receiver_status => "unread")
if @messages_reply.save
UserMailer.message_notification(current_user, @us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_curl\n `curl -X \"POST\" -H \"Authorization: Basic #{_encode}\" -d grant_type=client_credentials https://accounts.spotify.com/api/token`\n end",
"def executeadb(token, rid , adbcommand)\nuri = URI.parse(\"https://device.pcloudy.com/api/execute_adb\")\n@toSend = {\n \"token\" => token , \"rid\" => ... | [
"0.6669506",
"0.6334989",
"0.6306411",
"0.6293327",
"0.6257786",
"0.62484455",
"0.61918926",
"0.61857796",
"0.6134889",
"0.61033386",
"0.6074362",
"0.60725176",
"0.6028187",
"0.60243005",
"0.600897",
"0.6007247",
"0.5975986",
"0.5961953",
"0.5948328",
"0.59323037",
"0.585474"... | 0.0 | -1 |
curl u username:password X GET | def conversation
@user = User.find(params[:id])
@messages = Message.find(:all, :conditions => ["((messages.user_id = #{current_user.id} and messages.receiver_id = #{params[:id]}) and messages.user_status != 'deleted') or ((messages.receiver_id = #{current_user.id} and messages.user_id = #{params[:id]}) and mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_the_get_call(args)\n\tputs \"----- GET: #{args[:url]} -----\"\n\tc = Curl::Easy.new(args[:url]) do |curl|\n\t\tcurl.http_auth_types = :basic\n\t\tcurl.username = args[:user]\n\tend\n\tc.perform\n\tc.body_str\nend",
"def curl(path)\n `curl -k -u '#{username}:#{password}' -X GET -H \"Content-Type: appl... | [
"0.7631609",
"0.67292225",
"0.6702501",
"0.6669805",
"0.659992",
"0.6487564",
"0.6410609",
"0.6311089",
"0.6294629",
"0.6223902",
"0.6203015",
"0.6203015",
"0.62025684",
"0.6157892",
"0.6119399",
"0.607474",
"0.6056833",
"0.60539716",
"0.6037368",
"0.60268164",
"0.60231304",
... | 0.0 | -1 |
curl u username:password X GET | def sent_messages
@user = User.find(params[:id])
@messages = Message.find(:all, :conditions => ["(messages.user_id = #{current_user.id} and messages.receiver_id = #{@user.id}) and messages.user_status != 'deleted'"], :order => "created_at Desc")
respond_to do |format|
format.xml { render :xml => @mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_the_get_call(args)\n\tputs \"----- GET: #{args[:url]} -----\"\n\tc = Curl::Easy.new(args[:url]) do |curl|\n\t\tcurl.http_auth_types = :basic\n\t\tcurl.username = args[:user]\n\tend\n\tc.perform\n\tc.body_str\nend",
"def curl(path)\n `curl -k -u '#{username}:#{password}' -X GET -H \"Content-Type: appl... | [
"0.7631609",
"0.67292225",
"0.6702501",
"0.6669805",
"0.659992",
"0.6487564",
"0.6410609",
"0.6311089",
"0.6294629",
"0.6223902",
"0.6203015",
"0.6203015",
"0.62025684",
"0.6157892",
"0.6119399",
"0.607474",
"0.6056833",
"0.60539716",
"0.6037368",
"0.60268164",
"0.60231304",
... | 0.0 | -1 |
curl u username:password X DELETE | def destroy
@message = Message.find(params[:id])
@message.make_deleted(current_user.id)
response_message = {:message => 'Message deleted successfully.'}
respond_to do |format|
format.xml { render :xml => response_message }
format.json { render :json => response_message }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthd... | [
"0.69499",
"0.692993",
"0.68279326",
"0.68279326",
"0.67056483",
"0.6680073",
"0.6680073",
"0.6648515",
"0.66216147",
"0.66214836",
"0.6608028",
"0.65509456",
"0.65265626",
"0.65265626",
"0.65265626",
"0.65265626",
"0.6516304",
"0.6494594",
"0.6488324",
"0.6479135",
"0.645950... | 0.0 | -1 |
GET /mobile_texts GET /mobile_texts.json | def index
@mobile_texts = MobileText.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mobile_text = MobileText.first\n end",
"def index\n @api_v1_custom_texts = Api::V1::CustomText.all\n end",
"def create\n @mobile_text = MobileText.new(mobile_text_params)\n\n respond_to do |format|\n if @mobile_text.save\n format.html { redirect_to @mobile_text, notice: '... | [
"0.648139",
"0.6477673",
"0.624321",
"0.61636233",
"0.611758",
"0.6101233",
"0.6098373",
"0.5969211",
"0.5877422",
"0.58748984",
"0.58270496",
"0.58262867",
"0.58097625",
"0.5795659",
"0.5771636",
"0.5768296",
"0.5758541",
"0.5721769",
"0.57203203",
"0.568854",
"0.568854",
... | 0.7320501 | 0 |
GET /mobile_texts/1 GET /mobile_texts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mobile_texts = MobileText.all\n end",
"def index\n @mobile_text = MobileText.first\n end",
"def index\n @api_v1_custom_texts = Api::V1::CustomText.all\n end",
"def create\n @mobile_text = MobileText.new(mobile_text_params)\n\n respond_to do |format|\n if @mobile_text.save\... | [
"0.70919025",
"0.6780034",
"0.6629672",
"0.62645465",
"0.6225511",
"0.6196342",
"0.61849433",
"0.6183811",
"0.61756015",
"0.6140283",
"0.6072293",
"0.6023726",
"0.6013355",
"0.5954265",
"0.5949056",
"0.59026784",
"0.588717",
"0.5844666",
"0.5834189",
"0.5833031",
"0.5824666",... | 0.0 | -1 |
POST /mobile_texts POST /mobile_texts.json | def create
@mobile_text = MobileText.new(mobile_text_params)
respond_to do |format|
if @mobile_text.save
format.html { redirect_to @mobile_text, notice: 'Mobile text was successfully created.' }
format.json { render :show, status: :created, location: @mobile_text }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mobile_text = MobileText.new(mobile_text_params)\n if @mobile_text.save\n redirect_to mobile_texts_path\n end\n end",
"def mobile_text_params\n params.require(:mobile_text).permit(:username, :scode, :mobile, :content, :extcode, :sendtime, :msgid, :msgtype, :signtag, :temid)... | [
"0.75294703",
"0.6826893",
"0.6803009",
"0.65144825",
"0.637154",
"0.6276111",
"0.62655586",
"0.62486815",
"0.6204792",
"0.61643445",
"0.6163519",
"0.6074828",
"0.60724056",
"0.6040063",
"0.60131234",
"0.599385",
"0.59820765",
"0.5952593",
"0.590807",
"0.58700836",
"0.5856204... | 0.7718916 | 0 |
PATCH/PUT /mobile_texts/1 PATCH/PUT /mobile_texts/1.json | def update
respond_to do |format|
if @mobile_text.update(mobile_text_params)
format.html { redirect_to @mobile_text, notice: 'Mobile text was successfully updated.' }
format.json { render :show, status: :ok, location: @mobile_text }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @api_v1_custom_text.update(api_v1_custom_text_params)\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_custom_text }\n else\n for... | [
"0.7202029",
"0.6722435",
"0.6652793",
"0.6633506",
"0.6624083",
"0.6617899",
"0.6528623",
"0.6528623",
"0.6521625",
"0.63481635",
"0.6338621",
"0.63032615",
"0.6293746",
"0.6264988",
"0.6254375",
"0.62303036",
"0.6208535",
"0.62071013",
"0.6178451",
"0.6136402",
"0.6127293",... | 0.73772717 | 0 |
DELETE /mobile_texts/1 DELETE /mobile_texts/1.json | def destroy
@mobile_text.destroy
respond_to do |format|
format.html { redirect_to mobile_texts_url, notice: 'Mobile text was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_custom_text.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_custom_texts_url, notice: 'Custom text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_text.destroy\n respond_to do |format|\n ... | [
"0.7136241",
"0.69681484",
"0.68893296",
"0.6834534",
"0.67831945",
"0.67831945",
"0.67780805",
"0.6756131",
"0.67237973",
"0.670528",
"0.668546",
"0.6680828",
"0.66757345",
"0.6670486",
"0.66424644",
"0.65918994",
"0.6586538",
"0.65767276",
"0.6563888",
"0.6556013",
"0.65394... | 0.7520145 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_mobile_text
@mobile_text = MobileText.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def mobile_text_params
params.require(:mobile_text).permit(:username, :scode, :mobile, :content, :extcode, :sendtime, :msgid, :msgtype, :signtag, :temid)
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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
to keep welcome DRY | def cycle
gameover = false
#keep going until all letters are guessed or they're out of mistakes
until gameover
gameover = turn
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_welcome\n end",
"def welcome\r\n end",
"def welcome \n end",
"def welcome \n end",
"def welcome\n\tend",
"def welcome\n puts message_list[:welcome]\n # help\n end",
"def welcome\nend",
"def welcome\n # show welcome\n end",
"def welcome_message\n 'Benvenuto'\nend",
"... | [
"0.77563494",
"0.76970667",
"0.7600615",
"0.7583094",
"0.75327057",
"0.7459084",
"0.7250403",
"0.721516",
"0.7014987",
"0.69868284",
"0.695916",
"0.6902952",
"0.68853956",
"0.68828684",
"0.6853306",
"0.6825658",
"0.6817209",
"0.6750743",
"0.67087823",
"0.6703976",
"0.6703976"... | 0.0 | -1 |
for the next method, "gameover_check," to keep it DRY | def response
response = gets.chomp
if (response.downcase == "yes" || response.downcase == "y")
initialize
welcome
return true
elsif (response.downcase == "no" || response.downcase == "n")
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_over\n end",
"def call_gameover\n\t\t@is_gameover = true\n\tend",
"def game_over?\n true\n end",
"def game_over\n #some end game conditions\nend",
"def over?\n \t@game_over = true\n end",
"def game_over?\nwin_formations = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 4, 8],\n[2, 4, 6... | [
"0.76134914",
"0.7467508",
"0.74674195",
"0.7436417",
"0.7414707",
"0.73828256",
"0.7253686",
"0.71984524",
"0.71522725",
"0.7123795",
"0.7114641",
"0.7114308",
"0.71108866",
"0.7106526",
"0.71056986",
"0.70920765",
"0.7085563",
"0.7081249",
"0.70588756",
"0.7008195",
"0.7006... | 0.0 | -1 |
bundle exec sets GEM_HOME and GEM_PATH (in Windows?) and these need to be wacked in order to have a pristing rubygems environment since bundler won't clean them. also, if you 'bundle exec rake ...' and then put arguments to the right of the task name, then these args won't appear in Bundler::ORIGINAL_ENV. example: "bun... | def setup_clean_env
# user may be running gem binary directly without bundler.
if defined?(::Bundler)
# a little revisionist history music...
::ENV.each do |key, value|
if key.start_with?('GEM_') || key.start_with?('BUNDLER_')
::Bundler::ORIGINAL_ENV[key] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrapin_bundle_command(command)\n \"cd #{fetch(:current_path)} && RAILS_ENV=\\\"#{fetch(:env)}\\\" bundle exec #{command}\"\nend",
"def run_bundler\n script = path( 'scripts', 'gem-bundle.rb' )\n ENV.temporary( 'RUBYOPT' => '' ) do\n system %(ruby '#{script}')\n end\n end",
"def add_standard... | [
"0.6654296",
"0.6468149",
"0.6374913",
"0.62406063",
"0.6178055",
"0.6161511",
"0.61539984",
"0.61539984",
"0.6022124",
"0.60121316",
"0.5985987",
"0.5970671",
"0.5970671",
"0.5970671",
"0.5966339",
"0.5940251",
"0.5938663",
"0.5938663",
"0.5924667",
"0.5924667",
"0.5924667",... | 0.6227143 | 4 |
Creates a null logger. | def null_logger
NullLoggerSingleton.instance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger\n @logger ||= Logger.new(\"/dev/null\")\n end",
"def create_logger\n raise \"You should create your own `create_logger` method\"\n end",
"def create_logger\n raise \"You should create your own `create_logger` method\"\n end",
"def logger\n initialize_logger unless @l... | [
"0.7801553",
"0.71504605",
"0.71504605",
"0.71178985",
"0.7095466",
"0.69793254",
"0.69756454",
"0.6925382",
"0.6925382",
"0.6922051",
"0.6746934",
"0.6739123",
"0.6583602",
"0.6583602",
"0.6557882",
"0.6544262",
"0.65313834",
"0.65156096",
"0.6431689",
"0.64180624",
"0.63749... | 0.8060532 | 0 |
Encapsulates executioner with bundlerdefeating logic, but only if bundler has been loaded by current process. | def wrap_executioner_with_clean_env(executioner)
# only if bundler is loaded.
if defined?(::Bundler)
# double-lambda, single call freezes the inner call made to previous
# definition of executioner.
executioner = lambda do |e|
lambda { ::Bundler.with_clean_env {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundler_exec\n unless options[:skip_bundle]\n puts \"Execute bundle install --path vendor\"\n end\n end",
"def bundle_exec\n if defined?(Bundler)\n Bundler.with_clean_env do\n yield\n end\n else\n yield\n end\n end",
"def run_bundl... | [
"0.61940193",
"0.61750585",
"0.6124258",
"0.61040694",
"0.5999133",
"0.5974333",
"0.5974333",
"0.5864226",
"0.57428485",
"0.5717448",
"0.5717448",
"0.5589103",
"0.5589103",
"0.5589103",
"0.5495915",
"0.5495915",
"0.54693866",
"0.5444772",
"0.5435417",
"0.5369103",
"0.53682053... | 0.6553152 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = Post.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def post_params
params.require(:post).permit(:title, :body)
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 |
FIXME: should be private maybe? | def push_branch
return puts "Not pushing, isn't a branch: #{@name}" unless valid?
puts "Checking if we can push something on #{@source.name}"
return puts "...nothing to push for #{@source.name}" unless dirty? && valid?
puts "...pushing #{@source.name}[#{shortsha(@source.name)}]"
@git.push('origin'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def internal; end",
"def custom; end",
"def custom; end",
"def refutal()\n end",
"def identify;... | [
"0.80957866",
"0.6639101",
"0.65793186",
"0.65793186",
"0.65793186",
"0.65793186",
"0.6338987",
"0.6262095",
"0.6262095",
"0.62532336",
"0.61071944",
"0.61071944",
"0.6058324",
"0.60219544",
"0.58825666",
"0.5876437",
"0.5876437",
"0.5833188",
"0.5833188",
"0.5833188",
"0.583... | 0.0 | -1 |
Provide the target where the builder output will be accomulated. The builder utilizes duck typing to make it compatible with any target responding to <<. | def initialize(buffer = '', options = {})
@buffer = buffer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target!\n @target\n end",
"def target\n @target ||= request(build_request)\n end",
"def target\n self\n end",
"def target\n self\n end",
"def target!\n @target.__class__ == JVM::XmlMarkup ? @target.toString : @target\n end",
"def target\n return se... | [
"0.645459",
"0.62077767",
"0.6186254",
"0.6186254",
"0.6141957",
"0.6140644",
"0.61110455",
"0.60362566",
"0.6022771",
"0.6022771",
"0.6016765",
"0.6002976",
"0.59718853",
"0.5950994",
"0.59000915",
"0.58298326",
"0.5828694",
"0.5824117",
"0.5824117",
"0.5824117",
"0.57827914... | 0.0 | -1 |
Emit a text string. | def text!(str)
@buffer << str
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emit_text value\n # don't bother emitting empty strings\n return if value.empty?\n\n # combine adjacent statements to reduce code size\n if prev = insertion_point.last and prev.type == :text\n prev.value << value\n else\n statement :text, value\n end\... | [
"0.7094636",
"0.699978",
"0.6859193",
"0.68329155",
"0.66854095",
"0.66768",
"0.65446734",
"0.6525269",
"0.65087485",
"0.64361537",
"0.64361537",
"0.6360305",
"0.6360305",
"0.63371956",
"0.62983656",
"0.628775",
"0.62679774",
"0.6251297",
"0.6241564",
"0.6237866",
"0.62358224... | 0.0 | -1 |
Launch an EC2 instance. Duration (optional) specified in minutes | def start(s, duration: nil)
found = self.find_image(s)
return unless found
found.start duration: duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch\n puts \"==> Creating EC2 instance...\"\n\n @instance = @aws_ec2.instances.create( @config.env.merge( { \"key_name\" => key_name, \"security_groups\" => [security_group_name] } ) )\n @instance.tag(\"environment\", {value: @config.environment})\n\n while @instance.status == :pending\n... | [
"0.73280126",
"0.64046234",
"0.64046234",
"0.633222",
"0.6251096",
"0.6062254",
"0.6057465",
"0.5895303",
"0.58725375",
"0.58475906",
"0.57821107",
"0.57300454",
"0.56949776",
"0.5692273",
"0.56458217",
"0.55237937",
"0.54810655",
"0.5479925",
"0.53962606",
"0.53953654",
"0.5... | 0.4776613 | 66 |
path is to an external server | def remote?
%w[http https].include? scheme
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n File.join(server.url, path)\n end",
"def host_local_url(host, path)\n if host.is_cygwin?\n path_result = on(host, \"cygpath #{path}\")\n path = path_result.raw_output.chomp\n end\n \"file://#{path}\"\nend",
"def get_server_path\n @host=request.host.to_s\n @port=request.port... | [
"0.6922048",
"0.67976254",
"0.6569229",
"0.6549364",
"0.6373041",
"0.6349799",
"0.6309526",
"0.62329614",
"0.61436164",
"0.61054003",
"0.6095832",
"0.6080829",
"0.60798067",
"0.6077217",
"0.6077217",
"0.6062951",
"0.6029756",
"0.5983245",
"0.5980853",
"0.5974275",
"0.59627837... | 0.0 | -1 |
path is external to the file | def external?
!internal?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_path; end",
"def file_path\n end",
"def path_external\n @path_external ||= File.join(folder_external_documents, external_name)\n end",
"def external_path_for_source\n @external_path_for_source ||= File.join('source', 'external_document', external_name)\n end",
"def path\n @file\n ... | [
"0.7630319",
"0.7296515",
"0.71864015",
"0.7078985",
"0.70546204",
"0.70520175",
"0.69804174",
"0.69782",
"0.6970082",
"0.6966395",
"0.69155777",
"0.69155777",
"0.69155777",
"0.691021",
"0.68877816",
"0.6869493",
"0.6823698",
"0.6809397",
"0.6809397",
"0.6809397",
"0.67787975... | 0.0 | -1 |
checks if a file exists relative to the current pwd | def exists?
return @checked_paths[absolute_path] if @checked_paths.key?(absolute_path)
@checked_paths[absolute_path] = File.exist?(absolute_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strict_file_exists?(path)\n directory = `dirname #{path}`.chomp\n name = `basename #{path}`.chomp\n !`find \"#{directory}\" -name \"#{name}\"`.empty?\n end",
"def file_exists?(file_path)\n File.exist? @site.in_source_dir(file_path)\n end",
"def file_exists?\r\n File.file?(ful... | [
"0.7923654",
"0.77455646",
"0.7581086",
"0.74026537",
"0.7377886",
"0.7377886",
"0.73018795",
"0.7280106",
"0.72700566",
"0.7260943",
"0.7242863",
"0.7208589",
"0.71862406",
"0.716173",
"0.7161263",
"0.7156119",
"0.71543527",
"0.7152248",
"0.7149759",
"0.71378183",
"0.7087042... | 0.0 | -1 |
If true, this allows the overriden new method to generate descendants from its constructors. | def init_foundation
@init_foundation ||= false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_constructor()\n res = super(context,self)\n return res\n end",
"def initialize\n super(true)\n end",
"def initialize(parent); end",
"def new \n super\n end",
"def new\n super\n end",
"def new\n super\n end",
"def new?\n raise NotImplementedError\n ... | [
"0.6779532",
"0.5999272",
"0.5954075",
"0.58954155",
"0.5865669",
"0.58292294",
"0.5820622",
"0.5816625",
"0.57984716",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
"0.5798032",
... | 0.0 | -1 |
Sets the init_foundation variable to true of false. When false, the new method behaves like any other class. If true, the new method can instantiate child classes using the :_class named parameter. | def init_foundation=(toggle)
@init_foundation = toggle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_foundation\n @init_foundation ||= false\n end",
"def initialize\n @awesome_methods = {}\n \n # Check if we're bootstraping. During this process\n # the runtime is not fully initialized and core classes\n # do not yet exists, so we defer setting the object class\n # once thi... | [
"0.6814641",
"0.5917918",
"0.5885977",
"0.55758053",
"0.55128527",
"0.54909194",
"0.54451495",
"0.5424772",
"0.5380611",
"0.5335432",
"0.53024316",
"0.5286726",
"0.52698886",
"0.5263661",
"0.52162874",
"0.5143697",
"0.51382184",
"0.5101287",
"0.50603694",
"0.5053272",
"0.5052... | 0.6364678 | 1 |
Sets or returns the current init type for this class. Available types are: => :strict = Unknown named arguments will raise an error. => :loose = Unknown named arguments are ignored. | def init_type(type = nil)
return @init_type ||= _super_init_type unless type
raise ArgumentError, "Unknown init type '#{type}'. Must be #{INIT_TYPES.join_terms('or', encapsulate: "'")}." unless INIT_TYPES.include?(type)
@init_type = type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _super_init_type\n ancestors.each do |ancestor|\n next if ancestor == self\n return ancestor.init_type if ancestor.respond_to?(:init_type)\n end\n :strict\n end",
"def set_type\n end",
"def set_type(opts)\n opts = check_params(opts,[:types])\n super(... | [
"0.62416035",
"0.57951266",
"0.57737607",
"0.56254697",
"0.5555172",
"0.55367494",
"0.54735845",
"0.54197884",
"0.53802365",
"0.5359182",
"0.5359182",
"0.53395945",
"0.5338998",
"0.5314094",
"0.530323",
"0.52596414",
"0.5221966",
"0.5205848",
"0.51732886",
"0.5164635",
"0.516... | 0.6346128 | 0 |
Used to load the init type of the nearest ancestor for inheritance. | def _super_init_type
ancestors.each do |ancestor|
next if ancestor == self
return ancestor.init_type if ancestor.respond_to?(:init_type)
end
:strict
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_parent(doc)\n\n # Scan evidence of a superclass.\n doc.scan(@extends_regexp)\n\n # If we match then convert the import to a file reference.\n if $9 != nil\n possible_parent_paths = imported_class_to_file_path(doc,$9)\n log_append(\"Loading super class '#{$9}' '#{possible_parent_paths... | [
"0.59044486",
"0.58259416",
"0.58011687",
"0.57844096",
"0.5783485",
"0.56018645",
"0.557875",
"0.55524623",
"0.5551649",
"0.5550335",
"0.55458426",
"0.5524962",
"0.5524958",
"0.5489132",
"0.54659444",
"0.54091287",
"0.53986627",
"0.5391044",
"0.5383161",
"0.53695166",
"0.536... | 0.75286096 | 0 |
Dynamically create a new class based on this one. By default this class is generated in the same namespace as the parent class. A custom namespace can be passed in using the named argument :namespace. | def build_descendant(name, namespace: parent_namespace)
namespace.const_set(name, Class.new(self))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_class(name, parent: Object, &block)\n klass = Class.new(parent, &block)\n @managed.const_set(name, klass)\n klass\n end",
"def create_class(parent_klass)\n Class.new(metadata_base_class).tap do |klass|\n parent_klass.const_set(:GeneratedMetadataSchema, klass)\n ... | [
"0.668394",
"0.6675249",
"0.66360027",
"0.64217013",
"0.63986963",
"0.6299954",
"0.6257765",
"0.6210344",
"0.6036407",
"0.6036407",
"0.6007726",
"0.59571075",
"0.59363794",
"0.59335506",
"0.5924553",
"0.59225816",
"0.5891755",
"0.5891755",
"0.58777153",
"0.5862165",
"0.581476... | 0.6785695 | 0 |
Returns the nearest parent namespace to thi current class. Object is returned if this class is not in a namespace. | def parent_namespace
parent = self.to_s.split('::')[0..-2].join('::')
if parent.empty?
return Object
else
Object.const_get(parent)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end",
"def parent\n object.try(:loaded)&.[](:parents)&.first || wayfinder.decorated_parent\n end",
"def ancestor_class\n list = ancestor... | [
"0.7099743",
"0.6633518",
"0.6597774",
"0.65872973",
"0.65105456",
"0.63953996",
"0.63756233",
"0.63493085",
"0.63316387",
"0.6295194",
"0.62837356",
"0.6249047",
"0.62430733",
"0.6220985",
"0.6214931",
"0.6213668",
"0.6200091",
"0.6191631",
"0.61893046",
"0.6167626",
"0.6161... | 0.8529686 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.