query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /companies GET /companies.xml | def index
@companies = Company.all
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @companies }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render... | [
"0.75398785",
"0.75327474",
"0.75327474",
"0.75327474",
"0.75327474",
"0.7497508",
"0.6935157",
"0.6935157",
"0.6935157",
"0.69347507",
"0.6854752",
"0.6850258",
"0.6823983",
"0.68223643",
"0.6816815",
"0.67808086",
"0.6750553",
"0.6741065",
"0.67320025",
"0.67320025",
"0.673... | 0.7146844 | 6 |
GET /companies/1 GET /companies/1.xml | def show
@company = Company.find(params[:id])
@company_followers = @company.users.order("followers_count desc").all
#@followers_sum = @company_followers.sum(:followers_count)
@company_rails = @company.users.where(:rails => true)
@company_customers = @company.users.where(:customer => true)
@compa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml ... | [
"0.7401491",
"0.7401491",
"0.7401491",
"0.7401491",
"0.7348382",
"0.7346334",
"0.714079",
"0.7128595",
"0.7128595",
"0.7128595",
"0.7042543",
"0.68976426",
"0.683106",
"0.68117946",
"0.67653096",
"0.67072254",
"0.6640394",
"0.66199267",
"0.66157115",
"0.6611598",
"0.6559619",... | 0.0 | -1 |
GET /companies/new GET /companies/new.xml | def new
@company = Company.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @company }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format... | [
"0.79606134",
"0.78865623",
"0.7653094",
"0.7507378",
"0.7425004",
"0.74142385",
"0.7288424",
"0.72834563",
"0.72075427",
"0.7191281",
"0.7183322",
"0.71829945",
"0.7162946",
"0.71565783",
"0.7147453",
"0.7147453",
"0.7147453",
"0.7147453",
"0.7147453",
"0.7147453",
"0.714745... | 0.78726315 | 8 |
POST /companies POST /companies.xml | def create
@company = Company.new(params[:company])
respond_to do |format|
if @company.save
format.html { redirect_to(@company, :notice => 'Company was successfully created.') }
format.xml { render :xml => @company, :status => :created, :location => @company }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n ... | [
"0.65289694",
"0.6486415",
"0.6303046",
"0.6255152",
"0.62384295",
"0.6234217",
"0.6211041",
"0.6196829",
"0.6195619",
"0.6195619",
"0.6195619",
"0.6195619",
"0.6195619",
"0.61920244",
"0.6190725",
"0.6190725",
"0.6190725",
"0.6190725",
"0.61904544",
"0.61788446",
"0.61731255... | 0.65994 | 2 |
PUT /companies/1 PUT /companies/1.xml | def update
@company = Company.find(params[:id])
respond_to do |format|
if @company.update_attributes(params[:company])
format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action... | [
"0.6664095",
"0.66459405",
"0.66363287",
"0.66337687",
"0.64504045",
"0.6405931",
"0.63770616",
"0.6320883",
"0.6316433",
"0.6304934",
"0.6301482",
"0.6301482",
"0.6301482",
"0.6301482",
"0.6301482",
"0.6301482",
"0.62998307",
"0.6288434",
"0.62848234",
"0.6221155",
"0.621416... | 0.6639532 | 3 |
DELETE /companies/1 DELETE /companies/1.xml | def destroy
@company = Company.find(params[:id])
@company.destroy
respond_to do |format|
format.html { redirect_to(companies_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n add_to_log(t('Company dest... | [
"0.73547524",
"0.72838765",
"0.7242777",
"0.703207",
"0.6968639",
"0.6968201",
"0.6868082",
"0.68481386",
"0.6794488",
"0.66675",
"0.6642913",
"0.6627114",
"0.66241276",
"0.6618075",
"0.6598122",
"0.6598077",
"0.6582843",
"0.6582843",
"0.6582843",
"0.6582843",
"0.6582843",
... | 0.7294619 | 7 |
Get infos about a specific tag via the hardware identifier. | def show_by_hardware_id
hardware_id = params[:id]
hardware_type = params[:type]
# optional
lang_code = params[:lang]
latitude = params[:lat]
longitude = params[:lon]
ble_major = params[:major]
ble_minor = params[:minor]
error = []
if hardware_id.nil?
error << 'id'
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_tag_info(tag_id)\n return get_db_as_hash().execute(\"SELECT tag_name FROM tags WHERE tag_id = ?\", tag_id).first\n end",
"def tag\n Tag.find(tag_id)\n end",
"def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag ... | [
"0.64121467",
"0.61923975",
"0.5956767",
"0.5822114",
"0.5697626",
"0.5697626",
"0.5695954",
"0.56672263",
"0.5659402",
"0.5600018",
"0.5540556",
"0.54841185",
"0.5472664",
"0.5472603",
"0.54465085",
"0.544033",
"0.5389668",
"0.538326",
"0.5375789",
"0.532277",
"0.5318549",
... | 0.6727449 | 0 |
Show all tags from the current customer. | def show_my_tags
tags = Tag.where('customer_id = ? AND active = ?', current_customer.id, true)
if tags.nil?
return_error_infos(400, 'No tags found', 'NoTagsFound', nil)
else
json_tags = []
tags.each { |tag| json_tags << create_tag_infos(tag, nil) }
render :status => 200, :json => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n display_customers\n end",
"def show\n @customers = Customer.all\n end",
"def show\n @customers = Customer.all\n end",
"def show_contact_tags(**params)\n get('contactTags', params)\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"de... | [
"0.68568146",
"0.67293286",
"0.67293286",
"0.6675631",
"0.6526866",
"0.651673",
"0.6506005",
"0.62917435",
"0.62907445",
"0.6274457",
"0.6273326",
"0.62201476",
"0.62148684",
"0.62148684",
"0.62148684",
"0.62148684",
"0.62148684",
"0.62148684",
"0.62148684",
"0.62148684",
"0.... | 0.7313783 | 0 |
Create a new nearspeak tag in the system. | def create
text = params[:text]
lang_code = params[:lang]
purchase_id = params[:purchase_id]
# optional
gender = params[:gender]
auth_token = params[:auth_token]
hardware_id = params[:hardware_id]
hardware_type = params[:hardware_type]
name = params[:name]
parent_id = params[:p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\t@track = Track.find(params[:track_id])\n @tag = @track.tags.build(tag_params)\n @tag.what=\"track\"\n @tag.save\n end",
"def new_tag(tag)\n puts cyan(\"Found new tag: #{tag}\")\n end",
"def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instan... | [
"0.6125406",
"0.58250284",
"0.5811885",
"0.57908463",
"0.57577",
"0.57210684",
"0.57179004",
"0.5698262",
"0.5685897",
"0.5646225",
"0.56461984",
"0.5636216",
"0.5634761",
"0.5597516",
"0.5550141",
"0.55324244",
"0.55301374",
"0.5464749",
"0.5463797",
"0.5453342",
"0.53875935... | 0.0 | -1 |
Add a hardware to a nearspeak tag. | def add_hardware_id_to_tag
tag = Tag.find_by_tag_identifier(params[:id])
hardware_id = params[:hardware_id]
hardware_type = params[:hardware_type]
#optional
latitude = params[:lat]
longitude = params[:lon]
ble_major = params[:major]
ble_minor = params[:minor]
if hardware_id.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hardware_id_to_tag(hardware_id, hardware_type, ble_major, ble_minor, latitude, longitude)\n if hardware_id.nil?\n return :status => 400, :json => { :error => { :message => 'Error hardware id is missing', :code => 'UpdatedError' }}\n else\n if HardwaresHelper.validate_hardware_type(hardware_... | [
"0.6017577",
"0.598474",
"0.55017054",
"0.53317964",
"0.5321363",
"0.5265214",
"0.5133592",
"0.50702715",
"0.505052",
"0.5036305",
"0.5034614",
"0.5028374",
"0.5022001",
"0.49411774",
"0.49265242",
"0.4918374",
"0.48850882",
"0.48735234",
"0.48641604",
"0.48582113",
"0.485133... | 0.5845888 | 2 |
Get all supported translation languages by bing back. | def supported_language_codes
language_codes = TranslationsHelper.supported_language_codes
if language_codes.empty?
return_error_infos(400, 'Error no supported languages', 'TranslationError', nil)
else
render :status => 200, :json => { :language_codes => language_codes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language_list\n call :get_language_list\n end",
"def getLangs\r\n result = self.class.get '/getLangs', { query:{ key:@@api_key } }\r\n check_result result\r\n end",
"def languages\n translations.map(&:language)\n end",
"def languages(options={})\n res = self.get \"/t... | [
"0.76386017",
"0.7585657",
"0.7328664",
"0.72977066",
"0.7107639",
"0.706394",
"0.69482225",
"0.69378406",
"0.69378406",
"0.69378406",
"0.69378406",
"0.69353235",
"0.6911803",
"0.68804264",
"0.6871025",
"0.67505854",
"0.666741",
"0.6655446",
"0.664337",
"0.658132",
"0.6569414... | 0.65712595 | 20 |
Get all supported iBeacon UUIDs from the server. | def get_all_uuids
ble_uuids = Hardware.all_ble_uuids.map { |hw| hw.identifier }
render :status => 200, :json => { :uuids => ble_uuids }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuids(count = 1)\n uuids = JSON.parse(RestClient.get(File.join(self.uri, \"_uuids?count=#{ count }\")))[\"uuids\"]\n \n if count > 1\n uuids\n else\n uuids.first\n end\n end",
"def get_uuids(count=1)\n url = \"#{COUCHDB_HOST}/_uuids\"\n url << \"?count=#{co... | [
"0.636922",
"0.6157541",
"0.57883805",
"0.5680654",
"0.5658344",
"0.562614",
"0.5561203",
"0.5381829",
"0.53703785",
"0.5358279",
"0.52603006",
"0.5230233",
"0.51847386",
"0.5148557",
"0.5128268",
"0.51162076",
"0.51098853",
"0.5103235",
"0.5066383",
"0.5023102",
"0.5018726",... | 0.7148491 | 0 |
Creates json hash for linked tags. | def create_linked_tag_infos(tag, language_code)
return_tag = {}
unless tag.nil?
return_tag[:id] = tag.id
return_tag[:tag_identifier] = tag.tag_identifier
if language_code.nil? and !tag.original_name.nil?
return_tag[:name] = tag.original_name.text.to_s
return_tag[:lang] = tag.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [links, organization_id].hash\n end",
"def link_data\n data = {}\n @options[:tags].keys.each do |key|\n data[key.to_sym] = self.instance_eval(key.to_s)\n end\n data\n end",
"def generate_hash\n @tags.group_by do |x|\n x[:name]\n x.delete(:name)\n end\n ... | [
"0.65862304",
"0.64883304",
"0.6184285",
"0.615452",
"0.615452",
"0.61349255",
"0.6122195",
"0.6094475",
"0.6062012",
"0.59549385",
"0.5897189",
"0.5878014",
"0.58527356",
"0.58138734",
"0.58128333",
"0.5809358",
"0.57351506",
"0.57232887",
"0.57069385",
"0.56973183",
"0.5666... | 0.5646409 | 22 |
Creates json hash for a tag. | def create_tag_infos(tag, language_code)
return_tag = {}
# tag infos
unless tag.nil?
return_tag[:id] = tag.id
return_tag[:tag_identifier] = tag.tag_identifier
unless tag.description.nil? or tag.description.empty?
return_tag[:description] = tag.description
end
unless ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end",
"def to_hash\n {@tag => @value}\n end",
"def hash_for_json(state = T.unsafe(nil)); end",
"def export_tag(tag)\n tag[\"repository\"] = repository\n tag[\"user\"] = bitbucket_server.user # attribute all tags to export use... | [
"0.6353627",
"0.6347336",
"0.61894447",
"0.61880875",
"0.6112927",
"0.6051215",
"0.60229105",
"0.60211945",
"0.5923623",
"0.58145386",
"0.5812105",
"0.5788323",
"0.5778609",
"0.57721794",
"0.57667047",
"0.5766528",
"0.57558745",
"0.57553506",
"0.57553506",
"0.57553506",
"0.57... | 0.0 | -1 |
Return error messages in json format. | def return_error_infos(status, error_message, error_code, values)
if values.nil?
render :status => status, :json => { :error => { :message => error_message, :code => error_code }}
else
render :status => status, :json => { :error => { :message => error_message, :values => values, :code => error_code ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_messages_as_json\n { errors: object.errors.messages }\n end",
"def json_error(message = 'An error occurred')\n { status: 'error', message: message }\n end",
"def as_json\n { errors: @errors.as_json }\n end",
"def json_resource_errors\n resource.errors.messages.to_json\n end",
... | [
"0.8185727",
"0.7870275",
"0.7673822",
"0.7650131",
"0.7531577",
"0.7509541",
"0.74368405",
"0.7409526",
"0.7399416",
"0.7315439",
"0.7285325",
"0.7241888",
"0.7238899",
"0.7222158",
"0.7203799",
"0.7170167",
"0.711714",
"0.7107593",
"0.70757985",
"0.7038924",
"0.703877",
"... | 0.6248459 | 84 |
Returns the tag infos. | def return_tag_infos(tag, language_code)
if tag.nil?
render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}
else
tag_infos = create_tag_infos(tag, language_code)
render :status => 200, :json => { :tags => [tag_infos] }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags() ; info[:tags] ; end",
"def tags() ; info[:tags] ; end",
"def tags\n @data['tags']\n end",
"def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n ... | [
"0.7984245",
"0.7984245",
"0.71935064",
"0.71468174",
"0.7106804",
"0.7106804",
"0.7106804",
"0.7106804",
"0.7106804",
"0.71063936",
"0.6972442",
"0.68055046",
"0.6704886",
"0.6690637",
"0.6690265",
"0.66579574",
"0.6656171",
"0.6656171",
"0.6656171",
"0.6631099",
"0.6621546"... | 0.64190626 | 35 |
Increments the tag scan counter. | def tag_scanned(tag)
unless tag.nil?
if tag.scan_count.nil?
tag.scan_count = 1
else
tag.scan_count += 1
end
tag.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_increment(element)\n self.tags.each {|tagv| puts \"incrementing #{tagv} element: #{element}\" if @debug\n increment_stats(tagv,element)}\n \n end",
"def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n... | [
"0.68778443",
"0.6458778",
"0.6294124",
"0.6287247",
"0.6273021",
"0.62321144",
"0.6113978",
"0.60801786",
"0.6008011",
"0.596683",
"0.5915441",
"0.59139574",
"0.589288",
"0.5875342",
"0.58692014",
"0.5725742",
"0.5725513",
"0.57170326",
"0.57082814",
"0.57075477",
"0.5680436... | 0.78694206 | 0 |
Author: Hanan Hosny Description: this action displays the vendors returned from the search Params: search(this contains a hash of the search parameters that the user passes in) Success: The user gets a list of vendors specified in the search params Failure: The user gets a message "no matches found" | def index
@vendors = Vendor.search(params[:search]).order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendor_search\n convention = Convention.find(params[\"id\"])\n @search_results = convention.convention_vendor_search(params[\"search\"])\n end",
"def indexHairdressers\n\n \n @q = Vendor.where(entry:'Hairdresser').ransack(params[:q])\n\n @per_page = params[:per_page] || Vendor.per_page... | [
"0.7941395",
"0.73888373",
"0.7347787",
"0.7335241",
"0.7328197",
"0.7281448",
"0.72465974",
"0.72411853",
"0.7233456",
"0.7227041",
"0.71149284",
"0.70490617",
"0.69987243",
"0.6971896",
"0.69708985",
"0.6964569",
"0.69508517",
"0.6864202",
"0.6857606",
"0.6857606",
"0.68576... | 0.69522905 | 16 |
Description: this action displays the information of the vendor Params: id of the vendor Success: a page appears to the user having the samples,packages, contact info, comments and rating Failure: none | def show
@vendor = Vendor.find(params[:id])
@comments = @vendor.comments.paginate(:page => params[:page], :per_page => 10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # Check to see that a valid vendor id was sent in. If not, redirect to vendors index page\n if @vendor = Vendor.find_by(id: params[:id])\n # A valid vendor was passed via :id\n # get all reviews associated with this vendor\n @reviews = @vendor.vendor_reviews.paginate(:page => params... | [
"0.71774566",
"0.7092901",
"0.7092901",
"0.7092901",
"0.7069755",
"0.7004921",
"0.696097",
"0.6918403",
"0.6744089",
"0.66538715",
"0.65681016",
"0.6567927",
"0.6539958",
"0.6493271",
"0.6425434",
"0.6425434",
"0.6424076",
"0.6385756",
"0.6385756",
"0.6385756",
"0.6385756",
... | 0.64334553 | 14 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Hairdressers and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the hairdressers specified in the search params Failure: The user gets a messag... | def indexHairdressers
@q = Vendor.where(entry:'Hairdresser').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n e... | [
"0.6907898",
"0.67970914",
"0.67773914",
"0.67731386",
"0.67471725",
"0.67419183",
"0.6713348",
"0.67019045",
"0.6699008",
"0.6690009",
"0.6687804",
"0.66673625",
"0.6623276",
"0.66033524",
"0.66011214",
"0.65874976",
"0.65770596",
"0.6567535",
"0.6566356",
"0.6566105",
"0.65... | 0.7001766 | 0 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Dresses stores and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Dresses stores specified in the search params Failure: The user gets a me... | def indexDresses
@q = Vendor.where(entry:'Dress').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:search_item]\n @supplies = Supply.search_by_title(params[:search_item]).paginate(:page => params[:page]).per_page(10)\n else\n @supplies = Supply.order(\"id DESC\").paginate(:page => params[:page]).per_page(10) \n end\n end",
"def index\n @search_name = params[:sear... | [
"0.71030194",
"0.68364555",
"0.67101526",
"0.6665279",
"0.666288",
"0.66577405",
"0.6604498",
"0.6596116",
"0.6584342",
"0.65758175",
"0.6535047",
"0.65318745",
"0.6528339",
"0.65256757",
"0.6494455",
"0.64825445",
"0.6475564",
"0.647095",
"0.6466333",
"0.64546925",
"0.644939... | 0.6727449 | 2 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Makeup artists and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Makeupartists specified in the search params Failure: The user gets a mes... | def indexMakeup
@q = Vendor.where(entry:'Makeup').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @search_url = artists_path\n @search = params[:search].to_s.html_safe\n\n @artists = Artist.page(params[:page])\n\n if @search.present?\n @artists = @artists.search(:name,@search.mb_chars)\n end\n\n if params[:per_page].present?\n @artists = @artists.per(params[:per_page])\n... | [
"0.7395752",
"0.6916543",
"0.6793246",
"0.6733657",
"0.67067474",
"0.66380805",
"0.6474635",
"0.64036626",
"0.63810843",
"0.6377444",
"0.6375125",
"0.63435775",
"0.63367516",
"0.63344866",
"0.63298726",
"0.63220817",
"0.63148963",
"0.6302181",
"0.6251986",
"0.62457794",
"0.62... | 0.63735163 | 11 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the photographers and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the photographers specified in the search params Failure: The user gets a mess... | def indexPhotographers
@q = Vendor.where(entry:'Photographer').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matche... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @name = params[:name]\n @bio = params[:bio]\n filtro = \"1=1 \"\n\n if @name\n filtro += \"and display_name like '%\" + @name.strip + \"%' \"\n end\n\n if @bio\n filtro += \"and bio like '%\" + @bio.strip + \"%'\"\n end\n\n @photographers = Photographer.where(filtro).o... | [
"0.7520707",
"0.71957064",
"0.71512705",
"0.6880204",
"0.68473893",
"0.68407905",
"0.6835508",
"0.682738",
"0.67619056",
"0.67615646",
"0.6754211",
"0.6694781",
"0.6688925",
"0.66689324",
"0.6650272",
"0.6597543",
"0.65885204",
"0.6583543",
"0.656592",
"0.6551748",
"0.6538504... | 0.7233582 | 1 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Suites stores and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Suites stores specified in the search params Failure: The user gets a mess... | def indexSuites
@q = Vendor.where(entry:'Suit').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:search_item]\n @supplies = Supply.search_by_title(params[:search_item]).paginate(:page => params[:page]).per_page(10)\n else\n @supplies = Supply.order(\"id DESC\").paginate(:page => params[:page]).per_page(10) \n end\n end",
"def show\n admin_last_url\n search... | [
"0.72834605",
"0.695313",
"0.6901371",
"0.68205315",
"0.67625123",
"0.6713506",
"0.6679198",
"0.66722614",
"0.6671957",
"0.6657046",
"0.6655039",
"0.66182077",
"0.6613108",
"0.6610425",
"0.65960044",
"0.658222",
"0.65800446",
"0.6577616",
"0.65644866",
"0.6559791",
"0.6559466... | 0.683727 | 3 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Spa centers and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Spa centers specified in the search params Failure: The user gets a message ... | def indexSpa
@q = Vendor.where(entry:'Spa').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:page].nil?\n # ページ繰り以外\n @searched = Hash.new()\n session[:searched] = @searched\n if params[:commit].nil?\n @searched[:month] = Date.today.month\n else\n # 検索ボタン押下時:画面入力された条件のセッションへの保存\n params[:search].each do | key, value |\n @sear... | [
"0.6818575",
"0.679875",
"0.6720109",
"0.6716374",
"0.6677027",
"0.6635903",
"0.6626869",
"0.66173947",
"0.66008294",
"0.6597207",
"0.65918994",
"0.6566245",
"0.6562072",
"0.6551848",
"0.6527853",
"0.6511366",
"0.65071994",
"0.65039593",
"0.6500488",
"0.64933574",
"0.6489838"... | 0.64051485 | 30 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Djs and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Djs specified in the search params Failure: The user gets a message "no matches foun... | def indexDjs
@q = Vendor.where(entry:'Dj').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\n # gather data for pull down lists\n @collections = Collection.select_list\n @periods = Period.select_list\n @genres = Subject.genres.where(['subject_translations.locale=?', :en.to_s]).order('subject_translations.name')\n \n @page = params[:page] || 1\n @per_page = params[:per_pag... | [
"0.6943895",
"0.69425225",
"0.68919563",
"0.6865944",
"0.68634105",
"0.6835246",
"0.6809254",
"0.6790279",
"0.6787517",
"0.67815906",
"0.67779505",
"0.6770459",
"0.6764994",
"0.6759206",
"0.6746871",
"0.6739856",
"0.67226094",
"0.6714347",
"0.67143315",
"0.6695688",
"0.669365... | 0.70255905 | 0 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the yachts and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the yachts specified in the search params Failure: The user gets a message "no matche... | def indexYacht
@q = Vendor.where(entry:'Yacht').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:page].nil?\n # ページ繰り以外\n @searched = Hash.new()\n session[:searched] = @searched\n if params[:commit].nil?\n @searched[:month] = Date.today.month\n else\n # 検索ボタン押下時:画面入力された条件のセッションへの保存\n params[:search].each do | key, value |\n @sear... | [
"0.7015398",
"0.6839615",
"0.6826805",
"0.68235624",
"0.67858523",
"0.6749187",
"0.67464507",
"0.6740188",
"0.6739144",
"0.67314404",
"0.67055863",
"0.66956973",
"0.6694214",
"0.6679186",
"0.66556597",
"0.6620057",
"0.6606721",
"0.6604725",
"0.66031814",
"0.6590114",
"0.65762... | 0.66943896 | 12 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the villas and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the villas specified in the search params Failure: The user gets a message "no matche... | def indexVilla
@q = Vendor.where(entry:'Villa').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @search = Voluntario.search(params[:q])\n @voluntarios = @search.result.paginate(:page => params[:page], per_page: 10)\n \n end",
"def results\n @title = 'zoeken'\n\n # lets search\n squery = 'active = true'\n if params[:type] and params[:type] != '' and is_a_number?(params[:type]... | [
"0.72010607",
"0.70934665",
"0.7009363",
"0.6984718",
"0.69446635",
"0.693532",
"0.6921199",
"0.6917031",
"0.68683976",
"0.67763305",
"0.67384547",
"0.6714165",
"0.67107165",
"0.6691077",
"0.66786027",
"0.66747886",
"0.6674309",
"0.6673345",
"0.66714203",
"0.6670473",
"0.6668... | 0.6991799 | 3 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the Halls and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Halls specified in the search params Failure: The user gets a message "no matches ... | def indexHall
@q = Vendor.where(entry:'Hall').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
end ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n e... | [
"0.69893163",
"0.68236184",
"0.68086314",
"0.67715764",
"0.6714883",
"0.6713667",
"0.6641135",
"0.6543187",
"0.6484484",
"0.64828855",
"0.64728004",
"0.6452489",
"0.64328504",
"0.64263856",
"0.6426223",
"0.6415753",
"0.64071304",
"0.6403007",
"0.63949096",
"0.63850147",
"0.63... | 0.6886303 | 1 |
Author: Donia Magdy, Hanan Hosny Description: this action displays the villas and the results of the search filtering Params: q (this contains a hash of the search parameters that the user passes in) Success: The user gets the list of the Gardens specified in the search params Failure: The user gets a message "no match... | def indexGarden
@q = Vendor.where(entry:'Garden').ransack(params[:q])
@per_page = params[:per_page] || Vendor.per_page || 20
@vendors = @q.result(:distinct=>true).paginate( :per_page => @per_page, :page => params[:page])
if @vendors.size.zero?
flash[:notice] = "No Matches Found"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @gardens = Garden.search(params[:query])\n end",
"def results\n @title = 'zoeken'\n\n # lets search\n squery = 'active = true'\n if params[:type] and params[:type] != '' and is_a_number?(params[:type]) and params[:type] != '0'\n squery = squery + ' AND kunstvoorwerps.type_id = ' ... | [
"0.70403826",
"0.6811334",
"0.67557645",
"0.6707027",
"0.66831857",
"0.66641676",
"0.66567725",
"0.66119784",
"0.65980023",
"0.655265",
"0.65431446",
"0.6531602",
"0.6526537",
"0.651738",
"0.6514645",
"0.6502417",
"0.6477489",
"0.6475096",
"0.6465807",
"0.64576447",
"0.645528... | 0.7051275 | 0 |
instance method that handles one specific plant | def instance_to_json
# byebug
{
id: self.id,
name: self.name,
height: self.height,
last_watered: self.last_watered,
last_watered_amount: self.last_watered_amount,
grow_zone: self.grow_zone,
notes: self.notes,
planted_date: self.planted_date,
farm: self.farm,
sensor: self.sensor
# farm: {
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_plant\n @plant = Plant.find(params[:id])\n end",
"def set_plant\n @plant = Plant.find(params[:id])\n end",
"def set_plant\n @plant = Plant.find(params[:id])\n end",
"def set_plant\n @plant = Plant.find(params[:id])\n end",
"def set_plant\n @plant = Plant.find(params[:id])\n... | [
"0.6942618",
"0.6942618",
"0.6942618",
"0.6893441",
"0.6893441",
"0.6893441",
"0.6870907",
"0.66852653",
"0.65288675",
"0.65203714",
"0.63522947",
"0.6336821",
"0.6310381",
"0.6310381",
"0.618909",
"0.61512166",
"0.6126686",
"0.6029896",
"0.59918857",
"0.59385866",
"0.5924896... | 0.0 | -1 |
Performs an OR operation on register_a and register_b and stores the result in "destination". Example: 725A => 0111001001011010=> OR the contents of registers 2 and 5 and store the result in register A. | def execute
operand_a = @emulator.register_read(@register_a)
operand_b = @emulator.register_read(@register_b)
result = perform_or(operand_a, operand_b)
@emulator.register_write(@destination, result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_OR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value |= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend",
"def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] ==... | [
"0.70312804",
"0.6868007",
"0.6082348",
"0.6071662",
"0.6064233",
"0.5957623",
"0.5887315",
"0.5868412",
"0.5788157",
"0.57678974",
"0.57518387",
"0.5744202",
"0.5709026",
"0.56914127",
"0.56194884",
"0.56175154",
"0.5550042",
"0.5508806",
"0.54698944",
"0.54350936",
"0.54318... | 0.7180522 | 0 |
Performs an OR operation on two binary codes. | def perform_or(mask, source)
result = ""
(0..mask.length-1).each do |byte|
result.concat((mask[byte] == ?0 and source[byte] == ?0) ? "0" : "1")
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] ||... | [
"0.81577426",
"0.7179007",
"0.6954344",
"0.6932288",
"0.6872767",
"0.68508327",
"0.68284315",
"0.66352916",
"0.6568169",
"0.6525995",
"0.65240043",
"0.6502488",
"0.6498196",
"0.6497478",
"0.64941883",
"0.6436149",
"0.6396478",
"0.63749784",
"0.6361256",
"0.63584197",
"0.63270... | 0.69321775 | 4 |
Does type need to be created in a directory? Then, in type use: dir 'mydirectory' | def dir(directory)
@dir = directory
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir?\n type == :dir\n end",
"def make_if_not(name, type)\n if type == :file\n FileUtils.mkdir_p(File.dirname(name)) unless File.exists?(File.dirname(name))\n FileUtils.touch(name) unless File.exists?(name)\n elsif type == :dir\n FileUtils.mkdir_p(name) unless File.exists?(name)\n else\n ra... | [
"0.7130701",
"0.70288026",
"0.6995877",
"0.6849597",
"0.6633416",
"0.6498652",
"0.6485976",
"0.64461017",
"0.64461017",
"0.64450747",
"0.64450747",
"0.64450747",
"0.6439886",
"0.6435492",
"0.636401",
"0.63552713",
"0.6331843",
"0.6324089",
"0.6312461",
"0.6305947",
"0.6304087... | 0.0 | -1 |
Does type use a template? Then, in type use: template 'mytemplate.php' | def template(template)
@template = "#{Aina::TEMPLATES_DIR}/#{template}" if template
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_type_template(type)\n assit_kind_of(String, type)\n file_name = File.join(self.class.path_to_self, @template_dir, \"_#{type}.rhtml\")\n if(FileTest.exists?(file_name))\n File.join(@template_dir, type)\n else\n File.join(@template_dir, \"default\")\n end\n end",
"def template()... | [
"0.73843724",
"0.7286572",
"0.70685196",
"0.70283186",
"0.6860096",
"0.67436284",
"0.67436284",
"0.67436284",
"0.67436284",
"0.67436284",
"0.67436284",
"0.67436284",
"0.6644925",
"0.6635501",
"0.6627274",
"0.6624967",
"0.6564986",
"0.65589374",
"0.65488607",
"0.65488607",
"0.... | 0.6130036 | 42 |
Use callbacks to share common setup or constraints between actions. | def set_show
@show = Show.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def show_params
params.require(:show).permit(:name, :position, :visible)
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 |
validate that there is either a debit or credit, for each instance, not both not working | def check_only_one_entry
if self.credit != nil && self.debit != nil
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def amount_is_valid_for_outstanding_balance_or_credit\n end",
"def test_purchase_and_credit_for_check_with_differing_amounts\n assert purchase = @gateway.purchase(10000, @check, @options... | [
"0.68805665",
"0.6877778",
"0.6686647",
"0.6666252",
"0.6597549",
"0.6484979",
"0.6437538",
"0.6389601",
"0.63633746",
"0.6350113",
"0.63448673",
"0.6296595",
"0.6296595",
"0.6296465",
"0.622334",
"0.6214628",
"0.6145675",
"0.6144239",
"0.60883427",
"0.6079813",
"0.6063838",
... | 0.7004132 | 0 |
def receive def flush; return; end | def flush(events, teardown=false)
# Avoid creating a new string for newline every time
newline = "\n".freeze
# seen_series stores a list of series and associated columns
# we've seen for each event
# so that we can attempt to batch up points for a given series.
#
# Columns *MUST* be exactly ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive(data); end",
"def received\n end",
"def flush() end",
"def flush() end",
"def flush() end",
"def receiving(data); end",
"def receiving(data); end",
"def flush; end",
"def flush; end",
"def flush; end",
"def flush; end",
"def flush; end",
"def flush\n end",
"def flush\n end"... | [
"0.77193284",
"0.75919676",
"0.74574304",
"0.74574304",
"0.74574304",
"0.74086",
"0.74086",
"0.7313169",
"0.7313169",
"0.7313169",
"0.7313169",
"0.7313169",
"0.72936356",
"0.72936356",
"0.72936356",
"0.72936356",
"0.7187153",
"0.7187153",
"0.71813226",
"0.71813226",
"0.718132... | 0.0 | -1 |
GET /nursing_times/1 GET /nursing_times/1.json | def show
@nursing_time = NursingTime.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @nursing_time }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @nursing_time = NursingTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nursing_time }\n end\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def index\n @timecards = TimeCard.... | [
"0.6636114",
"0.6419181",
"0.6293851",
"0.60693514",
"0.60183",
"0.6006995",
"0.60049844",
"0.5982712",
"0.5967398",
"0.59587675",
"0.59533346",
"0.59533346",
"0.5945467",
"0.5920275",
"0.59065586",
"0.58882654",
"0.5876569",
"0.58602476",
"0.5850077",
"0.584353",
"0.5828638"... | 0.728623 | 0 |
GET /nursing_times/new GET /nursing_times/new.json | def new
@nursing_time = NursingTime.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @nursing_time }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @nursing_time = NursingTime.new(params[:nursing_time])\n\n respond_to do |format|\n if @nursing_time.save\n format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully created.' }\n format.json { render json: @nursing_time, status: :created, location: @nurs... | [
"0.74244094",
"0.70381063",
"0.70381063",
"0.70381063",
"0.701584",
"0.6926621",
"0.69199395",
"0.6911899",
"0.6894798",
"0.6876532",
"0.6875508",
"0.68461144",
"0.67960423",
"0.67201114",
"0.67123723",
"0.6635259",
"0.66190684",
"0.6599889",
"0.6591619",
"0.6567442",
"0.6557... | 0.78529596 | 0 |
POST /nursing_times POST /nursing_times.json | def create
@nursing_time = NursingTime.new(params[:nursing_time])
respond_to do |format|
if @nursing_time.save
format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully created.' }
format.json { render json: @nursing_time, status: :created, location: @nursing_time }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @nursing_time = NursingTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nursing_time }\n end\n end",
"def evening_nautical_twilight\n create_time @data['evening']['twilight']['nautical']\n end",
"def create\n @timing = Timin... | [
"0.62465996",
"0.5938326",
"0.58471704",
"0.5772389",
"0.5683244",
"0.5675456",
"0.5659345",
"0.5626771",
"0.56043124",
"0.5595167",
"0.55821145",
"0.5575803",
"0.5575514",
"0.5537266",
"0.5483621",
"0.5427556",
"0.5393079",
"0.53825414",
"0.5380394",
"0.5363516",
"0.5324422"... | 0.7007607 | 0 |
PUT /nursing_times/1 PUT /nursing_times/1.json | def update
@nursing_time = NursingTime.find(params[:id])
respond_to do |format|
if @nursing_time.update_attributes(params[:nursing_time])
format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully updated.' }
format.json { head :ok }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @event = Event.from_param(params[:event_id])\n @time_table = @event.time_tables.where(:permalink => params[:id]).first\n success = params[:time_table] && params[:time_table][:times] && \n @time_table.update_attributes(:times => JSON.parse(params[:time_table][:times]))\n succes... | [
"0.62858856",
"0.621682",
"0.6215542",
"0.60429794",
"0.5936402",
"0.58756965",
"0.58685815",
"0.58620614",
"0.5805144",
"0.5773552",
"0.57562137",
"0.5746815",
"0.573965",
"0.57311624",
"0.57152677",
"0.56974894",
"0.56866115",
"0.566259",
"0.5645719",
"0.56420904",
"0.56362... | 0.7187953 | 0 |
DELETE /nursing_times/1 DELETE /nursing_times/1.json | def destroy
@nursing_time = NursingTime.find(params[:id])
@nursing_time.destroy
respond_to do |format|
format.html { redirect_to nursing_times_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @hurdle_time = HurdleTime.find(params[:id])\n @hurdle_time.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n ... | [
"0.686492",
"0.6850696",
"0.6732421",
"0.67313486",
"0.6665845",
"0.66565984",
"0.66532785",
"0.6637171",
"0.6634874",
"0.6574352",
"0.6569372",
"0.65655786",
"0.65620166",
"0.65475994",
"0.65419775",
"0.65415436",
"0.65415436",
"0.6533001",
"0.6518055",
"0.64998853",
"0.6497... | 0.776573 | 0 |
Asserts that problem has a solution from given contestant | def solved_by?(contestant)
if solutions.where(:user_id => contestant).empty?
return false # not solved
else
return true # solved
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verifierCorrect()\n return @solution.equals(@partie.getCurrentGrid())\n end",
"def test_solve_empty_3x3\n square = MagicSquare.new(3)\n square.solve\n assert square.solved?\n assert_equal @@solutions.first, square.solution\n end",
"def test_solve_sudoku\n assert_equal(false, @sudoku_1.s... | [
"0.6712893",
"0.6562484",
"0.6377423",
"0.6348472",
"0.62822384",
"0.620066",
"0.61932224",
"0.61932224",
"0.61816406",
"0.60498554",
"0.6039964",
"0.6039964",
"0.6039964",
"0.6036954",
"0.5968031",
"0.5937109",
"0.59207207",
"0.59028953",
"0.58794373",
"0.5836163",
"0.581958... | 0.641033 | 2 |
initialize_cells column from 18 or A to H | def add_stone( col )
col = col.is_a?(Fixnum) ? col : letter_to_number(col)
return false if game_over
return false unless (1..Connect4::COLUMNS).include?( col )
return false if Connect4::ROWS <= @fill_heights[col]
@fill_heights[col] += 1
#p (col + (next_player ? 64 : 96... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\r\n @cells = *(0..9) # Splat operator creates an array of ten items, zero to nine\r\n @cells[0] = nil # Ignore the 0th element\r\n end",
"def initialize\n @cells = Array.new(9,\" \")\n end",
"def initialize\n @cells = Array.new(9, \" \")\n end",
"def initialize\n @cells = Arr... | [
"0.70832896",
"0.7082994",
"0.7006164",
"0.7006164",
"0.7006164",
"0.69685304",
"0.6921482",
"0.6796827",
"0.67606497",
"0.66618574",
"0.6654115",
"0.6557994",
"0.65568715",
"0.65568715",
"0.65568715",
"0.65568715",
"0.65121907",
"0.65121907",
"0.65121907",
"0.65121907",
"0.6... | 0.0 | -1 |
create relative (user friendly) sub path for pallet below current pallet root path, without leading slash | def relative_pallet_path_for(element)
sub_path = @sub_path.to_s
sub_path = sub_path[1..-1] + '/' unless sub_path.blank?
return sub_path << element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_path(from, to); end",
"def relativePath\n return (parentPathElements + [name]).join(\"/\")\n end",
"def home(subcomponent = \"\")\n File.expand_path(\"#{@basepath}/#{subcomponent}\")\n end",
"def sub_path\n \"#{\"%02x\" % (id.to_i % 256)}/#{id}\"\n end",
"def relative_path_... | [
"0.6606442",
"0.64130604",
"0.6343074",
"0.6326559",
"0.6322414",
"0.63208246",
"0.6301509",
"0.62845767",
"0.6276712",
"0.6261324",
"0.62603784",
"0.6258126",
"0.6250049",
"0.62490845",
"0.6242811",
"0.6212719",
"0.6197982",
"0.6196965",
"0.61922264",
"0.6179995",
"0.6179995... | 0.77942526 | 0 |
copies files with identical filenames to temporary folder and adds hierarchy as string to filename, to solve the conflicts creates zip temp dir, which will be returned too, so it can be cleaned up by caller after processing | def sanitize_zip_collection_collisions
collection = session[@pallet.collection][:files] + session[@pallet.collection][:directories]
collisions = []
processed = []
collision_basenames = []
# check all files for filename collisions
session[@pallet.collection][:files].each do |c|
basenam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_two_temp_dirs(filenames1 = [], filenames2 = [])\n Dir.mktmpdir() { |dir1|\n create_temp_files(dir1, filenames1)\n\n Dir.mktmpdir() { |dir2|\n create_temp_files(dir2, filenames2)\n\n yield dir1, dir2\n }\n }\nend",
"def replicate_dir(f)\n out_original = f.sub($queue,$original)\n ... | [
"0.60461056",
"0.59883237",
"0.5987315",
"0.59604967",
"0.5934907",
"0.5921715",
"0.5919402",
"0.582443",
"0.5789706",
"0.5785444",
"0.5775286",
"0.57316816",
"0.57305866",
"0.5711511",
"0.56790835",
"0.56206244",
"0.55965406",
"0.5590814",
"0.55812097",
"0.5578176",
"0.55596... | 0.0 | -1 |
remove files / dirs from collection, which are located below a collected dir | def remove_collection_redundancy
redundant_file_count = 0
redundant_dir_count = 0
redundant_files = []
redundant_dirs = []
session[@pallet.collection][:directories].each do |dir|
session[@pallet.collection][:files].each do |file|
if file.starts_with?(dir + '/')
logger.debug ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removed_unmarked_paths\n #remove dirs\n dirs_enum = @dirs.each_value\n loop do\n dir_stat = dirs_enum.next rescue break\n if dir_stat.marked\n dir_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n #recursive call\n dir_stat.remo... | [
"0.68111074",
"0.6368451",
"0.6367044",
"0.63273007",
"0.63052386",
"0.63052386",
"0.6286423",
"0.6250531",
"0.61636114",
"0.61636114",
"0.612149",
"0.61162907",
"0.6114212",
"0.60699564",
"0.60625774",
"0.6031762",
"0.6029742",
"0.6024609",
"0.5986657",
"0.5963824",
"0.59452... | 0.62459177 | 8 |
reads xml fixture file instead of hitting up the internets | def request(resource, method = "get", args = {}, sign_request=false)
@now_playing_url = 'http://62.216.251.203:80/nowplaying'
@submission_url = 'http://62.216.251.205:80/protocol_1.2'
@session_id = '17E61E13454CDD8B68E8D7DEEEDF6170'
if @base_url == Rockstar::API_URL + Rockstar::API_VERSION ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_fixture(name)\n File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', \"#{name}.xml\"))\nend",
"def read_big_xml\n return File.read(File.expand_path('../../benchmark/fixtures/big.xml', __FILE__))\nend",
"def read_fixture(filename)\n File.open(fixture filename) { |f| f.read }\n end",
"d... | [
"0.7391047",
"0.68208",
"0.6614034",
"0.6604022",
"0.65811074",
"0.65208614",
"0.64150226",
"0.63768554",
"0.63117146",
"0.62908167",
"0.62908167",
"0.6256828",
"0.62536997",
"0.6238699",
"0.617681",
"0.6165761",
"0.61413544",
"0.61328864",
"0.6132446",
"0.6124476",
"0.611995... | 0.0 | -1 |
Gather transaction traces that we'd like to transmit to the server. | def harvest!
return NewRelic::EMPTY_ARRAY unless enabled?
samples = @samples_lock.synchronize do
@last_sample = nil
harvest_from_sample_buffers
end
prepare_samples(samples)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback_traces\n return if @trace_buffer.empty?\n\n begin\n traces = @trace_buffer.pop()\n @trace_task.call(traces, @transport)\n rescue StandardError => e\n # ensures that the thread will not die because of an exception.\n # TODO[manu]: findout the rea... | [
"0.6357945",
"0.62232107",
"0.62172455",
"0.60785604",
"0.593422",
"0.58853436",
"0.5854599",
"0.5710741",
"0.570178",
"0.5686379",
"0.5657494",
"0.5643568",
"0.560345",
"0.5525237",
"0.552353",
"0.5501648",
"0.54868567",
"0.5460954",
"0.5452011",
"0.5415974",
"0.5415974",
... | 0.0 | -1 |
reset samples without rebooting the web server (used by dev mode) | def reset!
@samples_lock.synchronize do
@last_sample = nil
@sample_buffers.each { |sample_buffer| sample_buffer.reset! }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n reset_config\n reset_driver\n end",
"def reset\n setup\n end",
"def reset!\n stop_poller if @poller\n @poller = nil\n @selected_environment = :production\n @client_ready = false\n @server_ready = false\n @registry = {} \n end",
"def reset\n... | [
"0.6844887",
"0.66564685",
"0.6574511",
"0.650804",
"0.63407475",
"0.6282618",
"0.62760353",
"0.6271079",
"0.6271079",
"0.6269857",
"0.6253187",
"0.6227625",
"0.62127423",
"0.6211454",
"0.6210633",
"0.62104094",
"0.6193622",
"0.6192308",
"0.6162638",
"0.6162168",
"0.61562425"... | 0.58670825 | 59 |
Show all recordings belonging to user (not show) | def index
puts "index params = #{params}"
if params[:user_id]
@recordings = current_user.recordings
else
flash[:notice] = "You can only view recordings from your account."
redirect_to user_path(current_user)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n \t@recordings = Recording.where(surah_id: @surah.id, user_id: current_user.id)\n end",
"def active_recordings\n @recordings = current_user.active_recordings\n end",
"def get_recordings()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/recordings\"))[0]\n end"... | [
"0.7802624",
"0.68304455",
"0.67974645",
"0.67655474",
"0.6562201",
"0.6560149",
"0.65597135",
"0.6546963",
"0.64390177",
"0.6420115",
"0.64135385",
"0.64122826",
"0.6399312",
"0.63422555",
"0.6340061",
"0.6340061",
"0.63370126",
"0.63307875",
"0.6310799",
"0.6287554",
"0.628... | 0.7440342 | 1 |
Be able to create/set a recording | def create
puts "Recording Params = #{params}"
recording = Recording.new(recordings_params(:name, :user_id, :show_id))
if recording.check_recording == ""
recording.save
recording.allow_recording
redirect_to users_active_recordings(current_user)
else
flash[:notice] = recording.ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_recording\n @recording = Recording.find(params[:id])\n end",
"def set_audio_recording\n @audio_recording = AudioRecording.find(params[:id])\n end",
"def set_recording\n @recording = Recording.includes(recording_contributor_people: [:person]).find(params[:id])\n end",
"def set_... | [
"0.77773833",
"0.73275536",
"0.7313805",
"0.7276196",
"0.72131693",
"0.6910434",
"0.6862371",
"0.6822216",
"0.6791542",
"0.67306006",
"0.6694839",
"0.66919297",
"0.66827816",
"0.6637565",
"0.6623513",
"0.6577884",
"0.6514661",
"0.64800054",
"0.6426509",
"0.64060676",
"0.63888... | 0.6855088 | 7 |
Be able to update whether a recording is active or "deleted" (inactive) | def update
recording = Recording.find(params[:id])
recording.update(recordings_params(:name, :active))
redirect_to users_active_recordings(current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recording_on()\n update({:recording_enabled => true})\n reload()\n end",
"def track_record_update\n true\n end",
"def recording_off()\n update({:recording_enabled => false})\n reload()\n end",
"def check_published_recording\n cm_status = status\n debugger\n... | [
"0.6803659",
"0.62457424",
"0.61781365",
"0.60632324",
"0.6047709",
"0.5927819",
"0.59143233",
"0.5898322",
"0.58966374",
"0.58930653",
"0.58767533",
"0.58756864",
"0.5811844",
"0.58018166",
"0.57808226",
"0.5765166",
"0.5758377",
"0.57372534",
"0.5735355",
"0.5731502",
"0.57... | 0.6149046 | 3 |
Run a single task in the queue. | def tick(*args)
prior_status = @status
@status = :tick
task = first
result = task.call(*args)
delete task
merge(result) if result.is_a?(TaskList)
@status = prior_status
finished?
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_run(&block) \n task(&block).start\n end",
"def queue_task\n task_class.perform_later(id, variables)\n end",
"def run\n while true\n if task = next_task\n task.handle\n else\n sleep @wait_period\n end\n end\n end",
"def run_task(task_name, ... | [
"0.68248457",
"0.6681804",
"0.66072077",
"0.65425193",
"0.65353227",
"0.6497899",
"0.6497899",
"0.6426594",
"0.6408866",
"0.6379369",
"0.6330469",
"0.6304658",
"0.6297476",
"0.6291268",
"0.62873054",
"0.62760705",
"0.6261714",
"0.62570065",
"0.6231701",
"0.62008184",
"0.62002... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.phone_mailer.instructor_help_email.subject | def instructor_help_email(student,admin)
@admin = admin
@student = student
# carrier phone numbers:
# T-Mobile: phonenumber@tmomail.net max 140 char
# Verizon: phonenumber@vtext.com max 160 char
# Sprint: phonenumber@messaging.sprintpcs.com max 160 char
# AT&T: phonenumber@txt.att.net m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n ... | [
"0.711345",
"0.71120363",
"0.70564705",
"0.70435435",
"0.7042385",
"0.699917",
"0.6937891",
"0.689739",
"0.68837976",
"0.6855386",
"0.6767509",
"0.66983306",
"0.66959816",
"0.6672942",
"0.6641983",
"0.66415435",
"0.6615154",
"0.6607537",
"0.6607537",
"0.6607537",
"0.6607537",... | 0.6037522 | 60 |
Destined to be thrown away | def getHiredEmployees
# This is kind of a rediculous way to get this data
# and should probably be done via api call or upload-esque
# form if it's a broader service used outside of Hired
# (or both?)
employees = [] #All employees
about_url = 'https://hired.com/about'
doc = Nokogiri::HTML(open(about_ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup!; end",
"def cleanup!; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def discard; end",
"def discard; end",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def cleanup\n end",
"def cleanup\n... | [
"0.73327017",
"0.73327017",
"0.7287207",
"0.7287207",
"0.7287207",
"0.7287207",
"0.7173797",
"0.7173797",
"0.71484226",
"0.71382064",
"0.71382064",
"0.71382064",
"0.7077485",
"0.70703095",
"0.70703095",
"0.70703095",
"0.70703095",
"0.70196277",
"0.70196277",
"0.6931548",
"0.6... | 0.0 | -1 |
Create a method that takes in 2 strings and counts the total number of characters in common. Divide the total number of chars by the number in common. Spaces do not count. Capitols are not the same as lowercase Example: "I love this code", "This code loves me" Total Chars: 27 Chars In Common: 7 Solution: 27 / 7 = 3 | def lov(x,y)
a = x.strip
b = y.strip
t = a.size + b.size
c = a.count(b)
s = t / c
puts "The total characters: #{t}"
puts "Common characters: #{c}"
puts "Total characters (#{t}) divided by common (#{c}) equals:"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def love_test(str_1, str_2)\n str_1 = str_1.gsub(\" \", \"\").split(\"\")\n str_2 = str_2.gsub(\" \", \"\").split(\"\")\n p \"Total Chars in Common: #{((str_1 + str_2).count - 1) / (str_1 & str_2).count}\"\nend",
"def commonCharacterCount(s1, s2)\n a1 = s1.split(\"\").uniq\n a2 = s2.split(\"\").uniq\n ... | [
"0.868122",
"0.863864",
"0.82370585",
"0.7315749",
"0.7290788",
"0.721709",
"0.7195832",
"0.7142193",
"0.7084173",
"0.7051534",
"0.70409524",
"0.6946466",
"0.68511903",
"0.6847098",
"0.6842771",
"0.6835671",
"0.6819344",
"0.68140566",
"0.6797642",
"0.6788703",
"0.6771348",
... | 0.8408506 | 2 |
Used when is optional | def has_before_field_html?
before_field_html.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optional; end",
"def optional\n @optional = true\n end",
"def optional?\n @optional\n end",
"def optional\n @type = :optional\n end",
"def optional?\n not required\n end",
"def optional?\n\t\t!required?\n\tend",
"def optionality_implied?\n false\n ... | [
"0.82934994",
"0.7957859",
"0.75298667",
"0.7463417",
"0.73659223",
"0.72618157",
"0.7218371",
"0.71956277",
"0.7038071",
"0.701025",
"0.69714195",
"0.6821734",
"0.676162",
"0.6734643",
"0.66812044",
"0.66687095",
"0.666126",
"0.6638648",
"0.6638648",
"0.6638648",
"0.6616225"... | 0.0 | -1 |
Get all routes that Nagira provides. | def api
api = { }
param_regex = Regexp.new '\(\[\^\\\\\/\?\#\]\+\)'
Nagira.routes.keys.each do |method|
api[method] ||= []
Nagira.routes[method].each do |r|
path = r[0].inspect[3..-3]
r[1].each do |parm|
path.sub!(param_regex,":#{parm}")
end
path.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_routes\n matching_routes\n end",
"def routes_list\n response = RestClient.get(\n BASE_URL,\n params: {command: 'routeList', a: AGENCY}\n )\n\n parse_routes_response(response.body)\n end",
"def routes\n @routes ||= []\n end",
"def routes\n @routes ||= []\n ... | [
"0.7878906",
"0.77910924",
"0.7780717",
"0.7780717",
"0.7687642",
"0.7681961",
"0.7598423",
"0.7561414",
"0.7443013",
"0.74379265",
"0.73841834",
"0.736477",
"0.7361586",
"0.73106784",
"0.72371715",
"0.7211646",
"0.71793354",
"0.71792245",
"0.7155866",
"0.7155866",
"0.7146807... | 0.66456115 | 56 |
Finds the nth digit of Champernowne's constant. Champernowne's constant is an irrational decimal fraction created by concatenating all the positive integers: 0.12345678910111213141516.... Ex: champernowne(12) > 1 | def champernowne(n)
# Find which base-10 'power' n belongs to.
# (if it is ones, tens, hundreds, thousands, etc)
power = 0
0.step do |d|
if 9*(d+1) * 10**(d) >= n
power = d
break
end
end
return n if power == 0
digits = power + 1
# Get all the numbers that we've passed through before ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth(n)\n if n > 9 and n.to_s[-2..-1].to_i.between?(10,19)\n \"#{n}th\"\n elsif n.to_s[-1].to_i == 1\n \"#{n}st\"\n elsif n.to_s[-1].to_i == 2\n \"#{n}nd\"\n elsif n.to_s[-1].to_i == 3\n \"#{n}rd\"\n else\n \"#{n}th\"\n end \n end",
"def get_first_digit n \n n / ... | [
"0.6646794",
"0.6621753",
"0.654002",
"0.65277725",
"0.6471957",
"0.646934",
"0.6276042",
"0.6229317",
"0.6196422",
"0.6169419",
"0.61606705",
"0.6151587",
"0.6134961",
"0.61268425",
"0.612505",
"0.61233026",
"0.6114742",
"0.61028445",
"0.6090368",
"0.6073326",
"0.605601",
... | 0.77007383 | 0 |
Virtual attributes have no corresponding instance variable | def price_in_cents
Integer(@price*100 + 0.5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virtual; end",
"def instance_variables() end",
"def instance_attributes; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def instance_variables; end",
"def attr; end",
"def c... | [
"0.76361305",
"0.68762773",
"0.6844801",
"0.68358564",
"0.68358564",
"0.68358564",
"0.68358564",
"0.68358564",
"0.68358564",
"0.68358564",
"0.67874116",
"0.6772569",
"0.66704386",
"0.65519834",
"0.65243036",
"0.6504278",
"0.6463271",
"0.6463271",
"0.6463271",
"0.6463271",
"0.... | 0.0 | -1 |
Mapping values to instance variable | def price_in_cents=(cents)
@price = cents / 100.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping=( arg )\n\t\t\t@mapping = arg\n\t\t\t@mapping.each_pair{|key, value| instance_variable_set(key,value)}\n\t\tend",
"def map\n self.class.new(yield(value))\n end",
"def set_instance_variables(values)\n values.each_with_index do |value,i|\n name = self.class.takes[i]\n instanc... | [
"0.63219696",
"0.6266687",
"0.6174395",
"0.61706924",
"0.6120009",
"0.60353553",
"0.59758544",
"0.59563154",
"0.59563154",
"0.5912971",
"0.58967525",
"0.5891183",
"0.58770716",
"0.5868764",
"0.58591014",
"0.5855747",
"0.5855747",
"0.58540606",
"0.58486",
"0.5834683",
"0.58189... | 0.0 | -1 |
handle updates AND SMS status requests | def update
source = 'web'
# get the parameters from the POST
if params[:Body].present? && params[:From].present?
# SMS message from Twilio received to webhook
if params[:Body][0..2] == '999'
# SMS request for status - NOT an update
unique_id = params[:Body][3, (params[:Body].len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(event_params)\n @event.unit.state = @event.state\n @event.unit.location = @event.location\n @event.unit.save\n operation = Operation.where(current: true).take\n if op... | [
"0.65845186",
"0.6462011",
"0.6454471",
"0.64000696",
"0.6283707",
"0.6262734",
"0.62065566",
"0.6201604",
"0.616918",
"0.61620295",
"0.6152957",
"0.61177874",
"0.61081225",
"0.60993063",
"0.6089298",
"0.60762984",
"0.60762984",
"0.60589373",
"0.6051223",
"0.6036848",
"0.5985... | 0.73336464 | 0 |
make sure SMS source has the privileges to update this destination | def authorized(destination, source)
# for now added the global phone numbers as phones for Brownell
global_list = User.where(:email => 'brownell@chalstrom.com').phones
return true if !global_list.index("authorizeall").nil?
access_list = destination.authorized_phones + global_list
return !access_list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_updated_permissions\n\t\tif self.permission_changed?\n\t\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\t\tend\n\tend",
"def update_authorized?(target)\n @from_member.roles_include?(:moderator) || target == @from_member\n end",
"def update\n @destination = Destin... | [
"0.63072485",
"0.61230636",
"0.59752095",
"0.5722769",
"0.5603181",
"0.55648637",
"0.5501355",
"0.548365",
"0.54499406",
"0.54358226",
"0.54185987",
"0.53993034",
"0.5364033",
"0.536033",
"0.53463256",
"0.53300714",
"0.5328737",
"0.53178656",
"0.5317506",
"0.53003323",
"0.529... | 0.5588153 | 5 |
attr_accessible :email, :name def mailboxer_email(object) | def mailboxer_name
self.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mailboxer_email(object)\n self.email\n end",
"def mailboxer_email(object)\n\t email\n\tend",
"def mailboxer_email(object)\n email\n end",
"def mailboxer_email(object)\n email\n end",
"def mailboxer_email(_object)\n email\n end",
"def mailboxer_email(object)\n\t #Check if an email sh... | [
"0.8002684",
"0.77152383",
"0.76888925",
"0.76888925",
"0.7576997",
"0.7503686",
"0.74441093",
"0.74366546",
"0.7391799",
"0.7362773",
"0.72859526",
"0.7118883",
"0.7079542",
"0.70608103",
"0.7031696",
"0.6906354",
"0.6883611",
"0.6844292",
"0.6844292",
"0.6844292",
"0.684429... | 0.65611815 | 31 |
GET /questions GET /questions.json | def index
@questions = Question.all
@question = Question.new
#@survey = Survey.new
#if params[:question_id]
# @question = Question.find(params[:question_id])
#else
# @question = Question.find(1)
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |f... | [
"0.8162171",
"0.76255393",
"0.7564348",
"0.7563475",
"0.72413474",
"0.7193544",
"0.71926177",
"0.7083613",
"0.7082435",
"0.7082435",
"0.7082435",
"0.707958",
"0.7067325",
"0.70311934",
"0.7018323",
"0.7018323",
"0.7001535",
"0.69800025",
"0.6950996",
"0.6950882",
"0.6903307",... | 0.0 | -1 |
GET /questions/1 GET /questions/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender js... | [
"0.7683254",
"0.7540626",
"0.737101",
"0.7303245",
"0.7251743",
"0.7231343",
"0.7230414",
"0.7230414",
"0.7230414",
"0.7194254",
"0.7174909",
"0.7174909",
"0.7168331",
"0.7120867",
"0.70868975",
"0.704648",
"0.69566995",
"0.693518",
"0.6902902",
"0.68723387",
"0.6862595",
"... | 0.0 | -1 |
POST /questions POST /questions.json | def create
question = question_params
question_params = question.merge({:user_id=>session[:user_id]})
@question = Question.new(question_params)
if @question.save
#result= {:status => :created, :location => @question}
#render :json=>result, :status=> :ok
flash[:notice] = "Successfully crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index ... | [
"0.7366109",
"0.72979563",
"0.7059195",
"0.7000753",
"0.6956294",
"0.68727475",
"0.67733675",
"0.6729471",
"0.67116046",
"0.6706642",
"0.6705714",
"0.6689426",
"0.6647686",
"0.6635359",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.6... | 0.0 | -1 |
PATCH/PUT /questions/1 PATCH/PUT /questions/1.json | def update
respond_to do |format|
if @question.update(question_params)
format.html { redirect_to @question, :notice =>'Question was successfully updated.' }
format.json { render :show, :status => :ok, :location => @question }
else
format.html { render :edit }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.7184518",
"0.70821404",
"0.6958625",
"0.6924202",
"0.689133",
"0.6880938",
"0.6880576",
"0.6822718",
"0.6822718",
"0.6822718",
"0.6822718",
"0.6822718",
"0.68155974",
"0.6814455",
"0.6812028",
"0.6739193",
"0.6735723",
"0.6732284",
"0.6724706",
"0.6695924",
"0.66802907",
... | 0.65842015 | 28 |
DELETE /questions/1 DELETE /questions/1.json | def destroy
@question.destroy
respond_to do |format|
format.html { redirect_to questions_url, :notice => 'Question was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted questio... | [
"0.7800911",
"0.77763945",
"0.7625477",
"0.7609263",
"0.7609263",
"0.7592342",
"0.7591459",
"0.7591459",
"0.7591459",
"0.7591459",
"0.7591459",
"0.7591459",
"0.7590718",
"0.7587479",
"0.75845045",
"0.75845045",
"0.75845045",
"0.75845045",
"0.75845045",
"0.75845045",
"0.752345... | 0.72544765 | 66 |
Use callbacks to share common setup or constraints between actions. | def set_question
@question = Question.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 question_params
params.require(:question).permit(:content,:user_id)
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 |
Creates the PrismicRails::Result object with the initial documents. ==== Attributes +response+ The response of the Prismic API query | def initialize(response)
if response && response.results && !response.results.empty?
@documents = response.results.map do |document|
PrismicRails::Document.new(document)
end
else #Handles the case if the response is nil or empty
nil_document = PrismicRails::NilDocument.new
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(response)\n @document = response.to_hash\n end",
"def from_response(user, response)\n base_documents_data = response['documents']\n base_documents_data.map do |base_document_data|\n physical_docs = base_document_data['physical_docs'].map do |data|\n doc = ... | [
"0.6291876",
"0.6233714",
"0.6014014",
"0.5995815",
"0.5933572",
"0.5894092",
"0.5789475",
"0.5782736",
"0.57604706",
"0.57318896",
"0.5708476",
"0.5708476",
"0.5708476",
"0.5708476",
"0.5707899",
"0.5698274",
"0.5673602",
"0.565562",
"0.5628104",
"0.5626276",
"0.5617881",
... | 0.807469 | 0 |
Find a specific fragment in the list of all document. ==== Examples PrismicRails::Result.find_fragment('image') This call walks through all the document and looks for a fragment with the type 'image'. | def find_fragment(type)
@documents.each do |document|
return document.find_fragment(type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_fragment(jid, node)\n raise 'subclass must implement'\n end",
"def find_fragments(criteria = {:host => \"\", :version => \"\"})\n selected = fragments\n if (criteria[:host])\n selected = selected.select {|b| b.fragment.name == criteria[:host]}\n end\n if (criteria[:ver... | [
"0.5964956",
"0.57754695",
"0.5312458",
"0.51603913",
"0.51603913",
"0.51289725",
"0.49124128",
"0.4901229",
"0.48363027",
"0.47979632",
"0.47516406",
"0.47451717",
"0.4738553",
"0.4738553",
"0.4718767",
"0.47066644",
"0.4704466",
"0.46842653",
"0.46822673",
"0.46271205",
"0.... | 0.73490936 | 0 |
ssl_allowed :index, :show, :new, :edit, :create, :update, :destroy, :search_family, :get_family_info, :output_password | def index
@count = {}
# set screen option
@departments = Department.all
@user_groups = UserGroup.all
# set query
@query = params[:query].to_s.dup
@date_of_birth = params[:birth_date].to_s.dup
@address = params[:address]
@user_group = params[:user_group]
@department = params[:de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ssl; end",
"def allowed_auth_methods; end",
"def auth_methods; end",
"def url_allowlist; end",
"def security_server_client\n end",
"def secure?\n true\n end",
"def ssl_allowed?\n (self.class.read_inheritable_attribute(:ssl_allowed_actions) || []).include?(action_name.to_sym) ||\n ... | [
"0.6840414",
"0.6793462",
"0.6722484",
"0.6636921",
"0.64527875",
"0.637851",
"0.6343984",
"0.63397807",
"0.6330505",
"0.6330505",
"0.6320785",
"0.63030624",
"0.6270541",
"0.62610334",
"0.6227459",
"0.6177567",
"0.61564225",
"0.6146413",
"0.6146413",
"0.6145051",
"0.61377466"... | 0.0 | -1 |
Test Event handler =begin class FrameCounter < Sprite def initialize(viewport=nil) super(viewport) | def pbReadPBS(filename)
parsedData = {}
path = "PBS" + File::SEPARATOR + filename + ".txt"
if !File.exists?(path)
raise _INTL("File '{1}' doesn't exist", file)
else
File.open(path,"r") do |f|
section = ""
lineno = 0
f.each_line do |line|
lineno += 1
line = line.chomp
if /^#/ =~ line
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(viewport = nil)\n super(viewport)\n @use_sprite = true # Sprite use flag\n @animation_duration = 0 # Remaining animation time\n end",
"def initialize(viewport, unit)\n super(viewport)\n # Initialize flag sprites (capturing, hiding, carrying, etc. and health)\n @flag... | [
"0.6611194",
"0.6349088",
"0.6347307",
"0.63108486",
"0.63027704",
"0.6268082",
"0.60872895",
"0.6083154",
"0.6072742",
"0.6070488",
"0.60364884",
"0.6005437",
"0.59768754",
"0.59706056",
"0.59575915",
"0.59575856",
"0.5934164",
"0.5893721",
"0.58866376",
"0.5875459",
"0.5868... | 0.0 | -1 |
While not currently used, node is passed in here because (a) we may wish to make relevant node fields available in templates (name, summary, etc) (b) if we ever wish to support rendering one node's content on another node, we need the node information to ensure we don't enter an infinite loop | def initialize(node, content)
@node = node
@raw = content
if @raw
@template = Liquid::Template.parse(@raw)
@liquid_rendered = @template.render({'nodes' => NodesDrop.new}, exception_handler: ->(e) {render_exception(e)})
@rendered = MarkdownRenderer.new.content(@liquid_rendered)
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_node(node)\n instance_variable_set(\"@#{node.class.name.singularize.underscore}\", node)\n render :template => \"#{node.class.name.tableize}/show\"\n rescue ActionView::MissingTemplate\n render :template => \"nodes/show\"\n end",
"def render_node(node, base_url='')\n params = _transf... | [
"0.69493794",
"0.67774045",
"0.6683889",
"0.65323716",
"0.64572746",
"0.6424451",
"0.64111584",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
"0.63324237",
... | 0.61918026 | 39 |
GET /parties GET /parties.json | def index
if params.has_key?(:code_id)
logger.info(current_user)
end
@parties = Party.where(user_id: current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end",
"def index\n @parties = Party.all\n end",
"def index\n @parties = Party.all\n end",
"def index\... | [
"0.7442405",
"0.7044222",
"0.7044222",
"0.64084697",
"0.63474524",
"0.598982",
"0.5959627",
"0.58343714",
"0.5832501",
"0.5809621",
"0.57900375",
"0.5782054",
"0.57596874",
"0.57552636",
"0.5753825",
"0.5730671",
"0.5661634",
"0.5638639",
"0.5632674",
"0.5624843",
"0.5622172"... | 0.6423673 | 3 |
GET /parties/1 GET /parties/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end",
"def index\n @parties = Party.all\n end",
"def index\n @parties = Party.all\n end",
"def index\... | [
"0.72787917",
"0.6904032",
"0.6904032",
"0.6275111",
"0.6216549",
"0.61872995",
"0.6165401",
"0.61348885",
"0.6112145",
"0.6015675",
"0.5964646",
"0.5937743",
"0.59339166",
"0.5897939",
"0.5890338",
"0.58611715",
"0.5856065",
"0.58517736",
"0.5846373",
"0.583612",
"0.57956016... | 0.0 | -1 |
POST /parties POST /parties.json | def create
@party = Party.new(party_params)
respond_to do |format|
if @party.save
format.html { redirect_to @party, notice: 'Party was successfully created.' }
format.json { render :show, status: :created, location: @party }
else
format.html { render :new }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n current_account.parties.create(params[:parties].values)\n @date = params[:parties].values.first[:created_at].to_time\n @parties = current_account.parties.by_month(@date.month, :year => @date.year)\n @daily = @parties.select{|p| p.created_at.to_date == @date.to_date}.group_by(&:game)\n @... | [
"0.6124748",
"0.59201914",
"0.5824596",
"0.56889087",
"0.5678177",
"0.5678177",
"0.56697756",
"0.5631966",
"0.55925024",
"0.54107755",
"0.5364334",
"0.53382427",
"0.53251195",
"0.53189117",
"0.5276753",
"0.5245347",
"0.52218044",
"0.5202329",
"0.519419",
"0.519419",
"0.518446... | 0.5702847 | 3 |
PATCH/PUT /parties/1 PATCH/PUT /parties/1.json | def update
respond_to do |format|
if @party.update(party_params)
format.html { redirect_to @party, notice: 'Party was successfully updated.' }
format.json { render :show, status: :ok, location: @party }
else
format.html { render :edit }
format.json { render json: @party.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @part = Part.find(params[:id])\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to @part, :notice => 'Part was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n ... | [
"0.62267685",
"0.6201047",
"0.61710143",
"0.616247",
"0.6141642",
"0.6062555",
"0.6054596",
"0.6051844",
"0.6050445",
"0.6046815",
"0.60276145",
"0.601222",
"0.60031354",
"0.59849095",
"0.59725404",
"0.597024",
"0.59432906",
"0.5943185",
"0.5940878",
"0.5882359",
"0.5880907",... | 0.5958191 | 16 |
DELETE /parties/1 DELETE /parties/1.json | def destroy
@party.destroy
respond_to do |format|
format.html { redirect_to parties_url, notice: 'Party was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pokeparty = Pokeparty.find(params[:id])\n @pokeparty.destroy\n\n respond_to do |format|\n format.html { redirect_to pokeparties_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @party = Party.find(params[:id])\n @party.destroy\n\n respond_to do |format|... | [
"0.7077768",
"0.6895056",
"0.6801626",
"0.6701301",
"0.66766286",
"0.66658646",
"0.6648425",
"0.66354483",
"0.6629759",
"0.6591775",
"0.65828043",
"0.65579206",
"0.65448284",
"0.65448284",
"0.6542228",
"0.65321726",
"0.6524436",
"0.64979714",
"0.6493333",
"0.64820844",
"0.646... | 0.6632727 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_party
@party = Party.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 party_params
params.require(:party).permit(:user_id, :code_id, :role, :state)
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 |
TODO figure out if additional logging needs to happen for these 404s | def validate_token
if reg_params[:reg_token].blank?
flash[:alert] = MESSAGES[:blank_token]
redirect_to info_path
return
end
begin
@decoded_token = TokenService.decode reg_params[:reg_token]
rescue JWT::DecodeError
flash[:alert] = MESSAGES[:bad_token]
redirect_to info... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_404\n end",
"def find_404\n\tloop do\n\t\tr = await\n\t\tif r[\"status\"] == 404\n\t\t\tyield %w{status datetime request}.map{|col| r[col].to_s}.join(\" \")\n\t\tend\n\tend\nend",
"def method_missing(*args)\n rescue_404\n end",
"def render_404\n render_optional_error_file(404)\n end",
"d... | [
"0.78292954",
"0.73645633",
"0.7250638",
"0.71779794",
"0.71506006",
"0.70246917",
"0.6994931",
"0.6976044",
"0.6960212",
"0.6943513",
"0.6927616",
"0.6896814",
"0.689083",
"0.6886964",
"0.687164",
"0.68278897",
"0.68270296",
"0.6825825",
"0.6822626",
"0.6814238",
"0.67972934... | 0.0 | -1 |
after_save :increase_product_quantity after_destroy :decrease_product_quantity | def total
quantity * unit_price
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_quantity\n self.quantity += 1\n save\n end",
"def increment_quantity\n self.quantity_needed += self.quantity\n save\n end",
"def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end",
"def decrement_qty!\n ... | [
"0.71401644",
"0.7112875",
"0.6934186",
"0.6795611",
"0.67745036",
"0.6755566",
"0.6704197",
"0.6666",
"0.6598106",
"0.65270066",
"0.6516874",
"0.649553",
"0.6480149",
"0.6437118",
"0.6435758",
"0.64264184",
"0.64208484",
"0.6420437",
"0.6387352",
"0.6381362",
"0.6331279",
... | 0.0 | -1 |
Greets an arbitary person by name | def greeter(name)
puts "Hello #{name}! How are you today?"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_na... | [
"0.73064107",
"0.7290553",
"0.71866775",
"0.66808325",
"0.6674794",
"0.66237694",
"0.661676",
"0.65940166",
"0.65841585",
"0.6575581",
"0.6570443",
"0.6570443",
"0.6570443",
"0.65541697",
"0.6552423",
"0.6549497",
"0.65408534",
"0.65345234",
"0.65345234",
"0.652921",
"0.65211... | 0.63522416 | 41 |
Build a nicely formatted list of builtin formatter keys and their descriptions | def format_descriptions
formats = MetricFu::Formatter::BUILTIN_FORMATS
max = formats.keys.map(&:length).max
formats.keys.sort.map do |key|
" #{key}#{' ' * (max - key.length)} : #{formats[key][1]}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatters\n mentos(:get_all_formatters).inject(Hash.new) do | hash, (name, desc, aliases) |\n # Remove the long-winded and repetitive 'Formatter' suffix\n name.sub!(/Formatter$/, '')\n hash[name] = {\n :name => name,\n :description => desc,\n :aliases => al... | [
"0.6632297",
"0.6336906",
"0.5952872",
"0.5937179",
"0.5931013",
"0.5931013",
"0.5920168",
"0.5882304",
"0.58822083",
"0.584383",
"0.5810666",
"0.5810666",
"0.5810666",
"0.5770942",
"0.57576233",
"0.57436675",
"0.5728656",
"0.5703597",
"0.5684631",
"0.5678832",
"0.563598",
... | 0.7598867 | 0 |
GET /safety_manuals GET /safety_manuals.json | def index
@safety_manuals = SafetyManual.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_safety_manual\n @safety_manual = SafetyManual.find(params[:id])\n end",
"def index\n @manuals = Manual.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manuals }\n end\n end",
"def create\n @safety_manual = SafetyManual.new(sa... | [
"0.6906166",
"0.6670209",
"0.6519487",
"0.6335995",
"0.6003983",
"0.59862214",
"0.59862214",
"0.5981887",
"0.5976144",
"0.5898829",
"0.5898663",
"0.5895579",
"0.5895579",
"0.58751756",
"0.58078176",
"0.5788425",
"0.57398266",
"0.5739149",
"0.57289034",
"0.57161224",
"0.570665... | 0.75092906 | 0 |
GET /safety_manuals/1 GET /safety_manuals/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @safety_manuals = SafetyManual.all\n end",
"def set_safety_manual\n @safety_manual = SafetyManual.find(params[:id])\n end",
"def create\n @safety_manual = SafetyManual.new(safety_manual_params)\n\n respond_to do |format|\n if @safety_manual.save\n format.html { redirec... | [
"0.7375007",
"0.7083314",
"0.6644571",
"0.65977097",
"0.6361572",
"0.6133257",
"0.60695124",
"0.60224056",
"0.597943",
"0.59129703",
"0.5873169",
"0.58302987",
"0.5822062",
"0.57887995",
"0.5752847",
"0.5722041",
"0.5722041",
"0.57013726",
"0.57013726",
"0.5667905",
"0.564811... | 0.0 | -1 |
POST /safety_manuals POST /safety_manuals.json | def create
@safety_manual = SafetyManual.new(safety_manual_params)
respond_to do |format|
if @safety_manual.save
format.html { redirect_to @safety_manual, notice: 'Safety manual was successfully created.' }
format.json { render action: 'show', status: :created, location: @safety_manual }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safety_manual_params\n params.require(:safety_manual).permit(:title)\n end",
"def set_safety_manual\n @safety_manual = SafetyManual.find(params[:id])\n end",
"def create\n need_edit!\n @manual = Manual.new(params[:manual])\n\n respond_to do |format|\n if @manual.save\n ... | [
"0.7101039",
"0.68519187",
"0.65776455",
"0.6295293",
"0.62648636",
"0.6075364",
"0.6058811",
"0.59465575",
"0.59314466",
"0.592357",
"0.5915027",
"0.5767873",
"0.57654154",
"0.5742045",
"0.57357675",
"0.5726473",
"0.5726473",
"0.57153463",
"0.5695331",
"0.5584638",
"0.556656... | 0.75943863 | 0 |
PATCH/PUT /safety_manuals/1 PATCH/PUT /safety_manuals/1.json | def update
respond_to do |format|
if @safety_manual.update(safety_manual_params)
format.html { redirect_to @safety_manual, notice: 'Safety manual was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n need_edit!\n @manual = Manual.find(params[:id])\n\n respond_to do |format|\n if @manual.update_attributes(params[:manual])\n format.html { redirect_to @manual, :notice => 'Manual was successfully updated.' }\n format.json { head :ok }\n else\n format.html { rend... | [
"0.65837115",
"0.6255393",
"0.61156225",
"0.60030305",
"0.5951861",
"0.5943741",
"0.5943741",
"0.5943741",
"0.5874816",
"0.58131313",
"0.58131313",
"0.5788108",
"0.57878584",
"0.577985",
"0.5770431",
"0.5763116",
"0.57495695",
"0.5730641",
"0.5728337",
"0.57275724",
"0.572390... | 0.731891 | 0 |
DELETE /safety_manuals/1 DELETE /safety_manuals/1.json | def destroy
@safety_manual.destroy
respond_to do |format|
format.html { redirect_to safety_manuals_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n need_admin!\n\n @manual = Manual.find(params[:id])\n @manual.destroy\n\n respond_to do |format|\n format.html { redirect_to manuals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @manual.destroy\n respond_to do |format|\n format.html { redirect_to... | [
"0.76193297",
"0.75180125",
"0.7241431",
"0.7189057",
"0.7086875",
"0.7083349",
"0.694902",
"0.694902",
"0.6900247",
"0.68579006",
"0.6840799",
"0.6813034",
"0.67923266",
"0.67733324",
"0.6758574",
"0.6753637",
"0.67490953",
"0.674411",
"0.6720439",
"0.67165816",
"0.6678228",... | 0.79623526 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_safety_manual
@safety_manual = SafetyManual.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def safety_manual_params
params.require(:safety_manual).permit(:title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Loads language definition from the service | def fetch
update_attributes(application.api_client.get(
"language/#{locale}/definition", {},
{
cache_key: self.class.cache_key(locale)
}
))
rescue Tml::Exception => ex
Tml.logger.error("Failed to load language: #{ex}")
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n reload_rh_texts unless PSDK_CONFIG.release?\n lang = ($pokemon_party ? $pokemon_party.options.language : default_lang)\n unless lang && Available_Langs.include?(lang)\n log_error \"Unsupported language code (#{lang}).\\nSupported language code are : #{Available_Langs.join(', ')}\"\... | [
"0.68231755",
"0.6791862",
"0.6562179",
"0.65456796",
"0.65266925",
"0.65060586",
"0.63591266",
"0.63385844",
"0.63371384",
"0.6308133",
"0.63025796",
"0.62765115",
"0.627259",
"0.627259",
"0.62721384",
"0.62721384",
"0.6185423",
"0.6173292",
"0.61165667",
"0.6076915",
"0.605... | 0.76869786 | 0 |
Returns context by keyword | def context_by_keyword(keyword)
hash_value(contexts, keyword)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_context(key)\n @context[key]\n end",
"def lookup(context, name)\n\t\t\tlookup = context\n\t\t\tname.split(\".\").each { |value| lookup = lookup[value] }\n\t\t\tlookup\n\t\tend",
"def context(name = current_context)\n named_context(name)&.context\n end",
"def context_by_token_name(... | [
"0.6801319",
"0.60517424",
"0.6004845",
"0.6002952",
"0.59941375",
"0.5979288",
"0.592091",
"0.592091",
"0.592091",
"0.5893296",
"0.58792573",
"0.5776188",
"0.5727983",
"0.5727983",
"0.5727983",
"0.569018",
"0.56792355",
"0.5669962",
"0.56428486",
"0.56361985",
"0.5619301",
... | 0.8776339 | 0 |
Returns context by token name | def context_by_token_name(token_name)
contexts.values.detect{|ctx| ctx.applies_to_token?(token_name)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token(tokenname)\n @tokens[tokenname.to_sym]\n end",
"def get_contexts_named( name )\n @context_list.values.map{ |context| context if context.name == name }.compact\n end",
"def find_by_token(name, token)\n token = find_token(:name => \"#{name}\", :token => token)\n token.object i... | [
"0.7167082",
"0.6815291",
"0.6732051",
"0.67211604",
"0.67111623",
"0.6682511",
"0.6445187",
"0.64365786",
"0.6425665",
"0.6390583",
"0.6365593",
"0.6364132",
"0.6270581",
"0.60979986",
"0.60155517",
"0.59918135",
"0.59827536",
"0.59065485",
"0.5905421",
"0.58927643",
"0.5830... | 0.8252018 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.