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 |
|---|---|---|---|---|---|---|
GET /engineering_projects/1 GET /engineering_projects/1.json | def show
@engineering_project = EngineeringProject.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @engineering_project }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @environments = @project.environments.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @environments }\n end\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def index\n @projects = Project.all\n render js... | [
"0.7149485",
"0.7131069",
"0.70677793",
"0.70514643",
"0.7049605",
"0.70469934",
"0.70395297",
"0.7025475",
"0.69842905",
"0.69807994",
"0.6979739",
"0.6973522",
"0.6960466",
"0.6960466",
"0.6960466",
"0.6960466",
"0.6960466",
"0.6960466",
"0.6960466",
"0.69595706",
"0.693454... | 0.73231673 | 0 |
GET /engineering_projects/new GET /engineering_projects/new.json | def new
@engineering_project = EngineeringProject.new
@engineering_project = @engineering_project.incrament(@engineering_project)
respond_to do |format|
format.html # new.html.erb
format.json { render json: @engineering_project }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n ... | [
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"0.7931254",
"... | 0.72077984 | 82 |
POST /engineering_projects POST /engineering_projects.json | def create
@engineering_project = EngineeringProject.new(params[:engineering_project])
respond_to do |format|
if @engineering_project.save
format.html { redirect_to engineering_projects_url, notice: 'Engineering project was successfully created.' }
format.json { render json: @engineering_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application... | [
"0.6670475",
"0.66035074",
"0.65902543",
"0.65616924",
"0.6541283",
"0.6538897",
"0.6515668",
"0.64961314",
"0.6477171",
"0.6451445",
"0.64310026",
"0.642782",
"0.6421149",
"0.64194804",
"0.64130104",
"0.64118814",
"0.6405883",
"0.63849044",
"0.63764805",
"0.63690054",
"0.635... | 0.7267233 | 0 |
PUT /engineering_projects/1 PUT /engineering_projects/1.json | def update
@engineering_project = EngineeringProject.find(params[:id])
respond_to do |format|
if @engineering_project.update_attributes(params[:engineering_project])
format.html { redirect_to @engineering_project, notice: 'Engineering project was successfully updated.' }
format.json { hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:pattern] = '/proj... | [
"0.6712551",
"0.6664529",
"0.6631441",
"0.6618217",
"0.65340817",
"0.65230054",
"0.6522281",
"0.65103954",
"0.6496364",
"0.6467704",
"0.6467704",
"0.6459735",
"0.6454599",
"0.64523685",
"0.64351225",
"0.64351225",
"0.6425851",
"0.64228874",
"0.6414604",
"0.64095455",
"0.64016... | 0.7100575 | 0 |
DELETE /engineering_projects/1 DELETE /engineering_projects/1.json | def destroy
@engineering_project = EngineeringProject.find(params[:id])
@engineering_project.destroy
respond_to do |format|
format.html { redirect_to engineering_projects_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @... | [
"0.7532632",
"0.74692",
"0.7392556",
"0.7391879",
"0.735496",
"0.7354183",
"0.7353772",
"0.7353772",
"0.7353772",
"0.7353772",
"0.7353772",
"0.73463506",
"0.7344812",
"0.7343525",
"0.73400533",
"0.7323203",
"0.73174816",
"0.73171514",
"0.73104155",
"0.73021597",
"0.7298519",
... | 0.7660319 | 0 |
Data we will report: The path of any URL found by the crawler (web.uri, :path => page.path) The occurrence of any form (web.form :path, :type (get|post|path_info), :params) | def process_page(t, response, count)
msg = "[#{"%.3d" % count}/#{"%.3d" % datastore['MAX_PAGES']}] #{response.code || "ERR"} - #{t[:host]} - #{response.request.url}"
case response.code
when 301,302
if response.headers and response.headers["location"]
print_status(msg + " -> " + response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_search(url, html)\n\n forms = []\n html.css('form').each do |form|\n\n action = form.attr('action')\n\n action = url if action.nil?\n\n # prefix relative base url if no protocol\n unless action =~ /^https?:\\/\\//i\n uri = URI.parse(action)\n\n if action =~ /^\\//\n... | [
"0.5842315",
"0.5708506",
"0.5518015",
"0.54708505",
"0.53666943",
"0.5360666",
"0.5355922",
"0.5344207",
"0.5340404",
"0.5340404",
"0.53287673",
"0.5291734",
"0.5218734",
"0.52092195",
"0.5127866",
"0.5116219",
"0.5091266",
"0.5067943",
"0.5067943",
"0.50663805",
"0.50560606... | 0.4718625 | 68 |
Converts relative URL link into an absolute URL based on the location of the page | def to_absolute(link, url)
return nil if link.nil?
url = URI(url.to_s) unless url.is_a?(URI)
# remove anchor
link = URI.encode(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,''))
relative = URI(link)
absolute = url.merge(relative)
absolute.path = '/' if absolute.path.nil? or absolute.path.empty?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_link(link)\n # REMEMBER TO ADD ROUTES TO HANDLE THESE LINKS\n link.gsub!(@base, \"\").gsub!(\".html\", \"\").gsub!(\"-\", \"_\")\n end",
"def to_absolute(page, link)\n # remove anchor\n link = URI.encode(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,''))\n\n relative = URI(link)\n ... | [
"0.8045035",
"0.7990965",
"0.7821857",
"0.7715095",
"0.76195496",
"0.75861746",
"0.7556169",
"0.72590005",
"0.72563577",
"0.7248399",
"0.7148307",
"0.708138",
"0.6977423",
"0.69092673",
"0.6891401",
"0.68531436",
"0.68348545",
"0.6816892",
"0.67828214",
"0.6716942",
"0.669027... | 0.73076046 | 7 |
Returns a modified version of the URI that: 1. Always has a starting slash 2. Removes all the double slashes | def normalize_uri(*strs)
new_str = strs * "/"
new_str = new_str.gsub!("//", "/") while new_str.index("//")
# Makes sure there's a starting slash
unless new_str[0,1] == '/'
new_str = '/' + new_str
end
new_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conform_uri(uri_string)\n uri_string.gsub(/^(?!\\/)(.*)/, '/\\1').gsub(/[\\/]+$/, '')\n end",
"def normalize_uri(*strs)\n new_str = strs * '/'\n new_str = new_str.gsub!('//', '/') while new_str.index('//')\n new_str\n end",
"def omit_leading_slash\n start_with?('/') ? Wgi... | [
"0.73981124",
"0.7395531",
"0.6928813",
"0.6906778",
"0.6838501",
"0.68239987",
"0.6755301",
"0.669978",
"0.66091967",
"0.6592446",
"0.65886414",
"0.65886414",
"0.65712136",
"0.6557253",
"0.6515868",
"0.65105045",
"0.6503556",
"0.64747745",
"0.64444405",
"0.64392626",
"0.6439... | 0.76520234 | 0 |
see also problem 31 for simpler equivalent problem and problem 77 for a similar one but with primes | def num_sums(target)
@partial_num_sums = Array.new(target + 1) { Array.new(target + 1, nil) }
sums = num_sums_helper(target) - 1
@partial_num_sums = nil
sums
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n)\nend",
"def pretentious_primes(arr, num)\nend",
"def primes(num)\n \nend",
"def primes(num)\n \nend",
"def primes(num)\n \nend",
"def primes(num)\n \nend",
"def primes(n) \n max = Math::sqrt(n).truncate\n (2..max).each {|val|\n if n % val == 0 then\n p val\n ... | [
"0.7689883",
"0.7677716",
"0.7667661",
"0.7667661",
"0.7667661",
"0.7667661",
"0.7631236",
"0.75833565",
"0.75642216",
"0.75091016",
"0.74588686",
"0.74078935",
"0.7395441",
"0.73908305",
"0.73304445",
"0.7278016",
"0.7275344",
"0.72536093",
"0.7227031",
"0.7223335",
"0.72213... | 0.0 | -1 |
1/ New method RM 4.0.3 OK | def render_timelogquery_block(block, settings)
query = TimeEntryQuery.visible.find_by_id(settings[:query_id])
if query
query.column_names = settings[:columns] if settings[:columns].present?
query.sort_criteria = settings[:sort] if settings[:sort].present?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def verdi; end",
"def r; end",
"def r; end",
"def schubert; end",
"def probers; end",
"def refutal()\n end",
"def suivre; end",
"def operation; end",
"def operations; end",
"def operations; end",
"def result; end",
"def result; end",
"def result; end",
"def result... | [
"0.672943",
"0.6573889",
"0.6420117",
"0.6420117",
"0.6389923",
"0.630089",
"0.6260915",
"0.6238719",
"0.6182738",
"0.6135818",
"0.6135818",
"0.61186594",
"0.61186594",
"0.61186594",
"0.61186594",
"0.61186594",
"0.61186594",
"0.61186594",
"0.61186594",
"0.61023647",
"0.607091... | 0.0 | -1 |
2/ New method RM 4.0.3 OK | def render_timereportquery_block(block, settings)
@query = TimeReportQuery.visible.find_by_id(settings[:query_id])
if @query
if params[:debug]
@query.set_debug(params[:debug])
end
# Smile comment : no limit to scope
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def verdi; end",
"def schubert; end",
"def probers; end",
"def r; end",
"def r; end",
"def suivre; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def operation; end",
"def method_731(base); end",
"def oper... | [
"0.6908322",
"0.6627948",
"0.651237",
"0.64773726",
"0.63600266",
"0.63600266",
"0.63098097",
"0.6237784",
"0.6226272",
"0.6226272",
"0.6226272",
"0.6226272",
"0.6225964",
"0.6200398",
"0.61893713",
"0.61893713",
"0.61817205",
"0.61417305",
"0.6137803",
"0.6128365",
"0.609019... | 0.0 | -1 |
3/ New method RM 4.0.3 OK To override with alias_method in the plugins | def prepare_report_object_hook
# Nothing in base method
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alias_of; end",
"def alias_method(sym1,sym2) end",
"def is_alias?; end",
"def metaalias(to, from)\n metaclass.instance_eval{alias_method to, from}\n end",
"def aliases; end",
"def aliases; end",
"def aliases; end",
"def define_alias_methods(member_name, options); end",
"def aliases\n end... | [
"0.7365563",
"0.7026523",
"0.6927402",
"0.68487936",
"0.67963785",
"0.67963785",
"0.67963785",
"0.6764827",
"0.671146",
"0.665515",
"0.6635057",
"0.6611822",
"0.6597107",
"0.65781933",
"0.6537686",
"0.6513202",
"0.64953977",
"0.64953977",
"0.64812386",
"0.64812386",
"0.645244... | 0.0 | -1 |
Encrypts the provided text and return an encrypted +Message+. | def encrypt(clean_text, key:, deterministic: false)
cipher_for(key, deterministic: deterministic).encrypt(clean_text).tap do |message|
message.headers.encoding = clean_text.encoding.name unless clean_text.encoding == DEFAULT_ENCODING
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(message)\n xcrypt(:encrypt, message)\n end",
"def encrypt_message plaintext\n key_pair.encrypt plaintext\n end",
"def encrypt(text)\n Base64.encode64(@public_key.public_encrypt(text)).gsub(/\\n/, \"\") if text\n end",
"def encrypt(text)\n Base64.encode64(@publ... | [
"0.7498735",
"0.74466074",
"0.74364525",
"0.74364525",
"0.7332968",
"0.7199095",
"0.7138037",
"0.7006009",
"0.69818956",
"0.69747627",
"0.680743",
"0.67790973",
"0.67279255",
"0.667696",
"0.6633149",
"0.6579908",
"0.6579376",
"0.6518739",
"0.64462876",
"0.64414966",
"0.642478... | 0.6144903 | 37 |
Initializes a new Request, which defaults to the GET HTTP verb and has it's timeouts set to 0 | def initialize
@action = :get
@headers = {}
@timeout = 0
@connect_timeout = 0
@max_redirects = -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request\n HTTP.headers(request_headers).timeout(timeout_options)\n end",
"def initialize(options = {})\n options[:host] ||= Defaults::Request.host\n options[:port] ||= Defaults::Request.port\n options[:ssl] ||= Defaults::Request.ssl\n options[:headers] ||= Defaults::Reques... | [
"0.6813091",
"0.6762529",
"0.6668952",
"0.6660433",
"0.66468793",
"0.6513871",
"0.6487673",
"0.6427181",
"0.64227563",
"0.642166",
"0.6400212",
"0.63941866",
"0.6378751",
"0.6314297",
"0.6307211",
"0.6297913",
"0.6264972",
"0.62619936",
"0.62474525",
"0.62465006",
"0.62327886... | 0.7686842 | 0 |
Set the type of authentication to use for this request. | def auth_type=(type=:basic)
@auth_type = case type
when :basic, "basic"
Request::AuthBasic
when :digest, "digest"
Request::AuthDigest
when :any, "any"
Request::AuthAny
else
raise "#{type.inspect} is an unknown authentication type"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_authentication!()\n @type = TAC_PLUS_AUTHEN\n end",
"def authentication_type; end",
"def authentication_type=(_arg0); end",
"def set_authentication_method(opts)\n opts = check_params(opts,[:auth_methods])\n super(opts)\n end",
"def httpauth=(value)\n Curl.set_option(:... | [
"0.72311115",
"0.6745652",
"0.6630745",
"0.6344018",
"0.62302357",
"0.6174831",
"0.61166346",
"0.5910714",
"0.59071237",
"0.5872553",
"0.5865962",
"0.58547115",
"0.5852825",
"0.57615024",
"0.5743741",
"0.574223",
"0.57361823",
"0.5723181",
"0.56572896",
"0.56056994",
"0.56054... | 0.68796 | 1 |
Sets the upload data (request body) for the request. If the given argument is a Hash, the contents of the hash will be handled as form fields and will be formencoded. The somposition of the request body is then going to be handled by Curl. If the given `data` is any other object, it is going to be treated as a stringab... | def upload_data=(data)
@upload_data = case data
when Hash
self.multipart ? data : Util.build_query_string_from_hash(data, action == :post)
else
data
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_upload_body(request, data)\n if data.respond_to? :read\n request.body_stream = data\n if data.respond_to? :size\n request.content_length = data.size\n else\n request[\"Transfer-encoding\"] = \"chunked\"\n end\n else\n request.body = data\n ... | [
"0.7323534",
"0.68779415",
"0.6759827",
"0.67296624",
"0.65917283",
"0.6400696",
"0.6178055",
"0.60200787",
"0.59435344",
"0.5938734",
"0.59107304",
"0.58856946",
"0.5883825",
"0.5883825",
"0.5883825",
"0.5883825",
"0.58229727",
"0.5763764",
"0.57632416",
"0.5710576",
"0.5698... | 0.8126413 | 0 |
Sets the HTTP verb for the request | def action=(action)
if !VALID_ACTIONS.include?(action.to_s.upcase)
raise ArgumentError, "Action must be one of #{VALID_ACTIONS.join(', ')}"
end
@action = action.downcase.to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end",
"def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end",
"def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end",
"def parse_http_methods!(req)\n if (method = req.par... | [
"0.7802806",
"0.7802806",
"0.7347862",
"0.69301236",
"0.69205374",
"0.6857798",
"0.6764215",
"0.67509145",
"0.67239654",
"0.67199695",
"0.66172594",
"0.6583089",
"0.65722585",
"0.6404022",
"0.63841194",
"0.63023186",
"0.62446004",
"0.6230232",
"0.6076946",
"0.6076946",
"0.606... | 0.0 | -1 |
Sets the read timeout for the CURL request, in seconds. Can be set to less than a second using a floatingpoint value. Setting the value to 0 will disable the timeout. | def timeout=(new_timeout)
if new_timeout && new_timeout.to_f < 0
raise ArgumentError, "Timeout must be a positive number"
end
@timeout = new_timeout.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_timeout= secs\n if secs\n @read_timeout = secs\n @read_timeout_ms = secs * 1000\n else\n @read_timeout = @read_timeout_ms = nil\n end\n end",
"def read_timeout= read_timeout\n @agent.read_timeout = read_timeout\n end",
"def read_timeout(timeout = nil)\n timeout.ni... | [
"0.783469",
"0.7618157",
"0.746621",
"0.7461707",
"0.7395457",
"0.70567673",
"0.69884264",
"0.69160676",
"0.68962663",
"0.68962663",
"0.68885094",
"0.6818804",
"0.6655335",
"0.6581004",
"0.6581004",
"0.6581004",
"0.6581004",
"0.6581004",
"0.6581004",
"0.6581004",
"0.6581004",... | 0.5914818 | 39 |
Sets the connect timeout for the CURL request, in seconds. Can be set to less than a second using a floatingpoint value. | def connect_timeout=(new_timeout)
if new_timeout && new_timeout.to_f < 0
raise ArgumentError, "Timeout must be a positive number"
end
@connect_timeout = new_timeout.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connecttimeout_ms=(value)\n Curl.set_option(:connecttimeout_ms, value_for(value, :int), handle)\n end",
"def connecttimeout=(value)\n Curl.set_option(:connecttimeout, value_for(value, :int), handle)\n end",
"def connect_timeout=(val)\n @j_del.setConnectTimeout(val)\n self\... | [
"0.8625094",
"0.8623149",
"0.76465446",
"0.75889564",
"0.7442979",
"0.73705673",
"0.7162924",
"0.7153869",
"0.70934397",
"0.6889871",
"0.68548006",
"0.67794806",
"0.6617166",
"0.6592153",
"0.655213",
"0.6521994",
"0.6503267",
"0.64338213",
"0.64200765",
"0.6407172",
"0.633133... | 0.764688 | 2 |
Sets the maximum number of redirects that are going to be followed. | def max_redirects=(new_max_redirects)
if new_max_redirects.to_i < -1
raise ArgumentError, "Max redirects must be a positive integer, 0 or -1"
end
@max_redirects = new_max_redirects.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_redirects\n limit = @options &&\n (\n @options[:max_redirects] ||\n @options['max_redirects']\n )\n limit.nil? ? 5 : limit.to_i\n end",
"def max_redirects\n limit = @options &&\n (\n @options[:max_redirects] ||\n @options[... | [
"0.83502495",
"0.83502495",
"0.83502495",
"0.8033451",
"0.79478556",
"0.78956085",
"0.78803056",
"0.748363",
"0.748363",
"0.7053336",
"0.6970329",
"0.6521062",
"0.6381447",
"0.62619394",
"0.62324625",
"0.61793107",
"0.59735274",
"0.5962865",
"0.59527975",
"0.594619",
"0.58176... | 0.79474014 | 5 |
Sets the headers for the request. Headers muse be set with the right capitalization. The previously set headers will be replaced. | def headers=(new_headers)
if !new_headers.kind_of?(Hash)
raise ArgumentError, "Headers must be a hash"
end
@headers = new_headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_request_headers!(request); end",
"def update_headers(request_headers)\n @request_headers.merge!(request_headers)\n end",
"def setHeaders(headers)\n @headers = headers\n end",
"def request_headers=(request_headers); end",
"def request_headers= request_headers\n @agent.request... | [
"0.7666862",
"0.75491315",
"0.7477328",
"0.7333949",
"0.71646625",
"0.7116084",
"0.7045849",
"0.7044823",
"0.7039552",
"0.70156956",
"0.69731766",
"0.6966576",
"0.69139814",
"0.6838195",
"0.68167675",
"0.68142736",
"0.67825735",
"0.67711115",
"0.67370623",
"0.6729417",
"0.672... | 0.6539605 | 36 |
Sets the receive buffer size. This is a recommendedation value, as CURL is not guaranteed to honor this value internally (see By default, CURL uses the maximum possible buffer size, which will be the best especially for smaller and quicklyexecuting requests. | def buffer_size=(buffer_size)
if buffer_size != nil && buffer_size.to_i < 1
raise ArgumentError, "Buffer size must be a positive integer greater than 0 or nil"
end
@buffer_size = buffer_size != nil ? buffer_size.to_i : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buffer_size=(value)\n @buffer_size = value\n flush\n end",
"def set_read_buffer_size(readBufferSize=nil)\n if readBufferSize.class == Fixnum && !block_given?\n @j_del.java_method(:setReadBufferSize, [Java::int.java_class]).call(readBufferSize)\n return self\n end\n r... | [
"0.71513265",
"0.69853014",
"0.63514525",
"0.6311475",
"0.6278836",
"0.60965407",
"0.5926904",
"0.58008575",
"0.57339406",
"0.5733174",
"0.56532824",
"0.562524",
"0.55819076",
"0.55655897",
"0.54735506",
"0.5428337",
"0.5416092",
"0.5393617",
"0.5383402",
"0.5377695",
"0.5372... | 0.64251965 | 2 |
Returns the set HTTP authentication string for basic authentication. | def credentials
return nil if username.nil? || password.nil?
"#{username}:#{password}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_auth_string\n \"Basic \" + Base64.encode64(\"#{@admin_username}:#{@admin_password}\").rstrip\n end",
"def basic_auth\n \"#{username}:#{access_token}\"\n end",
"def basic_auth_header(username,password)\n auth_str = username.to_s + \":\" + password.to_s\n auth_str = \"Basic \"... | [
"0.7961715",
"0.77005494",
"0.76819026",
"0.7479998",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74782974",
"0.74167556",
"0.74102587",
... | 0.0 | -1 |
Returns the set HTTP verb | def action_name
@action.to_s.upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end",
"def http_verb(params)\n [:post, :put, :delete].detect { |method_name|\n params.key?(method_name)\n } || :get\n end",
"def request_method(verb)\n Net::HTTP.const_get(verb.to_s.capitalize)\... | [
"0.8018719",
"0.77956325",
"0.76324636",
"0.7592852",
"0.7527936",
"0.7527936",
"0.73217607",
"0.7262567",
"0.7241744",
"0.7213754",
"0.71826303",
"0.7125078",
"0.7123259",
"0.7115152",
"0.71081734",
"0.70182306",
"0.69879407",
"0.6937918",
"0.6878291",
"0.6878291",
"0.686035... | 0.0 | -1 |
Tells whether this Request is configured the same as the other request | def eql?(request)
return false unless Request === request
READER_VARS.inject(true) do |memo, name|
memo && (self.send(name) == request.send(name))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other_request)\n return false unless super(other_request)\n return false unless other_request.kind_of?(self.class)\n (other_request.response == response) && (other_request.uri == uri)\n end",
"def same_request?\n [request.url, request.fullpath].include?(request.referrer)\n end",
"def ==(ot... | [
"0.7543306",
"0.65781033",
"0.6360998",
"0.6268611",
"0.6173072",
"0.6145265",
"0.6098696",
"0.6056389",
"0.5959926",
"0.59493273",
"0.594375",
"0.5933399",
"0.5927131",
"0.5926772",
"0.5878375",
"0.586481",
"0.5838436",
"0.5821699",
"0.5807296",
"0.57887083",
"0.5776896",
... | 0.71406585 | 1 |
Returns a Marshalable representation of the Request | def marshal_dump
[ @url, @username, @password, @file_name, @proxy, @proxy_type, @insecure,
@ignore_content_length, @multipart, @action, @timeout, @connect_timeout,
@max_redirects, @headers, @auth_type, @upload_data, @buffer_size, @cacert ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marshal(request_object)\n JSON.pretty_generate(request_object.to_h)\n end",
"def to_s\n @request\n end",
"def to_hash\n @request\n end",
"def to_hash\n @request\n end",
"def to_json\n request.clone.to_json\n end",
"def to_json(*_args)\n ... | [
"0.73620737",
"0.72430986",
"0.689463",
"0.689463",
"0.65235466",
"0.6428086",
"0.6428086",
"0.63945997",
"0.63853353",
"0.6378121",
"0.6373438",
"0.63530993",
"0.62518334",
"0.6173387",
"0.61645854",
"0.6129523",
"0.6061535",
"0.6038844",
"0.6007464",
"0.59311503",
"0.585134... | 0.0 | -1 |
Reinstates instance variables from a marshaled representation | def marshal_load(data)
@url, @username, @password, @file_name, @proxy, @proxy_type, @insecure,
@ignore_content_length, @multipart, @action, @timeout, @connect_timeout,
@max_redirects, @headers, @auth_type, @upload_data, @buffer_size, @cacert = data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmarshal\n Marshal.restore self\n end",
"def marshal_load(variables)#:nodoc:\n fields_to_serialize.each_with_index{|field, index| instance_variable_set_value(field, variables[index])}\n end",
"def marshal_load(serialised); end",
"def marshal_dump\n ivars = instance_variables.reject {|var|... | [
"0.70109254",
"0.6290257",
"0.62279904",
"0.60362494",
"0.59536135",
"0.58496255",
"0.5712888",
"0.56872535",
"0.56567997",
"0.5642049",
"0.56128407",
"0.56046396",
"0.55459285",
"0.55377185",
"0.5504738",
"0.54937977",
"0.54937977",
"0.54861194",
"0.5469962",
"0.54682994",
"... | 0.0 | -1 |
GET /Probe/physical_units/1 GET /Probe/physical_units/1.xml | def show
@physical_unit = Probe::PhysicalUnit.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @physical_unit }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @physical_unit = Probe::PhysicalUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @physical_unit }\n end\n end",
"def create\n @physical_unit = Probe::PhysicalUnit.new(params[:physical_unit])\n\n respond_to do |format|\n if @p... | [
"0.65117055",
"0.6068307",
"0.58627737",
"0.5851825",
"0.58308125",
"0.5744226",
"0.56596756",
"0.5659382",
"0.56197035",
"0.5448576",
"0.5439022",
"0.5422734",
"0.5370271",
"0.5360169",
"0.5352875",
"0.5345707",
"0.53421247",
"0.53347003",
"0.53277725",
"0.5304104",
"0.52944... | 0.72951245 | 0 |
GET /Probe/physical_units/new GET /Probe/physical_units/new.xml | def new
@physical_unit = Probe::PhysicalUnit.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @physical_unit }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @physical_unit = Probe::PhysicalUnit.new(params[:physical_unit])\n\n respond_to do |format|\n if @physical_unit.save\n flash[:notice] = 'Probe::PhysicalUnit.was successfully created.'\n format.html { redirect_to(@physical_unit) }\n format.xml { render :xml => @physical... | [
"0.7301334",
"0.670398",
"0.650267",
"0.64133394",
"0.6227892",
"0.6211281",
"0.6203973",
"0.6167649",
"0.59758514",
"0.5960015",
"0.5957891",
"0.59281766",
"0.59281766",
"0.59135556",
"0.59107834",
"0.5902777",
"0.590052",
"0.5868987",
"0.5860157",
"0.5860157",
"0.5860157",
... | 0.79163975 | 0 |
POST /Probe/physical_units POST /Probe/physical_units.xml | def create
@physical_unit = Probe::PhysicalUnit.new(params[:physical_unit])
respond_to do |format|
if @physical_unit.save
flash[:notice] = 'Probe::PhysicalUnit.was successfully created.'
format.html { redirect_to(@physical_unit) }
format.xml { render :xml => @physical_unit, :stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @physical_unit = Probe::PhysicalUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @physical_unit }\n end\n end",
"def update\n @physical_unit = Probe::PhysicalUnit.find(params[:id])\n\n respond_to do |format|\n if @physical_un... | [
"0.62399805",
"0.60366935",
"0.5721104",
"0.5685707",
"0.56246924",
"0.5600984",
"0.5574535",
"0.5568409",
"0.5565819",
"0.55469257",
"0.554108",
"0.5518119",
"0.55159986",
"0.5479439",
"0.54403603",
"0.542842",
"0.541477",
"0.5392412",
"0.5383793",
"0.5377945",
"0.53286284",... | 0.7217344 | 0 |
PUT /Probe/physical_units/1 PUT /Probe/physical_units/1.xml | def update
@physical_unit = Probe::PhysicalUnit.find(params[:id])
respond_to do |format|
if @physical_unit.update_attributes(params[:physical_unit])
flash[:notice] = 'Probe::PhysicalUnit.was successfully updated.'
format.html { redirect_to(@physical_unit) }
format.xml { head :ok ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @physical_unit = Probe::PhysicalUnit.new(params[:physical_unit])\n\n respond_to do |format|\n if @physical_unit.save\n flash[:notice] = 'Probe::PhysicalUnit.was successfully created.'\n format.html { redirect_to(@physical_unit) }\n format.xml { render :xml => @physical... | [
"0.6007946",
"0.59617364",
"0.5754303",
"0.57445514",
"0.55933654",
"0.55897284",
"0.55827916",
"0.5577811",
"0.5543368",
"0.55116844",
"0.54995704",
"0.54159164",
"0.5413312",
"0.5326068",
"0.5309962",
"0.52925885",
"0.52254754",
"0.5215315",
"0.5209483",
"0.51807654",
"0.51... | 0.69172007 | 0 |
DELETE /Probe/physical_units/1 DELETE /Probe/physical_units/1.xml | def destroy
@physical_unit = Probe::PhysicalUnit.find(params[:id])
@physical_unit.destroy
respond_to do |format|
format.html { redirect_to(physical_units_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @storage_unit = StorageUnit.find(params[:id])\n @storage_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to(storage_units_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @probe = Probe.find(params[:id])\n @probe.destroy\n\n respond_to ... | [
"0.64701706",
"0.6421877",
"0.61882406",
"0.6114668",
"0.610639",
"0.61056083",
"0.60983515",
"0.6091949",
"0.6087555",
"0.6059911",
"0.6041925",
"0.6033903",
"0.59972954",
"0.5989652",
"0.59860545",
"0.596415",
"0.5959641",
"0.59588563",
"0.5957381",
"0.5950879",
"0.5949384"... | 0.74592304 | 0 |
GET /videos GET /videos.json | def index
@videos = Video.all
@title = 'Видео'
@per_page = 18
@video = Video.new
case params[:c]
when 'paragliding'
@videos = Video.paginate(:page => params[:page], :per_page => @per_page, :order => 'created_at DESC').find_all_by_category_id(5)
@category_name = 'Свободные полёты'
when 'power_paragliding'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n e... | [
"0.8299542",
"0.77354604",
"0.7705431",
"0.7585231",
"0.7490626",
"0.7490166",
"0.7490166",
"0.7490166",
"0.7490166",
"0.7474659",
"0.7362666",
"0.7358098",
"0.73576134",
"0.730568",
"0.7260066",
"0.7201",
"0.7195364",
"0.71250635",
"0.71250635",
"0.71250635",
"0.71250635",
... | 0.0 | -1 |
GET /videos/1 GET /videos/1.json | def show
@video = Video.find(params[:id])
if @video != nil
@title = @video.alter_name
@return_to = video_path(@video)
@page_params = {:part_id => 5,:page_id => 1,:entity_id => @video.id}
@path_array = [
{:name => 'Видео', :link => videos_path},
{:name => @video.category_name, :link => videos_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n e... | [
"0.77855194",
"0.7450134",
"0.7386234",
"0.73798877",
"0.73798877",
"0.73798877",
"0.73798877",
"0.73798877",
"0.73798877",
"0.73798877",
"0.73703194",
"0.7363398",
"0.73398286",
"0.7338815",
"0.7338815",
"0.7338815",
"0.7338815",
"0.7308188",
"0.722379",
"0.72142017",
"0.720... | 0.0 | -1 |
GET /videos/new GET /videos/new.json | def new
if user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'
@video = Video.new
@title = 'Новое видео'
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @video }
end
else
redirect_to '/404'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n... | [
"0.8016282",
"0.7963612",
"0.7884851",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.78837156",
"0.7604804",
"0.753364",
"0.7379394",
"0.72565913",
"0.7214344",
"0.71995765",
"0.71727395",
"0.7... | 0.75278044 | 15 |
POST /videos POST /videos.json | def create
if user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'
params[:video][:user_id] = current_user.id
@video = Video.new(params[:video])
respond_to do |format|
if @video.save
format.html { redirect_to @video, :notice => 'Видео успешно добавлено' }
format.json { render :jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end",
"def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }... | [
"0.7559166",
"0.72561485",
"0.72147936",
"0.72094315",
"0.7070432",
"0.70647645",
"0.70605457",
"0.70605457",
"0.70605457",
"0.70605457",
"0.69911706",
"0.69875956",
"0.69875956",
"0.69875956",
"0.69875956",
"0.69875956",
"0.69389236",
"0.69220686",
"0.69220686",
"0.6870992",
... | 0.6789509 | 27 |
PUT /videos/1 PUT /videos/1.json | def update
@video = Video.find(params[:id])
if @video.user == current_user or user_type == 'admin' or user_type == 'super_admin'
respond_to do |format|
if @video.update_attributes(params[:video])
format.html { redirect_to @video, :notice => 'Видео успешно обновлено' }
format.json { head :no_content }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @video.update(video_params)\n render json: @video\n end",
"def update\n Video.find(params[:id]).update(video_params)\n redirect_to \"/videos/#{params[:id]}\"\n end",
"def edit_video(video_id, title, description, method = HTTP_PUT)\n request_xml = %{\n <?xml version=\"1.0\... | [
"0.7424096",
"0.7119171",
"0.7058602",
"0.69600654",
"0.69600654",
"0.69392973",
"0.6919425",
"0.6919425",
"0.6919425",
"0.6919425",
"0.6919425",
"0.6919425",
"0.6919425",
"0.6879572",
"0.6862499",
"0.68542963",
"0.67888874",
"0.67666596",
"0.6766045",
"0.6766045",
"0.6766045... | 0.6392009 | 59 |
DELETE /videos/1 DELETE /videos/1.json | def destroy
@video = Video.find(params[:id])
if @video.user == current_user or user_type == 'admin' or user_type == 'super_admin'
@video.destroy
respond_to do |format|
format.html { redirect_to videos_url }
format.json { head :no_content }
end
else
redirect_to '/404'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.ht... | [
"0.7782917",
"0.7782917",
"0.7768144",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.77617705",
"0.7723812",
"0.77067566",
"0.7692495",
"0.7692495",
"0.7692495",
"0.... | 0.7147049 | 73 |
add functionality for checking for ".bot" within the player name as a flag to make a bot to play against | def create_players(num)
name_array = Array.new
player_array = Array.new
count = 1
while count <= num
valid_name = false
while valid_name == false
print "What is player number #{count}'s name?: "
name = gets.chomp
if name_array.include?(name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_bot?\n !!self.bot_name\n end",
"def add_ai_player\n @bots << setup_player(:bot => true)\n end",
"def check_for_greet(cmd, nick)\n if cmd =~ /\\b(Hi|Hello|Hey|Hay|Hola|Sup|Whats up|Yo)\\b/i\n self.say \"#{@greetings[rand(@greetings.length)]}, #{nick}\"\n end\n end"... | [
"0.6635775",
"0.62944585",
"0.60111225",
"0.5962038",
"0.589705",
"0.58871144",
"0.5866011",
"0.5861277",
"0.5861277",
"0.5861277",
"0.58233064",
"0.57767874",
"0.57767874",
"0.5756547",
"0.57381064",
"0.5734516",
"0.57049793",
"0.56944066",
"0.56217736",
"0.5610739",
"0.5583... | 0.0 | -1 |
Returns all performable steps | def performable
perf = []
@steps.each do |k, v|
# Check if all prerequesites have been performed
# p @performed
perf << k if (v - @performed).empty?
end
# p perf.sort
# p @performed
# perf = perf - @performed
# p perf.sort
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_steps\n\t#make calls to step here...\nend",
"def steps\n find_solution\n end",
"def steps\n @steps ||= []\n end",
"def steps\n %w[first last]\n end",
"def steps\n step_flows.collect(&:current_step)\n end",
"def steps\n %w[\n household_member_demographics_step... | [
"0.7807661",
"0.75769466",
"0.7431452",
"0.739641",
"0.73476076",
"0.6925048",
"0.67890674",
"0.67171055",
"0.66615474",
"0.6631614",
"0.6631614",
"0.6580921",
"0.64836735",
"0.64619964",
"0.6454354",
"0.6435984",
"0.64270467",
"0.6421234",
"0.63330793",
"0.63222355",
"0.6303... | 0.6587695 | 11 |
Update time left on step. If step complete, return step. Else, return nil | def update
@time += -1
if @time == -1
done = @target
@target = ""
return done
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def steps_remaining\n @total_steps - @step\n end",
"def update_timestep\n default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:update_timestep]\n attr = Sketchup.active_model.get_attribute('MSPhysics', 'Update Timestep', default)\n return AMS.clamp(attr.to_f, 1/1200.0, 1/30.0)\n ... | [
"0.64251965",
"0.6279883",
"0.6197872",
"0.61439985",
"0.6110506",
"0.6080877",
"0.5953515",
"0.59119385",
"0.5894738",
"0.5887935",
"0.582508",
"0.5815862",
"0.57811433",
"0.57709616",
"0.5760184",
"0.5748707",
"0.5726635",
"0.57215023",
"0.5719756",
"0.57014024",
"0.5672247... | 0.6018262 | 6 |
Returns all performable steps | def performable
perf = []
@steps.each do |k, v|
# Check if all prerequesites have been performed && not already performed && not currently performing by another worker
perf << k if (v - @performed).empty? && ! @performed.include?(k) && ! @performing.include?(k)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_steps\n\t#make calls to step here...\nend",
"def steps\n find_solution\n end",
"def steps\n @steps ||= []\n end",
"def steps\n %w[first last]\n end",
"def steps\n step_flows.collect(&:current_step)\n end",
"def steps\n %w[\n household_member_demographics_step... | [
"0.7807661",
"0.75769466",
"0.7431452",
"0.739641",
"0.73476076",
"0.6925048",
"0.67890674",
"0.67171055",
"0.66615474",
"0.6631614",
"0.6631614",
"0.6587695",
"0.6580921",
"0.64836735",
"0.64619964",
"0.6454354",
"0.6435984",
"0.64270467",
"0.6421234",
"0.63330793",
"0.63222... | 0.6223739 | 24 |
ducktyping Rubydora::Callbacks call_ methods | def call_on_change changes = {}
self.on_change.each do |h|
h.call(self, changes)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callbacks; end",
"def callbacks; end",
"def callback=(_arg0); end",
"def run_callbacks(options = T.unsafe(nil), &block); end",
"def callback_method\n run(\"on\", \"string\", \"callback\")\n end",
"def callback\n\n end",
"def callback\n end",
"def callback\n\tend",
"def run_c... | [
"0.74891335",
"0.74891335",
"0.72458917",
"0.7108573",
"0.70891225",
"0.70778054",
"0.6984745",
"0.6740013",
"0.66765237",
"0.6584321",
"0.6584321",
"0.657811",
"0.65125316",
"0.65125316",
"0.650847",
"0.6497482",
"0.64949924",
"0.643736",
"0.643736",
"0.64152247",
"0.6364258... | 0.0 | -1 |
this will get called when you save a new link | def create
link = current_user.links.new(link_params)
respond_to do | format |
if link.save
format.html{
redirect_to link
}
else
format.html{
render action: "new"
}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n @link.Save\n end",
"def link!\n self.linkbutton = true\n self.save\n self.linkbutton\n end",
"def save\n CONNECTION.execute(\"UPDATE links SET assignment_id = '#{self.assignment_id}', link = '#{self.link}', type = '#{self.type}', WHERE id = #{self.id};\")\n end",
"def... | [
"0.8060812",
"0.7176391",
"0.7091",
"0.70859003",
"0.6996543",
"0.67694783",
"0.67602444",
"0.66650563",
"0.66650563",
"0.66541594",
"0.6647754",
"0.6640204",
"0.65334576",
"0.65093446",
"0.6472604",
"0.64695424",
"0.6461509",
"0.63972867",
"0.6376838",
"0.6376838",
"0.637683... | 0.0 | -1 |
this will get called when you save an edit page for links | def update
link = current_user.links.find(params[:id])
respond_to do | format |
if link.update_attributes(link_params)
format.html{
redirect_to link
}
else
format.html{
render action: "edit"
}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n resource.prepare_links\n\n super\n end",
"def save\n @link.Save\n end",
"def link!\n self.linkbutton = true\n self.save\n self.linkbutton\n end",
"def after_validation_on_update\n\t\tself.permalink = Page.find_by_id(self.id).permalink if self.permalink.empty?... | [
"0.71389323",
"0.65221184",
"0.65132",
"0.6266318",
"0.62618273",
"0.6252772",
"0.6252772",
"0.6231251",
"0.61952597",
"0.61952597",
"0.61563003",
"0.6137088",
"0.61092037",
"0.61092037",
"0.6095062",
"0.6080943",
"0.6080096",
"0.60674924",
"0.5992103",
"0.5977966",
"0.594603... | 0.0 | -1 |
this will get called when we delete a link | def destroy
link = current_user.links.find(params[:id])
respond_to do | format |
if link.destroy
format.html{
redirect_to links_url
}
else
format.html{
redirect_to link
}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n CONNECTION.execute(\"DELETE FROM links WHERE id = #{self.id};\")\n end",
"def link_delete\n @linkalation = Linkalation.find_by_link_id_and_user_id(params[:link], current_user.id)\n\n @linkalation[0].destroy\n\n render :nothing => true\n end",
"def destroy\n @link.destroy\n flas... | [
"0.7619714",
"0.75857997",
"0.7545921",
"0.7525898",
"0.7519979",
"0.7511109",
"0.74847656",
"0.74847656",
"0.7413447",
"0.7353555",
"0.7351366",
"0.7227976",
"0.72263783",
"0.71766657",
"0.7160464",
"0.7153053",
"0.7124369",
"0.712294",
"0.7101781",
"0.7101781",
"0.7101781",... | 0.682165 | 67 |
This calculate code is based c source code in NXP AN3785 document | def calculatePCompLong(padc, tadc, a0, b1, b2, c12)
if a0 >= 0x8000 then
a0 = a0 - 0x10000
end
if b1 >= 0x8000 then
b1 = b1 - 0x10000
end
if b2 >= 0x8000 then
b2 = b2 - 0x10000
end
if c12 >= 0x8000 then
c12 = c12 - 0x10000
end
padc = padc >> 6
tadc = tadc >> 6
# ******* STEP 1 : c12x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculated; end",
"def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end",
"def calculation\n end",
"def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend",
"def recalculate\n\tend",
"def recalculate\n end",
"def gecos(*) end",
"def ctof... | [
"0.6488921",
"0.63957405",
"0.62883055",
"0.6108692",
"0.6015515",
"0.59767705",
"0.59753805",
"0.5965318",
"0.5953741",
"0.592391",
"0.5897091",
"0.58796716",
"0.5872965",
"0.5865685",
"0.58424693",
"0.5822392",
"0.5799124",
"0.5787038",
"0.57793885",
"0.57720596",
"0.575735... | 0.55178696 | 62 |
vi: set ft=ruby : | def gen_node_configs(cluster_yml)
master_n = cluster_yml['master_n']
master_mem = cluster_yml['master_mem']
master_cpus = cluster_yml['master_cpus']
slave_n = cluster_yml['slave_n']
slave_mem = cluster_yml['slave_mem']
slave_cpus = cluster_yml['slave_cpus']
master_ipbase = cluster_yml['master_ipbase']
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_of_executing_the_commands\n @commands = \":set ft=ruby\r\" + @commands\n RobotVim::Runner.new.run(:input_file => @input, :commands => @commands)\nend",
"def ruby\n unless @ruby\n @ruby = \"\"\n @body.each_line do |l|\n @commands << {:ruby => l}\n @ruby << l\n ... | [
"0.5803009",
"0.5457295",
"0.544725",
"0.5440447",
"0.540047",
"0.5387971",
"0.53144646",
"0.520739",
"0.5160547",
"0.5159978",
"0.5159782",
"0.5146485",
"0.5083554",
"0.50814515",
"0.5080929",
"0.5077087",
"0.50639117",
"0.50580174",
"0.50580174",
"0.50380445",
"0.50380445",... | 0.0 | -1 |
dynamically widen column if there's a wider field than its default width | def rejigger(w)
@width = w if w > @width
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shrink\n column_size = table.columns_size\n ratio = ((natural_width - renderer.width) / column_size.to_f).ceil\n\n widths = (0...column_size).reduce([]) do |lengths, col|\n width = (renderer.column_widths[col] - ratio)\n # basically ruby 2.4 Numeric#clamp\n ... | [
"0.71692073",
"0.700296",
"0.69066584",
"0.6883455",
"0.6862464",
"0.67648464",
"0.6738441",
"0.66961753",
"0.66961753",
"0.66961753",
"0.6622812",
"0.6544651",
"0.6494876",
"0.6434554",
"0.6407674",
"0.63904154",
"0.6380468",
"0.63688844",
"0.6363172",
"0.63178897",
"0.62850... | 0.62337583 | 23 |
render this column's name according to the layout rules | def title
v = name.to_s.capitalize
align_right? ? Justifier.rjust(v, width) : Justifier.ljust(v, width)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n self[:name] || (title ? Array(title).join(\"\\n\") : \"_col=#{colnum}\")\n end",
"def name_column(record)\n label = record.host_status\n case label\n when \"Pending Installation\"\n style =\"label-info\"\n # TRANSLATORS: host's status: first character of \"build\"\n sho... | [
"0.70669425",
"0.6699584",
"0.66138715",
"0.6466996",
"0.6274391",
"0.62713563",
"0.6187298",
"0.61112314",
"0.61098427",
"0.6096345",
"0.60567814",
"0.6045677",
"0.60085243",
"0.5994173",
"0.599246",
"0.598457",
"0.59634656",
"0.5947697",
"0.5893075",
"0.5881806",
"0.5879072... | 0.60364735 | 12 |
render the target according to this column's layout rules | def render(target)
align_right? ? Justifier.rjust(target, width) : Justifier.ljust(target, width)
rescue StandardError => e
raise "Column #{name} failed: #{e.message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_layout(output, layout, info); end",
"def draw()\n @vc.content_tag(:table) do\n @left = true\n @vc.capture do\n for col in columns do\n @vc.concat col.field(@record, self)\n end\n @vc.concat('<td colspan=3></td>'.html_safe) if... | [
"0.5928397",
"0.56657493",
"0.5447441",
"0.5398529",
"0.53850174",
"0.53850174",
"0.53391665",
"0.5261703",
"0.5242185",
"0.51957273",
"0.51542795",
"0.5153357",
"0.5142795",
"0.5112394",
"0.5092332",
"0.50778955",
"0.50750566",
"0.5056718",
"0.5037667",
"0.50170743",
"0.5015... | 0.63163245 | 0 |
Performs the conversion of the +file+. Returns the Tempfile that contains the new image. | def make
Paperclip.log("*********** Label Thumbnail Processor...")
dst = Tempfile.new([@basename, @format].compact.join("."))
dst.binmode
# first create the name text image
nameImg = createText(name, "72", "")
# next create the description text image
descImg = createText(des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_to_tempfile(file)\n args = [File.basename(file.path, \".*\"), File.extname(file.path)] if file.respond_to?(:path)\n tempfile = Tempfile.new(args || \"image\", binmode: true)\n IO.copy_stream(file, tempfile.path)\n file.rewind\n tempfile\n end",
"def _... | [
"0.67844445",
"0.6759146",
"0.675596",
"0.67280394",
"0.66866213",
"0.66826224",
"0.65577257",
"0.6509937",
"0.64805377",
"0.64679414",
"0.6467515",
"0.6451561",
"0.6376406",
"0.6325129",
"0.62452567",
"0.62380874",
"0.6217012",
"0.61967254",
"0.6190408",
"0.6137506",
"0.6106... | 0.0 | -1 |
Add a Font to the Workbook. Used by the parser. You should not need to use this Method. | def add_font font
@fonts.push(font).uniq! if font
font
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = wo... | [
"0.68803114",
"0.68803114",
"0.6739475",
"0.66601634",
"0.65599996",
"0.6439189",
"0.64200765",
"0.6216788",
"0.62061256",
"0.6084988",
"0.6084988",
"0.5998853",
"0.5963805",
"0.5949415",
"0.59119934",
"0.59010935",
"0.58772564",
"0.5848665",
"0.58234996",
"0.5819681",
"0.581... | 0.68840617 | 0 |
Add a Format to the Workbook. If you use Rowset_format, you should not need to use this Method. | def add_format format
if format && !@formats_set[format]
@formats_set[format] = true
@formats.push(format)
end
format
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_format format\n if format.is_a? Workbook::Format\n if format.name\n @formats[format.name] = format\n else\n @formats[@formats.keys.count] = format\n end\n else\n raise ArgumentError, \"format should be a Workboot::Format\"\n end\n end",
"def... | [
"0.723279",
"0.69973165",
"0.6938403",
"0.6823968",
"0.6488521",
"0.61928844",
"0.6033516",
"0.581336",
"0.5751758",
"0.5631482",
"0.5597061",
"0.559295",
"0.5529008",
"0.5481331",
"0.5429493",
"0.53262097",
"0.5249236",
"0.5238088",
"0.5225572",
"0.52054095",
"0.5198023",
... | 0.6617109 | 4 |
Add a Worksheet to the Workbook. | def add_worksheet worksheet
worksheet.workbook = self
@worksheets.push worksheet
worksheet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_worksheet(name = '')\n name = check_sheetname(name)\n worksheet = Worksheet.new(self, @worksheets.size, name)\n @worksheets << worksheet\n worksheet\n end",
"def add_worksheet(name)\n Worksheet.new(@wb.addWorksheet(name))\n end",
"def <<(worksheet)\n if not worksheet.is_... | [
"0.7830548",
"0.7671169",
"0.72260106",
"0.71145856",
"0.71145856",
"0.71145856",
"0.70875525",
"0.6746598",
"0.6512325",
"0.63165456",
"0.6204948",
"0.6144341",
"0.58928716",
"0.58156896",
"0.5808976",
"0.57219607",
"0.56609434",
"0.56186354",
"0.56186354",
"0.540763",
"0.53... | 0.7913903 | 0 |
Delete a Worksheet from Workbook by it's index | def delete_worksheet worksheet_index
@worksheets.delete_at worksheet_index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_index index_name\n table = table index_list_table\n name_col = 0\n row = find_target_row table,index_name,name_col\n if row\n delete_button(table,row).click\n alert_ok\n else\n raise \"can not find target row\"... | [
"0.6862954",
"0.685755",
"0.65720487",
"0.65214527",
"0.6512442",
"0.6448732",
"0.6417274",
"0.6343114",
"0.63177735",
"0.6290051",
"0.62202555",
"0.621021",
"0.6198806",
"0.6178648",
"0.6139415",
"0.6139415",
"0.6119726",
"0.6118927",
"0.6097346",
"0.607582",
"0.6073057",
... | 0.85671884 | 0 |
Change the RGB components of the elements in the colour palette. | def set_custom_color idx, red, green, blue
raise 'Invalid format' if [red, green, blue].find { |c| ! (0..255).include?(c) }
@palette[idx] = [red, green, blue]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palette_rgb_color\n [self.palette_red, self.palette_green, self.palette_blue]\n end",
"def set_color_palette # :nodoc:\n @palette = [\n [0x00, 0x00, 0x00, 0x00], # 8\n [0xff, 0xff, 0xff, 0x00], # 9\n [0xff, 0x00, 0x00, 0x00], # 10\n [0x00, 0xff, 0x00, 0x00], #... | [
"0.6962374",
"0.6669218",
"0.6658371",
"0.6657283",
"0.64955765",
"0.64660907",
"0.638095",
"0.6342888",
"0.6342888",
"0.6274809",
"0.623298",
"0.623038",
"0.623038",
"0.6195973",
"0.619496",
"0.6174064",
"0.61715066",
"0.6169406",
"0.6154318",
"0.6126697",
"0.6097942",
"0.... | 0.68405616 | 1 |
Create a new Worksheet in this Workbook. Used without options this creates a Worksheet with the name 'WorksheetN' where the new Worksheet is the Nth Worksheet in this Workbook. Use the option :name => 'My pretty Name' to override this behavior. | def create_worksheet opts = {}
opts[:name] ||= client("Worksheet#{@worksheets.size.next}", 'UTF-8')
add_worksheet Worksheet.new(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_worksheet( options = {} )\n sheet_name = options[:name]\n\n @workbook = HSSFWorkbook.new if @workbook.nil?\n\n if sheet_name\n\n name = sanitize_sheet_name( sheet_name )\n\n return create_sheet_and_set_styles( name ) if @workbook.getSheetIndex(name) < 0 # Check sheet doesn't... | [
"0.8025738",
"0.76083887",
"0.76083887",
"0.76083887",
"0.70478785",
"0.6937331",
"0.6839304",
"0.6579359",
"0.6554881",
"0.6491634",
"0.6131276",
"0.6114652",
"0.6028703",
"0.5925843",
"0.5887323",
"0.5721588",
"0.5584028",
"0.55776286",
"0.5551589",
"0.5505132",
"0.5382274"... | 0.8046372 | 0 |
Returns the count of total worksheets present. | def sheet_count
@worksheets.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returned_sheets\n return 0 if course.profs.empty? || form.get_tutor_question.nil?\n tutor_db_column = form.get_tutor_question.db_column.to_sym\n RT.count(form.db_table, {:barcode => course.barcodes, \\\n tutor_db_column => tutnum})\n end",
"def total_weeks\n week_split.size\n end",
"... | [
"0.7013994",
"0.67292756",
"0.67114174",
"0.6688579",
"0.63910156",
"0.63318574",
"0.621356",
"0.599591",
"0.5939081",
"0.5933313",
"0.5926134",
"0.5919079",
"0.5913066",
"0.5906283",
"0.5906105",
"0.5892721",
"0.5872874",
"0.58621746",
"0.58269715",
"0.58137363",
"0.58081007... | 0.8372011 | 0 |
The Font at _idx_ | def font idx
@fonts[idx]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def font_id(style_index)\n xf_id(style_index)[:fontId]\n end",
"def find_idex_of_font(searched_font)\n @fonts.find_index { |font| font == searched_font }\nend",
"def font\n @font_path\n end",
"def name\n read_attribute(:font_name)\n end",
"def fontName\n return @font_name\n end",
"de... | [
"0.76105905",
"0.6950638",
"0.69176257",
"0.68710756",
"0.6860478",
"0.6824049",
"0.68206733",
"0.68087876",
"0.67877024",
"0.67776823",
"0.6704898",
"0.6650132",
"0.6600139",
"0.6582369",
"0.6482837",
"0.6400976",
"0.62693393",
"0.62643945",
"0.62457544",
"0.62330335",
"0.62... | 0.8963445 | 0 |
The Format at _idx_, or if _idx_ is a String the Format with name == _idx_ | def format idx
case idx
when Integer
@formats[idx] || @default_format || Format.new
when String
@formats.find do |fmt| fmt.name == idx end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formats_idx; end",
"def format idx\n @formats[idx] || @default_format \\\n || @worksheet.column(idx).default_format if @worksheet\n end",
"def set_format idx, fmt\n @formats[idx] = fmt\n @worksheet.add_format fmt\n @worksheet.row_updated @idx, self if @worksheet\n fmt\n ... | [
"0.7474329",
"0.73671514",
"0.64267224",
"0.6329604",
"0.63190204",
"0.62475955",
"0.6208199",
"0.6193427",
"0.61749464",
"0.6087957",
"0.59250534",
"0.58525485",
"0.58525485",
"0.58431375",
"0.58224106",
"0.58224106",
"0.58224106",
"0.58224106",
"0.57064056",
"0.56977737",
"... | 0.84146225 | 0 |
The Worksheet at _idx_, or if _idx_ is a String the Worksheet with name == _idx_ | def worksheet idx
case idx
when Integer
@worksheets[idx]
when String
@worksheets.find do |sheet| sheet.name == idx end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](ind)\n case ind\n when Integer then worksheets[ind]\n when String then worksheets.find { |ws| ws.sheet_name == ind }\n end\n end",
"def [](ind)\n case ind\n when Integer then worksheets[ind]\n when String then worksheets.find { |ws| ws.sheet_name == ind }\n end... | [
"0.7726725",
"0.7726725",
"0.7726725",
"0.7324187",
"0.68988425",
"0.6317099",
"0.62111413",
"0.5949698",
"0.59345746",
"0.5904901",
"0.57841957",
"0.56039816",
"0.55284864",
"0.5461587",
"0.5394434",
"0.5353135",
"0.5333704",
"0.531262",
"0.52908695",
"0.52808464",
"0.527345... | 0.8489995 | 0 |
Write this Workbook to a File, IO Stream or Writer Object. The latter will make more sense once there are more than just an ExcelWriter available. | def write io_path_or_writer
if io_path_or_writer.is_a? Writer
io_path_or_writer.write self
else
writer(io_path_or_writer).write(self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writer io_or_path, type=Excel\n Excel::Writer::Workbook.new io_or_path\n end",
"def writer io_or_path, type=Excel, version=self.version\n if type == Excel\n Excel::Writer::Workbook.new io_or_path\n else\n raise NotImplementedError, \"No Writer defined for #{type}\"\n end\... | [
"0.6979765",
"0.68915045",
"0.5926749",
"0.5816107",
"0.5739565",
"0.5649337",
"0.55894893",
"0.547847",
"0.5427997",
"0.5423211",
"0.54042065",
"0.5381387",
"0.535559",
"0.53415364",
"0.53186375",
"0.5312382",
"0.53096724",
"0.52787906",
"0.5247716",
"0.52249295",
"0.5208692... | 0.6309293 | 2 |
Returns a new instance of the default Writer class for this Workbook (can only be an Excel::Writer::Workbook at this time) | def writer io_or_path, type=Excel, version=self.version
if type == Excel
Excel::Writer::Workbook.new io_or_path
else
raise NotImplementedError, "No Writer defined for #{type}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writer io_or_path, type=Excel\n Excel::Writer::Workbook.new io_or_path\n end",
"def writer_instance!(additional_settings = {})\n writer_class.new(writer_settings.merge(additional_settings))\n end",
"def writer!\n return writer_class.new(settings.merge(\"logger\" => logger))\n end",
"d... | [
"0.7192458",
"0.6512454",
"0.6360704",
"0.6360704",
"0.6298871",
"0.61119044",
"0.58510166",
"0.5634421",
"0.5525334",
"0.5519411",
"0.5478092",
"0.5425497",
"0.54208064",
"0.54032403",
"0.5337961",
"0.53268003",
"0.5325396",
"0.53050023",
"0.5302603",
"0.5273634",
"0.5204365... | 0.7204642 | 0 |
GET /learning_styles GET /learning_styles.json | def index
@learning_styles = LearningStyle.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end",
"def create\n @learning_style = LearningStyle.new(learning_style_params)\n\n respond_to do |format|\n if @learning_style.save\n format.html { redirect_to @l... | [
"0.7151899",
"0.6756578",
"0.657925",
"0.6484931",
"0.6380623",
"0.6238298",
"0.61653286",
"0.61399674",
"0.6124368",
"0.6096404",
"0.6083397",
"0.60253054",
"0.60033166",
"0.5949661",
"0.5944303",
"0.5930815",
"0.59187925",
"0.5914878",
"0.5893835",
"0.5840874",
"0.58222187"... | 0.7443632 | 0 |
GET /learning_styles/1 GET /learning_styles/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @learning_styles = LearningStyle.all\n end",
"def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end",
"def create\n @learning_style = LearningStyle.new(learning_style_params)\n\n respond_to do |format|\n ... | [
"0.7263709",
"0.7153664",
"0.67630696",
"0.66471213",
"0.64611006",
"0.6417502",
"0.620029",
"0.6173162",
"0.6124298",
"0.60975206",
"0.6063558",
"0.60535455",
"0.60271287",
"0.6026286",
"0.60196245",
"0.595465",
"0.59503126",
"0.5949493",
"0.5946434",
"0.5905388",
"0.588376"... | 0.0 | -1 |
POST /learning_styles POST /learning_styles.json | def create
@learning_style = LearningStyle.new(learning_style_params)
respond_to do |format|
if @learning_style.save
format.html { redirect_to @learning_style, notice: 'Learning style was successfully created.' }
format.json { render :show, status: :created, location: @learning_style }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_style_params\n params.require(:learning_style).permit(:nome, :descricao, :sigla)\n end",
"def create\n @user = current_user\n @learningstyle1 = @user.learningstyles.find_by_user_id(@user.id)\n if @learningstyle1\n redirect_to edit_user_learningstyle_path(@user.id, @learningstyl... | [
"0.6844892",
"0.6777917",
"0.66405153",
"0.64489573",
"0.634721",
"0.63317233",
"0.6319507",
"0.6302192",
"0.6283806",
"0.6236274",
"0.6229727",
"0.61860514",
"0.61524814",
"0.6145055",
"0.611767",
"0.6066704",
"0.60401046",
"0.6020641",
"0.6012584",
"0.59986126",
"0.59966344... | 0.7611729 | 0 |
PATCH/PUT /learning_styles/1 PATCH/PUT /learning_styles/1.json | def update
respond_to do |format|
if @learning_style.update(learning_style_params)
format.html { redirect_to @learning_style, notice: 'Learning style was successfully updated.' }
format.json { render :show, status: :ok, location: @learning_style }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n style = Style.find(params[:id])\n style.update(update_params)\n save_style style.stylable_id\n head :ok\n end",
"def update\n @body_style = BodyStyle.find(params[:id])\n\n respond_to do |format|\n if @body_style.update_attributes(params[:body_style])\n format.html { re... | [
"0.6971867",
"0.6741395",
"0.6678016",
"0.6466867",
"0.6433796",
"0.64272356",
"0.6423357",
"0.63847697",
"0.63558733",
"0.6349047",
"0.6279886",
"0.621098",
"0.61847794",
"0.6176383",
"0.617068",
"0.61682135",
"0.6136629",
"0.6134317",
"0.6105596",
"0.60889906",
"0.6064129",... | 0.73158413 | 0 |
DELETE /learning_styles/1 DELETE /learning_styles/1.json | def destroy
@learning_style.destroy
respond_to do |format|
format.html { redirect_to learning_styles_url, notice: 'Learning style was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @learningstyle.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Learningstyle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @body_style = BodyStyle.find(params[:id])\n @body_style.destroy\n\n ... | [
"0.73779994",
"0.70031875",
"0.6988316",
"0.6959401",
"0.6947318",
"0.692155",
"0.69158846",
"0.6887238",
"0.6879879",
"0.68635815",
"0.6858288",
"0.6813364",
"0.67608017",
"0.6730196",
"0.67295164",
"0.6726254",
"0.6677997",
"0.664442",
"0.65781814",
"0.6557691",
"0.6546632"... | 0.7585685 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_learning_style
@learning_style = LearningStyle.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 learning_style_params
params.require(:learning_style).permit(:nome, :descricao, :sigla)
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 |
Use callbacks to share common setup or constraints between actions. | def set_decrypt_messages
@rsa = Rsa.find(params[:rsa_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def decrypt_message_params
params.require(:decrypt_message).permit(:content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
GET /raiway_stations GET /raiway_stations.json | def index
@raiway_stations = RaiwayStation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def stations_list\n @route.get_stations_list\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def get_all_stations\n url = 'radio/station'... | [
"0.7935934",
"0.7593563",
"0.74178016",
"0.7388151",
"0.73613495",
"0.722495",
"0.7178617",
"0.70940316",
"0.7085768",
"0.70173377",
"0.7010987",
"0.6949354",
"0.6873708",
"0.6846112",
"0.673237",
"0.67244667",
"0.6709124",
"0.6694815",
"0.66494465",
"0.6645305",
"0.66361964"... | 0.76643586 | 1 |
GET /raiway_stations/1 GET /raiway_stations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def index\n @raiway_stations = RaiwayStation.all\n end",
"def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render... | [
"0.7561904",
"0.7389459",
"0.7217648",
"0.71691805",
"0.7086982",
"0.70854354",
"0.7011547",
"0.68807447",
"0.6837085",
"0.68269384",
"0.673301",
"0.6726412",
"0.6706736",
"0.6692917",
"0.66482264",
"0.66383815",
"0.66276276",
"0.65239346",
"0.6512668",
"0.6500011",
"0.648195... | 0.0 | -1 |
POST /raiway_stations POST /raiway_stations.json | def create
@raiway_station = RaiwayStation.new(raiway_station_params)
respond_to do |format|
if @raiway_station.save
format.html { redirect_to @raiway_station, notice: 'Raiway station was successfully created.' }
format.json { render :show, status: :created, location: @raiway_station }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @station = Station.new(station_params)\n\n if @station.save\n render json: @station, status: :created, location: @station\n else\n render json: @station.errors, status: :unprocessable_entity\n end\n end",
"def create\n @railway_station = RailwayStation.new(rai... | [
"0.68845767",
"0.67238677",
"0.6687122",
"0.6687122",
"0.6609189",
"0.6593426",
"0.6592289",
"0.65019995",
"0.6498406",
"0.6493501",
"0.63199866",
"0.6313733",
"0.6309623",
"0.62926716",
"0.6292425",
"0.6254605",
"0.62117136",
"0.61915964",
"0.61844856",
"0.615863",
"0.614519... | 0.7314385 | 0 |
PATCH/PUT /raiway_stations/1 PATCH/PUT /raiway_stations/1.json | def update
respond_to do |format|
if @raiway_station.update(raiway_station_params)
format.html { redirect_to @raiway_station, notice: 'Raiway station was successfully updated.' }
format.json { render :show, status: :ok, location: @raiway_station }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n if @line_station.update_attributes(params[:line_station])\n format.html { redirect_to @line_station, notice: 'Line station was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.66762435",
"0.6660116",
"0.6660116",
"0.6577477",
"0.65140176",
"0.65132564",
"0.64696944",
"0.64253163",
"0.6393388",
"0.6387457",
"0.638409",
"0.63526684",
"0.62920004",
"0.6277507",
"0.6261165",
"0.6257637",
"0.62281376",
"0.6215096",
"0.6212403",
"0.61801594",
"0.61485... | 0.7059308 | 0 |
DELETE /raiway_stations/1 DELETE /raiway_stations/1.json | def destroy
@raiway_station.destroy
respond_to do |format|
format.html { redirect_to raiway_stations_url, notice: 'Raiway station was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway_station.destroy\n respond_to do |format|\n form... | [
"0.7360316",
"0.711518",
"0.71138823",
"0.7084262",
"0.69929665",
"0.6948466",
"0.69278085",
"0.6925962",
"0.68842655",
"0.68606734",
"0.68326527",
"0.6791782",
"0.6784973",
"0.6721687",
"0.6666459",
"0.66622597",
"0.6656914",
"0.66409403",
"0.663683",
"0.662985",
"0.66202277... | 0.73849124 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_raiway_station
@raiway_station = RaiwayStation.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 raiway_station_params
params.require(:raiway_station).permit(:title)
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 |
This basic methods receives commonly used params: message(payload) inline_query(query, offset) chosen_inline_result(result_id, query) callback_query(data) Define public methods to respond to commands. Command arguments will be parsed and passed to the method. Be sure to use splat args and default values to not get erro... | def start(data = nil, *)
response = from ? I18n.t(:welcome, username: from['username']) : 'Здарова!'
respond_with :message, text: response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_command(args, rest)\n # [:@ident, \"public\", [6, 8]]\n (_, name, (line, _column)) = args\n\n method_name = \"on_#{name}_command\"\n if respond_to? method_name\n return send(method_name, line, args, rest)\n else\n RubyLanguageServer.logger.debug(\"We don't have a #{met... | [
"0.6906706",
"0.6440029",
"0.6307482",
"0.6268446",
"0.6251905",
"0.6144187",
"0.6130562",
"0.61296666",
"0.6102067",
"0.60628176",
"0.60585725",
"0.60128796",
"0.5986272",
"0.595631",
"0.5953115",
"0.59148926",
"0.5874875",
"0.5843688",
"0.5836966",
"0.58089596",
"0.57933724... | 0.0 | -1 |
This module is largely based on ssh_creds and firefox_creds.rb. | def run
print_status("Finding .gnupg directories")
paths = enum_user_directories.map {|d| d + "/.gnupg"}
# Array#select! is only in 1.9
paths = paths.select { |d| directory?(d) }
if paths.nil? or paths.empty?
print_error("No users found with a .gnupg directory")
return
end
download_loot(paths)
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials\n if Rails.env.test? || Rails.env.development?\n Rugged::Credentials::SshKeyFromAgent.new(username: username)\n else\n Rugged::Credentials::SshKey.new(username: 'git', publickey: SETTINGS['ssh_public_key'], privatekey: SETTINGS['ssh_private_key'])\n ... | [
"0.67853355",
"0.66518867",
"0.66518867",
"0.66518867",
"0.66518867",
"0.66518867",
"0.6558385",
"0.6434354",
"0.6434354",
"0.64129627",
"0.6362262",
"0.631364",
"0.631364",
"0.631364",
"0.631364",
"0.631364",
"0.62789667",
"0.61812145",
"0.61744165",
"0.61744165",
"0.6034199... | 0.0 | -1 |
using hex grid of doubled coordinates see: constraint is (x + y) % 2 == 0 | def starting_grid
# hash of grid. key is coord [x, y]. value is true (black) or false (white)
grid = Hash.new(false)
raw_input.each_line do |line|
pos = [0, 0]
directions(line.chomp).each do |dir|
pos = move(pos, dir)
end
grid[pos] = !grid[pos]
end
grid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_coords(x,y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end",
"def fit_hexagons(width, length, y)\n x = y/Math.sqrt(3) # half the width of a hexagon side\n num_rows = (length / y - 1).floor\n num_cols = ((width / x - 1)/3).floor\n if num_rows.even?\n # all columns have equal length\n ... | [
"0.6572218",
"0.65647507",
"0.6524446",
"0.64033985",
"0.63939357",
"0.62699425",
"0.62572336",
"0.6254332",
"0.62257904",
"0.62240267",
"0.6198346",
"0.6167137",
"0.6163231",
"0.6161851",
"0.6143458",
"0.6088695",
"0.6087282",
"0.60576034",
"0.60576034",
"0.6049895",
"0.6040... | 0.0 | -1 |
A whole line of input needs a particular color. This makes it easy to have all the ERB happening in one spot to avoid escaping issues. | def hsay(output,color_scheme)
@highline.say("<%= color(%Q{#{output}},'#{color_scheme}') %>")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(line)\n line.gsub!(/^#.*/, '') # remove comments\n return if line.match?(/^\\s*$/) # skip blank lines\n color = Color.new line\n color.to_html\nend",
"def red(input)\n puts \"\\e[31m#{input}\\e[0m\"\nend",
"def red(input)\n puts \"\\e[31m#{input}\\e[0m\"\nend",
"def coloured(string, colour)... | [
"0.7178804",
"0.63660556",
"0.63660556",
"0.62497264",
"0.62005246",
"0.61182195",
"0.60078996",
"0.59924096",
"0.5945975",
"0.5915797",
"0.58820045",
"0.5826702",
"0.5795976",
"0.5785625",
"0.5767209",
"0.5737419",
"0.57253957",
"0.5722164",
"0.57178646",
"0.57174176",
"0.57... | 0.0 | -1 |
Prompt for input, returning what was typed. Options can be passed in. If echo is false, then '' is printed out for each character typed in. If it is any other character then that is output instead. If validate is set to true, then it will prompt twice and make sure that the two values match | def prompt(p,options)
validated = false
line = ""
extra_prompt = " (again)"
original_prompt = p
validation_prompt = original_prompt + extra_prompt
echo = options[:echo].nil? ? true : options[:echo]
width = options[:width] || 30
validate = options[:validate] || fal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt(message, valid_options)\n if valid_options\n answer = get_stdin(\"#{message} #{valid_options.to_s.gsub(/\"/, '').gsub(/, /,'/')} \") while !valid_options.include?(answer)\n else\n answer = get_stdin(message)\n end\n answer\nend",
"def prompt(output, err, options = nil)\n\t\t@return = \"\"\n\... | [
"0.6845991",
"0.67609984",
"0.6728641",
"0.6676123",
"0.65499014",
"0.64704037",
"0.63623196",
"0.6345473",
"0.6345473",
"0.62365323",
"0.6220203",
"0.62198967",
"0.61992353",
"0.61800385",
"0.61792946",
"0.6141362",
"0.61317503",
"0.61140376",
"0.6098023",
"0.6088541",
"0.60... | 0.65029687 | 5 |
Set a signed cookie (username) to recognize the user | def create
cookies.signed[:username] = params[:session][:username]
redirect_to messages_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end",
"def set_userid(id)\n response.set_cookie('userid', id)\n end",
"def cookieMe\n if user_signed_in?... | [
"0.716693",
"0.7093491",
"0.7055815",
"0.70506203",
"0.70442206",
"0.6980412",
"0.6974392",
"0.69384116",
"0.69319236",
"0.68949234",
"0.6832203",
"0.6802919",
"0.6799232",
"0.6791142",
"0.67800874",
"0.6779318",
"0.6742566",
"0.67415327",
"0.6736103",
"0.6735562",
"0.6692341... | 0.6582804 | 29 |
Yields `Script` object concurrently, in different threads. | def each(&block)
if block_given?
Parallel.each(each_path, in_threads: threads) do |path|
load_script_from_path path, &block
end
else
self.enum_for :each
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_to_thread\n Threaded.new map { |x| Thread.new { yield(x) } }\n end",
"def run_script(fail_silently=false)\n\t\tif script_running?\n\t\t\traise 'Script thread already running' unless fail_silently\n\t\t\treturn\n\t\tend\n\t\t\n\t\t@script_thread = Thread.new do\n\t\t\tbegin\n\t\t\t\tyield\n\t\t\t... | [
"0.5762757",
"0.53838515",
"0.53617525",
"0.52676225",
"0.52265",
"0.5145316",
"0.5135039",
"0.5110482",
"0.5063523",
"0.5049162",
"0.50147015",
"0.5012238",
"0.50037926",
"0.49901572",
"0.49901572",
"0.49901572",
"0.49901572",
"0.49843395",
"0.4982407",
"0.49722397",
"0.4970... | 0.6263764 | 0 |
chosen_array is an array of 3 elements These are defined in the first line of the method | def process_purchase_of_card(turn, chosen_data)
@purchased_card = chosen_data[1] #TODO I don't think this should be in the CLI
type_of_card, card, card_cost = chosen_data[0], chosen_data[1], chosen_data[2]
turn.player.money = turn.player.money - card_cost
if type_of_card == :landmark
tur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_array_option(array_of_choices, result_as_num = false)\n raise 'Array of choices is empty!' unless array_of_choices.any?\n display_array_value_with_index(array_of_choices)\n get_array_option_input(array_of_choices, result_as_num)\n end",
"def choose_from_things(array_of_items)\n array_of... | [
"0.65289575",
"0.6367767",
"0.6334653",
"0.62908614",
"0.6272709",
"0.6260643",
"0.6162164",
"0.61455095",
"0.6129117",
"0.6109222",
"0.6100579",
"0.60355353",
"0.6006153",
"0.60055155",
"0.5993413",
"0.5989776",
"0.5965948",
"0.5940526",
"0.59327286",
"0.59180206",
"0.583860... | 0.0 | -1 |
We want to offer the user a choice of something from 4 sets. 1) The cards available in the town. 2) Unbuilt landmarks. 3) Databank menu (in which case, repeat, once databank is dealt with) 4) Purchase nothing. | def purchase_card(turn)
own_money = turn.player.money
keep_repeating = true
while keep_repeating == true do
keep_repeating = false
@@cli.say "Now it is time to purchase a card; you have <%= color('#{own_money}', BOLD) %> money."
# Create a hash for the cards in the town
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # G... | [
"0.6438876",
"0.63244176",
"0.63165843",
"0.62784415",
"0.6165441",
"0.6161509",
"0.61452544",
"0.6139433",
"0.61336094",
"0.6120482",
"0.6114446",
"0.6097838",
"0.60727054",
"0.60648745",
"0.60519934",
"0.6040854",
"0.60355026",
"0.60305786",
"0.60285723",
"0.60273165",
"0.5... | 0.69793445 | 0 |
def consider_free_turn(turn) if turn.player.has_ability(:double_free_turn) && turn.rolled_double? | def end_turn(turn)
#todo have another turn???
@@cli.say "Your turn is over!"
@purchased_card = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_double()\n hand = @hands[@current_hand]\n @total_money > 0\n end",
"def regular_turn?(turn)\n min_turn = @players_count * 2 + 1\n turn >= min_turn\n end",
"def can_double?\n\t\treturn (@hand.length == 2 and @balance.balance >= @bet)\n\tend",
"def has_free_trial?\n return (trial and t... | [
"0.71182126",
"0.69824433",
"0.6836066",
"0.6704356",
"0.6696704",
"0.64594716",
"0.64004636",
"0.6385871",
"0.6379321",
"0.6379321",
"0.6360447",
"0.63556045",
"0.63517326",
"0.6350896",
"0.63249373",
"0.6283704",
"0.62574506",
"0.6210186",
"0.6200038",
"0.6200038",
"0.61903... | 0.0 | -1 |
Read YAML file and extract all targets as array | def get_targets(path)
config = YAML.load(File.read(path))
targets = config['storage']['targets'].group_by { |key| key['type'] }
targets_valid?(targets)
process_targets(targets)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets\n return YAML.safe_load(File.read(@cache), permitted_classes: [Symbol]) unless @cache.nil?\n\n targets = Pod::Config.instance.with_changes(silent: true) do\n Pod::Installer.targets_from_sandbox(\n Pod::Config.instance.sandbox,\n Pod::Config.instance.podfile,... | [
"0.6282208",
"0.6208211",
"0.61870646",
"0.6109267",
"0.60213774",
"0.59636647",
"0.5950326",
"0.594212",
"0.591044",
"0.58973885",
"0.5807369",
"0.5804173",
"0.5802087",
"0.57778984",
"0.5739973",
"0.57203466",
"0.57195204",
"0.570183",
"0.5698444",
"0.5687806",
"0.56582135"... | 0.6580413 | 0 |
Write JSON files to current directory | def make_files(targets)
file_pairs = targets.map { |t|
filename = sanitize_filename(t[:data][:name] + '.json')
[filename, t]
}
unique_pairs = uniqufy(file_pairs)
unique_pairs.each do |name, content|
puts "Write #{File.absolute_path(name)}"
File.open(name, 'w') { |file| file.write(JSON.pretty_g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_json_file(json, filepath)\n File.open(filepath,\"w\") do |f|\n f.write(json.to_json)\n end\nend",
"def write\n return if PictureTag.site.config['disable_disk_cache']\n\n FileUtils.mkdir_p(File.join(base_directory, sub_directory))\n\n File.open(filename, 'w+') do |f|\n ... | [
"0.7916004",
"0.7432245",
"0.74287003",
"0.7340335",
"0.7340335",
"0.73075485",
"0.7161206",
"0.7145883",
"0.7123917",
"0.7122465",
"0.7035154",
"0.7011647",
"0.69957346",
"0.6992947",
"0.69468313",
"0.6942736",
"0.69015807",
"0.6892244",
"0.68310595",
"0.6793148",
"0.6783911... | 0.6221117 | 72 |
Accept list list of key/value pairs and append `_1`, `_2` etc to all nonunique pairs | def uniqufy(original_list)
# Recursive function to bump index unti it is not unique
def increment(key, acc) if acc.map { |p| p[0] }.include?(key) then increment(bump(key), acc) else key end end
def bump(pair) [pair[0], pair[1] + 1] end # Increment index in pair of key and index
list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplify_key_value_list(elements)\n # remove everything form right to left till the double unerline\n elements.each do |element|\n element.keyValueList.transform_keys! do |key|\n index = key.index('__')\n if !index.nil?\n key.slice(index + 2, key.length)\n else\n ... | [
"0.6602779",
"0.60821414",
"0.58457065",
"0.5826849",
"0.57933366",
"0.5703905",
"0.56895053",
"0.5643811",
"0.5613607",
"0.5589431",
"0.55825424",
"0.5563786",
"0.5540814",
"0.5538539",
"0.5494287",
"0.54846907",
"0.54744655",
"0.54380316",
"0.54326874",
"0.542944",
"0.53920... | 0.7105965 | 0 |
Convert string to valid filename | def sanitize_filename(filename)
fn = filename.split(/(?<=.)\.(?=[^.])(?!.*\.[^.])/m)
fn.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
return fn.join '.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(string)\n\tstring.gsub! \"'\", '\"'\n\tstring[%r{(?<=\")[\\./]*[\\w\\.-]+(/[\\w\\.-]+)*\\.[a-z\\.]+(?=\")}i] # (?:\\.|'|\")\nend",
"def parse_filename(string)\n string.sub(/^\\//, '') #remove leading slash\n end",
"def sanitize_filename(s)\n return '' if s.nil?\n s.chars.map{ |c| c.ord <... | [
"0.7065377",
"0.7057291",
"0.69374615",
"0.68665624",
"0.6854589",
"0.68135166",
"0.6742105",
"0.6691723",
"0.6683799",
"0.6677254",
"0.66683346",
"0.6604435",
"0.65638864",
"0.6526309",
"0.650159",
"0.6486805",
"0.6430456",
"0.6394104",
"0.63767904",
"0.6362011",
"0.63584673... | 0.62261903 | 26 |
Check that targets have valid type. Throw exception otherwise | def targets_valid?(targets_hash)
targets_hash.keys.each { |type|
unless KNOWN_TYPES.include? type
raise "Unknown target type [#{type}]"
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can?(source, target)\n !conversions[source, target].nil?\n rescue NoTypeConversionAvailableError\n false\n end",
"def valid?\n\t\t\t!@targets.nil?\n\t\tend",
"def type?(source,target)\n @cyc.with_any_mt{|cyc| cyc.isa?(target,source) }\n end",
"def valid_target\n if ... | [
"0.65575856",
"0.6510424",
"0.6351766",
"0.6234614",
"0.6145633",
"0.59866554",
"0.5858753",
"0.57873005",
"0.5764521",
"0.57595795",
"0.57554525",
"0.56960446",
"0.56960446",
"0.56667304",
"0.5658385",
"0.5646511",
"0.56412464",
"0.56229794",
"0.55740696",
"0.55710244",
"0.5... | 0.75150025 | 0 |
Convert each target to selfdescribing JSON accroding to its type | def process_targets(targets_hash)
redshift = targets_hash['redshift']
postgres = targets_hash['postgres']
elasticsearch = targets_hash['elasticsearch']
redshift.to_a.map { |t| process_redshift(t) } + postgres.to_a.map { |t| process_postgres(t) } + elasticsearch.to_a.map { |t| process_elasticsearch(t) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(*a)\n result = {}\n self.type_mappings.keys.each { |key| result[key] = self.send(key).to_json }\n {\n 'json_class' => self.class.name,\n 'data' => result\n }.to_json(*a)\n end",
"def apply_json_trait(value); end",
"def to_json(options = nil)\n @target... | [
"0.61434907",
"0.5765579",
"0.56928325",
"0.56599426",
"0.5612669",
"0.56109416",
"0.5541712",
"0.55206215",
"0.5518733",
"0.5488898",
"0.54576534",
"0.5448013",
"0.5446344",
"0.5442987",
"0.54265577",
"0.5425347",
"0.54065645",
"0.53767437",
"0.5367521",
"0.5367059",
"0.5319... | 0.0 | -1 |
Generate Redshift target from YAML configuration | def process_redshift(target)
{
:schema => 'iglu:com.snowplowanalytics.snowplow.storage/redshift_config/jsonschema/1-0-0',
:data => {
:name => target['name'],
:host => target['host'],
:database => target['database'],
:port => target['port'],
:sslMode => target['ssl_mode'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_staging_config(url, config)\n staging = {'domain' => url, 'baseurl' => url,\n 'assets' => {'baseurl' => \"#{url}/assets\"}}\n File.open(config, 'w') { |f| f.write staging.to_yaml }\nend",
"def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end",
"d... | [
"0.5392372",
"0.53823996",
"0.52460706",
"0.5176819",
"0.50904",
"0.49996495",
"0.496856",
"0.49492514",
"0.49396148",
"0.4913128",
"0.48884887",
"0.4874308",
"0.48442677",
"0.48147744",
"0.47878233",
"0.47873798",
"0.47873798",
"0.47733277",
"0.4770039",
"0.474924",
"0.47115... | 0.5701421 | 0 |
Generate Postgres target from YAML configuration | def process_postgres(target)
{
:schema => 'iglu:com.snowplowanalytics.snowplow.storage/postgresql_config/jsonschema/1-0-0',
:data => {
:name => target['name'],
:host => target['host'],
:database => target['database'],
:port => target['port'],
:sslMode => target['ssl_mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_postgresql_version; end",
"def pg\n uri = URI.parse( hpg_resolve(shift_argument, \"DATABASE_URL\").url )\n config = {\n 'name' => gen_datasource_name(\"PostgreSQL\"),\n 'type' => \"POSTGRESQL\",\n 'config' => {\n 'host' => uri.host,\n 'port' => uri.port || 5432,\n ... | [
"0.5972615",
"0.5954309",
"0.57254016",
"0.5643788",
"0.5543402",
"0.5534567",
"0.5485235",
"0.5429662",
"0.53716457",
"0.526291",
"0.52305365",
"0.5212931",
"0.5212931",
"0.5194829",
"0.51871914",
"0.5186865",
"0.51768947",
"0.51745534",
"0.51447475",
"0.5139655",
"0.5109313... | 0.63593376 | 0 |
Generate Elasticsearch target from YAML configuration | def process_elasticsearch(target)
{
:schema => 'iglu:com.snowplowanalytics.snowplow.storage/elastic_config/jsonschema/1-0-0',
:data => {
:name => target['name'],
:host => target['host'],
:index => target['database'],
:port => target['port'],
:type => target['table'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_output\n # create logstash configs\n indexname = @name\n File.open(File.join(@logstashdir, \"output.conf\"), \"w\") do |f|\n f.write <<OUTPUT\n# Generated by elasticsupport\noutput {\n elasticsearch {\n template => \"elasticsupport-template.json\"\n template_overwrite => tru... | [
"0.59408975",
"0.59269726",
"0.53826165",
"0.5224561",
"0.5204935",
"0.5194702",
"0.51795983",
"0.50886965",
"0.49358997",
"0.49163163",
"0.48897022",
"0.4878237",
"0.48510945",
"0.4844163",
"0.48357973",
"0.48014498",
"0.47993672",
"0.47627613",
"0.47398958",
"0.47344536",
"... | 0.6059052 | 0 |
/api/list/authors?top=1 Top Authors /api/list/authors?q=james | def index
conditions = { :block => false }
conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'
conditions.merge!( :is_agency => true ) if params[:agency] == '1'
unless params[:author_id].blank? && params[:author_ids].blank?
author_ids = scan_multiple_value_param( :author_id, :firs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authors_top\n\t\t\t@db.js('musicthoughts.top_authors($1)', [20])\n\t\tend",
"def index\n @q = Author.search(params[:q])\n @authors = @q.result(distinct: true).paginate(:page => params[:page]).order('last_name ASC')\n end",
"def authors\n\t\t\t@db.js('musicthoughts.top_authors(NULL)')\n\t\tend",
"d... | [
"0.7939891",
"0.7282789",
"0.7271097",
"0.6960294",
"0.6813424",
"0.6810869",
"0.6451418",
"0.64347094",
"0.643353",
"0.6431695",
"0.6328852",
"0.6320716",
"0.62607414",
"0.6252384",
"0.62394124",
"0.62334394",
"0.6176195",
"0.60966927",
"0.6092105",
"0.60843813",
"0.6061751"... | 0.6989752 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.