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 |
|---|---|---|---|---|---|---|
Post method which accepts form parameters from postcode lookup and redirects to constituency_path. | def postcode_lookup
flash[:postcode] = params[:postcode]
redirect_to constituency_path(params[:constituency_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n\t redirect_to search_path( query: params[:query] )\n\tend",
"def create\n @post_code = PostCode.new(post_code_params)\n\n respond_to do |format|\n if @post_code.save\n format.html { redirect_to @post_code, notice: 'Post code was successfully created.' }\n format.json { render... | [
"0.601083",
"0.58243847",
"0.57342035",
"0.5613032",
"0.5558212",
"0.5543345",
"0.5499545",
"0.5471181",
"0.546844",
"0.5455429",
"0.5447761",
"0.5424066",
"0.5388734",
"0.5366871",
"0.53646636",
"0.5326812",
"0.53149766",
"0.5274738",
"0.52576333",
"0.5253722",
"0.52461255",... | 0.7674942 | 0 |
Renders a constituency that has a constituency area object on map view given a constituency id. Will respond with GeoJSON data using the geosparqltogeojson gem if JSON is requested. | def map
respond_to do |format|
format.html do
@constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first
@json_location = constituency_map_path(@constituency.graph_id, format: 'json')
end
format.json do
@constituency = Parliament:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helper... | [
"0.6665441",
"0.62658805",
"0.560211",
"0.55548006",
"0.55038095",
"0.5484718",
"0.5409774",
"0.54057163",
"0.5393519",
"0.5364922",
"0.53348184",
"0.531092",
"0.5278387",
"0.5256406",
"0.5243053",
"0.5214157",
"0.52126855",
"0.52115476",
"0.51657003",
"0.5163363",
"0.5145046... | 0.6267736 | 1 |
UC1 Put nformation about vendors and products of ones | def put_vendor_contract(q)
$LOG.info('put_vendor_contract');
@VENDOR=q["VENDOR"];
@PRODUCT=q["PRODUCT"];
@VID=@VENDOR["VID"];
@PRODUCT["VID"]=@VID;
# CHECK IN CACHE VENDOR
@vendor=$CACHE.get("VENDOR",@VID)
# IF NOT IN CACHE CHECK IN STORE
if (@vendor == nil)
# IF IN STORAGE RENEW IN CACHE
@vendor=$STORAGE.get("VEND... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sku_combination_creation\n end",
"def add_vendor\n vendor = @product_row[:vendor].match(/[\\D\\s]*/)\n vendors = Spree::Vendor.where(\"name ILIKE ?\", \"%#{vendor[0].strip}%\")\n if !(vendors.empty?)\n if(@product_row[:vendor].match(/goers/i))\n notes = notes = \"\" ? @product... | [
"0.58449596",
"0.58203465",
"0.55460596",
"0.5476416",
"0.54544294",
"0.5346234",
"0.532324",
"0.5238781",
"0.5215226",
"0.52136964",
"0.51984155",
"0.5191942",
"0.5150586",
"0.51504123",
"0.5126002",
"0.5106959",
"0.50947833",
"0.509215",
"0.5088456",
"0.5064857",
"0.5055025... | 0.56582946 | 2 |
UC2 Put information about Users and contracts with Vendors | def put_contract(q)
$LOG.info('put_contract');
@USER=q["USER"];
@CONTRACT=q["CONTRACT"];
@CID=@USER["CID"];
@user=$CACHE.get("USER",@CID)
$LOG.info(@USER.to_s()+' - '+@CONTRACT.to_s());
if (@user == nil)
@user=$STORAGE.get("USER",@CID)
if (@user == nil)
$STORAGE.put("USER",@CID,@USER)
@user=$STORAGE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendor_params\n params.require(:vendor).permit(:bank, :bank_account, :branch_code, :account_number, :family_name, :first_name, :post_number, :city,:address, :building_name, :created_at, :updated_at, :prefecture_id ).merge(user_id: current_user.id)\n end",
"def create\n @vendor = current_user.vendors.n... | [
"0.55371755",
"0.54913795",
"0.54703075",
"0.53519434",
"0.5263387",
"0.51892287",
"0.5170976",
"0.5159538",
"0.5153413",
"0.51261294",
"0.5103107",
"0.51030314",
"0.5053509",
"0.5051054",
"0.5040232",
"0.50084823",
"0.4998513",
"0.4972688",
"0.49528152",
"0.4945624",
"0.4945... | 0.55504066 | 0 |
UC3 Put Special prices for corresponding contracts | def put_new_pricebid(q)
$LOG.info('put_new_pricebid');
@CID=q["USER"];
@PID=q["PRODUCT"];
@PRICE=q["PRICE"];
@product=get_product(@PID)
$LOG.info('put_new_pricebid: '+@PID.to_s());
$LOG.info('put_new_pricebid: '+@PRICE.to_s());
$LOG.info('put_new_pricebid: '+@CID.to_s());
$LOG.info('put_new_pricebid: '+@product.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contract_params\n params.require(:contract).permit(:ticker, :strike_price, :option_type, :expiration_date, :premium, :average_premium_purchase_price, :count, :resource_id, daily_premium_prices: [[]] )\n end",
"def with_currency(new_currency); end",
"def contract_params\n params.require(:contra... | [
"0.59256154",
"0.5680014",
"0.5652126",
"0.56215507",
"0.5534247",
"0.5528158",
"0.5477522",
"0.5467856",
"0.54495084",
"0.5385718",
"0.53639704",
"0.5354278",
"0.5350004",
"0.5319892",
"0.5319892",
"0.5305047",
"0.5298456",
"0.5295921",
"0.52634",
"0.5247313",
"0.5245897",
... | 0.56760985 | 2 |
UC4 Put Special pricies for corresponding contracts | def get_price_of_the_product(q)
@pricebid=nil
$LOG.info('get_price_of_the_product');
@CID=q["USER"];
@PID=q["PRODUCT"];
@product=get_product(@PID)
$LOG.info(@PID.to_s()+' - '+@product.to_s());
if (@product != nil)
@pricebid=@product["DEFPRICE"]
@vid=@product["VID"]
$LOG.info(@vid.to_s()+' - '+@pricebid.to_s());
@co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_random_contract\n available_contract_missions.each do |m|\n end\n end",
"def contract_params\n params.fetch(:contract, {}).permit(:contract, :risk, :risk_limit)\n end",
"def add_contract_requirements(sheet)\n bold_style = sheet.styles.add_style b: true\n sheet.add_row []\n sh... | [
"0.5693713",
"0.5360878",
"0.5329585",
"0.532126",
"0.52766716",
"0.52474195",
"0.5227371",
"0.521614",
"0.5170425",
"0.51640564",
"0.5157892",
"0.51266116",
"0.51208174",
"0.5117237",
"0.5105529",
"0.5101629",
"0.5049592",
"0.504398",
"0.50347215",
"0.5031669",
"0.5021257",
... | 0.0 | -1 |
UC5 Make Order for Product | def order_product(q)
$LOG.info('order_product');
@CID=q["USER"];
@PID=q["PRODUCT"];
@orders=get_orders_by_product(@PID)
@orders[@CID]=DateTime.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_order(arr)\n\nend",
"def order1 \n puts(\"\\n\\n- - - - - - - - - - - - - - - -\\n[SHOP] Executing order 1: ABCDABA should be $13.25\\n\\n\") \n @shop.reset_order\n @shop.add_product_to_order_by_name('A')\n @shop.add_product_to_order_by_name('B')\n @shop.add_product_to_order_by_name('C')\n @s... | [
"0.57688946",
"0.57559365",
"0.5732896",
"0.5601772",
"0.55900025",
"0.55900025",
"0.5578126",
"0.5572557",
"0.5535404",
"0.54481006",
"0.5427964",
"0.5389294",
"0.5382906",
"0.5375876",
"0.53378683",
"0.5320349",
"0.52330345",
"0.5212837",
"0.5212647",
"0.5205473",
"0.520250... | 0.5062189 | 28 |
Creates a new SexpProcessor. Use super to invoke this initializer from SexpProcessor subclasses, then use the attributes above to customize the functionality of the SexpProcessor | def initialize
@expected = Sexp
# we do this on an instance basis so we can subclass it for
# different processors.
@processors = {}
@context = []
public_methods.each do |name|
if name.to_s.start_with? "process_" then
@processors[name[8..-1].to_sym] = name.to_sym
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @expected = Sexp\n @processors = self.class.processors\n @context = []\n\n if @processors.empty?\n public_methods.each do |name|\n if name.to_s.start_with? \"process_\" then\n @processors[name[8..-1].to_sym] = name.to_sym\n end\n end\n end\n end"... | [
"0.68719083",
"0.67864865",
"0.6003468",
"0.5708315",
"0.56322914",
"0.5605215",
"0.55952346",
"0.558298",
"0.539174",
"0.53711504",
"0.52841204",
"0.5227974",
"0.5194748",
"0.5193247",
"0.5148749",
"0.5145704",
"0.51257926",
"0.5111365",
"0.5039571",
"0.50331455",
"0.5020619... | 0.69607973 | 0 |
Default Sexp processor. Invokes process_ methods matching the Sexp type given. Performs additional checks as specified by the initializer. | def process(exp)
return nil if exp.nil?
result = nil
type = exp.first
raise "type should be a Symbol, not: #{exp.first.inspect}" unless
Symbol === type
in_context type do
# now do a pass with the real processor (or generic)
meth = @processors[type]
if meth then
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process exp\n return nil if exp.nil?\n\n unless Sexp === exp then\n raise SexpTypeError, \"exp must be a Sexp, was #{exp.class}:#{exp.inspect}\"\n end\n\n if self.context.empty? then\n p :rewriting unless debug.empty?\n exp = self.rewrite(exp)\n p :done_rewriting unless debug.em... | [
"0.7451764",
"0.7434105",
"0.6505911",
"0.6460087",
"0.6388599",
"0.63822263",
"0.6163957",
"0.612368",
"0.6037836",
"0.5958047",
"0.58640337",
"0.5844334",
"0.5833821",
"0.57282895",
"0.56586176",
"0.5653573",
"0.5579693",
"0.553309",
"0.55093855",
"0.5496367",
"0.54887104",... | 0.75268567 | 0 |
A fairly generic processor for a dummy node. Dummy nodes are used when your processor is doing a complicated rewrite that replaces the current sexp with multiple sexps. Bogus Example: def process_something(exp) return s(:dummy, process(exp), s(:extra, 42)) end | def process_dummy(exp)
result = @expected.new(:dummy) rescue @expected.new
until exp.empty? do
result << self.process(exp.shift)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_dummy exp\n result = @expected.new(:dummy) rescue @expected.new\n result << self.process(exp.shift) until exp.empty?\n result\n end",
"def process_dummy(exp)\n process_block(exp).chomp\n end",
"def process_defn exp\n exp.shift unless auto_shift_type # node type\n name = @sclass.... | [
"0.63568693",
"0.6237473",
"0.5949897",
"0.5918314",
"0.5550516",
"0.55156153",
"0.54685557",
"0.5429859",
"0.5420868",
"0.5302231",
"0.5297833",
"0.5243836",
"0.52326226",
"0.52313733",
"0.521029",
"0.5202815",
"0.51909214",
"0.51699054",
"0.51671785",
"0.51224387",
"0.51151... | 0.6348755 | 1 |
Add a scope level to the current env. Eg: def process_defn exp name = exp.shift args = process(exp.shift) scope do body = process(exp.shift) ... end end env[:x] = 42 scope do env[:x] => 42 env[:y] = 24 end env[:y] => nil | def scope &block
env.scope(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_scope exp\n # NOPE?\n end",
"def scope\n @env.unshift({})\n begin\n yield\n ensure\n @env.shift\n raise \"You went too far unextending env\" if @env.empty?\n end\n end",
"def scope_level; end",
"def add_scope()\n $highest_scope += 1\n $current_sco... | [
"0.6767192",
"0.6705041",
"0.6117308",
"0.5946095",
"0.59248245",
"0.59236115",
"0.59077585",
"0.58959657",
"0.5893147",
"0.5893147",
"0.5893147",
"0.58474076",
"0.5840782",
"0.5755145",
"0.5755145",
"0.5701138",
"0.56867534",
"0.56778735",
"0.5675147",
"0.567086",
"0.5602732... | 0.632707 | 3 |
ensure taht there are no line items referencing this product | def ensure_not_referenced_by_any_line_item
unless line_items.empty?
errors.add(:base, 'Line Items Present')
throw :abort
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_not_referenced_by_any_line_item\n\t\t\tunless line_items.empty?\n\t\t\t\terrors.add(:base, 'Line items reference this product')\n\t\t\t\tthrow :abort\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Pro... | [
"0.8622005",
"0.8570661",
"0.8243011",
"0.8208382",
"0.8173206",
"0.81245625",
"0.8084768",
"0.80435437",
"0.8001131",
"0.7999396",
"0.7979597",
"0.79733557",
"0.7972292",
"0.79670155",
"0.79621685",
"0.79478484",
"0.7939269",
"0.7939269",
"0.7937669",
"0.79318327",
"0.793005... | 0.8002314 | 8 |
==== Tenant transaction ===== | def paid_request_to_tenant(reservation)
@reservation = reservation
@tenant = @reservation.user
@cookoon = @reservation.cookoon
@host = @cookoon.user
mail(to: @tenant.full_email, subject: 'Vous avez demandé un Cookoon !')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def within_transaction; end",
"def within_transaction; end",
"def set_current_tenant_if_necessary\n if !self.user.current_tenant\n self.user.current_tenant = self.tenant\n self.user.save\n end\n end",
"def create_tenant\n Apartment::Tenant.create(params[:id])\n Apartment::Tenant.switch... | [
"0.6950582",
"0.6950582",
"0.6789479",
"0.67725646",
"0.6745909",
"0.6745909",
"0.6745909",
"0.66731495",
"0.66731495",
"0.6652706",
"0.66163355",
"0.6574344",
"0.65256685",
"0.6512877",
"0.64912224",
"0.6490651",
"0.64855635",
"0.64842343",
"0.64813507",
"0.64507824",
"0.643... | 0.0 | -1 |
==== Tenant notification ===== | def notify_approaching_reservation_to_tenant(reservation)
@reservation = reservation
@tenant = @reservation.user
@cookoon = @reservation.cookoon
@host = @cookoon.user
mail(to: @tenant.full_email, subject: 'Votre location Cookoon se rapproche !')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tenant_notification(tenant)\n @header_img_name = 'rental_confirm'\n \n setup_email tenant.email, 'USSelfStorageLocator.com <info@usselfstoragelocator.com>', \"Your #{tenant.listing.storage_type.try(:titleize) || 'Self Storage'} Rental\"\n @body[:tenant] = tenant\n @body[:rental] = tenant.rental\... | [
"0.7523809",
"0.6611643",
"0.6377483",
"0.63216186",
"0.6276264",
"0.62708396",
"0.62708396",
"0.6219926",
"0.620107",
"0.6186556",
"0.6165063",
"0.614687",
"0.6116051",
"0.6088869",
"0.6049955",
"0.60401434",
"0.6025788",
"0.59896827",
"0.59855264",
"0.5979489",
"0.59681267"... | 0.64689314 | 2 |
==== Host transaction ===== | def paid_request_to_host(reservation)
@reservation = reservation
@tenant = @reservation.user
@cookoon = @reservation.cookoon
@host = @cookoon.user
mail(to: @host.full_email, subject: "#{@tenant.first_name} souhaite louer votre Cookoon !")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction(&block); end",
"def within_transaction; end",
"def within_transaction; end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def transaction(&blk)\n tap(&blk)\n end",
"def use_transactions; end",
"def use_transactions; end",
"def within... | [
"0.80423635",
"0.769474",
"0.769474",
"0.767147",
"0.767147",
"0.767147",
"0.72856444",
"0.72463876",
"0.72463876",
"0.7173958",
"0.7163731",
"0.7159608",
"0.7159608",
"0.71257496",
"0.70231944",
"0.70231944",
"0.6807834",
"0.67990243",
"0.67990243",
"0.6721091",
"0.67136455"... | 0.0 | -1 |
==== Host notification ===== | def notify_awaiting_request_to_host(reservation)
@reservation = reservation
@tenant = @reservation.user
@cookoon = @reservation.cookoon
@host = @cookoon.user
mail(to: @host.full_email, subject: "Rappel: #{@tenant.first_name} souhaite louer votre Cookoon !")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def notify\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify_host\n OrganisationMailer.notify_... | [
"0.69776773",
"0.69776773",
"0.6935529",
"0.6901565",
"0.6901565",
"0.6901565",
"0.6867888",
"0.6799408",
"0.6799408",
"0.67029834",
"0.66427845",
"0.66110843",
"0.6558393",
"0.6558393",
"0.6558393",
"0.6483394",
"0.6483394",
"0.64751005",
"0.64751005",
"0.64612323",
"0.64271... | 0.0 | -1 |
GET /bid_winners GET /bid_winners.json | def index
@bid_winners = BidWinner.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def all_booking_of_client\n\t\t@bo... | [
"0.6780769",
"0.6647827",
"0.6563457",
"0.652974",
"0.61657447",
"0.608783",
"0.6080473",
"0.6074066",
"0.6041351",
"0.6015063",
"0.60125554",
"0.601035",
"0.59837455",
"0.595581",
"0.5943688",
"0.5916635",
"0.58888197",
"0.5884723",
"0.58798057",
"0.58788425",
"0.58627576",
... | 0.7656405 | 0 |
GET /bid_winners/1 GET /bid_winners/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bid_winners = BidWinner.all\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }... | [
"0.7438424",
"0.66676885",
"0.66555125",
"0.6388762",
"0.62146926",
"0.6191606",
"0.6187363",
"0.6181984",
"0.6146363",
"0.6120238",
"0.6119596",
"0.6094287",
"0.6063412",
"0.6060782",
"0.60500216",
"0.60280657",
"0.6015247",
"0.59655696",
"0.59595674",
"0.5958303",
"0.595462... | 0.0 | -1 |
POST /bid_winners POST /bid_winners.json | def create
@bid_winner = BidWinner.new(bid_winner_params)
respond_to do |format|
if @bid_winner.save
format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully created.' }
format.json { render :show, status: :created, location: @bid_winner }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \t@bet = Bet.find(params[:bet_id])\n @winner = @bet.build_winner(winner_params)\n\n respond_to do |format|\n if @winner.save\n @bet.participations.each do |participation|\n if participation.choice == @winner.choice\n user = participation.user\n winning... | [
"0.64246356",
"0.6414788",
"0.6399638",
"0.63068753",
"0.6241566",
"0.6133156",
"0.6027251",
"0.59767824",
"0.5944652",
"0.5922627",
"0.59179306",
"0.59175223",
"0.5902692",
"0.58576345",
"0.5856097",
"0.5831401",
"0.57759506",
"0.5766759",
"0.5765637",
"0.57549363",
"0.57486... | 0.69893986 | 0 |
PATCH/PUT /bid_winners/1 PATCH/PUT /bid_winners/1.json | def update
respond_to do |format|
if @bid_winner.update(bid_winner_params)
format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully updated.' }
format.json { render :show, status: :ok, location: @bid_winner }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n ... | [
"0.692455",
"0.6564157",
"0.65320796",
"0.64614964",
"0.6446403",
"0.6444107",
"0.6438846",
"0.6438846",
"0.6438846",
"0.6438846",
"0.6431077",
"0.64215314",
"0.6402706",
"0.6386484",
"0.6367449",
"0.6357738",
"0.6268321",
"0.62669903",
"0.6233732",
"0.6230411",
"0.6223576",
... | 0.69262636 | 0 |
DELETE /bid_winners/1 DELETE /bid_winners/1.json | def destroy
@bid_winner.destroy
respond_to do |format|
format.html { redirect_to bid_winners_url, notice: 'Bid winner was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bid = @swarm_request.bids.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(swarm_request_bids_url(:swarm_request_id => @swarm_request.to_param)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid.destroy\n\n respond_to... | [
"0.7177306",
"0.7116709",
"0.7081332",
"0.7081332",
"0.70671713",
"0.69776374",
"0.694754",
"0.69332546",
"0.6883727",
"0.6860931",
"0.6833714",
"0.6829652",
"0.6829652",
"0.6829652",
"0.6829652",
"0.6829652",
"0.6822566",
"0.6820957",
"0.68122256",
"0.6805556",
"0.6804825",
... | 0.7298102 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bid_winner
@bid_winner = BidWinner.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 bid_winner_params
params.require(:bid_winner).permit(:winner_id, :bid_product, :winning_amount, :bid_cart_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Provide a user friendly representation | def to_s
'#<Twilio.Routes.V2.TrunkList>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Provide a user friendly representation | def to_s
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Routes.V2.TrunkContext #{context}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Provide a detailed, user friendly representation | def inspect
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Routes.V2.TrunkContext #{context}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for mor... | [
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64... | 0.0 | -1 |
Build an instance of TrunkInstance | def get_instance(payload)
TrunkInstance.new(@version, payload)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trunk code, options = {}\n TrunkCode.new code, options\n end",
"def get_instance(payload)\n TranscriptInstance.new(@version, payload)\n end",
"def new_instance(suite, platform, index)\n Instance.new(\n :busser => new_busser(suite, platform... | [
"0.6475194",
"0.6136434",
"0.57862455",
"0.5784211",
"0.5720444",
"0.5533709",
"0.541989",
"0.53673667",
"0.5281895",
"0.5267927",
"0.5225712",
"0.5204002",
"0.50863034",
"0.5076422",
"0.5072901",
"0.50608623",
"0.50405186",
"0.50070596",
"0.49636728",
"0.49558178",
"0.493797... | 0.79163444 | 0 |
Provide a user friendly representation | def to_s
'<Twilio.Routes.V2.TrunkPage>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context | def context
unless @instance_context
@instance_context = TrunkContext.new(@version , @params['sip_trunk_domain'])
end
@instance_context
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n ... | [
"0.6837958",
"0.68024147",
"0.6796363",
"0.6771269",
"0.6768456",
"0.6768456",
"0.6731739",
"0.66826314",
"0.6680222",
"0.6678165",
"0.6677005",
"0.6640645",
"0.66272235",
"0.6610219",
"0.66006243",
"0.65918165",
"0.6568012",
"0.6560853",
"0.6556747",
"0.65498286",
"0.6546767... | 0.65719545 | 16 |
Provide a user friendly representation | def to_s
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Routes.V2.TrunkInstance #{values}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Provide a detailed, user friendly representation | def inspect
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Routes.V2.TrunkInstance #{values}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for mor... | [
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64... | 0.0 | -1 |
GET /provincia/provincia_id/partidos/partido_id/localidades.json GET /localidades/1.json | def show
@localidad = Localidad.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_part_by_company_part\n @parts = PartsController::PartService.get_part_by_company_part(params[:param_part])\n if !@parts.nil?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoe... | [
"0.6416379",
"0.6206604",
"0.6159835",
"0.6154614",
"0.61402464",
"0.6113565",
"0.60688066",
"0.59984833",
"0.59729457",
"0.5954942",
"0.5925315",
"0.59159523",
"0.5900415",
"0.58651465",
"0.58270305",
"0.5802913",
"0.5779527",
"0.576133",
"0.57380867",
"0.5717439",
"0.570488... | 0.57600284 | 18 |
start Ebay Shopping Methods | def find_half_products_by_keyword( keywords, options = {} )
options.merge!({:QueryKeywords => keywords})
req = EbayShopping::Request.new(self,:FindHalfProducts,options)
req.execute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hit_ebay\n self.gimmie_the_goods(self.ebay_grab)\n end",
"def fetch_products\n if Settings.ebay.try(:crawler)\n fetch_products_with_crawler\n else\n fetch_products_with_api\n end\n end",
"def start\n send_message('Hello! Welcome to Hedma store🥰')\n send_message('Which item do... | [
"0.61007935",
"0.6023272",
"0.59614694",
"0.5957287",
"0.5916267",
"0.5770658",
"0.576249",
"0.5757823",
"0.57383835",
"0.5711802",
"0.5686604",
"0.5664512",
"0.5663861",
"0.5645578",
"0.5623897",
"0.56088245",
"0.55879164",
"0.5447996",
"0.5404726",
"0.53857327",
"0.5360915"... | 0.0 | -1 |
TODO remove hack, consider moving to initializers | def load_youtube
Video
YouTube
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize() end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def... | [
"0.74650115",
"0.7454861",
"0.7454861",
"0.7454861",
"0.7454861",
"0.7454861",
"0.74329656",
"0.74329656",
"0.74329656",
"0.74329656",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327",
"0.7392327"... | 0.0 | -1 |
========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Write a method that rotates an array by moving the first element to the end of the array. The original array should not be modified. Do not use the method Arrayrotate or Arrayrotate! for your implementation. E: rotate_array([7, 3, 5, 2, 9, 1]) == [... | def rotate_array(array_of_numbers)
rotated_array = array_of_numbers.clone
rotated_array << rotated_array.shift
rotated_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(input_array)\n return input_array if input_array.size <= 1\n new_array = []\n index_counter = 1\n loop do\n new_array << input_array[index_counter]\n index_counter += 1\n break if index_counter >= input_array.size\n end\n new_array << input_array[0]\n new_array\nend",
"def rotate... | [
"0.81887287",
"0.80985403",
"0.80985403",
"0.8023813",
"0.80042064",
"0.7981421",
"0.79398644",
"0.7939189",
"0.79229003",
"0.7916857",
"0.7905621",
"0.78907263",
"0.7876534",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.786838... | 0.85668236 | 0 |
Problem 2: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Write a method that can rotate the last n digits of a number. For example: Note that rotating just 1 digit results in the original number being returned. You may use the rotate_array method from the previous exercise if you want. (Recomm... | def rotate_rightmost_digits(number, times)
rotated_number = number.to_s.split('')
rotated_number[(times * -1)..-1] = rotate_array(rotated_number[times*-1..-1])
rotated_number.join('').to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_rightmost_digits(number, n)\nall_digits = number.to_s.chars\nall_digits[-n..-1] = rotate_array(all_digits[-n..-1])\nall_digits.join.to_i\nend",
"def rotate_rightmost_digits(number, n)\np all_digits = number.to_s.chars\n# all_digits[-n..-1] = rotate_array(all_digits[-n..-1])\nend",
"def rotate_righ... | [
"0.8391217",
"0.835978",
"0.8349933",
"0.8316089",
"0.82851315",
"0.8275841",
"0.8262235",
"0.82566714",
"0.82449263",
"0.8137147",
"0.80840546",
"0.80435205",
"0.8026875",
"0.795778",
"0.7936077",
"0.7936077",
"0.79317474",
"0.79215944",
"0.78983253",
"0.78910375",
"0.788550... | 0.82787925 | 5 |
Problem 3: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: If you take a number like 735291, and rotate it to the left, you get 352917. If you now keep the first digit fixed in place, and rotate the remaining digits, you get 329175. Keep the first 2 digits fixed in place and rotate again to 3217... | def max_rotation(number)
number_digits = number.to_s.length
number = number.to_s.chars
number_digits.times do |n|
number[n-1..number_digits] = rotate_array(number[n-1..number_digits])
end
number.join('').to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_rotation(number)\n num_length = number.to_s.length\n\n while num_length > 0\n number = rotate_rightmost_digits(number, num_length)\n num_length -= 1\n end\n\n number\nend",
"def max_rotation(number)\n num_array = number.to_s.split(//)\n rotation = num_array.length\n loop do\n break if rot... | [
"0.8793686",
"0.8762939",
"0.86702144",
"0.86198914",
"0.86198914",
"0.8599965",
"0.858693",
"0.8564013",
"0.85540897",
"0.8495103",
"0.84926724",
"0.84751904",
"0.8443711",
"0.8422142",
"0.84191316",
"0.8414584",
"0.83999455",
"0.8377612",
"0.8309676",
"0.8299562",
"0.806738... | 0.87507695 | 2 |
Problem 4: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: You have a bank of switches before you, numbered from 1 to n. Each switch is connected to exactly one light that is initially off. You walk down the row of switches and toggle every one of them. You go back to the beginning, and on this ... | def light_sequence(n)
lights = {}
n.times {|num| lights[num+1] = "on"}
n.times do |num|
lights.each do |light, status|
if light % (num+1) == 0
lights[light] == "on" ? lights[light] = "off" : lights[light] = "on"
end
end
end
lights.select {|light, status| status == 'off'}.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light_switches(n)\n light_hash = {}\n 1.upto(n) { |i| light_hash[i] = true }\n 2.upto(n) do |current_pass|\n light_hash.map do |light, state|\n light_hash[light] = !state if light % current_pass == 0\n end\n end\n lights_left_on = light_hash.select do |_, state|\n state\n end\n result = []... | [
"0.792712",
"0.7749223",
"0.7739923",
"0.7692745",
"0.76643014",
"0.74957013",
"0.7375937",
"0.7313735",
"0.72194535",
"0.71955246",
"0.7178645",
"0.71327615",
"0.6890177",
"0.6886227",
"0.687644",
"0.67687666",
"0.67145634",
"0.668294",
"0.6666244",
"0.6658966",
"0.6572849",... | 0.78218555 | 1 |
Problem 5: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Write a method that displays a 4pointed diamond in an n x n grid, where n is an odd integer that is supplied as an argument to the method. You may assume that the argument will always be an odd integer. E: diamond(9) D: input an integer,... | def triangle(num)
stars = []
spaces = ''
number_of_stars = (3..num).to_a.reverse
current_num = num
loop do
spaces += ' '
stars << spaces + ("*" * current_num)
break if current_num == 1
current_num -= 2
end
stars.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diamond(num)\n raise ArgumentError, 'Odd number must be supplied' unless num.odd?\n\n i = 1\n middle = num / 2 + 1\n space_each_side = middle - 1\n\n while i <= num\n num_diamond = num - space_each_side * 2\n puts ' ' * space_each_side + '*' * num_diamond + ' ' * space_each_side\n if i < middle\n... | [
"0.79708976",
"0.7965833",
"0.7901512",
"0.7843196",
"0.782509",
"0.7797201",
"0.7791015",
"0.7630087",
"0.7627679",
"0.7627008",
"0.76105285",
"0.7590149",
"0.75405943",
"0.7520621",
"0.7514975",
"0.7501551",
"0.7491178",
"0.74647987",
"0.7423649",
"0.7413358",
"0.7356257",
... | 0.6711096 | 33 |
Problem 6: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: A stack is a list of values that grows and shrinks dynamically. In ruby, a stack is easily implemented as an Array that just uses the push and pop methods. A stackandregister programming language is a language that uses a stack of values... | def minilang(string)
register = 0
stack = []
string.split(' ').each do |cmd|
case cmd
when 'PUSH' then stack.push(register)
when 'ADD' then register += stack.pop.to_i
when 'SUB' then register -= stack.pop.to_i
when 'MULT' then register *= stack.pop.to_i
when 'DIV' then register ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stackEval(cmdStack, resStack, memState)\n # cmdStack => the command stack implemented using a list\n # resStack => the results stack implemented using a list\n # memState => the memory state implemented using a block. Will contain a map for variable names and their integers\n\n # cr... | [
"0.6332841",
"0.633018",
"0.6228028",
"0.6073753",
"0.5940878",
"0.5940878",
"0.5924584",
"0.5902276",
"0.588438",
"0.58516985",
"0.5842788",
"0.5814223",
"0.5796433",
"0.5755147",
"0.5735655",
"0.56363976",
"0.5635745",
"0.5589201",
"0.55873513",
"0.55779636",
"0.5554847",
... | 0.57360953 | 14 |
Problem 8: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Write a recursive method that computes the nth Fibonacci number, where nth is an argument to the method. E: fibonacci(1) == 1 fibonacci(2) == 1 fibonacci(3) == 2 fibonacci(4) == 3 fibonacci(5) == 5 fibonacci(12) == 144 fibonacci(20) == 6... | def fibonacci(current_num)
return current_num if current_num < 2
fibonacci(current_num -1) + fibonacci(current_num -2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend",
"def fibonacci(n)\n if n < 2\n return n\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend",
"def fibonacci(n)\n if n < 2\n... | [
"0.86330044",
"0.8520115",
"0.85185325",
"0.8517282",
"0.8505002",
"0.85015255",
"0.8484593",
"0.84775037",
"0.846297",
"0.846297",
"0.84616333",
"0.84551394",
"0.84490925",
"0.84419644",
"0.84419644",
"0.84419644",
"0.84419644",
"0.84291095",
"0.84220266",
"0.84141535",
"0.8... | 0.8290971 | 70 |
Problem 9: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Rewrite your recursive fibonacci method so that it computes its results without recursion. E: fibonacci(20) == 6765 fibonacci(100) == 354224848179261915075 D: Input integer, output integer A: Create a method fibonacci that takes one argu... | def fibonacci(num)
first, last = [1, 1]
3.upto(num) do
first, last = [last, first + last]
end
last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibonacci(num)\n return 1 if num <= 2\n fibonacci(num - 1) + fibonacci(num -2)\nend",
"def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend",
"def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend",... | [
"0.829699",
"0.8295511",
"0.8295511",
"0.8287801",
"0.8188932",
"0.81873995",
"0.81440985",
"0.81382084",
"0.81228006",
"0.81149834",
"0.81136876",
"0.8104607",
"0.8103951",
"0.8103353",
"0.8099077",
"0.8086643",
"0.8086643",
"0.8086643",
"0.8086643",
"0.8022646",
"0.8013671"... | 0.0 | -1 |
Problem 10: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: In this exercise, you are going to compute a method that returns the last digit of the nth Fibonacci number. E: fibonacci_last(15) > 0 (the 15th Fibonacci number is 610) fibonacci_last(20) > 5 (the 20th Fibonacci number is 6765) fibonac... | def fibonacci_last(integer)
last_2 = [1, 1]
3.upto(integer) do
last_2 = [last_2.last, (last_2.first + last_2.last) % 10]
end
last_2.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibonacci_last(nth)\n answer = fibonacci(nth)\n answer.to_s.chars[-1].to_i\nend",
"def fibonacci_last(n)\n num = fibonacci(n)\n num.to_s[-1].to_i\nend",
"def fibonacci_last(n)\n fibonacci(n).to_s[-1].to_i\nend",
"def fibonacci_last(n)\n return 1 if n.between?(1, 2)\n prev_last_digits = [1, 1]\n \... | [
"0.8083491",
"0.79659504",
"0.79616785",
"0.7922941",
"0.79221547",
"0.78886247",
"0.78805083",
"0.78015107",
"0.77934843",
"0.7722195",
"0.7653347",
"0.7633005",
"0.7582422",
"0.75569475",
"0.7520394",
"0.75141144",
"0.7446444",
"0.7393725",
"0.7379388",
"0.7365814",
"0.7344... | 0.75360006 | 14 |
The perform method is in charge of our code execution when enqueued. | def perform(registration)
RegisterMail.register_success_mail(registration).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n raise NotImplementedError, 'Implement this in a subclass'\n end",
"def perform\n \n end",
"def perform; end",
"def perform; end",
"def _run\n super.tap { reenqueue }\n end",
"def perform(&block); end",
"def execute\n adapter.enqueue klass, *args\n end",... | [
"0.71829754",
"0.7173839",
"0.7080186",
"0.7080186",
"0.70769703",
"0.7040585",
"0.70270985",
"0.69795537",
"0.6891379",
"0.6850613",
"0.68463117",
"0.68291926",
"0.6788192",
"0.6747695",
"0.6741019",
"0.6697734",
"0.6690095",
"0.6655567",
"0.6651279",
"0.6634857",
"0.6597891... | 0.0 | -1 |
GET /resource_types GET /resource_types.json | def index
respond_to do |format|
format.html # index.html.erb
format.json { render json: @resource_types }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def find_res... | [
"0.8383496",
"0.8339535",
"0.7316782",
"0.7301671",
"0.7277845",
"0.7234124",
"0.71839243",
"0.7138549",
"0.6978057",
"0.6942139",
"0.68985695",
"0.6896717",
"0.68536764",
"0.6807834",
"0.6777348",
"0.671819",
"0.67053664",
"0.6697003",
"0.6667048",
"0.66580653",
"0.6639848",... | 0.7421985 | 2 |
GET /resource_types/1 GET /resource_types/1.json | def show
@resource_fields = Field.where("resource_type_id = ?", params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @resource_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def index\n ... | [
"0.74772924",
"0.7396458",
"0.72913396",
"0.721878",
"0.7098519",
"0.70269924",
"0.70105314",
"0.6985157",
"0.69457066",
"0.6847062",
"0.6846108",
"0.68067735",
"0.6798842",
"0.6796883",
"0.6796883",
"0.6796883",
"0.6796883",
"0.6787315",
"0.6779011",
"0.67679393",
"0.6752532... | 0.7220071 | 3 |
GET /resource_types/new GET /resource_types/new.json | def new
@resource_type = ResourceType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @resource_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.... | [
"0.80984217",
"0.749518",
"0.72583467",
"0.7163297",
"0.7077784",
"0.7077784",
"0.7077784",
"0.6994682",
"0.699189",
"0.69738686",
"0.6973582",
"0.69266593",
"0.6924751",
"0.68841773",
"0.6876847",
"0.6873741",
"0.6855479",
"0.6854698",
"0.6847847",
"0.6828631",
"0.6825493",
... | 0.8351805 | 0 |
POST /resource_types POST /resource_types.jsojoins(:field_type)n | def create
@resource_type = ResourceType.new(params[:resource_type])
respond_to do |format|
if @resource_type.save
if params[:fields]
params[:fields].each do |param|
@field = Field.new(
:name => param[:name],
:field_type_id ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_as_json(field)\n res = \"'#{field.name}' => @#{field.name}\"\n field_base_type = _schema_base_class(field.type).type_sym\n\n if %i(record enum).include?(field_base_type)\n res += case field.type.type_sym\n when :array\n '.map { |... | [
"0.56644815",
"0.5489921",
"0.54534537",
"0.5450834",
"0.54328495",
"0.53692836",
"0.5260073",
"0.5241032",
"0.5222839",
"0.5208282",
"0.5194803",
"0.51610243",
"0.513126",
"0.5117086",
"0.50895536",
"0.5083326",
"0.5080772",
"0.50585425",
"0.5018466",
"0.4976705",
"0.4956067... | 0.5658422 | 1 |
PUT /resouresource_type_reference_idrce_types/1 PUT /resource_types/1.json | def update
respond_to do |format|
if @resource_type.update_attributes(params[:resource_type])
if params[:fields]
params[:fields].each do |param|
if param[:id]
@field = Field.find(param[:id])
@field.update_attributes(
:name ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_resourcetype\n @resourcetype = Resourcetype.find(params[:id])\n end",
"def set_resource_type\n @resource_type = ResourceType.find(resource_type_params[:id])\n end",
"def resource_type=(value)\n @resource_type = value\n end",
"def resource_type=(value)\n ... | [
"0.66288024",
"0.659765",
"0.6444448",
"0.6444448",
"0.6444448",
"0.6444448",
"0.62002903",
"0.6195512",
"0.6046237",
"0.5994548",
"0.59595627",
"0.5855925",
"0.5822086",
"0.58165985",
"0.57949823",
"0.57949823",
"0.5765026",
"0.57434666",
"0.5717103",
"0.5716621",
"0.5716172... | 0.592635 | 11 |
DELETE /resource_types/1 DELETE /resource_types/1.json | def destroy
begin
if @resource_type.destroy
respond_to do |format|
format.html { redirect_to resource_types_url }
format.json { head :no_content }
end
end
rescue
respond_to do |format|
format.html { redirect_to "index", notice: "Resource_type cann'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_resource(type, id, data = {})\n model = fetch_generic_object_definition(type, id, data)\n delete_resource_main_action(type, model, data)\n model\n rescue => err\n raise BadRequestError, \"Deleting #{model_ident(model, type)} - #{err}\"\n end",
"def destroy\n authorize :res... | [
"0.75429046",
"0.74166036",
"0.7370498",
"0.7339524",
"0.7250024",
"0.7213917",
"0.7186394",
"0.7171517",
"0.71469706",
"0.71456087",
"0.7096467",
"0.70753014",
"0.7072549",
"0.7066805",
"0.70355505",
"0.6999935",
"0.698017",
"0.6972318",
"0.6968882",
"0.6968364",
"0.6964999"... | 0.7696583 | 0 |
Initialize with model class | def initialize(model_class)
@model_class = model_class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize(model)\n @model = model\n end",
"def initialize_model\n end",
"def initialize_model\n ... | [
"0.82658815",
"0.8260851",
"0.8260851",
"0.8260851",
"0.7779325",
"0.7756454",
"0.74143684",
"0.73924434",
"0.73777056",
"0.7332128",
"0.7330528",
"0.7274797",
"0.723779",
"0.723779",
"0.7206016",
"0.71815187",
"0.7122468",
"0.7119589",
"0.7094314",
"0.70433825",
"0.7000995",... | 0.82601494 | 4 |
Set metadata as origin | def fields=(fields)
@fields = ::ActiveSupport::HashWithIndifferentAccess.new fields
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metadata(*args)\n self.metadata.set(*args)\n end",
"def metadata=(_); end",
"def setOrigin(origin)\n @origin = origin\n end",
"def metadata=(value)\n @metadata = value\n end",
"def metadata=(value)\n @metadata = value\n end",
... | [
"0.69283915",
"0.6648875",
"0.65009546",
"0.6282812",
"0.6282812",
"0.6251183",
"0.6251183",
"0.6251183",
"0.6251183",
"0.6235042",
"0.6167347",
"0.61413664",
"0.60971266",
"0.609449",
"0.609051",
"0.60719144",
"0.60089135",
"0.59800416",
"0.59609365",
"0.5959143",
"0.5930539... | 0.0 | -1 |
Set metadata for index page | def index_fields=(fields)
@index_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_meta\n puts 'meta'\n end",
"def initialize\n document = U.parse_html_from_file_or_uri(@base_uri, @index_html, \n :force_fetch => FORCE_FETCH)\n\n @index_metadata = get_metadata(document)\n U.write_yaml(@index_data, @index_metadata) ... | [
"0.67659014",
"0.6616011",
"0.66055864",
"0.66055864",
"0.6605296",
"0.6555782",
"0.65321064",
"0.65321064",
"0.6521355",
"0.6491442",
"0.64829355",
"0.6482531",
"0.6482531",
"0.6482531",
"0.6482531",
"0.6454628",
"0.6446398",
"0.63646877",
"0.63381803",
"0.63096374",
"0.6274... | 0.0 | -1 |
Set metadata for show page | def show_fields=(fields)
@show_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_meta\n puts 'meta'\n end",
"def store_metadata\n html = HTMLParse.new(url)\n self.meta_title = html.title\n self.meta_desc = html.desc\n end",
"def show\n @page_title = @podcast.title\n @page_description = @podcast.extrait\n @page_keywords = \"Podcasts, enseigneme... | [
"0.72025263",
"0.69920105",
"0.6989512",
"0.69105196",
"0.68542737",
"0.68542737",
"0.68542737",
"0.68460894",
"0.68245846",
"0.68245846",
"0.68170434",
"0.67233086",
"0.66963804",
"0.6692096",
"0.66808486",
"0.6680172",
"0.6680172",
"0.6680172",
"0.6680172",
"0.66790855",
"0... | 0.0 | -1 |
Set metadata for form (new/edit) page | def form_fields=(fields)
@form_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_new_form_information\n @information[:subtitle] = t('view.permissions.new_title')\n @information[:form_url] = [@parent, 'permissions', no_firm: @no_firm]\n end",
"def set_edit_form_information\n @information[:subtitle] = t('view.permissions.edit_title')\n @information[:form_url] = [... | [
"0.72939754",
"0.6946894",
"0.6788896",
"0.6603299",
"0.6434732",
"0.6432347",
"0.6317404",
"0.62168145",
"0.6216066",
"0.619247",
"0.6166297",
"0.61328864",
"0.61161834",
"0.5970437",
"0.5961768",
"0.5932819",
"0.5932819",
"0.5932819",
"0.5929848",
"0.59273195",
"0.59208006"... | 0.0 | -1 |
To guess the title for a resource. This title will be used on the following places: page title on show page in the response for autocomplete association field title of show link for a resource | def guess_title(_resource)
raise NotImplemented
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_title(resource)\n resource.try title_field_finder.find\n end",
"def resource_title\n title_field = components.values.last[:title] || :to_s\n resource.send(title_field.to_sym) if resource\n end",
"def guess_title(resource)\n ModuleUtils.try_to resource, title_field_find... | [
"0.8316989",
"0.7851038",
"0.78505635",
"0.77721363",
"0.76289654",
"0.716412",
"0.7109765",
"0.70912665",
"0.70200646",
"0.69883615",
"0.6945674",
"0.69441974",
"0.6824266",
"0.6816478",
"0.68162245",
"0.6793656",
"0.6789771",
"0.6760486",
"0.67566025",
"0.6745436",
"0.67271... | 0.74636567 | 5 |
Ensure type is present | def validate_presence_of(field_name, type)
type || raise(::ArgumentError, "Type is required for #{field_name}.")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_type(klass)\n ensure_par(type: '-t')\n if klass.KNOWN_TYPES[self[:type]].nil?\n raise \"Unrecognized type: #{self[:type]}\"\n end\n end",
"def check_type\n \t self.type = TYPES[0] if !TYPES.include?(self.type)\n\t end",
"def has_type?\n ! type.nil?\n end",
"def check_type... | [
"0.77729285",
"0.7704161",
"0.7560505",
"0.7064094",
"0.692323",
"0.6918804",
"0.6846484",
"0.66028047",
"0.6579896",
"0.65788656",
"0.6546868",
"0.6546868",
"0.6426992",
"0.6408479",
"0.6406387",
"0.63634545",
"0.63630074",
"0.6336469",
"0.63176376",
"0.6297555",
"0.62947947... | 0.6901915 | 7 |
Returns the Configuration for this resource. | def config
@config ||= Smartgen::Configuration.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration\n Configuration::get\n end",
"def configuration\n Configuration::get\n end",
"def configuration\n self[:configuration]\n end",
"def configuration\n self.class.configuration\n end",
"def configuration\n self.class.configuration\n ... | [
"0.79388976",
"0.79388976",
"0.7776188",
"0.7651384",
"0.7651384",
"0.7627841",
"0.7559593",
"0.74952406",
"0.7479493",
"0.7479213",
"0.74774563",
"0.7468118",
"0.74233526",
"0.74233526",
"0.73868895",
"0.73285186",
"0.7325427",
"0.7325427",
"0.7325427",
"0.7325427",
"0.73254... | 0.0 | -1 |
Generate files, based on the current Configuration. | def generate!
generator.invoke_all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_files\n ip = local_ip\n version = Farmstead::VERSION\n scaffold_path = \"#{File.dirname __FILE__}/scaffold\"\n scaffold = Dir.glob(\"#{scaffold_path}/**/*.erb\", File::FNM_DOTMATCH)\n scaffold.each do |file|\n basename = File.basename(file)\n folderstruct = file.... | [
"0.70923567",
"0.70407",
"0.6990284",
"0.6926751",
"0.6828299",
"0.68100923",
"0.6641247",
"0.66312045",
"0.6614509",
"0.66023564",
"0.65694267",
"0.6545237",
"0.65097785",
"0.64939386",
"0.64928365",
"0.6467922",
"0.6463168",
"0.64235246",
"0.6420177",
"0.6414279",
"0.634423... | 0.5796557 | 77 |
I THINK IM MERGING THIS METHOD THAT ALREADY EXISTS IN MY PARENT CLASS(APPLICATION CONTROLLER, USING SUPER), SO BY DOING THAT IM OVERRRIDING THAT CLASS AND MAKING ALL THE INFO IM PASSING AVAILABLE TO ALL MY VIES AND CONTROLLERS THKS TO INHERITANCE. | def url_options
{todo_list_id: params[:todo_list_id]}.merge(super) #ITS AUTOMATICALLY CALLED EVERYTIME A URL IS GENERATED.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_instance_methods(include_super=true) end",
"def parent_api; end",
"def parent_api; end",
"def super_method; end",
"def protected_instance_methods(include_super=true) end",
"def instance_methods(include_super=true) end",
"def overrides; end",
"def private; end",
"def initialize ( _caller ... | [
"0.60870045",
"0.60677075",
"0.60677075",
"0.60270256",
"0.60247606",
"0.60061765",
"0.5973717",
"0.596544",
"0.596327",
"0.596327",
"0.5901155",
"0.5901155",
"0.5897629",
"0.58964896",
"0.58944404",
"0.579621",
"0.5789971",
"0.57849133",
"0.57613987",
"0.57613987",
"0.575209... | 0.0 | -1 |
finds the first five primes | def count_prime(numbers)
prime_array = []
numbers.each do |num|
if prime?(num)
prime_array << num
end
end
output = "this array has #{numbers.length} numbers and #{prime_array.length} are prime: " + prime_array.join(", ")
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n) \n max = Math::sqrt(n).truncate\n (2..max).each {|val|\n if n % val == 0 then\n p val\n primes(n/val)\n return\n elsif val == max then\n p n\n return\n end\n }\nend",
"def primes(n)\nend",
"def primes_under(n)\n ... | [
"0.73485553",
"0.72513944",
"0.71873426",
"0.7142738",
"0.7114723",
"0.7069628",
"0.70629925",
"0.7061988",
"0.7056047",
"0.7028984",
"0.69411755",
"0.6935662",
"0.6907952",
"0.6894265",
"0.6890295",
"0.6888991",
"0.6885496",
"0.688398",
"0.68823606",
"0.6879862",
"0.6879862"... | 0.0 | -1 |
Cookbook Name:: tomcat Resource:: keystore.rb Copyright IBM Corp. 2017, 2018 | def run_cmd(cmd)
Mixlib::ShellOut.new(cmd).run_command.exitstatus == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keycerts; end",
"def keycert_files; end",
"def update_key_cert\n converge_by(\"Update #{new_resource} cert key method\") do\n\t kid = new_resource.keyid\n\t cid = new_resource.certid\n caid = new_resource.cacertid if !new_resource.cacertid.nil?\n\t todel='-alt'\n\t if @current_resource... | [
"0.6560407",
"0.63470495",
"0.6223508",
"0.62197",
"0.62186843",
"0.6190275",
"0.6107682",
"0.6107682",
"0.5937524",
"0.58946455",
"0.5849017",
"0.58374745",
"0.58021986",
"0.57981896",
"0.57981896",
"0.57937044",
"0.5769242",
"0.5769242",
"0.5769242",
"0.57677674",
"0.576466... | 0.0 | -1 |
I worked on this challenge [by myself, with: ]. largest_integer is a method that takes an array of integers as its input and returns the largest integer in the array +list_of_nums+ is an array of integers largest_integer(list_of_nums) should return the largest integer in the +list_of_nums+ If +list_of_nums+ is empty th... | def largest_integer(list_of_nums)
list_of_nums.sort!
return list_of_nums[-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_integer(list_of_nums)\n \tlen = list_of_nums.length\n\tlargest = list_of_nums[0]\n \tif len == 0\n\t\treturn nil\n \telsif len == 1\n \t\treturn largest\n \telse\n \t\tlist_of_nums.each do |num|\n \t\t\tif num > largest\n \t\t\t\tlargest = num\n \t\t \tend\n \t\tend\n \t\treturn largest\n \t... | [
"0.9034175",
"0.8946485",
"0.8938047",
"0.8928415",
"0.8882369",
"0.88500947",
"0.88149774",
"0.8808036",
"0.88069385",
"0.8720289",
"0.86900926",
"0.86813873",
"0.86569315",
"0.8629564",
"0.85903436",
"0.8555338",
"0.85351384",
"0.8497995",
"0.84604335",
"0.84164834",
"0.839... | 0.8482026 | 18 |
Creates a blank quote | def create
settings = Setting.run_sql_query("SELECT * FROM Settings WHERE dtCreated IN (SELECT MAX(dtCreated) FROM Settings GROUP BY name)")
settings_hash = {}
settings.each do |setting|
settings_hash[setting["name"]] = setting["value"]
end
count = Quote.where(dtCreated: DateTime.now.strftime(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end"... | [
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527",
"0.69660527"... | 0.0 | -1 |
Creates a blank quote ca | def remove_car
@quote_car = QuoteCar.where(id: params[:car])
@quote_car.destroy
return render_json_response({:msg => "ok"}, :ok)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_ca_data!\n self.private_key = OpenSSL::PKey::RSA.new(2048)\n public_key = private_key.public_key\n\n self.ca_cert = OpenSSL::X509::Certificate.new\n self.ca_cert.subject = self.ca_cert.issuer = self.subject # self-signed\n self.ca_cert.not_before = Time.now\n self.ca_cert.not_after =... | [
"0.5664664",
"0.5629879",
"0.5611972",
"0.5579369",
"0.5542708",
"0.5536832",
"0.55252475",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0.55250984",
"0... | 0.0 | -1 |
Get all possible status. | def all_status
status = Status.all
return render_json_response(status, :ok)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses\n api.get('status')\n end",
"def status_enum\n status_list\n end",
"def statuses; end",
"def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end",
"def list_possible_status_ids\n\ts... | [
"0.809433",
"0.7732141",
"0.7430762",
"0.742711",
"0.737841",
"0.7299032",
"0.7242177",
"0.7125727",
"0.6745043",
"0.6709533",
"0.66951156",
"0.66534764",
"0.66389066",
"0.6620211",
"0.660402",
"0.6602061",
"0.6578015",
"0.657234",
"0.6551321",
"0.6551321",
"0.6545473",
"0.... | 0.76213694 | 2 |
Get all quotes of a particular customer. | def particular_customer_quotes
offset = 0
filter = "%"
if (params[:offset].class.to_s != "NilClass" && params[:offset].integer?)
offset = params[:offset].to_i
end
if (params[:filter].class.to_s != "NilClass")
filter = "%" + params[:filter] + "%"
end
# lstQuotes = Quote.includes(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id... | [
"0.71521217",
"0.71521217",
"0.71521217",
"0.71171844",
"0.7053067",
"0.69887656",
"0.69722396",
"0.6859832",
"0.6850377",
"0.6752485",
"0.6670968",
"0.6610085",
"0.65651894",
"0.65310913",
"0.6528366",
"0.6511401",
"0.6506537",
"0.6476576",
"0.6470181",
"0.6429302",
"0.64233... | 0.70744073 | 4 |
0 counts as positive sign | def same_sign?(number, number2)
return (number * number2 > 0 or (number >= 0 and number2 >= 0))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign\n return -1 if self < 0\n return 1 if self > 0\n return 0\n end",
"def sign(v) \n if(v > 0)\n +1\n elsif(v < 0)\n -1\n else\n 0\n end\nend",
"def zero?; end",
"def zero?; end",
"def nozero(num)\n num > 0 ? -num : num \nend",
"def zero?() end",
"def zero?() end",
"d... | [
"0.79069316",
"0.7830235",
"0.7424184",
"0.7424184",
"0.73563755",
"0.73453236",
"0.73453236",
"0.7316459",
"0.73063517",
"0.7197056",
"0.71961325",
"0.71849084",
"0.7121114",
"0.7092033",
"0.7092033",
"0.7056567",
"0.704413",
"0.69872636",
"0.6974088",
"0.69341683",
"0.69327... | 0.0 | -1 |
GID of the user | def initialize(*args)
super
@action = :create
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unix_gid; end",
"def gid\n self['GID'].to_i\n end",
"def gid\n self['GID'].to_i\n end",
"def gid\n self['GID'].to_i\n end",
"def gid() end",
"def account_gid; account.gid end",
"def gid\n \"##{id}\"\n end",
"def unix_gid=(_arg0); end",... | [
"0.78416365",
"0.7773188",
"0.7773188",
"0.7773188",
"0.76888466",
"0.7595219",
"0.72343516",
"0.7197455",
"0.7125175",
"0.6977075",
"0.6977075",
"0.68465847",
"0.6842233",
"0.6748401",
"0.6748401",
"0.66131437",
"0.65247285",
"0.6460531",
"0.634359",
"0.6341721",
"0.6326873"... | 0.0 | -1 |
Set the attribute of the error to test. | def on_attribute(attribute)
@attribute = attribute
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error=(value) @error = true; end",
"def error=(val)\n @error = val\n self.state = 'error'\n end",
"def error=(value)\n @error = value\n end",
"def []=(attribute, error)\n self[attribute.to_sym] << error\n end",
"def []=(attribute, error)\n self... | [
"0.70878583",
"0.7084648",
"0.691707",
"0.6776746",
"0.67393965",
"0.6685827",
"0.625193",
"0.6231658",
"0.6187235",
"0.6161637",
"0.6142924",
"0.6120564",
"0.6117762",
"0.6117762",
"0.60640264",
"0.6009081",
"0.5941146",
"0.5901237",
"0.590055",
"0.58951557",
"0.58951557",
... | 0.0 | -1 |
=begin ================================================== PROBLEM: Write a method that takes one argument, a positive integer, and returns a string of alternating 1s and 0s, always starting with 1. The length of the string should match the given integer. Further exploration: Modify stringy so it takes an additional opt... | def stringy(num, b = 1)
string = ''
if b = 0
num.times { |v| v.odd? ? string.concat('1') : string.concat('0') }
return string
else
num.times { |v| v.odd? ? string.concat('0') : string.concat('1') }
return string
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringy(int, int1 = 1)\n if int && int1 != 0\n Array.new(int) { |i| i.even? ? '1' : '0' }.join\n elsif int1 == 0\n Array.new(int) { |i| i.even? ? '0' : '1' }.join\n end\nend",
"def stringy(integer, optional = 1)\n return_string = ''\n if optional == 1\n integer.times { |idx| idx.even? ? return_... | [
"0.8069861",
"0.8048098",
"0.79764473",
"0.7915742",
"0.7797426",
"0.7778363",
"0.77531654",
"0.7699496",
"0.76830786",
"0.765349",
"0.7600713",
"0.758895",
"0.75617623",
"0.7559037",
"0.7528772",
"0.75243056",
"0.75237733",
"0.7521259",
"0.75043243",
"0.7469403",
"0.74595004... | 0.77413166 | 7 |
"1,2,3,None,None,4,None,None,5,None,None," DFS, preorder, recursion | def serialize2(root, results = [])
if root.nil?
results.push('None')
return
end
results.push(root.val)
serialize2(root.left, results)
serialize2(root.right, results)
results.join(',')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dfs(node)\n preorder, visited = [], []\n dfs_visit(node, visited, preorder)\n preorder\nend",
"def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return cur... | [
"0.694815",
"0.65672797",
"0.64413065",
"0.64405996",
"0.6377096",
"0.6226266",
"0.62203777",
"0.6211299",
"0.6200334",
"0.6125805",
"0.6103299",
"0.6066069",
"0.6020705",
"0.60149914",
"0.5995899",
"0.5985339",
"0.59129065",
"0.58785707",
"0.58006227",
"0.57837284",
"0.57695... | 0.0 | -1 |
code goes here buy_fish can buy a fish that is an instance of the Fish class (FAILED 1) knows about its fishes (FAILED 2) | def buy_fish(fish_name)
fish = Fish.new(fish_name)
self.pets[:fishes] << fish
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:fishes].each { |fish| expect(fish).to be_a(Fish)}\n new_fish # expect(owner.pets[:fishes].count).to eq(1)\n # = knows about its fish... | [
"0.7892063",
"0.75105274",
"0.7415106",
"0.71251506",
"0.71078",
"0.71078",
"0.7060742",
"0.6967579",
"0.68729085",
"0.68459284",
"0.6725376",
"0.64211845",
"0.63710755",
"0.6366283",
"0.6306252",
"0.62900853",
"0.6183415",
"0.612467",
"0.5968325",
"0.5957169",
"0.59326524",
... | 0.7428818 | 2 |
buy_cat can buy a cat that is an instance of the Cat class (FAILED 3) knows about its cats (FAILED 4) | def buy_cat(cat_name)
cat = Cat.new(cat_name)
self.pets[:cats] << cat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_cat(name) # expect(owner.pets[:cats].count).to eq(0)\n new_cat = Cat.new(name) # owner.buy_cat(\"Crookshanks\")\n self.pets[:cats] << new_cat # owner.pets[:cats].each { |cat| expect(cat).to be_a(Cat) }\n new_cat # expect(owner.pets[:cats].count).to eq(1)\n # = knows about its cats; Owner knows ... | [
"0.77343345",
"0.7412346",
"0.7361814",
"0.7341354",
"0.7273689",
"0.7218789",
"0.7217713",
"0.7215786",
"0.71946025",
"0.7105338",
"0.7105338",
"0.7105338",
"0.7105338",
"0.7074326",
"0.70086014",
"0.6988133",
"0.6886837",
"0.5900335",
"0.57850444",
"0.57291144",
"0.5677426"... | 0.7232027 | 5 |
buy_dog can buy a dog that is an instance of the Dog class (FAILED 5) knows about its dogs (FAILED 6) | def buy_dog(dog_name)
dog = Dog.new(dog_name)
self.pets[:dogs] << dog
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\n # tommy.buy_cat(\"Garfield\")\n end",
"def buy_dog(name)\n Dog.new(name,self)\n end",
"def buy_dog(name)\n new_dog = Dog.new(name,self)\n end",
"def buy_dog(name)\n Dog.new(name, self)\n end",
"def buy_dog(name)\n Dog.new(nam... | [
"0.7821202",
"0.759405",
"0.75633985",
"0.75414926",
"0.75414926",
"0.7539524",
"0.7514351",
"0.75130224",
"0.74989164",
"0.74964404",
"0.74808854",
"0.72889435",
"0.72756505",
"0.7117511",
"0.6457529",
"0.63717353",
"0.6149575",
"0.60366565",
"0.6001052",
"0.5991753",
"0.596... | 0.74960583 | 10 |
walk_dogs walks the dogs which makes the dogs' moods happy (FAILED 7) | def walk_dogs
self.pets[:dogs].each do |dog|
dog.mood = "happy"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end",
"def walk_dogs\n self.dogs.each{|dog|\n dog.mood = \"happy\"\n }\n end",
"def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end",
"def walk_dogs \n self.dogs.each do |dog|\n dog.mood =... | [
"0.72698534",
"0.72123915",
"0.7209461",
"0.71824974",
"0.71406496",
"0.7115614",
"0.7053708",
"0.7039653",
"0.6944568",
"0.69413483",
"0.6889855",
"0.6846809",
"0.68118554",
"0.66077983",
"0.653068",
"0.6425921",
"0.6320209",
"0.6300419",
"0.6275439",
"0.6257949",
"0.6104061... | 0.70882684 | 6 |
play_with_cats plays with the cats which makes the cats moods happy (FAILED 8) | def play_with_cats
self.pets[:cats].each do |cat|
cat.mood = "happy"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_with_cats\n pets[:cats].each do |cat|\n cat.mood = \"happy\"\n end\n end",
"def play_with_cats\n @pets[:cats].each { |cat| cat.mood = \"happy\"}\n end",
"def play_with_cats\n#makes each of the cat's moods happy when played with\n pets[:cats].each do |cat|\n cat.mood = \"happy\"... | [
"0.66102177",
"0.6336153",
"0.63124394",
"0.59365517",
"0.5877527",
"0.5847523",
"0.58019",
"0.57824814",
"0.5780341",
"0.5767283",
"0.57447094",
"0.57197255",
"0.5716265",
"0.57112557",
"0.57064337",
"0.56984246",
"0.5640625",
"0.5630616",
"0.56266683",
"0.5612311",
"0.55936... | 0.6333235 | 2 |
feed_fish feeds the fishes which makes the fishes' moods happy (FAILED 9) | def feed_fish
self.pets[:fishes].each do |fish|
fish.mood = "happy"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed_fish\n pets[:fishes].each do |fish|\n fish.mood = \"happy\"\n end\n end",
"def feed_fish\n @pets[:fishes].each { |fish| fish.mood = \"happy\"}\n end",
"def feed_fish\n @pets[:fishes].each {|fish| fish.mood = \"happy\"}\n end",
"def feed(food)\n puts \"Mmmm, \" + food + \"!\"\n... | [
"0.72045267",
"0.70892316",
"0.707225",
"0.6678427",
"0.643399",
"0.6155729",
"0.61218",
"0.60823095",
"0.6074913",
"0.60460913",
"0.59686893",
"0.593222",
"0.5892891",
"0.58799773",
"0.5843985",
"0.57496357",
"0.57332045",
"0.5725145",
"0.5725145",
"0.5725145",
"0.5725145",
... | 0.6854544 | 3 |
sell_pets can sell all its pets, which make them nervous (FAILED 10) | def sell_pets
self.pets[:dogs].each do |dog|
dog.mood = "nervous"
end
self.pets[:cats].each do |cat|
cat.mood = "nervous"
end
self.pets[:fishes].each do |fish|
fish.mood = "nervous"
end
self.pets[:fishes] = []
self.pets[:dogs] = []
self.pets[:cats] = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sell_pets\n pets.each {|kind, moods|\n moods.each {|pets| pets.mood=(\"nervous\")}\n moods.clear\n }\n end",
"def sell_pets\n all_owner_pets = self.dogs + self.cats\n \n all_owner_pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end \n\n en... | [
"0.7185933",
"0.69073516",
"0.68372464",
"0.68290275",
"0.6668799",
"0.6603629",
"0.66026217",
"0.65897256",
"0.6563657",
"0.65608513",
"0.63159746",
"0.6314997",
"0.6294718",
"0.627704",
"0.6215362",
"0.6143786",
"0.6139594",
"0.6136496",
"0.6114417",
"0.609051",
"0.6084492"... | 0.6153385 | 15 |
list_pets can list off its pets (FAILED 11) | def list_pets
dog_n = self.pets[:dogs].size
cat_n = self.pets[:cats].size
fish_n = self.pets[:fishes].size
"I have #{fish_n} fish, #{dog_n} dog(s), and #{cat_n} cat(s)."
#self.pets.each do |key,value|
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pets\n\t\t@pets_list\n\tend",
"def list_pets\n \"I have #{pets[:fishes].count} fish, #{pets[:dogs].count} dog(s), and #{pets[:cats].count} cat(s).\"\n end",
"def list_pets\n \"I have #{pets[:fishes].count} fish, #{pets[:dogs].count} dog(s), and #{pets[:cats].count} cat(s).\"\n end",
"def list_pet... | [
"0.7706681",
"0.71577007",
"0.71577007",
"0.71334076",
"0.70857656",
"0.705761",
"0.70176697",
"0.700302",
"0.6876377",
"0.6876377",
"0.67844975",
"0.66361696",
"0.6573887",
"0.63973236",
"0.6341928",
"0.6326054",
"0.62993085",
"0.6298144",
"0.6298144",
"0.6224643",
"0.621015... | 0.6464818 | 13 |
overwrite the method of user module from mainrepo | def user_page name
@t[:title] = _var(:title, :www) if @t[:title] == nil
_tpl name, _var(:layout, :www).to_sym, :www
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def user_provider=(_arg0); end",
"def user; end",
"def user; end",
"def set_user; end",
"def user\n raise NotImplementedError\n end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def r... | [
"0.6504564",
"0.6504564",
"0.6504564",
"0.6504564",
"0.6428444",
"0.64247566",
"0.64247566",
"0.62942475",
"0.62362826",
"0.6207774",
"0.6207774",
"0.6207774",
"0.6207774",
"0.6187236",
"0.6169578",
"0.6161174",
"0.6098005",
"0.6097198",
"0.6049912",
"0.604174",
"0.60381645",... | 0.0 | -1 |
Returns the comments on the given startup. | def startup_comments(id)
get("1/startups/#{id}/comments")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments\n @docstring.all\n end",
"def comments\n\t\t\t@comments ||= read_comments\n\t\tend",
"def description\n comment_sections.first\n end",
"def co... | [
"0.62729996",
"0.62729996",
"0.62729996",
"0.62729996",
"0.62729996",
"0.62729996",
"0.6271587",
"0.6245342",
"0.6235109",
"0.6204977",
"0.6120188",
"0.6094312",
"0.6094312",
"0.6094312",
"0.6094312",
"0.6094312",
"0.6002215",
"0.5987624",
"0.59661573",
"0.59236956",
"0.58643... | 0.7397307 | 0 |
Returns up to 50 startups at a time, given an Array of ids. | def get_startups(ids)
params = { :ids => ids.join(',') }
get("1/startups/batch", params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_user_profiles_from_ids(ids)\n ids = ids.map{|i| Integer(i) }\n profiles = []\n count = 0\n ids.each_slice(100) do |arr|\n count += 1\n puts \"On count: #{count}\"\n begin\n data = Twit.fetch_users_by_ids(arr)\n ... | [
"0.67651993",
"0.66166914",
"0.60484505",
"0.6021994",
"0.58882123",
"0.5844549",
"0.5763887",
"0.5762793",
"0.5753166",
"0.57400334",
"0.5730895",
"0.56570125",
"0.55848336",
"0.5583678",
"0.55628765",
"0.5545807",
"0.55302626",
"0.5518771",
"0.5465705",
"0.5456989",
"0.5445... | 0.74887687 | 0 |
Returns the firehose of companies on AngelList. Results are paginated. | def all_startups(options={})
get("1/startups", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n end",
"def index\n @employees = Employee.all.order(created_at... | [
"0.6541858",
"0.618571",
"0.60380113",
"0.5960054",
"0.5942503",
"0.5928719",
"0.5902036",
"0.58749175",
"0.58127373",
"0.5812024",
"0.5764103",
"0.57514775",
"0.5718664",
"0.5715024",
"0.5715024",
"0.5715024",
"0.5715024",
"0.5715024",
"0.5715024",
"0.57001513",
"0.57001513"... | 0.0 | -1 |
Search for a startup given a URL slug. Responds like GET /startups/:id. | def startup_search(options={})
get("1/startups/search", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n if Config[\"ISEARCH\"]\n incremental_search\n else\n str = getstr('/')\n do_search NEXT, str\n end\n end",
"def find(slug)\n target_url = fetch_target_url(slug)\n\n fail(Errors::SlugNotFound, slug) unless target_url\n\n to_url(slug, target_url)\n... | [
"0.54361725",
"0.53489435",
"0.5294611",
"0.5292878",
"0.5270016",
"0.5260653",
"0.52603585",
"0.52084076",
"0.52073455",
"0.51507175",
"0.5139186",
"0.5105882",
"0.5086841",
"0.50842106",
"0.50469387",
"0.50155705",
"0.49937168",
"0.49776912",
"0.49465457",
"0.49241126",
"0.... | 0.68186027 | 0 |
Returns a company's startup roles. If direction is outgoing, then it returns the companies which the given company is tagged in. If direction is incoming, or omitted, then it returns the users and companies which are tagged in the given company. Results are paginated. | def startup_roles(id, options={})
get("1/startups/#{id}/roles", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @roles = @company.roles.ordered\n @roles = @roles.search(params[:sSearch]) if params.try(:[], :sSearch).present?\n @roles = @roles.page(page).per(per_page)\n end",
"def roles_instance(company)\r\n company_roles.find_by(user: self, company: company)\r\n end",
"def index\n @company =... | [
"0.51911014",
"0.50654566",
"0.4931237",
"0.48948213",
"0.46904027",
"0.46797135",
"0.46786702",
"0.45831951",
"0.45385292",
"0.4533901",
"0.45325634",
"0.44519255",
"0.44473284",
"0.4433605",
"0.4422826",
"0.43336686",
"0.43222022",
"0.4317427",
"0.43055034",
"0.43050846",
"... | 0.4696573 | 4 |
will update the settings | def updateNotifications(data)
self.comment_status = data[:comment_status].to_i
self.experience_status = data[:experience_status].to_i
self.experience_p_status = data[:experience_p_status].to_i
self.feelike_status = data[:feelike_status].to_i
self.follows_status = data[:follows_status].to_i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_settings\n end",
"def update_settings(settings)\n @bridge.update_settings(settings)\n end",
"def update\n\n ok = true\n # Save settings\n @setting = Setting.get_settings\n if @setting.update(settings_params)\n # Notify to the music server the settings change\n ... | [
"0.90265507",
"0.7738973",
"0.75129527",
"0.7425245",
"0.74152315",
"0.7180644",
"0.7150864",
"0.7028868",
"0.70081246",
"0.69973284",
"0.6941449",
"0.6936152",
"0.6903238",
"0.6825875",
"0.6819927",
"0.67667764",
"0.6751343",
"0.67478555",
"0.6741506",
"0.6721444",
"0.671051... | 0.0 | -1 |
output to a file, and the streaming output handler | def log_and_stream(output)
write_file output, @filename if @filename
@block.call(output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_to_file\n @output=:file\n end",
"def process_output(file=nil)\n output = if file\n File.new(file.to_s,'w')\n else\n STDOUT\n end\n\n yield output if block_given?\n\n output.flush\n output.close\n return ni... | [
"0.70496744",
"0.6911427",
"0.677642",
"0.6775058",
"0.67674965",
"0.6717924",
"0.66240805",
"0.65162593",
"0.64997506",
"0.64211464",
"0.6414503",
"0.63471895",
"0.63361895",
"0.633134",
"0.63018715",
"0.6292471",
"0.62518466",
"0.622082",
"0.6200323",
"0.61857706",
"0.61738... | 0.729572 | 0 |
Run external command with timing information streams and logs the output of the command as well does not (currently) check exit status codes | def run_cmd(cmd)
ret = ""
start = Time.now.to_i
log_and_stream "<div class='command'><h4>Running #{cmd}</h4><p class='output'>"
time = Benchmark.measure do
Open3.popen3(cmd) do |inn, out, err|
output = ""
until out.eof?
# raise "Timeout" if output.empty? &... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _external(cmd, opts={})\n #log :info, \"cmd is ||#{cmd.inspect}||\"\n log :info, \"starting [#{cmd.join(' ')}]\" if !opts.has_key?(:silent)\n\n start = Time.now\n outfile = Tempfile.new\n pid = Process.spawn(*cmd, out: outfile.fileno, err: :out)\n SUBPROCS << pid # add to halt list\n\n begin\n ... | [
"0.7211847",
"0.7065461",
"0.7041343",
"0.67256796",
"0.6720106",
"0.667679",
"0.6659391",
"0.6583466",
"0.6563336",
"0.6563336",
"0.6563336",
"0.6563336",
"0.65072024",
"0.64922863",
"0.64795613",
"0.64740103",
"0.64442164",
"0.64410657",
"0.644074",
"0.643898",
"0.6432363",... | 0.662283 | 7 |
pokemon_name = [] def pokemons_names(pokemon_name) Pokemon.each do |pokemon| pokemon_name << pokemon[:name] end pokemon_name end def pokemons_names pokemon_name = [] Pokemon.each do |pokemon| pokemon_name << pokemon[:name] end pokemon_name end | def pokemons_names
Pokemon.collect do |pokemon|
pokemon[:name]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_names(pokemon)\n pokemon.map do |pokemon_data|\n pokemon_data[:name]\n end\nend",
"def list_of_names\n World.politicians.map { |p| p.name } + World.voters.map { |p| p.name}\nend",
"def get_name(pokemon)\n pokemon['species']['name']\nend",
"def list_pokemon_stats\n puts(\"Name: {#name}\")\n ... | [
"0.8352148",
"0.6975621",
"0.6961352",
"0.6800399",
"0.67062896",
"0.6685342",
"0.6606104",
"0.65480524",
"0.652607",
"0.65034187",
"0.63971573",
"0.63942194",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.63625735",
"0.6362492"... | 0.82182777 | 1 |
You can provide the weight as a integer percentage 40 meaning 40%, or in decimal form. Therefore, 40% would be 0.4 | def initialize(title, weight)
@grades = []
@title = title
# If the weight is an Integer convert it to a Float,
# else if is a float then pass it on unchanged.
@weight = weight.is_a?(Fixnum) ? weight/100.0 : weight
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bakers_percent weight\n weight / bakers_percent_100.to_f\n end",
"def weight\n 2 # ounces\n end",
"def weight; end",
"def weight=(value)\n @weight = value\n end",
"def weight\n 0\n end",
"def weight_class\n if @weight < 215\n \"Lightweight\"\n elsi... | [
"0.80317044",
"0.74939483",
"0.73584646",
"0.7265818",
"0.7246008",
"0.7162207",
"0.7044672",
"0.70015055",
"0.70014066",
"0.6976318",
"0.6963033",
"0.6956574",
"0.69250095",
"0.6909406",
"0.6846733",
"0.6839247",
"0.68391454",
"0.6834041",
"0.6819097",
"0.68037474",
"0.67601... | 0.6298062 | 74 |
Use callbacks to share common setup or constraints between actions. | def find_resource
@resource = resource_class.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 resource_params
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
List institution by id | def show
institution = Institution.find(params[:id])
render json: { status: '200', message: "Loaded Institution with id #{params[:id]}", data: institution }, status: :ok
rescue ActiveRecord::RecordNotFound
render json: { status: '404', error: "No Institution with id #{params[:id]}", data: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def institution(id = nil)\n res = Connection.get('institutions', id)\n id.nil? ? Institution.all(res) : Institution.new(res)\n end",
"def institution(id=nil)\n @institution = Plaid::Institution.new\n res = self.get('institutions',id)\n id.nil? ? @institution.instantiate_all_institutio... | [
"0.7553722",
"0.72237504",
"0.64025193",
"0.63459146",
"0.6315954",
"0.6314081",
"0.6272273",
"0.62659115",
"0.6217061",
"0.6211757",
"0.6166694",
"0.61565566",
"0.6101913",
"0.6101913",
"0.6101913",
"0.6101913",
"0.60868335",
"0.60868335",
"0.60103387",
"0.5995426",
"0.59794... | 0.6011277 | 18 |
Update institution by id Handling errors from not finding the id and wrong data | def update
institution = Institution.find(params[:id])
if institution.update(institution_params)
render json: { status: '200', message: "Updated Institution with id #{params[:id]}", data: institution }, status: :ok
else
render json: { status: '422', error: 'Institution not up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_institution\n @institution = current_user.institutions.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { errors: [I18n.t('api.institution.not_found')] }, status: :not_found\n end",
"def update\n @institution = Institution.find(params[:id])\n\n respond_to do |f... | [
"0.717103",
"0.7150022",
"0.71217936",
"0.70621365",
"0.70548487",
"0.6986477",
"0.69753784",
"0.6964017",
"0.6932576",
"0.6932301",
"0.6890543",
"0.6877638",
"0.6799948",
"0.6799948",
"0.6799948",
"0.6799948",
"0.6790408",
"0.67805046",
"0.6764449",
"0.66290385",
"0.6588837"... | 0.75500005 | 0 |
Returns boolean as to wether the specified constant is defined. Examples: const_defined? 'String' true const_defined? 'WierdClass' false const_defined? ['ActiveRecord', 'Base'] true (assuming Active Record is installed) | def const_defined?(klass)
klass = [klass] unless klass.kind_of? Array
klass.inject(Object) do |context, scope|
if context.const_defined?(scope)
context.const_get(scope)
else
return false
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constant_defined?(name); end",
"def constant_is_defined?(const_name)\n const_name.to_s.sub(/\\A::/,'').split('::').inject(Object) do |namespace, name|\n begin\n result = namespace.const_get(name)\n\n # const_get looks up the inheritence chain, so if it's a class\n ... | [
"0.7899093",
"0.77737206",
"0.7770563",
"0.7666365",
"0.7652031",
"0.75903374",
"0.7571167",
"0.7369838",
"0.7369838",
"0.7322153",
"0.72399926",
"0.7172762",
"0.713877",
"0.7135864",
"0.7074048",
"0.705255",
"0.6930371",
"0.6914746",
"0.6904092",
"0.68911463",
"0.6664005",
... | 0.74345434 | 7 |
Returns the specified class. Examples: const_get 'String' String const_get ['ActiveRecord', 'Base'] ActiveRecord::Base | def const_get(klass)
klass = [klass] unless klass.kind_of? Array
klass.inject(Object) do |context, scope|
context.const_get(scope)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_class(name)\n # 'self' -- the class from which get_class is called.\n self.const_get(name)\n end",
"def get_constant(basis, class_string)\n begin\n class_string.split('::').reduce(basis) do |basis, const|\n basis.const_get(const, false)\n end\n rescue NameError\n ... | [
"0.7334412",
"0.7214519",
"0.7104253",
"0.6873072",
"0.6851775",
"0.68110424",
"0.6771656",
"0.6707184",
"0.6704635",
"0.6664223",
"0.6611103",
"0.6603974",
"0.6578395",
"0.65712726",
"0.65712726",
"0.6550021",
"0.65496194",
"0.6544749",
"0.65220696",
"0.6471819",
"0.6458103"... | 0.6863396 | 4 |
Removes the specified class. Examples: const_get 'String' String const_get ['ActiveRecord', 'Base'] ActiveRecord::Base | def const_remove(klass)
klass = [klass] unless klass.kind_of? Array
if klass.length > 1
Utility.const_get(klass[0..-2]).send :remove_const, klass.last
elsif klass.any?
Object.send :remove_const, klass.last
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_class ( klass )\n klass = klass.name.to_s if klass.kind_of? Class\n Object.class_exec { remove_const klass } if Object.const_defined? klass\nend",
"def destroy_class ( klass )\n klass = klass.name.to_s if klass.kind_of? Class\n Object.class_exec { remove_const klass } if Object.const_defined? kla... | [
"0.7097662",
"0.7097662",
"0.6871307",
"0.6773116",
"0.6773116",
"0.66102207",
"0.6467323",
"0.6315427",
"0.62628007",
"0.6225008",
"0.6170541",
"0.61001974",
"0.6087947",
"0.6046526",
"0.6029146",
"0.60193866",
"0.5984087",
"0.5979203",
"0.59605956",
"0.59605956",
"0.5959502... | 0.72459763 | 0 |
end before filter methods | def index
if params[:show_deleted]
@users = User.order('login ASC')
else
@users = User.active.order('login ASC')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter\n end",
"def apply_filter\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def filters; end",
"def filters; end",
"def filter\n super\n end",
"def filters\n end",
"def filter!; end",
"def global_filter; end",
"def after_filter; end",
"def filter_... | [
"0.8296995",
"0.82520986",
"0.821787",
"0.821787",
"0.821787",
"0.81738895",
"0.81738895",
"0.79680437",
"0.7895059",
"0.77649826",
"0.75688267",
"0.74624014",
"0.74499047",
"0.74499047",
"0.73177344",
"0.72990304",
"0.72163707",
"0.72163707",
"0.71732414",
"0.71664345",
"0.7... | 0.0 | -1 |
setter should hit all checkers of the variable | def blocks_to_hit
super + (task.variable ? task.variable.checkers : [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set; end",
"def set; end",
"def __setter__\n \"#{self}=\"\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def x=(value)\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"de... | [
"0.67743814",
"0.67743814",
"0.6687141",
"0.6473359",
"0.6364297",
"0.63558584",
"0.635131",
"0.63388634",
"0.6333896",
"0.63212645",
"0.63179046",
"0.6286533",
"0.62589914",
"0.62398773",
"0.6228378",
"0.622298",
"0.6216064",
"0.61827826",
"0.6178179",
"0.6173674",
"0.615168... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.