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 |
|---|---|---|---|---|---|---|
def require_no_user if current_user store_location flash[:notice] = "You must be logged out to access this page" redirect_to orders_path return false end end | def store_location
session[:return_to] = request.request_uri
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_no_user\n if current_user\n store_location\n flash[:notice] = \"You must be logged out to access this page\"\n redirect_to \"\"\n return false\n end\n end",
"def require_no_user\n if current_user\n store_location\n flash[:notice] = \"You must be l... | [
"0.8981221",
"0.89482",
"0.88327885",
"0.877803",
"0.8469743",
"0.8334182",
"0.8242191",
"0.8078861",
"0.80153507",
"0.79986113",
"0.7994833",
"0.79785866",
"0.79205173",
"0.78732777",
"0.7866844",
"0.7849221",
"0.7848418",
"0.78266984",
"0.7825126",
"0.78135705",
"0.780292",... | 0.0 | -1 |
When using the lexer, it may be useful to have a visual representation of the tree Just pass the tree (or any node in it, if you're only interested in that part) to this function, and a visual representation of the tree will magically appear in stdout | def output_tree(element, indent = '')
puts "#{indent}#{element.class}: #{element.text_value}"
(element.elements || []).each do |e|
output_tree(e, "#{indent} ")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)",
"def cmd_tree\n print_tree(Editor, 0)\n end",
"def print_tree\n ''\n end",
"def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += ' ' *... | [
"0.7655568",
"0.749664",
"0.7090162",
"0.7004867",
"0.687688",
"0.6814686",
"0.67334473",
"0.6701234",
"0.6698068",
"0.66764474",
"0.6666655",
"0.664827",
"0.66236657",
"0.6621132",
"0.6609223",
"0.65719277",
"0.656961",
"0.65045434",
"0.6471695",
"0.6466503",
"0.6449666",
... | 0.5917864 | 55 |
GET /packages GET /packages.json | def index
authorize! :manage, @packages , :message => "Access denied."
# authorize! :manage, @packages , :message => "Access denied."
# if params[:sort] == nil then
# @packages = Package.search(params[:search]).page(params[:page]).per(50)
# else
# @packages = Package.order(sort_column +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user_packages = UserPackage.all\n\n render json: @user_packages\n end",
"def get_packages!(path)\n response = Api::Request.new do |request|\n request[:sign] = false\n request[:method] = :GET\n request[:path] = \"/shared/packages/#{path}\"\n end.execute!\n\n ... | [
"0.7094987",
"0.6980382",
"0.6915026",
"0.6870578",
"0.66833556",
"0.6557783",
"0.64823544",
"0.64163077",
"0.64163077",
"0.64163077",
"0.64163077",
"0.6404226",
"0.6371317",
"0.63614136",
"0.63333756",
"0.63276005",
"0.62957823",
"0.6293979",
"0.62011826",
"0.6176134",
"0.61... | 0.0 | -1 |
GET /packages/1 GET /packages/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_packages!(path)\n response = Api::Request.new do |request|\n request[:sign] = false\n request[:method] = :GET\n request[:path] = \"/shared/packages/#{path}\"\n end.execute!\n\n Object::File.open(path, 'wb') do |file|\n file.write(response)\n end\n\n path... | [
"0.681649",
"0.6812562",
"0.6763046",
"0.6685305",
"0.6537243",
"0.6433314",
"0.6433314",
"0.6433314",
"0.6433314",
"0.64313513",
"0.64066017",
"0.632991",
"0.63220793",
"0.62971985",
"0.62949884",
"0.6280894",
"0.62229276",
"0.61833423",
"0.6109267",
"0.6067275",
"0.6053432"... | 0.0 | -1 |
POST /packages POST /packages.json | def create
# authorize! :manage, @packages , :message => "Access denied."
@package = @product.packages.new(package_params)
respond_to do |format|
if @package.save
format.html { redirect_to [@package.product, @package], notice: 'Package was successfully created.' }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @package = Package.create(package_params)\n\n render json: @package\n end",
"def create\n api_service = Api.find_by(status: true).name\n result_hash = RouteCalculator.call(package_params.merge(service: api_service))\n @package = current_user.packages.new(result_hash.merge(package_par... | [
"0.70456994",
"0.66020286",
"0.65726715",
"0.6569471",
"0.6481375",
"0.6404256",
"0.6404256",
"0.63239944",
"0.6218412",
"0.61218315",
"0.6079297",
"0.60578644",
"0.59421116",
"0.5926232",
"0.59254676",
"0.59175384",
"0.58785355",
"0.5864909",
"0.5817439",
"0.5808393",
"0.580... | 0.64943224 | 4 |
PATCH/PUT /packages/1 PATCH/PUT /packages/1.json | def update
authorize! :manage, @packages , :message => "Access denied."
respond_to do |format|
if @package.update(package_params)
format.html { redirect_to [@package.product, @package], notice: 'Package was successfully updated.' }
format.json { render :show, status: :ok, location: @packag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { re... | [
"0.6710467",
"0.669309",
"0.66357875",
"0.6552224",
"0.6543628",
"0.6543628",
"0.65336233",
"0.651972",
"0.64734954",
"0.64249307",
"0.637781",
"0.6356463",
"0.62867546",
"0.6226313",
"0.6212045",
"0.6172058",
"0.61518764",
"0.61461717",
"0.61108196",
"0.6104951",
"0.60995954... | 0.6640788 | 2 |
DELETE /packages/1 DELETE /packages/1.json | def destroy
authorize! :manage, @packages , :message => "Access denied."
@package.destroy
respond_to do |format|
format.html { redirect_to product_packages_url, notice: 'Package was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @package = Package.find(params[:id])\n @package.destroy\n\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @package.status = nil\n @package.save!\n respond_to do |format|\n format.html { ... | [
"0.7325984",
"0.72980565",
"0.7151152",
"0.7102877",
"0.7102877",
"0.7101819",
"0.6978",
"0.6962748",
"0.69584566",
"0.69584566",
"0.6896802",
"0.68251055",
"0.6820448",
"0.6804538",
"0.6768487",
"0.6722521",
"0.6719763",
"0.6709181",
"0.67016065",
"0.67013747",
"0.6674813",
... | 0.70484847 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_package
@package = @product.packages.friendly.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 package_params
params.require(:package).permit(:product_id, :operating_system_id, :name, :version, :package, :release_note, :release_package, :emergency_package, :notwork_package, :is_public, :checksum, :release_date, :build_date, :description, :latest)
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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
Get Product that has the Product | def set_product
@product = Product.friendly.find(params[:product_id])
# logger.debug "product #{@product.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product\n FarMar::Product.all.select { |product| product.product_id == product_info }\n end",
"def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end",
"def product(product)\n products.find(product.id)\n end",
"def product\n sale_... | [
"0.7682468",
"0.74092805",
"0.7388538",
"0.71369946",
"0.71029747",
"0.6985329",
"0.69102985",
"0.6869826",
"0.6844655",
"0.68376106",
"0.6831536",
"0.67818165",
"0.6745678",
"0.67380875",
"0.67316407",
"0.6651312",
"0.6608695",
"0.6602806",
"0.65990824",
"0.65512735",
"0.651... | 0.0 | -1 |
currently supported by twitter, github, ads and ads_fulltext agents with slightly different header names | def get_rate_limit_remaining(headers)
headers["X-Rate-Limit-Remaining"] || headers["X-RateLimit-Remaining"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_header_contents; end",
"def pull_headers\n header_str = \"\"\n ['h1','h2','h3'].each do |html_tag|\n html = URI.parse(self.personal_website_url).open\n header_str += Nokogiri::HTML.parse(html).css(html_tag).map(&:text).join(' | ')\n end\n self.headers = header_str\n end",
"def ... | [
"0.63003683",
"0.6282477",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.622161",
"0.61278176",
"0.6113992",
"0.61025983",
"0.60810107",
"0.605466",
"0.6022259",
"0.60016835",
"0.599745",
"0.5995154",
"0.59951... | 0.0 | -1 |
This web service retrieves information for a specific building. The building must already be shared with you. | def building(building_id)
perform_get_request("/building/#{building_id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend",
"def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from c... | [
"0.72374034",
"0.6838142",
"0.67383283",
"0.6726845",
"0.6517205",
"0.64626366",
"0.6462489",
"0.64470285",
"0.64426756",
"0.63730145",
"0.63660455",
"0.63171434",
"0.63077825",
"0.62177324",
"0.6200808",
"0.61689395",
"0.6163148",
"0.6141038",
"0.61324954",
"0.6102507",
"0.6... | 0.7780683 | 0 |
This web service returns a list of buildings for a specific property that is shared with you. | def building_list(property_id)
perform_get_request("/property/#{property_id}/building/list")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n # @properties = Property.filter_by_building(params[:buildingnumber])\n # @building = Building.find(params[:building_id])\n @properties = Property.search(params[:search])\n end",
"def similar\n @property = Property.find(params[:id])\n @response = HTTParty.get(\"http://api.nestoria.co.u... | [
"0.6237419",
"0.5827237",
"0.55985934",
"0.55917674",
"0.55683666",
"0.5476454",
"0.5467701",
"0.5440224",
"0.5423854",
"0.5420254",
"0.5408246",
"0.5407922",
"0.54058325",
"0.5401892",
"0.53831905",
"0.535187",
"0.531338",
"0.5306648",
"0.52869403",
"0.5285553",
"0.52239287"... | 0.7112393 | 0 |
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge with Chris Aubuchon 1. Pseudocode What is the input? The input for mode() is an array of numbers or strings What is the output? (i.e.... | def mode(array)
count = Hash.new(0)
array.each do |x| count[x] += 1 end #counts number of occurences and stores in count hash
if array == array.uniq # if array values occur equally, return array
array
else
array.keep_if{
|x| array.count(x) >= count.values.max #keep all v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mode (array)\n # -make a hash to keep track of each item's frequecy\n tracker = {}\n# -iterate through the input array\n array.each do |x|\n# -create a key for each different thing in the input array\n if tracker.has_key?(x) # use the value to keep track of how often each thing shows up\n #incr... | [
"0.86008817",
"0.8544852",
"0.8460332",
"0.84569407",
"0.83833796",
"0.83805496",
"0.8375056",
"0.8368867",
"0.8340044",
"0.8298759",
"0.8295732",
"0.82839125",
"0.8279288",
"0.8275578",
"0.8267966",
"0.82626617",
"0.8254931",
"0.8242589",
"0.8221323",
"0.821267",
"0.8210273"... | 0.8409738 | 4 |
Method to get a list of CDN providers from Dyn Expects: nothing Returns: Array of strings | def get_providers
@weights.map{|k,v|v.keys}.flatten.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def providers\n url = url_with_api_version(@base_url, 'providers')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def providers\n @providers.keys\n end",
"def marketplace_domains\n marketplace_names.map { |domain| \"#{domain}.net\" }\n end",
"def prov... | [
"0.65891606",
"0.6532489",
"0.6522358",
"0.60959446",
"0.6090895",
"0.6036891",
"0.6010642",
"0.59818554",
"0.5974093",
"0.5901336",
"0.58558667",
"0.5824679",
"0.58131593",
"0.5798249",
"0.57813907",
"0.57655454",
"0.5759701",
"0.57450306",
"0.57450306",
"0.57427895",
"0.571... | 0.5233509 | 68 |
Get list of nodes configured for this target Expects: nothing Returns: Array of strings | def get_nodes
@weights.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_list\n connect unless connected?\n set_config unless @config\n\n return [] unless config\n\n [\"#{@host}:#{@port}\"]\n end",
"def get_nodes\n @known_nodes\n end",
"def nodes\n state(metrics: \"nodes\").dig(\"nodes\")\n end",
"def node_list\n Ch... | [
"0.7843288",
"0.75913024",
"0.7540712",
"0.73748535",
"0.7374696",
"0.7374312",
"0.7356032",
"0.7300147",
"0.72607666",
"0.72438335",
"0.7218411",
"0.7152561",
"0.71010226",
"0.70933163",
"0.6996158",
"0.69932413",
"0.69805294",
"0.69587153",
"0.6956007",
"0.69473994",
"0.692... | 0.58668536 | 98 |
Method to show current balance Expects: nothing Returns: nothing (prints to screen) | def show_balance(header = "NODE BALANCE")
puts "\n#{header}"
puts "=" * header.length
@weights.each do |node,providers|
puts "#{node}"
providers.each do |label,detail|
printf " %-12s weight = %2d | serve_mode = %-8s | status = %-4s | address = %s\n",
label... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_balance()\n puts \"Balance:$#{@balance}.\"\n returned\n end",
"def show_current_balance\n return \"Balance: $#{sprintf \"%.2f\", @balance}\"\n end",
"def balance_display(balance)\n puts \"Your current balance is $#{@balance}.\"\n end",
"def show_balance\n\t\t\tr... | [
"0.87110704",
"0.8371198",
"0.8318065",
"0.81749594",
"0.8158547",
"0.8132756",
"0.797508",
"0.789857",
"0.7785668",
"0.7781545",
"0.7649036",
"0.7534009",
"0.7522581",
"0.75125396",
"0.74360055",
"0.7404572",
"0.7399909",
"0.73659873",
"0.7361639",
"0.7337288",
"0.73030454",... | 0.6796632 | 41 |
Method to set weight for a provider Expects: provider: Provider to set weight for (String) weight: Weight to set provider to (Int) safe: Whether or not to prompt to confirmation (Boolean, default to true) Returns: nothing | def set_weight(provider, weight, safe=true)
get_yn("You're about to modify the weight of #{provider} to #{weight} are you sure (Y|N)?") unless safe == false
# do it
@nodes.each do |node|
old_weight = @weights[node][provider]['weight']
address = @weights[node][provider]['address']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_Weight(value)\n set_input(\"Weight\", value)\n end",
"def set_Weight(value)\n set_input(\"Weight\", value)\n end",
"def weight=(value)\n @weight = value\n end",
"def update_factor_weight(factor_name,weight)\n index = get_element_index(rand_factor... | [
"0.5926987",
"0.5926987",
"0.57322776",
"0.56523913",
"0.55748713",
"0.5565364",
"0.5457819",
"0.5457819",
"0.5457819",
"0.5457819",
"0.5352822",
"0.5280082",
"0.5251673",
"0.5251673",
"0.51963997",
"0.51706517",
"0.51530206",
"0.5149938",
"0.51408327",
"0.51161224",
"0.50881... | 0.80475295 | 0 |
Method to set mode for a provider Expects: provider: Provider to set weight for (String) mode: Mode to set provider to (String) safe: Whether or not to prompt to confirmation (Boolean, default to true) Returns: nothing | def set_serve_mode(provider, mode, safe=true)
get_yn("You're about to change the serving mode for #{provider} to '#{mode}' are you sure (Y|N)?") unless safe == false
# do it
@nodes.each do |node|
old_mode = @weights[node][provider]['serve_mode']
address = @weights[node][provider]['ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_selected_provider\n autodetect_selected_provider if params[:provider] == 'auto' && params[:ord].present?\n\n @selected_provider = case params[:provider]\n when 'estcard'\n if EcwidPizzeria::Application.config.estcard.enabled\n prepare_estcard\n params[:provider]\n end\n ... | [
"0.62550616",
"0.611883",
"0.5840455",
"0.5733326",
"0.56338125",
"0.5623864",
"0.5623075",
"0.5572656",
"0.5572656",
"0.55571413",
"0.5511927",
"0.5511927",
"0.5511927",
"0.5511927",
"0.5511927",
"0.5511927",
"0.5511927",
"0.5499222",
"0.5493656",
"0.54832697",
"0.5473518",
... | 0.71542436 | 0 |
Method to set dump current weights to JSON Expects: target: Target of which to dump weights (String) output_path: File path to dump JSON files to Returns: nothing | def dump_weights(target,output_path)
## jankiest thing that will work development approach
summary = {}
# assetion here is every node in the target group has same weight (should be true)
key = @weights.keys.first
@weights[key].each do |provider, config|
enabled = config["serve_mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_weights_to_yaml(file_name=nil)\n @weights_set.dump_to_yaml(file_name)\n end",
"def serialize(target, json, serialize_context: new_serialize_context)\n case target\n when ViewModel\n target.serialize(json, serialize_context: serialize_context)\n when Array\n json.arra... | [
"0.55397636",
"0.5494046",
"0.54731876",
"0.5166362",
"0.5164026",
"0.511486",
"0.50841457",
"0.50417346",
"0.49960396",
"0.49960396",
"0.4961099",
"0.4936102",
"0.4919725",
"0.4919725",
"0.48931745",
"0.48514712",
"0.48206347",
"0.4750627",
"0.47438344",
"0.4741218",
"0.4738... | 0.7716465 | 0 |
Helper method to get y/n response Expects: message: Message for y/n prompt (String) Returns: nothing | def get_yn(message)
while true
print "#{message} "
case STDIN.gets.strip
when 'N', 'n'
puts "Aborting!"
exit
when 'Y', 'y'
puts ""
break
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask(msg)\n request(\"#{msg} [yn] \") == 'y'\n end",
"def get_confirmation(msg)\n print msg << \"(y/n) \"\n loop do\n answer = gets\n if answer.nil?\n return false\n end\n case answer.strip\n when \"y\", \"yes\" then break true\n when \"n\", \"no\" then b... | [
"0.765609",
"0.7398236",
"0.70976335",
"0.6993028",
"0.6978031",
"0.6961586",
"0.68576616",
"0.68462574",
"0.68060356",
"0.68056643",
"0.6768546",
"0.6756069",
"0.67423016",
"0.673975",
"0.6681366",
"0.6680905",
"0.66578543",
"0.6639246",
"0.6610804",
"0.6577755",
"0.65684205... | 0.731284 | 2 |
Adds ' to the url prefix if it doesn't already exist. | def url=(new_url)
super(new_url)
unless URI.parse(self.url).scheme
self.url.prepend("http://")
end
rescue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_with_prefix\n\t\t( url.blank? ) ? '' :\n\t\t\t( url.match(/^http(s)?:\\/\\//) ? url : \"http://#{url}\" )\n\tend",
"def prefix=(value)\n value += '/' if value != '' and value[-1] != '/'\n @prefix = value\n end",
"def append_without_prefix(string); end",
"def prefix(path=nil)\n ... | [
"0.6962045",
"0.6217591",
"0.6162192",
"0.6153817",
"0.60375834",
"0.60255224",
"0.59548134",
"0.59533083",
"0.5881739",
"0.58771896",
"0.5835034",
"0.58130836",
"0.58127725",
"0.5796784",
"0.57826066",
"0.57577294",
"0.57428145",
"0.57225907",
"0.57130784",
"0.56960016",
"0.... | 0.0 | -1 |
GET /email_types GET /email_types.json | def index
@email_types = EmailType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def index\n @search = EmailType.search(params[:search])\n @email_types = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # indexoo.html.erb\n form... | [
"0.6210807",
"0.6210791",
"0.6090657",
"0.6060671",
"0.60589904",
"0.60532594",
"0.6038844",
"0.6037739",
"0.59949505",
"0.59949505",
"0.59873927",
"0.5983898",
"0.5980195",
"0.5966879",
"0.5943255",
"0.5845462",
"0.58331925",
"0.5812633",
"0.57922983",
"0.57905203",
"0.57765... | 0.7243354 | 0 |
GET /email_types/1 GET /email_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @email_types = EmailType.all\n end",
"def show\n @entry_mail_type = EntryMailType.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry_mail_type }\n end\n end",
"def show\n @email_type_list = Emai... | [
"0.7073004",
"0.66210127",
"0.63968134",
"0.631236",
"0.6206902",
"0.61194974",
"0.6113951",
"0.6080928",
"0.60145146",
"0.6005447",
"0.6005447",
"0.5997288",
"0.5997288",
"0.5930504",
"0.59241843",
"0.59241706",
"0.59183687",
"0.5914155",
"0.5891329",
"0.5885487",
"0.5861344... | 0.0 | -1 |
POST /email_types POST /email_types.json | def create
@email_type = EmailType.new(email_type_params)
respond_to do |format|
if @email_type.save
format.html { redirect_to @email_type, notice: 'Email type was successfully created.' }
format.json { render action: 'show', status: :created, location: @email_type }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sell_payment_types_create (email, params={})\r\n url = api_url \"/sell/payment_types/new\"\r\n load = MultiJson.dump email: email\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req \r\n end \r\n end",
"def email_type_params\n ... | [
"0.6840441",
"0.64415693",
"0.63384026",
"0.62671655",
"0.6064451",
"0.59708065",
"0.5929137",
"0.5848231",
"0.5848231",
"0.58427954",
"0.58009285",
"0.58009285",
"0.57350475",
"0.57175267",
"0.5691874",
"0.5609394",
"0.5576175",
"0.5565429",
"0.5550735",
"0.5499388",
"0.5441... | 0.65145344 | 1 |
PATCH/PUT /email_types/1 PATCH/PUT /email_types/1.json | def update
respond_to do |format|
if @email_type.update(email_type_params)
format.html { redirect_to @email_type, notice: 'Email type was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @email... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n respond_to do |format|\n if @email_type.update_attributes(params[:email_type])\n format.html { redirect_to(@email_type, :notice => 'Email type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n forma... | [
"0.69515723",
"0.64380664",
"0.64150834",
"0.6338813",
"0.6300505",
"0.62245524",
"0.6214556",
"0.61361706",
"0.6133563",
"0.6118387",
"0.61065924",
"0.6103716",
"0.6046778",
"0.6020238",
"0.6016482",
"0.60073936",
"0.59824127",
"0.5974907",
"0.59595466",
"0.5940605",
"0.5940... | 0.7289262 | 0 |
DELETE /email_types/1 DELETE /email_types/1.json | def destroy
@email_type.destroy
respond_to do |format|
format.html { redirect_to email_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @entry_mail_type = EntryMailType.find(params[:id])\n @entry_mail_type.destroy\n \n respond_to do |format|\n format.html { redirect_to entry_mail_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mail_typ = MailTyp.find(params[:id])... | [
"0.7052297",
"0.7041433",
"0.6991515",
"0.69330716",
"0.69330716",
"0.6911162",
"0.68644094",
"0.6861975",
"0.685607",
"0.67733955",
"0.6739916",
"0.67298865",
"0.6715277",
"0.671152",
"0.6703352",
"0.66702515",
"0.6667607",
"0.66561586",
"0.6652749",
"0.66501665",
"0.6640839... | 0.7933676 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_email_type
@email_type = EmailType.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 email_type_params
params.require(:email_type).permit(:code, :description, :observation)
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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
intervals variable is set to 1 when calculating current_period_end from current_period_start & plan intervals variable is set to 2 when calculating Stripe::Invoice.upcoming end from current_period_start & plan | def get_ending_time(start_time, plan, intervals = 1)
case plan[:interval]
when "week"
start_time + (604800 * (plan[:interval_count] || 1) * intervals)
when "month"
(Time.at(start_time).to_datetime >> ((plan[:interval_count] || 1) * intervals)).to_time.to_i
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_interval(period, &block); end",
"def supported_payment_intervals\n HashWithIndifferentAccess.new(\n weekly: 1,\n fortnightly: 2,\n monthly: 3,\n quarterly: 4,\n halfyearly: 5,\n annually: 6\n )\n end",
"def set_boundaries\n ... | [
"0.6726482",
"0.6726097",
"0.6202229",
"0.6184547",
"0.6127711",
"0.60111564",
"0.5970286",
"0.59591156",
"0.5940627",
"0.5917875",
"0.579534",
"0.5792494",
"0.5752805",
"0.57512003",
"0.5702322",
"0.5699264",
"0.5681518",
"0.5681518",
"0.5675864",
"0.56478643",
"0.5604918",
... | 0.6526993 | 2 |
target_uri must be ends with / when target is directory. | def initialize(list_file, target_uri)
@list_file = list_file
@target_uri = target_uri
@expired_src = {}
@expired_dst = {}
@update_count = 0
load
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_url(target)\n File.join(\"/\", Pathname.new(target).relative_path_from(Pathname.new(DST_DIR)).to_s)\nend",
"def target_uri\n \"#{@configuration.protocol}://#{@configuration.host}\"\n end",
"def target_path\n Pathname.new(config[:target_path])\n end",
"def target_path\n Pathname.n... | [
"0.6815592",
"0.65775967",
"0.63308614",
"0.63275486",
"0.6255943",
"0.60673296",
"0.6060522",
"0.5993538",
"0.5934427",
"0.5881742",
"0.585114",
"0.57999223",
"0.5789499",
"0.5767933",
"0.57003397",
"0.5690131",
"0.5679109",
"0.5661783",
"0.56557614",
"0.56552076",
"0.564602... | 0.0 | -1 |
assume a node's coordinates can be within 100..100 range | def set_coordinates
[rand(-100..100), rand(-100..100)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coords_from_node(node)\n\t\t[node.x,node.y]\n\tend",
"def test_get_node_range_no_features\n nodes = @container.get_nodes('1',12,27,0)\n assert_equal(4, nodes.length)\n assert_equal([11,15,0], [nodes[0].start, nodes[0].stop, nodes[0].count])\n assert_equal([16,20,0], [nodes[1].start, nodes[1].... | [
"0.6590314",
"0.63568723",
"0.6286032",
"0.6065249",
"0.6064784",
"0.6055938",
"0.60135174",
"0.59715635",
"0.596844",
"0.59228456",
"0.5842789",
"0.58347905",
"0.58152455",
"0.5776881",
"0.576882",
"0.5764191",
"0.57590175",
"0.5757687",
"0.57454044",
"0.5710801",
"0.5677739... | 0.60018367 | 7 |
BSON will use Stringforce_encoding to make the string 8bit ASCII. This could break unicode text so we should dup in this case, and it also fails with frozen strings. | def to_binary(s)
s = s.dup if s.frozen? || s.encoding != Encoding::ASCII_8BIT
::BSON::Binary.new(s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_utf8\n str = force_encoding(\"UTF-8\")\n return str if str.valid_encoding?\n\n str.encode(\"UTF-8\", \"binary\",\n invalid: :replace, undef: :replace, replace: \"\")\n end",
"def safe_encode_utf8(text)\n text.force_encoding('ASCII-8BIT').encode(\"UTF-8\", :invalid => :replace, :u... | [
"0.6669327",
"0.6667115",
"0.6625736",
"0.6608654",
"0.66075855",
"0.6533529",
"0.6484363",
"0.64087665",
"0.6359182",
"0.63576806",
"0.6317415",
"0.6298812",
"0.6289886",
"0.6273089",
"0.6268598",
"0.62674004",
"0.62626094",
"0.62268573",
"0.62051725",
"0.614468",
"0.614468"... | 0.63518935 | 10 |
DELETE /incomes/1 DELETE /incomes/1.json | def destroy
income = Income.destroy(params["id"])
if income
render json: {
status: "SUCCESS",
message: "Income deleted",
}, status: :ok
else
render json: {
status: "ERROR",
message: "Invalid id",
}, status: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @income = Income.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @income = current_company.incomes.find(params[:id])\n @income.destroy\n\n respond... | [
"0.7905099",
"0.7768056",
"0.7577897",
"0.7529606",
"0.74151504",
"0.733064",
"0.7281832",
"0.71439207",
"0.70970714",
"0.7081335",
"0.70588696",
"0.704886",
"0.7025281",
"0.69865257",
"0.69457453",
"0.69062954",
"0.68993306",
"0.68964624",
"0.68853223",
"0.6862435",
"0.68613... | 0.74815494 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_income
@income = income.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 income_params
params.require(:income).permit(:account_id, :amount, :source, :vendor, :description, :date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /biometrias GET /biometrias.json | def index
set_persona_biometria
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def set_biometria\n @biometria = Biometria.find(params[:id])\n end",
"def show\n @user_biography = UserBiography.find(params[:id])\n... | [
"0.67485106",
"0.66011953",
"0.63265926",
"0.625541",
"0.6122454",
"0.60953826",
"0.6083318",
"0.6082335",
"0.60631484",
"0.6049852",
"0.6015496",
"0.59998006",
"0.5950362",
"0.59485966",
"0.58847207",
"0.5878337",
"0.58782774",
"0.5853434",
"0.5852453",
"0.58439374",
"0.5834... | 0.6155322 | 4 |
GET /biometrias/1 GET /biometrias/1.json | def show
set_persona_biometria
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def set_biometria\n @biometria = Biometria.find(params[:id])\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\... | [
"0.696589",
"0.6665572",
"0.64423925",
"0.64054215",
"0.62867534",
"0.6253005",
"0.6210766",
"0.6100335",
"0.6068325",
"0.6056189",
"0.6053179",
"0.6052502",
"0.6038631",
"0.60352826",
"0.603049",
"0.60124385",
"0.60010976",
"0.59861183",
"0.5985529",
"0.5973877",
"0.59663653... | 0.61611754 | 7 |
POST /biometrias POST /biometrias.json | def create
@biometria = Biometria.new(biometria_params)
respond_to do |format|
if @biometria.save
format.html { redirect_to index_biometria_path(params[:biometria][:paciente_id]), notice: 'Datos de biometria guardados correctamente'}
format.json { render :show, status: :created, location:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def biometria_params\n params.require(:biometria).permit(:paciente_id, :globulos_rojos,:globulos_blancos, :plaquetas, :hemoglobina, :hematocritos, :neutrofilos, :monocitos, :linfocitos)\n end",
"def create\n @tipocambio = Tipocambio.new(tipocambio_params)\n\n respond_to do |format|\n if @tipoc... | [
"0.7129329",
"0.64318216",
"0.64049846",
"0.62540627",
"0.6073067",
"0.5949405",
"0.58965015",
"0.5858995",
"0.57580036",
"0.57473975",
"0.5714608",
"0.5710553",
"0.57091427",
"0.57088554",
"0.5692129",
"0.5678594",
"0.5668127",
"0.5668127",
"0.56493235",
"0.56363285",
"0.560... | 0.70765084 | 1 |
PATCH/PUT /biometrias/1 PATCH/PUT /biometrias/1.json | def update
respond_to do |format|
if @biometria.update(biometria_params)
format.html { redirect_to index_biometria_path(params[:biometria][:paciente_id]), notice: 'Biometria se actualizo correctamente'}
format.json { render :show, status: :ok, location: @biometria }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @tipocambio.update(tipocambio_params)\n format.html { redirect_to @tipocambio, notice: 'Tipocambio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipocambio }\n else\n format.html { render :edit }\n ... | [
"0.65152013",
"0.63285846",
"0.6282303",
"0.6262766",
"0.62269104",
"0.6209791",
"0.6195962",
"0.61584145",
"0.6151712",
"0.61240673",
"0.61098117",
"0.6100649",
"0.6037135",
"0.603695",
"0.60126776",
"0.6006565",
"0.5993651",
"0.59904635",
"0.598981",
"0.59885514",
"0.598163... | 0.678604 | 0 |
DELETE /biometrias/1 DELETE /biometrias/1.json | def destroy
@biometria.destroy
respond_to do |format|
format.html { redirect_to index_biometria_path(params[:paciente_id]), notice: 'Biometria elimino correctamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n @imobiliaria.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\... | [
"0.6980366",
"0.68872803",
"0.6843533",
"0.6823583",
"0.68021876",
"0.67854446",
"0.67802376",
"0.67789286",
"0.677778",
"0.6774319",
"0.67680943",
"0.674726",
"0.67426693",
"0.6714663",
"0.67049515",
"0.6690043",
"0.66898793",
"0.66864336",
"0.6686396",
"0.668259",
"0.666594... | 0.7417017 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_biometria
@biometria = Biometria.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def biometria_params
params.require(:biometria).permit(:paciente_id, :globulos_rojos,:globulos_blancos, :plaquetas, :hemoglobina, :hematocritos, :neutrofilos, :monocitos, :linfocitos)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Overwriting the sign_out redirect path method | def after_sign_out_path_for(commitable_or_scope)
root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(reso... | [
"0.8102037",
"0.8007481",
"0.7984188",
"0.79324496",
"0.7897868",
"0.78892565",
"0.7874593",
"0.78685254",
"0.7857867",
"0.78436327",
"0.78436327",
"0.78436327",
"0.78436327",
"0.7842701",
"0.7821579",
"0.77880424",
"0.7748489",
"0.77373666",
"0.7731692",
"0.77291566",
"0.772... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_initiation
@initiation = Initiation.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def initiation_params
params.require(:initiation).permit(:characters)
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.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
The method should return true if the only common divisor between the two numbers is 1. The method should return false otherwise. For example coprime?(25, 12) is true because 1 is the only number that divides both 25 and 12. | def coprime?(num_1,num_2)
(2..num_1).none?{|fac| num_1 % fac == 0 && num_2 % fac == 0}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coprime?(num1, num2)\n # div1 = get_divisors(num1)\n # div2 = get_divisors(num2)\n # # if num1.even? && num2.even?\n # # return false\n # if div1.one? { |ele| div2.include?(ele)}\n # return true\n # else\n # return false\n # end\n\n (2..num1).none? {|factor| num1 % fac... | [
"0.88569736",
"0.8828487",
"0.8813763",
"0.8790531",
"0.87874633",
"0.8748482",
"0.87193555",
"0.8711553",
"0.8691748",
"0.86887336",
"0.8672548",
"0.8655852",
"0.8629594",
"0.8598255",
"0.8556939",
"0.85246587",
"0.84906113",
"0.8475431",
"0.84471524",
"0.8354478",
"0.833038... | 0.8635269 | 12 |
Method to print a list and make it look pretty input: updated grocery list steps: display each item on a separate line so looks like a list output: pretty list. | def print_list(complete_list)
puts "Here is a list of things of things you need to buy and the amount needed:"
complete_list.each {|key, value| puts "#{value} #{key}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend",
"def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_pretty(new_list)\n puts \"Groc... | [
"0.85605705",
"0.82432616",
"0.8204501",
"0.8197529",
"0.81079584",
"0.81079584",
"0.8098411",
"0.80977386",
"0.80220187",
"0.80118847",
"0.7987854",
"0.79754126",
"0.7945001",
"0.7900039",
"0.7872492",
"0.7836655",
"0.7826102",
"0.7772973",
"0.7763324",
"0.7652477",
"0.76474... | 0.0 | -1 |
dntest: 177......291 psio: 144.................497 | def detectCollision(x, y, width, height)
@points.each_key { |pnt|
# does the proposed box start in the middle of another box?
if (@points[pnt]['y1'] == y) && (x < @points[pnt]['x2']) && (x >= @points[pnt]['x1'])
return pnt
end
# does the proposed box end in the midd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_a\n ## SUMO を TraCI モードで立ち上げ。TraCI サーバのポートは port\n (port,_) = Sumo::Traci::Client.prepareServer(SampleConfFile)\n Sumo::Util::waitTcpPortIsReady(port) ;\n\n ## クライアント作成。TraCI サーバのポートは port\n ## ログは、$stdout に吐き出す。\n traci = Sumo::Traci::Client.new({ :port => port, \n ... | [
"0.5637782",
"0.5626769",
"0.5546277",
"0.5502978",
"0.54721415",
"0.54123914",
"0.53964907",
"0.53831655",
"0.53512704",
"0.53512704",
"0.5340771",
"0.5317473",
"0.5315037",
"0.5315037",
"0.5315037",
"0.5279633",
"0.52686316",
"0.5264399",
"0.5232611",
"0.52283263",
"0.52061... | 0.0 | -1 |
being a personal service, we're storing the locale in the session. YES, we're breaking the web | def extract_locale_from_session
session[:locale] || nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_locale\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>\"}\n\t\t#puts \"set_locale:params[:locale]=#{params[:locale]}\"\n\t\tif params[:locale]\n\t\t\tI18n.locale = params[:locale]\n\t\t\tsession[:lng] = I18n.locale\n\t\telse\n\t\t\tunless @current_user.nil?\n\t\t\t\t#puts \"s... | [
"0.7936122",
"0.78654975",
"0.7834164",
"0.78090364",
"0.7576541",
"0.75621396",
"0.7536197",
"0.7532058",
"0.7521062",
"0.7513068",
"0.7513068",
"0.7512584",
"0.7468487",
"0.7442259",
"0.74255747",
"0.7418252",
"0.73853004",
"0.7355701",
"0.73427045",
"0.7320431",
"0.7309738... | 0.7623279 | 4 |
it allows to write object data outside the class | def obj_fun
puts "It is an object function. Object of class can access it"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write\n write_data\n end",
"def data=(obj, klass = obj.class)\n\t\twrite_local(:klass, klass.to_s)\n\t\twrite_local(:data, obj.to_s)\n\t\t@klass = klass.to_s\n\t\t@data = obj.to_s\n\tend",
"def write_object(object)\n object\n end",
"def serialize(_object, data); end",
"def serialize(_obj... | [
"0.7144928",
"0.7044822",
"0.70067304",
"0.70024186",
"0.70024186",
"0.68739235",
"0.6787564",
"0.6772391",
"0.66979265",
"0.66979265",
"0.66979265",
"0.66979265",
"0.6608896",
"0.6608896",
"0.65985644",
"0.6578611",
"0.65324146",
"0.65258986",
"0.64957064",
"0.6482818",
"0.6... | 0.0 | -1 |
methods that are private are accessible within the class | def salary
puts 'private method'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private_method; end",
"def a_private_method\n\tend",
"def private_method\n\tend",
"def private_method\n\tend",
"def private_method\n end",
"def private_method\n end",
"def internal_methods; end",
"def methods() end",
"def private_methods(all=true) end",
"def methods; end",
"def method... | [
"0.8046715",
"0.7931866",
"0.78764987",
"0.78764987",
"0.7819963",
"0.7790944",
"0.7739899",
"0.7711129",
"0.7710619",
"0.7653277",
"0.7653277",
"0.7653277",
"0.7653277",
"0.76266503",
"0.74135727",
"0.7375438",
"0.7323127",
"0.72104394",
"0.7188107",
"0.71751946",
"0.7158673... | 0.62692875 | 84 |
methods that are public are accessible even from outside the class through class objects | def policy
puts 'public method'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def public; end",
"def public; end",
"def internal_methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def public_methods(all=true) end",
"def other_public_method\n end",
"def test3\r\n\t\t\"public method\" #a method can be publi... | [
"0.73920035",
"0.73354155",
"0.73354155",
"0.7308563",
"0.72835046",
"0.72835046",
"0.72835046",
"0.72835046",
"0.7148917",
"0.70484555",
"0.70412993",
"0.7038357",
"0.69267535",
"0.6860843",
"0.6832391",
"0.68277156",
"0.68007725",
"0.67873335",
"0.6773429",
"0.6751881",
"0.... | 0.0 | -1 |
methods that are protected are accessible within the class and child classes | def departments
puts 'protected method'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protected_instance_methods(include_super=true) end",
"def protected_method\n end",
"def protected_methods(all=true) end",
"def protected_method\n\tend",
"def protected_method\n end",
"def protected_methods(all=true)\n __getobj__.protected_methods(all) | super\n end",
"def private_instance... | [
"0.76436853",
"0.76024026",
"0.7547474",
"0.75334793",
"0.7408363",
"0.7327719",
"0.7265435",
"0.70146334",
"0.70036924",
"0.6993725",
"0.6993725",
"0.6993725",
"0.6993725",
"0.69820064",
"0.6945972",
"0.69385886",
"0.6851727",
"0.68198454",
"0.68147683",
"0.677806",
"0.67665... | 0.6363103 | 38 |
+Array+ of grocery item codes Return +Response+ object with the validation results | def validate(*groceries)
invalid_items = groceries - @inventory_items
Response.new(data: groceries - invalid_items,
errors: build_error_messages(invalid_items))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan(*grocery_codes)\n response = @input_validator.validate(*grocery_codes)\n response = Response.new(data: Receipt.new(grocery_codes, repo: @repo)) if response.valid?\n response\n end",
"def product_codes\n data[:product_codes]\n end",
"def validate_response_code\n return ... | [
"0.6854472",
"0.5355895",
"0.52847177",
"0.52541935",
"0.52248305",
"0.5189226",
"0.5188079",
"0.5171983",
"0.515572",
"0.5120626",
"0.5120541",
"0.5115254",
"0.51077473",
"0.51055026",
"0.50999576",
"0.5088775",
"0.50582427",
"0.50530416",
"0.5049056",
"0.5044216",
"0.503686... | 0.6375707 | 1 |
Compute the year's team result For each collegieate team Extract list of pilots Extract list of contests for each pilot Determine qualification Determine best score combination | def recompute_team
teams = CollegiateResult.where(:year => @year).all
teams.each do |team|
ctc = CollegiateTeamComputer.new(team.pilot_contests)
result = ctc.compute_result
team.qualified = result.qualified
team.points = result.total
team.points_possible = result.total_possible
team.update_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"def compute_qualification(team, pilots, pilot_contests)\n if 3 <= pilots.size\n contests_properties = gather_contest_properties(pilot_contests)\n non_primary_pa... | [
"0.6825781",
"0.6287799",
"0.62628824",
"0.6155725",
"0.610074",
"0.60488427",
"0.5954381",
"0.59167135",
"0.59087306",
"0.5901991",
"0.588913",
"0.58759385",
"0.58624434",
"0.5757988",
"0.57508975",
"0.5671768",
"0.5667918",
"0.56268406",
"0.5609604",
"0.5574188",
"0.5574188... | 0.61520666 | 4 |
Compute the year's individual results | def recompute_individual
cic = CollegiateIndividualComputer.new(@year)
cic.recompute
results = CollegiateIndividualResult.where(:year => @year).all
RankComputer.compute_result_rankings(results)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_yearwise(incomes_or_deductions)\n income_deduction_per_year = Hash.new(0)\n\n incomes_or_deductions.each do |income_deduction|\n working_days_in_year = Float(52*5)\n daily_income = 0\n\n case income_deduction.frequency\n when \"daily\"\n daily_income = income_deduct... | [
"0.73206735",
"0.6981387",
"0.69695944",
"0.6867446",
"0.68612325",
"0.6826955",
"0.6798853",
"0.6720858",
"0.66504335",
"0.6627427",
"0.6621547",
"0.6569767",
"0.65672827",
"0.65672827",
"0.6554791",
"0.6503521",
"0.6489401",
"0.64546245",
"0.64459777",
"0.6437487",
"0.64336... | 0.0 | -1 |
Sets team qualified boolean result Count of pilots participating is three or more and Three contests with three pilots and Three contests with at least one nonPrimary pilot | def compute_qualification(team, pilots, pilot_contests)
if 3 <= pilots.size
contests_properties = gather_contest_properties(pilot_contests)
non_primary_participant_occurrence_count = 0
three_or_more_pilot_occurrence_count = 0
contests_properties.each do |contest|
non_primary_participant_occurren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def competitor_has_result?(competitor)\n competitor.scores.count > 0\n end",
"def team_member_count\n self.teams.count < TOTAL_TEAMS\n end",
"def won_match?\n @sets_won == 3\n end",
"def points_if_not_trial\n n = event.tournament.number_of_non_exhibition_teams\n\n if disqualified? then ... | [
"0.5742312",
"0.5700503",
"0.5665687",
"0.56396663",
"0.5590337",
"0.5539603",
"0.5516765",
"0.54943794",
"0.5469817",
"0.54552567",
"0.54293823",
"0.5407414",
"0.5406301",
"0.5403492",
"0.5373501",
"0.53535986",
"0.53499544",
"0.53380495",
"0.533336",
"0.53086764",
"0.529607... | 0.78361684 | 0 |
pilot_contests is hash of pilot (member) => [ array of pc_result ] return an array of hashes, one for each unique contest found in pilot_contests each hash contains keys: :has_non_primary boolean true if one pilot flew the contest not in Primary :pilot_count integer count of pilots who flew in the contest | def gather_contest_properties(pilot_contests)
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_qualification(team, pilots, pilot_contests)\n if 3 <= pilots.size\n contests_properties = gather_contest_properties(pilot_contests)\n non_primary_participant_occurrence_count = 0\n three_or_more_pilot_occurrence_count = 0\n contests_properties.each do |contest|\n non_primary_participa... | [
"0.63679206",
"0.6154912",
"0.60452527",
"0.5764699",
"0.5623247",
"0.55127805",
"0.53873074",
"0.5381637",
"0.5377291",
"0.53413665",
"0.5320741",
"0.5302443",
"0.5275509",
"0.52669626",
"0.5261556",
"0.5240859",
"0.52363825",
"0.5233217",
"0.5213175",
"0.5206576",
"0.520623... | 0.6700594 | 0 |
Sets team points and points_possible Sets team pc_results list of up to three used for points and points_possible For each pilot participating in Sportsman or above For each of that pilot's nonPrimary results For each combination of up to two other pilots For each combination of those two pilot's results Keep the best ... | def compute_best_score(team, pilots, pilot_contests)
combination = []
total = 0.0
total_possible = 0
puts 'compute_score TBD'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_team_points\n # If the bracket is complete, we can calculate points based on the\n # teams' `final_rank`s.\n if @state == \"complete\"\n calculate_team_points_by_final_rank\n return\n end\n\n # For each team, look at the matches that it is in, ... | [
"0.6309664",
"0.61954224",
"0.61898696",
"0.61610645",
"0.61543465",
"0.6140556",
"0.6135318",
"0.60040754",
"0.60000336",
"0.59519583",
"0.588957",
"0.58581764",
"0.5838421",
"0.5816935",
"0.5780449",
"0.57664835",
"0.5708591",
"0.5703218",
"0.5681984",
"0.5656245",
"0.56280... | 0.68966603 | 0 |
We monkey patch a few core classes (Enumerable, Array, boolean classes...) and several of the gems (ActiveRecord, Discordrb, Webrick...) See the MonkeyPatch module in models.rb for the details | def monkey_patch
MonkeyPatches.apply
log("Applied monkey patches")
rescue => e
fatal("Failed to apply monkey patches: #{e}")
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch; end",
"def patch; end",
"def patch_class(klass)\n @patches.each do |patch|\n patch.patch_class(klass)\n end\n end",
"def patched_methods\n @patched_methods ||= {}.with_indifferent_access\n end",
"def monkey_patch!(*args)\n args = %w{ symbol string } if args.empty... | [
"0.6276915",
"0.6276915",
"0.6028084",
"0.6016583",
"0.59762025",
"0.5950845",
"0.5865972",
"0.5764845",
"0.57022995",
"0.56307197",
"0.56099993",
"0.5560093",
"0.55485755",
"0.5516041",
"0.5462106",
"0.54303277",
"0.5390006",
"0.538165",
"0.5352901",
"0.5338077",
"0.5305431"... | 0.6004815 | 4 |
Initialize the global variables used by the bot Also set some environment variables and ensure some folders are created | def initialize_vars
# Initialize global variables
$config = nil
$channel = nil
$mapping_channel = nil
$nv2_channel = nil
$content_channel = nil
$last_potato = Time.now.to_i
$potato = 0
$last_mishu = nil
$status_update = Time.now.to_i
$twitch_token = nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init!\n @defaults = {\n :@refresh_token => ENV[\"STC_REFRESH_TOKEN\"],\n :@client_id => ENV[\"STC_CLIENT_ID\"],\n :@client_secret => ENV[\"STC_CLIENT_SECRET\"],\n :@language_code => \"nl-NL\",\n :@environment => 'test',\n :@version => 1,\n :@verbose => ... | [
"0.6410699",
"0.63365144",
"0.63040775",
"0.6287989",
"0.6253432",
"0.62309283",
"0.61602443",
"0.606828",
"0.6058834",
"0.60455143",
"0.6041849",
"0.5986752",
"0.5986752",
"0.59840184",
"0.59820306",
"0.59713876",
"0.5944195",
"0.59160614",
"0.58936566",
"0.588825",
"0.58855... | 0.7334171 | 0 |
Parse the database configuration file, as well as some environment variables | def load_config
$config = YAML.load_file(CONFIG)[DATABASE]
$config['discord_client'] = (TEST ? ENV['DISCORD_CLIENT_TEST'] : ENV['DISCORD_CLIENT']).to_i
$config['discord_secret'] = TEST ? ENV['DISCORD_TOKEN_TEST'] : ENV['DISCORD_TOKEN']
$config['twitch_client'] = ENV['TWITCH_CLIENT']
$config['twitch_secret'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend",
"def read_config\n db_config = YAML.load_file('config/database.y... | [
"0.7353318",
"0.7353318",
"0.70982295",
"0.68885165",
"0.68863654",
"0.6855257",
"0.68265414",
"0.6804761",
"0.67908055",
"0.6733716",
"0.6717117",
"0.6706297",
"0.6677784",
"0.66135406",
"0.65173936",
"0.6508979",
"0.6485389",
"0.6386801",
"0.63431823",
"0.632604",
"0.63116"... | 0.5913504 | 54 |
Connect to the database | def connect_db
ActiveRecord::Base.establish_connection($config)
log("Connected to database")
rescue => e
fatal("Failed to connect to the database: #{e}")
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end",
"def connect\n @conn = PG.connect(\n :dbname => 'HackerNewsAppDB1',\n :user => 'paul',\n :password => 'password')\n end",
... | [
"0.80985224",
"0.7731795",
"0.7717307",
"0.76748836",
"0.7664702",
"0.7662488",
"0.7633124",
"0.76256657",
"0.76101726",
"0.76101726",
"0.7571929",
"0.75515187",
"0.749092",
"0.7466066",
"0.74170727",
"0.7415184",
"0.7376527",
"0.7330069",
"0.7319734",
"0.72802854",
"0.727429... | 0.69467866 | 40 |
Disconnect from the database | def disconnect_db
ActiveRecord::Base.connection_handler.clear_active_connections!
ActiveRecord::Base.connection.disconnect!
ActiveRecord::Base.connection.close
log("Disconnected from database")
rescue => e
fatal("Failed to disconnect from the database: #{e}")
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect\n database.close if connected?\n @@connections[name][db_name] = nil\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n\t\tbegin\n\t\t\... | [
"0.8389373",
"0.77766365",
"0.77766365",
"0.77766365",
"0.77766365",
"0.7644163",
"0.7597346",
"0.7526214",
"0.7510292",
"0.74176866",
"0.7339006",
"0.7311929",
"0.73027956",
"0.7284822",
"0.728266",
"0.727985",
"0.7229165",
"0.7216841",
"0.7183267",
"0.7131999",
"0.71170515"... | 0.76843566 | 5 |
Create and configure the bot | def create_bot
$bot = Discordrb::Bot.new(
token: $config['discord_secret'],
client_id: $config['discord_client'],
log_mode: :quiet,
intents: [
:servers,
:server_members,
:server_bans,
:server_emojis,
:server_integrations,
:server_webhooks,
:server_invit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bot\n derp = @config\n @bot = Cinch::Bot.new do \n configure(&derp)\n end\n end",
"def configure\n\n # Give the bot a handle to config and handler\n conf = @config\n\n # Configure the bot\n @bot = Isaac::Bot.new\n @bot.configure{|c|\n c.server ... | [
"0.7717736",
"0.7327983",
"0.7021659",
"0.6897774",
"0.64715195",
"0.6325835",
"0.62425184",
"0.6165734",
"0.6161311",
"0.6110627",
"0.60832036",
"0.6042264",
"0.6009758",
"0.6008981",
"0.5995935",
"0.5959688",
"0.59242046",
"0.59179807",
"0.5881199",
"0.58229667",
"0.5813769... | 0.7474 | 1 |
Setup triggers for DMs, mentions, messages and interactions. Discordrb creates a new thread for each of these, so we must either take a db connection from the pool or remember to disconnect at the end to prevent zombie connections. | def setup_bot
# Respond to DMs
$bot.private_message do |event|
next if !RESPOND && event.user.id != BOTMASTER_ID
remove_mentions!(event.content)
special = event.user.id == BOTMASTER_ID && event.content[0] == '!'
special ? respond_special(event) : respond(event)
str = special ? 'Special ' : ''
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n # Include all handlers now.\n Dir['./handlers/*.rb'].sort.each do |file|\n require file\n end\n\n @config.bots.each do |bot_id, bot_data|\n conn = DiscordConnection.new(bot_data)\n\n conn.connection_id = bot_id\n\n conn.message do |msg|\n next unless @config.discord... | [
"0.592732",
"0.5827502",
"0.56215525",
"0.55795735",
"0.5558283",
"0.5448506",
"0.53478307",
"0.52868044",
"0.5262255",
"0.52574056",
"0.51768243",
"0.5157873",
"0.5127225",
"0.5116089",
"0.50598216",
"0.50494033",
"0.5013195",
"0.4999999",
"0.49905255",
"0.4978545",
"0.49769... | 0.53039116 | 7 |
Start running the bot, and set up an interrupt trigger to shut it down | def run_bot
$bot.run(true)
trap("INT") { shutdown }
leave_unknown_servers
log("Bot connected to servers: #{$bot.servers.map{ |id, s| s.name }.join(', ')}.")
rescue => e
fatal("Failed to execute bot: #{e}")
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_bot\n $bot.stop\n log(\"Stopped bot\")\nrescue => e\n fatal(\"Failed to stop the bot: #{e}\")\n exit\nend",
"def shutdown\n log(\"Shutting down...\")\n # We need to perform the shutdown in a new thread, because this method\n # gets called from within a trap context\n Thread.new {\n Sock.off\n... | [
"0.7188273",
"0.68452877",
"0.6472349",
"0.62952524",
"0.6173055",
"0.6139374",
"0.60594034",
"0.6044558",
"0.6007674",
"0.5967409",
"0.5937225",
"0.5903991",
"0.5898845",
"0.58954066",
"0.58954066",
"0.58954066",
"0.58791846",
"0.5873857",
"0.5864538",
"0.5860918",
"0.586004... | 0.64770836 | 2 |
Stop running the bot | def stop_bot
$bot.stop
log("Stopped bot")
rescue => e
fatal("Failed to stop the bot: #{e}")
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :stop, :sudo => false\n end",
"def stop\n @running = false\n end",
"def stop\n @running = false\n end",
"def stop\n @running = false\n end",
"def stop\n data = { :bot => Encryptor.... | [
"0.7454395",
"0.74012023",
"0.74012023",
"0.74012023",
"0.7379231",
"0.73548716",
"0.73519117",
"0.7349947",
"0.7349947",
"0.7349947",
"0.7339903",
"0.7339903",
"0.7306211",
"0.72213066",
"0.715692",
"0.71526754",
"0.70756537",
"0.7074826",
"0.70359397",
"0.7005308",
"0.70053... | 0.8214516 | 0 |
Routine to shutdown the program Needs to be executed in a new thread, since this method will be called from within a trap context (see run_bot) | def shutdown
log("Shutting down...")
# We need to perform the shutdown in a new thread, because this method
# gets called from within a trap context
Thread.new {
Sock.off
stop_bot
disconnect_db
unblock_threads
exit
}
rescue => e
fatal("Failed to shut down bot: #{e}")
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown!; end",
"def shutdown!; end",
"def shutdown!; end",
"def shutdown\n log 'Exiting...'\n Thread.list.each { |t| t[:shutdown] = true }\n @shutdown = true\n end",
"def shutdown!\n shutdown\n end",
"def shutdown\n puts \"shutting down\"\n @run = false\n ... | [
"0.7540127",
"0.7540127",
"0.7540127",
"0.75395155",
"0.75006515",
"0.74606156",
"0.7383801",
"0.7380072",
"0.7380072",
"0.7380072",
"0.7380072",
"0.7380072",
"0.7380072",
"0.7380072",
"0.7368145",
"0.73421377",
"0.7316532",
"0.72910905",
"0.7271421",
"0.7260742",
"0.725253",... | 0.79305923 | 0 |
redis store related methods | def expected_quote_hash
# hmset name:hm_week_start_at key: symbol_end_at val: expected_quote_highlow
quote, highlow = get_platform_expected_quote
if quote > 0
val = [ quote, highlow].join('_')
{ expected_quote_key => val }
else
{}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save!\n $redis.hset RedisContainer, self.full_name, self.to_json\n end",
"def redis_pool; end",
"def save\n $redis.hsetnx RedisContainer, self.full_name, self.to_json\n end",
"def store; end",
"def store; end",
"def store; end",
"def store\n connection.store\n end",
"def store(*args);... | [
"0.7004179",
"0.69015396",
"0.6890748",
"0.6865345",
"0.6865345",
"0.6865345",
"0.67537546",
"0.67533094",
"0.66328114",
"0.66328114",
"0.6606449",
"0.65791696",
"0.65720445",
"0.648575",
"0.6459586",
"0.64493006",
"0.6419347",
"0.64185977",
"0.6409248",
"0.63985044",
"0.6389... | 0.0 | -1 |
INPUT: string representing a player name OUTPUT: integer representing that player's points | def num_points_scored(player_name)
players = get_players
found_player = find_player(players, player_name)
# return that player's points
found_player[:points]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_points_scored(player_name)\n return find_player_value(player_name, game_hash, :points)\nend",
"def num_points_scored(player_name)\n player = player_by_name(player_name)\n player.values[0][:points]\n end",
"def num_points_scored(playerName)\n player_stats(playerName)[:points]\nend",
... | [
"0.7659386",
"0.76478535",
"0.75562716",
"0.7517005",
"0.7485962",
"0.7399368",
"0.7399368",
"0.7388201",
"0.73736835",
"0.73472226",
"0.7226262",
"0.71865714",
"0.7185142",
"0.7143404",
"0.71146697",
"0.7087914",
"0.70691824",
"0.70445985",
"0.70412564",
"0.7037301",
"0.6981... | 0.7785582 | 0 |
INPUT: string of player name OUTPUT: integer for player's shoe size | def shoe_size(player_name)
# get list of players
players = get_players
# find player with matching name
found_player = find_player(players, player_name)
# return player's shoe size
found_player[:shoe]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shoe_size(playerName)\n player_stats(playerName)[:shoe]\nend",
"def shoe_size(name)\n player_stats(name)[:shoe]\nend",
"def shoe_size(player_name)\n # Hash # String #Symbol\n found_player(player_name)[:shoe] # Number\nend",
"def shoe_size(player_name)\n # Hash # String #Symbol\n ... | [
"0.8454757",
"0.8329962",
"0.82432425",
"0.82432425",
"0.82119167",
"0.80964744",
"0.7929967",
"0.7909887",
"0.7909843",
"0.78736013",
"0.78562045",
"0.7852176",
"0.78430045",
"0.78328216",
"0.7788605",
"0.777805",
"0.7759948",
"0.77557987",
"0.7716057",
"0.7694557",
"0.76837... | 0.86006624 | 0 |
Set classname for concerns to set the other parameters | def set_resource_class_name
@resource_class_name = 'Gallery'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concerns(*args); end",
"def declare_concern( concern_name )\n concern concern_name do\n collection do\n get concern_name\n end\n end\n end",
"def concerns(*args)\n options = args.extract_options!\n args.flatten.each do |name|\n if concern = @concerns[nam... | [
"0.7065537",
"0.6229327",
"0.60437655",
"0.5686859",
"0.56718034",
"0.5662666",
"0.5662666",
"0.5636472",
"0.5636472",
"0.55633104",
"0.55258137",
"0.55257255",
"0.54790676",
"0.5468865",
"0.5408179",
"0.54029024",
"0.53834873",
"0.53586847",
"0.5314786",
"0.53100526",
"0.529... | 0.0 | -1 |
This replaces the same test that's been excluded from DirtyTest. We can run it here with use_transactional_tests set to false. See test/excludes/DirtyTest.rb | def test_field_named_field
ActiveRecord::Base.connection.create_table :testings do |t|
t.string :field
end
assert_nothing_raised do
Testings.new.attributes
end
ensure
ActiveRecord::Base.connection.drop_table :testings rescue nil
ActiveRecord::Base.clear_cache!
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_uncommitted(test_pattern)\n if File.directory?(\".svn\")\n changed_since_checkin = silence_stderr { `svn status` }.split.map { |path| path.chomp[7 .. -1] }\n elsif File.directory?(\".git\")\n changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.split.map { |... | [
"0.57993937",
"0.56593347",
"0.55377084",
"0.5441645",
"0.53883785",
"0.5329107",
"0.53231645",
"0.53121275",
"0.53003335",
"0.52704793",
"0.52562195",
"0.52541345",
"0.52277863",
"0.52277863",
"0.52277863",
"0.5212227",
"0.52008665",
"0.51950175",
"0.5185412",
"0.51568437",
... | 0.0 | -1 |
TODO: let generator generate card | def card_number
card = full_card_number.scan(/(\d{4})/)
card[2] = card[1] = 'X' * 4
card.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_card\n\t suit = %w[s d h c]\n\t rank = %w[1 2 3 4 5 6 7 8 9 10 j q k]\n\t #(0...size).map{ charset.to_a[rand(charset.size)] }.join\n\t suit[rand(suit.size)] + rank[rand(rank.size)] + \".gif\"\n\tend",
"def get_card\n end",
"def generate_black_card\n black_deck.deal!\n # ERB: puts \"Blac... | [
"0.7724807",
"0.7602663",
"0.75167453",
"0.7451381",
"0.7350688",
"0.7286611",
"0.7261606",
"0.72537786",
"0.7240924",
"0.7237471",
"0.7196788",
"0.7192448",
"0.7156386",
"0.7077871",
"0.7061739",
"0.70542264",
"0.70318294",
"0.70038104",
"0.69868326",
"0.69682413",
"0.694920... | 0.0 | -1 |
As you can see, we don't need to take customer in as an argument, because we're passing in self as a reference to the current instance of customer. | def new_meal(waiter, total, tip=0)
Meal.new(waiter, self, total, tip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customer\n self.customer\n end",
"def set_customer\n @customer = current_customer_user\n end",
"def customer\n @customer ||= Customer.new(value_for('customer'))\n end",
"def set_customer\n @customer = current_unit.customers.find(params[:customer_id])\n end",
"def buy_car(custome... | [
"0.7406373",
"0.7330859",
"0.7118634",
"0.7042828",
"0.70025074",
"0.69929594",
"0.6945177",
"0.6918149",
"0.6905769",
"0.6887982",
"0.688358",
"0.688358",
"0.6863101",
"0.6863101",
"0.6863101",
"0.6863101",
"0.6863101",
"0.68372476",
"0.68327045",
"0.6822278",
"0.6806302",
... | 0.0 | -1 |
We're iterating through every instance of Meal and returning only the ones where the meal's customer matches the current customer instance. | def meals
Meal.all.select {|meal| meal.customer == self}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meals\r\n Meal.all.select do |meal|\r\n meal.customer == self\r\n end\r\n end",
"def meals\n Meal.all.select do |meal|\n meal.customer == self\n end \n end",
"def meals\n Meal.all.select {|m| m.customer == self}\n end",
"def meals\n Meal.all.se... | [
"0.8348969",
"0.8290535",
"0.8233662",
"0.82145506",
"0.6611489",
"0.65014607",
"0.6462183",
"0.6454877",
"0.64504504",
"0.60912865",
"0.57709885",
"0.57586086",
"0.5757784",
"0.5748496",
"0.56554043",
"0.5624976",
"0.56068134",
"0.55904365",
"0.5557162",
"0.5524487",
"0.5517... | 0.8174304 | 5 |
def Ask_order_date puts "What's your name?" return gets.chomp end | def ask_employee_order
puts "What's employee order"
return gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n return gets.chomp\n end",
"def ask_name\n puts \"What's your name?\"\n gets.chomp\nend",
"def make_task_nam... | [
"0.7685556",
"0.7558566",
"0.73796034",
"0.73703736",
"0.7343466",
"0.733478",
"0.7310279",
"0.72761697",
"0.72466964",
"0.72466964",
"0.7240328",
"0.7223997",
"0.7203203",
"0.71869856",
"0.7168581",
"0.71243125",
"0.7073989",
"0.70656633",
"0.7064118",
"0.705829",
"0.7036302... | 0.79535407 | 0 |
Keeps track of how many cards are in play (for reshuffling). | def start_deal
@deal_count = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @cards.length\n end",
"def games_played\n @games_played = @games_played += 1\n end",
"def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the... | [
"0.708387",
"0.7056916",
"0.70420015",
"0.7033525",
"0.70175815",
"0.70175815",
"0.7006494",
"0.6973595",
"0.69453824",
"0.69451",
"0.6929292",
"0.692527",
"0.6896063",
"0.6880077",
"0.68659574",
"0.68138134",
"0.68051493",
"0.67792505",
"0.6759043",
"0.67301255",
"0.6720101"... | 0.0 | -1 |
utility method to help with comparison between colors | def sum
[@r,@g,@b].inject(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def much_green?(colors) ; colors[1] > 200 ; end",
"def compareColor(c1, c2, c3)\n\tif c1.color == c2.color and c1.color == c3.color\n\t\treturn true\n\telsif c1.color != c2.color and c1.color != c3.color and c2.color != c3.color\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def scan_for_colors; end... | [
"0.78257364",
"0.75812936",
"0.7284436",
"0.71232235",
"0.71223676",
"0.71086395",
"0.7071251",
"0.70410436",
"0.6985995",
"0.6985995",
"0.69724464",
"0.69698817",
"0.6935939",
"0.6905966",
"0.6905254",
"0.68289226",
"0.6827243",
"0.68017423",
"0.67950404",
"0.6779109",
"0.67... | 0.0 | -1 |
def voted_deprecated?(post) votes.find_by(post_id: post.id) end def vote_deprecated!(post) votes.create!(post_id: post.id, category_id: post.category_id) end | def voted_on_status?(contribution)
likes.find_by(target_id: contribution.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upvoted?(post)\n voted_up_on? post\n end",
"def user_has_voted(post)\n if (current_user)\n if (post.voted_by?(current_user))\n 1\n else\n 0\n end\n else\n 2\n end\nend",
"def vote_up!(user)\n vote_ups.create(:user => user) unless voted_by?(user)\n end",
"def create_vote\n... | [
"0.65780354",
"0.6500335",
"0.6478819",
"0.6393821",
"0.6393821",
"0.63861823",
"0.6327552",
"0.63123804",
"0.6306107",
"0.62572163",
"0.6168924",
"0.6168924",
"0.6154136",
"0.6146032",
"0.611826",
"0.6117658",
"0.60937446",
"0.6092434",
"0.60757536",
"0.60417753",
"0.6033118... | 0.0 | -1 |
Below is old and deprecated | def unvote!(post)
votes.find_by(post_id: post.id).destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def custom; end",
"def custom; end",
"def probers; end",
"def schubert; end",
"def internal; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def extra; end",
"def who_we_are\r\n end",
"def wrapper; end",
"... | [
"0.7747044",
"0.6536426",
"0.6536426",
"0.6494749",
"0.6457344",
"0.64379406",
"0.642681",
"0.6333042",
"0.6333042",
"0.6333042",
"0.6333042",
"0.6329859",
"0.6293285",
"0.62212324",
"0.61637497",
"0.61637497",
"0.6102826",
"0.6089723",
"0.60673326",
"0.60673326",
"0.6059908"... | 0.0 | -1 |
Wscript login for Internet Explorer method | def login_in_model_window(user, password)
wsh = WIN32OLE.new('Wscript.Shell')
wsh.AppActivate('Windows Security')
wsh.SendKeys(user)
wsh.SendKeys("{TAB}")
sleep(1)
copy_string_to_clipboard(password)
wsh.SendKeys("^V")
sleep(0.5)
clear_buffer
current_capybara_session.driver.browser.switch_to.alert.ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Surveyhead_login(email,passwd)\n\n # New IE instance creation\n driver = Selenium::WebDriver.for :firefox, :profile => \"Selenium\"\n ff = Watir::Browser.new driver\n #ff.maximize\n\n ff.goto('http://www.p.surveyhead.com')\n # Setting login credentials (email/password)\n #ff.link(:id,\"memL... | [
"0.6497166",
"0.64287156",
"0.62579757",
"0.61785626",
"0.617125",
"0.61548376",
"0.6099498",
"0.6058697",
"0.6048779",
"0.60246056",
"0.6013883",
"0.5964704",
"0.5959895",
"0.5933768",
"0.59229255",
"0.59191823",
"0.5887057",
"0.5880279",
"0.58404976",
"0.58404976",
"0.58404... | 0.60638845 | 7 |
needed for to clean the env if using bundler (like in dev). this is because the ansible gem module doesn't work right with the bundler env vars set, so we need to remove them, but when running in dev we want modules written in ruby like nrser.state_mate's `state` script to have access to them so it can fire up bundler ... | def with_clean_env &block
if defined? Bundler
# copy the Bundler env vars into a hash
dev_env = ENV.select {|k, v|
k.start_with?("BUNDLE_") ||
[
'GEM_HOME',
'GEM_PATH',
'MANPATH',
'RUBYOPT',
'RUBYLIB',
].include?(k)
}
qb_env = ENV.select {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unset_bundler_env_vars\n empty_env = with_environment { with_unbundled_env { ENV.to_h } }\n aruba_env = aruba.environment.to_h\n (aruba_env.keys - empty_env.keys).each do |key|\n delete_environment_variable key\n end\n empty_env.each do |k, v|\n set_environm... | [
"0.7731613",
"0.77178425",
"0.7636374",
"0.7636374",
"0.76346093",
"0.75697",
"0.7538066",
"0.7482849",
"0.74360555",
"0.725155",
"0.72447056",
"0.70605",
"0.70316714",
"0.70316714",
"0.703027",
"0.7008503",
"0.6924972",
"0.6797178",
"0.66856074",
"0.6476647",
"0.647237",
"... | 0.79932106 | 0 |
def check_user? first = input.split.first last = input.split.last | def add_job_title
# require "pry"; binding.pry
# @job_data << input
@user.update_attributes(input_counter: 2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_full_name(full_name, full_name_split, first_name)\n if full_name_split.length > 1\n check_name_in_database(full_name, first_name)\n else\n puts \"\"\n puts \"Give me your full name, jackass!\".print_slowly\n get_user_name\n end\nend",
"def taken?(input)\n position(input) != \"\" &&... | [
"0.68598664",
"0.66275007",
"0.65374464",
"0.6504822",
"0.64915824",
"0.6439932",
"0.6434796",
"0.64230144",
"0.6370884",
"0.6340049",
"0.6335202",
"0.62773335",
"0.62633777",
"0.6262702",
"0.62494683",
"0.62354505",
"0.6234391",
"0.6230496",
"0.6204913",
"0.61820763",
"0.617... | 0.0 | -1 |
regex for matching tag and its settings | def regex
/^\s*#{Regexp.quote(@processor.tag)}(:(?<settings>.*?))?\s*$/im
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regex\n 'tag regex not defined'\n end",
"def tag_regex\n /<[^\"'<>]*(?:\"[^\"]*\"[^\"'<>]*|'[^']*'[^\"'<>]*)*(?:>|(?=<)|$)/\n end",
"def get_tag_regex(tag)\n return Regexp.new(\"\\\\A\\\\{#{tag} /\\\\}\")\n end",
"def tag_pattern\n rgx = Overdrive_Board_Settings::PLAYER_TAG_PATTERN\n ... | [
"0.71367466",
"0.694858",
"0.6871768",
"0.67856544",
"0.67019325",
"0.66611445",
"0.6603045",
"0.64667386",
"0.6349793",
"0.6267703",
"0.625633",
"0.616755",
"0.61418015",
"0.61284435",
"0.61146706",
"0.6077358",
"0.60662264",
"0.5997349",
"0.59794724",
"0.59794724",
"0.59685... | 0.7485339 | 0 |
GET /jobbers GET /jobbers.json | def index
unless params[:q].nil?
jobbers = Jobber.arel_table
query_string = "%#{params[:q]}%"
if params[:l]=='true'
@jobbers = Jobber.where(jobbers[:name].matches(query_string).or(jobbers[:street].matches(query_string)).or(jobbers[:zip_city].matches(query_string)).or(jobbers[:email].matche... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @jobber = Jobber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jobber }\n end\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"... | [
"0.7386305",
"0.7288412",
"0.7284855",
"0.7229548",
"0.69594955",
"0.6925373",
"0.6919528",
"0.68424106",
"0.68040687",
"0.6740462",
"0.6734996",
"0.67097795",
"0.67097795",
"0.66845334",
"0.66507316",
"0.66427237",
"0.66302",
"0.6622494",
"0.6622494",
"0.6622494",
"0.6622494... | 0.0 | -1 |
now the jobber has confirmed then what? 1 if the jobber has requested a specific job send him off to the job contact 2 if the jobber has requested a delivery team send him off to that team otherwise introduce a message on the VJC dialogue dashboard | def confirmation
begin
if @jobber.jobs.count > 0
# match jobber with job
@jobber.update_attributes( next_contact_at: 4.weeks.since)
Message.mail subject: 'Tak for din bekræftelse!',
who: @jobber.email,
what: m4_message,
jobber: @jobber,
job: @job... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end",
"def confirm(blank)\n @blank = blank\n if @blank.apply_typ... | [
"0.67476755",
"0.67027366",
"0.6668378",
"0.6636732",
"0.6631899",
"0.6593687",
"0.65787446",
"0.6498315",
"0.64961594",
"0.6487164",
"0.6471896",
"0.6422965",
"0.6379835",
"0.6376579",
"0.6350724",
"0.6335432",
"0.6316192",
"0.63013667",
"0.62950766",
"0.6294512",
"0.6275632... | 0.7605743 | 0 |
GET /jobbers/1 GET /jobbers/1.json | def show
respond_to do |format|
format.html { render layout: false }
format.json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @jobber = Jobber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jobber }\n end\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"... | [
"0.7520701",
"0.715835",
"0.7154415",
"0.71157444",
"0.7076401",
"0.69894934",
"0.6974839",
"0.6974839",
"0.6974839",
"0.6974839",
"0.6974839",
"0.69258296",
"0.69066864",
"0.6852204",
"0.6851614",
"0.6845718",
"0.6845718",
"0.68085104",
"0.67760587",
"0.67158914",
"0.6712862... | 0.0 | -1 |
POST /jobbers POST /jobbers.json | def create
@jobber = Jobber.new(jobber_params)
authorize @jobber
@jobber.confirmed_token = Devise.friendly_token
# raw, enc = Devise.token_generator.generate(self.class, :confirmation_token)
# @raw_confirmation_token = raw
# self.confirmation_token = enc
# self.confirmation_sent_at = Tim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @jobber = Jobber.new(params[:jobber])\n\n respond_to do |format|\n if @jobber.save\n format.html { redirect_to @jobber, notice: 'Jobber was successfully created.' }\n format.json { render json: @jobber, status: :created, location: @jobber }\n else\n format.html { r... | [
"0.71390754",
"0.70505345",
"0.68091",
"0.6603039",
"0.6428123",
"0.6416035",
"0.64075",
"0.6392767",
"0.638192",
"0.6368085",
"0.63677263",
"0.6361904",
"0.63260454",
"0.63220763",
"0.63072574",
"0.62807906",
"0.6249288",
"0.620574",
"0.6203732",
"0.6169059",
"0.6169059",
... | 0.0 | -1 |
PATCH/PUT /jobbers/1 PATCH/PUT /jobbers/1.json | def update
respond_to do |format|
if @jobber.update(jobber_params)
format.html { redirect_to @jobber, notice: 'Jobberen blev opdateret korrekt' }
format.js { head 220 }
format.json { render :show, status: :ok, location: @jobber }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @jobber = Jobber.find(params[:id])\n\n respond_to do |format|\n if @jobber.update_attributes(params[:jobber])\n format.html { redirect_to @jobber, notice: 'Jobber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.717499",
"0.7165834",
"0.7018597",
"0.6911706",
"0.68856275",
"0.6828015",
"0.6816819",
"0.67902076",
"0.67896897",
"0.67894614",
"0.6765881",
"0.6765881",
"0.6765881",
"0.6755184",
"0.6737651",
"0.67314667",
"0.67303944",
"0.67190814",
"0.6718186",
"0.6660381",
"0.660991"... | 0.6719945 | 17 |
DELETE /jobbers/1 DELETE /jobbers/1.json | def destroy
result = true if @jobber.destroy
result ? (flash.now[:info] = "Jobberen blev slettet korrekt") : (flash.now[:error] = "Jobberen blev ikke slettet korrekt" )
if result==true
render layout:false, status: 200, locals: { result: true }
else
render layout:false, status: 301, locals: {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @jobber = Jobber.find(params[:id])\n @jobber.destroy\n\n respond_to do |format|\n format.html { redirect_to jobbers_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n ... | [
"0.74268264",
"0.7269706",
"0.72501993",
"0.7166391",
"0.71403384",
"0.71403384",
"0.71403384",
"0.71403384",
"0.7139543",
"0.7132911",
"0.7127203",
"0.71241045",
"0.7123176",
"0.7089805",
"0.7079827",
"0.70757014",
"0.7027564",
"0.69886357",
"0.69860834",
"0.6982394",
"0.695... | 0.0 | -1 |
jobber rerouted to delivery team | def m2_message
[
"Super fedt at du gerne vil hjælpe os, med at planlægge Spejdernes Lejr 2017!",
"\n\nUd fra dine fantastiske kompetencer, har vi videregivet dine kontaktoplysninger til {{udvalg}}. Hvis du ikke hører fra {{udvalg}}, eller hvis I ikke fandt noget du var interesseret i, så er du mere end ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overdue_job(user, job)\n @job = job \n mail(to: user.email, subject: 'Job Overdue') \n end",
"def confirmation\n begin\n if @jobber.jobs.count > 0\n # match jobber with job\n @jobber.update_attributes( next_contact_at: 4.weeks.since)\n Message.mail subject: 'Tak for di... | [
"0.5949897",
"0.5873408",
"0.57887864",
"0.5592983",
"0.55793446",
"0.5526272",
"0.5514401",
"0.5500796",
"0.54987943",
"0.54976904",
"0.5478595",
"0.5460972",
"0.545573",
"0.5451519",
"0.5443264",
"0.5430359",
"0.54185975",
"0.5403596",
"0.5400648",
"0.53771985",
"0.5365817"... | 0.0 | -1 |
jobber picked a job | def m4_message
[
"Tak for din interesse for at være **{{jobnavn}}** på Spejdernes Lejr 2017.",
"\n\nVi har sendt dine kontaktoplysninger videre til {{kontaktperson}}, som er kontaktperson for denne opgave. Hvis du ikke hører fra {{kontaktperson}}, eller hvis jobbet ikke passede til dig alligevel, så er ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job\n job_uuid && Jobber::Job::Base.find_job(job_uuid)\n end",
"def set_jobber\n @jobber = Jobber.find(params[:id])\n end",
"def job \n @job\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def set_job\n @job = J... | [
"0.70248413",
"0.6772522",
"0.66516066",
"0.6637051",
"0.6637051",
"0.6585084",
"0.65388393",
"0.6508853",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"0.65057945",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_jobber
@jobber = Jobber.find(params[:id])
authorize @jobber
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 jobber_params
params.require(:jobber).permit( :delivery_team_id, :job_name, :job_id, :name, :street, :zip_city, :phone_number, :email, :confirmed_token, :confirmed_at, :jobber_assigned, :next_contact_at, :description, :jobbers_controlled)
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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
Calculate Distance between Driver and location using google api | def calculate_drivers_overhead_using_google_api()
# Batching Google APIs
p "Batch drivers Sources #{batch_drivers_sources}"
p "passenger_source #{passenger_source}"
p "API #{GoogleMapsApi::DRIVERS_OVERHEAD}"
drivers_srcs_passenger_src = GoogleMapsApi.calculate_batch_cost_metric(
batch_dri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_calculator(start, destination)\n #http://forrst.com/posts/Read_JSON_data_using_Ruby-13V\n url = \"http://maps.googleapis.com/maps/api/distancematrix/json?origins=#{start}&destinations=#{destination}&mode=driving&sensor=false\"\n \n buffer = open(url).read\n result = JSON.parse(buffer)\n \n dura... | [
"0.6769126",
"0.6611405",
"0.65409267",
"0.64907104",
"0.6431482",
"0.64080197",
"0.63272166",
"0.63139737",
"0.6248598",
"0.62188715",
"0.6216064",
"0.6167928",
"0.6167928",
"0.6141305",
"0.61250883",
"0.61097455",
"0.60866016",
"0.60851765",
"0.6057182",
"0.60504574",
"0.60... | 0.6351318 | 6 |
Send email to given email address when an email gets raised | def new_rollover_alert(rollover, to_email)
@rollover = rollover
@account = rollover.account
@site_host = APP_CONFIG['env_config']['site_host']
mail(:to => MailerTasks.recipients(to_email),
:subject => MailerTasks.rendered_subject("New #{APP_CONFIG['env_config']['site_name']} payment profile ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email(email)\n email.deliver_now\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def send_to_user(email)\n @email = email\n mail(:to => email.user_email, :subject => 'Your email has been sent!')\n end",
"def purchase_email\n @greeting = \"Hi... | [
"0.74131244",
"0.7388868",
"0.71130276",
"0.7111293",
"0.7074708",
"0.7067896",
"0.70291835",
"0.7002953",
"0.7002415",
"0.69796455",
"0.69770026",
"0.6971841",
"0.69286686",
"0.69214475",
"0.69017535",
"0.68967324",
"0.68823606",
"0.68823606",
"0.68823606",
"0.68823606",
"0.... | 0.0 | -1 |
The name of the model associated with the controller. Expected to be overridden. | def model_name; 'Post'; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_name\n @_model_name ||= ActiveModel::Naming.param_key(model.new)\n end",
"def model_name\n @model_class ? @model_class.name.demodulize.underscore : self.controller_name.singularize\n end",
"def model_name\n self.class.name[/(.*)Controller/,1].singularize.underscore\n end",... | [
"0.81997925",
"0.8050944",
"0.78874743",
"0.7868907",
"0.7841889",
"0.78242004",
"0.7771451",
"0.77692264",
"0.7731751",
"0.77171344",
"0.768886",
"0.76762474",
"0.7665794",
"0.7501163",
"0.74941003",
"0.7486006",
"0.74218744",
"0.7404861",
"0.7401691",
"0.7401691",
"0.736478... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.