query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /bet_winners GET /bet_winners.json | def index
@bet_winner = BetWinner.find_by user_id: current_user.id
@countries = {"" => "",
"ブラジル" => "BRA",
"メキシコ" => "MEX",
"オランダ" => "NLD",
"チリ" => "CHL",
"コロンビア" => "COL",
"ギリシャ" => "GRC",
... | {
"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 @bid_winners = BidWinner.all\n end",
"def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format... | [
"0.7195063",
"0.7145797",
"0.67371273",
"0.6697946",
"0.64387745",
"0.6433053",
"0.6323343",
"0.6318709",
"0.6314709",
"0.6271426",
"0.62694806",
"0.62616295",
"0.62246233",
"0.6211078",
"0.6187966",
"0.6184599",
"0.61695004",
"0.61664647",
"0.6152172",
"0.61129695",
"0.60816... | 0.5583938 | 96 |
GET /bet_winners/1 GET /bet_winners/1.json | def show
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 @bid_winners = BidWinner.all\n end",
"def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format... | [
"0.711579",
"0.69510764",
"0.67279214",
"0.65919524",
"0.65883726",
"0.6525028",
"0.6473071",
"0.6392419",
"0.63723123",
"0.63601637",
"0.6349975",
"0.63315904",
"0.62163305",
"0.6185323",
"0.6173673",
"0.6169284",
"0.61344767",
"0.6132582",
"0.6077086",
"0.6074116",
"0.60717... | 0.0 | -1 |
POST /bet_winners POST /bet_winners.json | def create
@bet_winner = BetWinner.new(bet_winner_params)
respond_to do |format|
if @bet_winner.save
format.html { redirect_to @bet_winner, notice: 'Bet winner was successfully created.' }
format.json { render :show, status: :created, location: @bet_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.7258499",
"0.6514531",
"0.643887",
"0.64005816",
"0.63990235",
"0.62919396",
"0.62724364",
"0.62656236",
"0.6231302",
"0.6208956",
"0.61915463",
"0.61759084",
"0.6147461",
"0.6087893",
"0.6019758",
"0.60074204",
"0.5994387",
"0.598773",
"0.598655",
"0.5945289",
"0.59352964... | 0.7142821 | 1 |
PATCH/PUT /bet_winners/1 PATCH/PUT /bet_winners/1.json | def update
respond_to do |format|
if @bet_winner.update(bet_winner_params)
format.html { redirect_to @bet_winner, notice: 'Bet winner was successfully updated.' }
format.json { render :show, status: :ok, location: @bet_winner }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n if @bet.update_attributes(params[:bet])\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format... | [
"0.70754606",
"0.6952498",
"0.6952498",
"0.6952498",
"0.6914687",
"0.67278105",
"0.66614693",
"0.6571196",
"0.64845055",
"0.6482303",
"0.6479204",
"0.6428967",
"0.6414069",
"0.6399907",
"0.6292957",
"0.6264341",
"0.62525004",
"0.62369055",
"0.6221181",
"0.6202749",
"0.6199225... | 0.71008104 | 0 |
DELETE /bet_winners/1 DELETE /bet_winners/1.json | def destroy
@bet_winner.destroy
respond_to do |format|
format.html { redirect_to bet_winners_url, notice: 'Bet winner was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.7303999",
"0.7303999",
"0.7096991",
"0.7035749",
"0.7014956",
"0.6874355",
"0.6871629",
"0.6847071",
"0.68272287",
"0.68161106",
"0.6778511",
"0.67624986",
"0.6725841",
"0.66852075",
"0.6666986",
"0.6662528",
"0.66330487",
"0.66068",
"0.657784",
"0.6539272",
"0.6534418",
... | 0.72691846 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_bet_winner
@bet_winner = BetWinner.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 bet_winner_params
params.require(:bet_winner).permit(:winner_first, :winner_second, :winner_third)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
TODO: this should be moved upwards in the controller hierarchy, and make it a replacement for current_user | def uri_user
@uri_user ||= Carto::User.where(id: current_user.id).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n\t\tview_context.current_user\n\tend",
"def current_user\n @user\n end",
"def current_user\n @current_user\n end",
"def current_user\n @current_user\n end",
"def current_user\n @current_user\n end",
"def current_user\n @current_user\n end",
"def context; { user: cu... | [
"0.7666586",
"0.75107825",
"0.7483979",
"0.7483979",
"0.7483979",
"0.7483979",
"0.74610853",
"0.7457236",
"0.7431448",
"0.7431448",
"0.74167293",
"0.73922926",
"0.73845893",
"0.7374389",
"0.73522913",
"0.7342451",
"0.73305345",
"0.73305345",
"0.7322441",
"0.7306801",
"0.73068... | 0.0 | -1 |
human readable list of variant options | def fenix_variant_options(v, options={})
values = v.option_values.sort do |a, b|
a.option_type.position <=> b.option_type.position
end
values.to_a.map! do |ov|
"#{ov.presentation}"
end
values.to_sentence({ words_connector: ", ", two_words_connector: ", " })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variant_options(v, options={})\n v.options_text\n end",
"def variant_options(v, options={})\n #content_tag(:ul, :class => \"list\")\n # v.options_text\n #we have hide additional price shown in varians\n # if variant_price v\n # v.options_text.to_s + \" \" + (variant_price ... | [
"0.8179612",
"0.74293745",
"0.7166239",
"0.7083214",
"0.69349",
"0.6799214",
"0.6793235",
"0.6793235",
"0.6724374",
"0.6658755",
"0.6596978",
"0.6536883",
"0.6485548",
"0.64852405",
"0.64108723",
"0.63450634",
"0.6321704",
"0.6301741",
"0.6282074",
"0.6259055",
"0.62476933",
... | 0.7753867 | 2 |
human readable list of product options | def fenix_product_options_types(p)
values=p.option_types.to_a.map! do |ot|
"#{ot.presentation}"
end
values.to_sentence({ words_connector: ", ", two_words_connector: ", " })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_addons\n res = product_options.map { |po| po.name }.join(', ')\n unless res.blank?\n res = \"(#{res})\"\n end\n res\n end",
"def variant_options(v, allow_back_orders = Spree::Config[:allow_backorders])\n list = v.option_values.map { |ov| \"#{ov.option_type.presentation}: #{ov.present... | [
"0.7184086",
"0.69830596",
"0.6791546",
"0.675949",
"0.67120975",
"0.6676874",
"0.6657305",
"0.66521835",
"0.6613013",
"0.6528155",
"0.6528155",
"0.64917177",
"0.64385605",
"0.6434302",
"0.6420369",
"0.64166176",
"0.6399657",
"0.63951415",
"0.63885003",
"0.63573873",
"0.63241... | 0.7707014 | 1 |
"AJAX" style post request to the server, with a callback | def post(target, data, &block)
xhr = XMLHttpRequest.new()
xhr.open('POST', "actions/#{target}", true)
xhr.setRequestHeader('Content-Type', 'application/json;charset=utf-8')
xhr.responseType = 'text'
def xhr.onreadystatechange()
if xhr.readyState == 4
data = nil
begin
if xhr.status ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, headers, body, &callback)\n request('POST', path, headers, body, &callback)\n end",
"def post; end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def POST; end",
"def send\n http = EM::HttpRequest.new(@uri).post(@request_options)\n\n http.cal... | [
"0.67773664",
"0.6595329",
"0.6541795",
"0.65414405",
"0.6538024",
"0.65194964",
"0.64949596",
"0.6427209",
"0.6405466",
"0.6399475",
"0.63986313",
"0.6373768",
"0.6337788",
"0.6322749",
"0.6308524",
"0.63063866",
"0.63044107",
"0.62966335",
"0.62949",
"0.6293085",
"0.6292252... | 0.6601284 | 1 |
before_ callbacks will only stop actions if they return false | def check_if_admin
if admin?
errors.add(:admin, "You can't delete admin users")
throw :abort # New in ActiveRecord 5
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_actions; end",
"def stop_hooks_unless(result)\n\t\t\t\t\t(result == true) ? continue(true) : stop(false)\n\t\t\t\tend",
"def run_before_instance_hooks(hook)\n instance_hooks(hook).each{|b| return false if b.call == false}\n end",
"def before_action \n end",
"def before_run;... | [
"0.6683273",
"0.6402097",
"0.6366943",
"0.63314223",
"0.632032",
"0.6255987",
"0.62473476",
"0.62302667",
"0.6142563",
"0.61359036",
"0.6049641",
"0.60466594",
"0.6034906",
"0.60314375",
"0.6016427",
"0.60069805",
"0.59757984",
"0.59312373",
"0.5930276",
"0.5914965",
"0.59149... | 0.0 | -1 |
eql? and hash are used to see if an item is in a Set | def eql?(other)
(@x == other.x) && (@y == other.y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(set)\n equal?(set) and return true\n\n set.is_a?(Set) && size == set.size or return false\n\n hash = @hash.dup\n set.all? { |o| hash.include?(o) }\n end",
"def in_set?(set, element)\n set.each do |t|\n if t == element\n return true\n end\n end\n return fa... | [
"0.77634525",
"0.7540183",
"0.7355722",
"0.70217264",
"0.69964236",
"0.69964236",
"0.69964236",
"0.6988335",
"0.69597197",
"0.6945075",
"0.6909692",
"0.6881913",
"0.6878455",
"0.68122613",
"0.6796444",
"0.67692757",
"0.6760324",
"0.67255",
"0.67174375",
"0.671414",
"0.6662749... | 0.0 | -1 |
the spaceship operator is used to sort the Set | def <=>(other)
cmp_x = (@x <=> other.x)
return cmp_x unless cmp_x.zero?
@y <=> other.y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spaceship(left, right, **options)\n case\n # @see https://www.w3.org/TR/sparql11-query/#OperatorMapping\n # @see https://www.w3.org/TR/sparql11-query/#modOrderBy\n when left.is_a?(RDF::Literal) && right.is_a?(RDF::Literal)\n # @see https://www.w3.org/TR/xpath-functions/#str... | [
"0.62999237",
"0.6160827",
"0.58486307",
"0.5487279",
"0.53786707",
"0.53241557",
"0.5303843",
"0.52977884",
"0.52872926",
"0.52827233",
"0.5272578",
"0.52692986",
"0.5261007",
"0.5258451",
"0.524004",
"0.517907",
"0.517907",
"0.5175537",
"0.5169865",
"0.5169552",
"0.5142332"... | 0.0 | -1 |
Number of spaces where a beacon cannot be present on row(n) | def row(r)
ranges = Ranges.new
@sensors.sort.each{|loc, sen|
range_at_r = sen.range - (loc.y - r).abs
next if range_at_r.negative?
ranges.union([loc.x - range_at_r, loc.x + range_at_r])
}
ranges
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mine_count\n grid.flatten.count { |space| space.mine }\n end",
"def counting_spaces\n i = 0\n while i < 9 do\n result = @array.at(i)\n result.each do |num|\n if num == 0\n @@count = @@count + 1\n end\n end\n i = i + 1\n end\n end",
"def adjacent_mine... | [
"0.6727308",
"0.670149",
"0.668819",
"0.6648776",
"0.6630279",
"0.656853",
"0.654305",
"0.6539288",
"0.65344507",
"0.65035117",
"0.64864093",
"0.6458655",
"0.6402478",
"0.63932157",
"0.6391314",
"0.63787526",
"0.6362489",
"0.63481396",
"0.63440984",
"0.6336241",
"0.63314146",... | 0.0 | -1 |
write variable into hash | def write_inheritable_attr(key, value)
inheritable_attrs[key] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_hash(hash)\n\t\twrite_byte(3)\n\t\thash.each do |key, value|\n\t\t\twrite_utf(key.to_s)\n\t\t\twrite(value)\n\t\tend\n\n\t\t# write the end object flag 0x00, 0x00, 0x09\n\t\twrite_int16_network(0)\n\t\twrite_byte(9)\n\tend",
"def add(item, quantity, hash)\n hash[item] = quantity\n puts hash\nend",
... | [
"0.64423436",
"0.6374256",
"0.62840223",
"0.61459297",
"0.60785025",
"0.60357195",
"0.6015897",
"0.596192",
"0.59454554",
"0.5934762",
"0.5934762",
"0.5934762",
"0.5934762",
"0.5934762",
"0.5934762",
"0.5934762",
"0.59059334",
"0.5897666",
"0.5883037",
"0.58777523",
"0.587299... | 0.0 | -1 |
read variable from hash | def read_inheritable_attr(key)
inheritable_attrs[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_from_hash(hash, key)\n # return the correct value using the hash and key parameters\n hash[key]\nend",
"def load_var(load_hash)\n @wrong_arr = load_hash['wrong_arr']\n @guess_arr = load_hash['guess_arr']\n @turn = load_hash['turn']\n @resolved_arr = load_hash['resolved_arr']\n @solution... | [
"0.6865548",
"0.67546827",
"0.64368683",
"0.64075506",
"0.6376753",
"0.62561816",
"0.6111337",
"0.61100525",
"0.61091745",
"0.6101454",
"0.6094522",
"0.60715634",
"0.60549307",
"0.60394084",
"0.60308695",
"0.5998124",
"0.59437555",
"0.5926804",
"0.58993167",
"0.58869183",
"0.... | 0.0 | -1 |
GET /members GET /members.json | def index
@members = Member.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @members }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n ... | [
"0.85555315",
"0.8368444",
"0.80864495",
"0.79692763",
"0.79227495",
"0.7810278",
"0.7673862",
"0.7492891",
"0.74862355",
"0.7377688",
"0.7360226",
"0.7336541",
"0.7336541",
"0.7235276",
"0.7182636",
"0.718245",
"0.71680915",
"0.71680915",
"0.71680915",
"0.71680915",
"0.71680... | 0.7484284 | 11 |
GET /members/1 GET /members/1.json | def show
@member = Member.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n ... | [
"0.8023607",
"0.74336106",
"0.7342003",
"0.7342003",
"0.7342003",
"0.73214304",
"0.7298026",
"0.72192717",
"0.7218691",
"0.7147416",
"0.71341074",
"0.70936525",
"0.70936525",
"0.70766354",
"0.7053166",
"0.7035738",
"0.7028867",
"0.69767696",
"0.6938388",
"0.6938388",
"0.69383... | 0.7146131 | 18 |
GET /members/new GET /members/new.json | def new
@member = Member.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @member = Member.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m... | [
"0.79043746",
"0.7789812",
"0.76272595",
"0.75811505",
"0.7581038",
"0.7546918",
"0.7513603",
"0.7477062",
"0.7446343",
"0.74113417",
"0.7382035",
"0.72367895",
"0.72031033",
"0.71898484",
"0.7185999",
"0.7159002",
"0.7158302",
"0.7136005",
"0.7136005",
"0.7136005",
"0.713469... | 0.78913903 | 7 |
POST /members POST /members.json | def create
@member = Member.new(params[:member])
respond_to do |format|
if @member.save
format.html { redirect_to @member, notice: 'Member was successfully created.' }
format.json { render json: @member, status: :created, location: @member }
else
format.html { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_member_to_list(user, list, member_id, options={})\n post(\"/#{user}/#{list}/members.json\", options.merge(:id => member_id))\n end",
"def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.ge... | [
"0.6734318",
"0.6707801",
"0.6686722",
"0.66615456",
"0.66511947",
"0.6612481",
"0.6595865",
"0.6569636",
"0.65571123",
"0.65534073",
"0.6552213",
"0.6539384",
"0.6535769",
"0.6534659",
"0.6526704",
"0.6526704",
"0.6526704",
"0.6526704",
"0.6507443",
"0.6491895",
"0.64855516"... | 0.6571146 | 9 |
PUT /members/1 PUT /members/1.json | def update
@member = Member.find(params[:id])
respond_to do |format|
if @member.update_attributes(params[:member])
format.html { redirect_to @member, notice: 'Member was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n params.require(:member).permit(:name)\n if @member.update(member_params)\n format.html { redirect_to @member, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n ... | [
"0.6593529",
"0.64914197",
"0.64502794",
"0.6438251",
"0.6406436",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6333237",
"0.6329286",
"0.6317044",
"0.6317044",
"0.6271256",
"0.6264795",
"0.625334",
... | 0.640992 | 7 |
DELETE /members/1 DELETE /members/1.json | def destroy
@member = Member.find(params[:id])
@member.destroy
respond_to do |format|
format.html { redirect_to members_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n \n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to me... | [
"0.76810235",
"0.7641482",
"0.7641482",
"0.76110274",
"0.76110274",
"0.7567863",
"0.7567863",
"0.7557461",
"0.73533356",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7285102",
"0.7273715",... | 0.7545494 | 13 |
Transforms this string into XHTML. | def to_xhtml
with_protected_tags(self, VERBATIM_TAGS, true) do |text|
html = with_protected_tags(text, PROTECTED_TAGS, false) do
|s| s.thru_maruku
end
# Markdown's "code spans" should really be "pre spans"
while html.gsub! %r{(<pre>)<code>(.*?)</code>(</pre>)}m, '\1\2\3'
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xhtml(*args); end",
"def to_xhtml(*args); end",
"def to_xhtml(*args); end",
"def to_xhtml(*args); end",
"def to_xhtml(options = T.unsafe(nil)); end",
"def to_xhtml(options = T.unsafe(nil)); end",
"def to_s\n if is_xhtml?\n @doc.to_xhtml(:encoding => nil)\n else\n ... | [
"0.68449223",
"0.68449223",
"0.68449223",
"0.68449223",
"0.6740881",
"0.6740881",
"0.65882224",
"0.6572175",
"0.6511185",
"0.6500991",
"0.6476766",
"0.6409672",
"0.6405884",
"0.63918483",
"0.63904095",
"0.6361005",
"0.6240205",
"0.62238127",
"0.6219485",
"0.6216599",
"0.61932... | 0.5965414 | 43 |
Returns the result of running this string through Maruku. | def thru_maruku #:nodoc:
#
# XXX: add a newline at the beginning of the text to
# prevent Maruku from interpreting the first line
# of text as a parameter definition, which is the
# case if that first line matches /\S{2}: /
#
# see this bug report for details:
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n @string\n end",
"def final_result\n\t\tresult = @@english_numeral.strip\n\t\t@@english_numeral.clear\n\t\t\n\t\tputs result\n\t\treturn result\n\n\tend",
"def script\n @value[:text]\n end",
"def script\n @value[:text]\n end",
"def output\n @text\n end",
"... | [
"0.6261525",
"0.58932996",
"0.5800609",
"0.5800609",
"0.5733833",
"0.57081217",
"0.56879675",
"0.55525815",
"0.5546838",
"0.54961795",
"0.54799956",
"0.5432799",
"0.54279447",
"0.539595",
"0.53762394",
"0.5375152",
"0.53654796",
"0.5360472",
"0.53157085",
"0.52908885",
"0.528... | 0.56368977 | 7 |
Adds syntax coloring to elements in this string. Each element is annotated with a class="line" or a class="para" attribute, according to whether it spans a single line or multiple lines of code. In the latter case, the element is replaced with a element so that its multiline body appears correctly in textmode web brows... | def thru_coderay #:nodoc:
gsub %r{<(code)(.*?)>(.*?)</\1>}m do
elem, atts, code = $1, $2, CGI.unescapeHTML($3).sub(/\A\r?\n/, '')
lang_regexp = /\blang=('|")(.*?)\1/io
lang = atts[lang_regexp, 2]
lang = :ruby if lang !~ /\S/
atts.sub! lang_regexp, %{lang="#{lang}"}
body = CodeR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_syntax_highlighter_to_class_attr(attr, lang = T.unsafe(nil)); end",
"def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); end",
"def highlight_code(options={})\n require 'uv'\n\n wrap_with = options[:wrap_with] || ['','']\n text = @modified_string\n\n ... | [
"0.6102301",
"0.5871838",
"0.58625495",
"0.5850061",
"0.58350134",
"0.5756749",
"0.57509494",
"0.5747284",
"0.56792694",
"0.56333154",
"0.56283987",
"0.5547415",
"0.5544059",
"0.55376875",
"0.55162126",
"0.5489813",
"0.5482285",
"0.54179275",
"0.5327017",
"0.5324054",
"0.5297... | 0.4779798 | 85 |
Protects the given tags in the given input, passes that protected input to the given block, restores the given tags in the result of the block and returns it. [verbatim] If true, the content of the elments having the given tags will not be temporarily altered so that process nested elements can be processed. | def with_protected_tags input, tag_defs, verbatim #:yields: input
raise ArgumentError unless block_given?
input = input.dup
escapes = {}
# protect the given tags by escaping them
tag_defs.each_key do |tag|
input.gsub! %r{(<#{tag}.*?>)(.*?)(</#{tag}>)}m do
head, body, tail = $1, $2, $... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protect aInput, aTags, aVerbatim #:yields: aInput\n raise ArgumentError unless block_given?\n\n input = aInput.dup\n escapes = {}\n\n # protect the given tags by escaping them\n aTags.each do |tag|\n input.gsub! %r{(<#{tag}.*?>)(.*?)(</#{tag}>)}m do\n head, body, tail = $1, $2, $3\n\... | [
"0.7756095",
"0.54632473",
"0.5096062",
"0.4959304",
"0.48927122",
"0.48847705",
"0.48757035",
"0.4824985",
"0.4811131",
"0.4802465",
"0.47376913",
"0.4736441",
"0.4734334",
"0.4699535",
"0.46715218",
"0.46382606",
"0.46382606",
"0.4622419",
"0.45925963",
"0.45891386",
"0.458... | 0.76476675 | 1 |
Returns a digest of the given string that will not be altered by Stringto_xhtml. | def calc_digest input
Digest::SHA1.hexdigest(input.to_s).
# XXX: surround all digits with alphabets so
# Maruku doesn't change them into HTML
gsub(/\d/, 'z\&z')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest(string)\n @digest_class.new(string).digest\n end",
"def digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def hexdigest(string)\n @digest_class.new(string).hexdigest\n end",
"def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n ... | [
"0.78951025",
"0.7326923",
"0.7137455",
"0.7050926",
"0.67282254",
"0.67282254",
"0.6542793",
"0.65405685",
"0.64569545",
"0.6456803",
"0.64095986",
"0.64095986",
"0.6351511",
"0.6311691",
"0.6236843",
"0.6236843",
"0.6236843",
"0.62289876",
"0.6228824",
"0.6169448",
"0.61605... | 0.6550358 | 6 |
GET /tags/1 GET /tags/1.json | def show
@tag = Tag.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @tag }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_ha... | [
"0.7841505",
"0.7612557",
"0.7493275",
"0.7401228",
"0.7207367",
"0.71431935",
"0.7123889",
"0.70965606",
"0.7029651",
"0.69644773",
"0.69596124",
"0.6939314",
"0.68929696",
"0.6886842",
"0.68744135",
"0.6864103",
"0.68359417",
"0.6822819",
"0.68169296",
"0.67671245",
"0.6754... | 0.6672386 | 31 |
GET /tags/new GET /tags/new.json | def new
@tag = Tag.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @tag }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tag = Tag.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end",
"def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end",
"def... | [
"0.80480677",
"0.79461527",
"0.79461527",
"0.79461527",
"0.7897595",
"0.7711944",
"0.7690126",
"0.7509567",
"0.7441448",
"0.7409764",
"0.7391192",
"0.73422575",
"0.7315394",
"0.73117083",
"0.7310875",
"0.7303562",
"0.7265349",
"0.7246642",
"0.7246642",
"0.72461045",
"0.724336... | 0.7861523 | 6 |
POST /tags POST /tags.json | def create
@tag = Tag.new(params[:tag])
respond_to do |format|
if @tag.save
format.html { redirect_to tags_url, :notice => 'Tag was successfully created.' }
format.json { render :json => @tag, :status => :created, :location => @tag }
else
format.html { render :action => "new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def create\n @tag = Tag.new(tag_params)\n if @tag.save\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n @tag = Tag.new(tag_params)\r\n\r\n if... | [
"0.7692835",
"0.7152648",
"0.7079401",
"0.69583875",
"0.68204635",
"0.6769902",
"0.67647225",
"0.67260826",
"0.66941917",
"0.6688469",
"0.66698825",
"0.6658007",
"0.660596",
"0.659979",
"0.6581441",
"0.6563798",
"0.6547826",
"0.6547316",
"0.65432066",
"0.653725",
"0.64850676"... | 0.677452 | 5 |
PUT /tags/1 PUT /tags/1.json | def update
@tag = Tag.find(params[:id])
respond_to do |format|
if @tag.update_attributes(params[:tag])
format.html { redirect_to tags_url, :notice => 'Tag was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n bod... | [
"0.7205384",
"0.7147123",
"0.68801117",
"0.67290765",
"0.6670296",
"0.66023207",
"0.65643096",
"0.6541451",
"0.65410334",
"0.6507774",
"0.6494705",
"0.64896363",
"0.648434",
"0.64522034",
"0.6415144",
"0.64134103",
"0.6404194",
"0.64038527",
"0.6386176",
"0.63825136",
"0.6379... | 0.64789766 | 13 |
DELETE /tags/1 DELETE /tags/1.json | def destroy
@tag = Tag.find(params[:id])
@tag.destroy
flash[:error] = @tag.errors[:base]
respond_to do |format|
format.html { redirect_to tags_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(tag)\n api_client.tags.multi_delete(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n\n ... | [
"0.77049047",
"0.7578366",
"0.75631344",
"0.75317156",
"0.75252473",
"0.7507605",
"0.7507605",
"0.7507605",
"0.74904907",
"0.74870014",
"0.7461779",
"0.7456964",
"0.7387652",
"0.73832756",
"0.73818654",
"0.7368147",
"0.73671025",
"0.7343283",
"0.7313129",
"0.72514915",
"0.723... | 0.7085798 | 35 |
add a factor to the factorization | def add(b,e)
if (@factors[b] = @factors[b]+e) == 0
@factors.delete(b)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end",
"def insert_factor(new_factor, new_multiplicity=1)\n\t\tm = @factors_and_multiplicities.length\n\t\tfor i in 0..(m-1)\... | [
"0.6820832",
"0.66118467",
"0.65579194",
"0.64024484",
"0.62153864",
"0.6185269",
"0.6160603",
"0.6111994",
"0.6024057",
"0.5876151",
"0.585008",
"0.5682992",
"0.5682992",
"0.5682992",
"0.5677579",
"0.56745815",
"0.5625668",
"0.5495931",
"0.54783183",
"0.5460302",
"0.54465276... | 0.6675672 | 1 |
multiplies this factoriztion with a other factorization | def * f
result = Factorization.new(@factorbase)
@factors.each do |b,e|
result.add(b,e)
end
f.factors.each do |b,e|
result.add(b,e)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply(other)\n clone.multiply! other\n end",
"def mul(factors)\n view.update_many(\"$mul\" => collect_operations(factors))\n end",
"def product_of_factorization(prime_factors)\n answer = 1\n prime_factors.each do |prime, exponent|\n answer *= prime**exponent\n end\n answer\nend",
... | [
"0.6809563",
"0.67379093",
"0.67155194",
"0.66199625",
"0.6430448",
"0.62804586",
"0.6250811",
"0.6248106",
"0.62252665",
"0.6216468",
"0.620259",
"0.61522853",
"0.6115925",
"0.6108653",
"0.6042442",
"0.60423",
"0.6029561",
"0.60019785",
"0.5999325",
"0.5991298",
"0.5987031",... | 0.6587529 | 4 |
the binary representation of this factorization (coefficients are taken mod 2) | def to_bin(separator='')
Array.new(factorbase.size){|i| (factors[factorbase[i]] || 0) % 2 }.join(separator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bit\n self\n end",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end",
"def bits\n super.to_i\n end",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end",
"def bits\n\t\t# Get a safe copy of the @bits array\n\t\tbts = @bits.clone\n\... | [
"0.6284963",
"0.6026039",
"0.6019314",
"0.599158",
"0.5985189",
"0.5976641",
"0.59663934",
"0.596432",
"0.5919604",
"0.59131587",
"0.5837011",
"0.5828835",
"0.57973194",
"0.5787693",
"0.5717487",
"0.5696447",
"0.56891936",
"0.5689188",
"0.5686802",
"0.5653252",
"0.5647137",
... | 0.60267895 | 1 |
take the square root of this factorization | def sqrt
res = Factorization.new(factorbase)
factors.each do |b,e|
raise 'all exponents are not a power of 2' if e % 2 > 0
res.add(b, e / 2)
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_root_of(number)\n Math.sqrt number\nend",
"def sqr\n\t\t\tself.dot( self )\n\t\tend",
"def square_root_of(number)\n\tMath.sqrt(number)\nend",
"def square_root_of(number)\n Math.sqrt(number)\nend",
"def square_root_of(number)\n Math.sqrt(number)\nend",
"def square_root_of(number)\n Math.s... | [
"0.65608096",
"0.6539516",
"0.6527567",
"0.6487364",
"0.6468152",
"0.6468152",
"0.6463399",
"0.6399146",
"0.62706375",
"0.62706375",
"0.6226737",
"0.6206857",
"0.6158054",
"0.6151364",
"0.6141826",
"0.61364955",
"0.61155885",
"0.61110157",
"0.6108463",
"0.61019635",
"0.610182... | 0.77247983 | 0 |
GET /food_notes or /food_notes.json | def index
@food_notes = FoodNote.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specific_notes(id, accept)\n begin\n \t# Calls a certain note depending on the number \n return RestClient.get 'http://localhost:4567/notes/' + id.to_s, :accept => accept\n rescue => e\n return e.response\n end\n end",
"def get_notes_with_http_info(opts = {})\n if @api_client.conf... | [
"0.6643151",
"0.66100055",
"0.65667284",
"0.6496119",
"0.6377379",
"0.6338673",
"0.63297147",
"0.63202703",
"0.63189393",
"0.6307445",
"0.62889737",
"0.6257376",
"0.6227494",
"0.62011087",
"0.61988",
"0.61505437",
"0.6147097",
"0.61358285",
"0.61232847",
"0.61132145",
"0.6112... | 0.61433125 | 17 |
GET /food_notes/1 or /food_notes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specific_notes(id, accept)\n begin\n \t# Calls a certain note depending on the number \n return RestClient.get 'http://localhost:4567/notes/' + id.to_s, :accept => accept\n rescue => e\n return e.response\n end\n end",
"def get_notes_with_http_info(opts = {})\n if @api_client.conf... | [
"0.7135214",
"0.6681879",
"0.6437608",
"0.64331913",
"0.64075273",
"0.6396435",
"0.6390724",
"0.6305119",
"0.62658066",
"0.6256857",
"0.6229001",
"0.62258387",
"0.6225322",
"0.6212579",
"0.6208586",
"0.62081736",
"0.6189565",
"0.6177363",
"0.61638296",
"0.6109781",
"0.607264"... | 0.0 | -1 |
POST /food_notes or /food_notes.json | def create
@food_note = FoodNote.new(food_note_params)
respond_to do |format|
if @food_note.save
format.html { redirect_to @food_note, notice: "Food note was successfully created." }
format.json { render :show, status: :created, location: @food_note }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: note_url(@note)\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def create\n @note = Note.new(note_params)\n if @note.save\n render json:... | [
"0.6612983",
"0.6482092",
"0.6414504",
"0.6380727",
"0.6380497",
"0.6357515",
"0.6333557",
"0.62925303",
"0.6280407",
"0.62711704",
"0.6247935",
"0.6238394",
"0.62343913",
"0.6227067",
"0.6222141",
"0.6222141",
"0.61867917",
"0.6159145",
"0.6136938",
"0.61349607",
"0.6106363"... | 0.7127762 | 0 |
PATCH/PUT /food_notes/1 or /food_notes/1.json | def update
respond_to do |format|
if @food_note.update(food_note_params)
format.html { redirect_to @food_note, notice: "Food note was successfully updated." }
format.json { render :show, status: :ok, location: @food_note }
else
format.html { render :edit, status: :unprocessable_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end",
"def update\n... | [
"0.6854329",
"0.68502814",
"0.66395086",
"0.6635184",
"0.6632283",
"0.66100067",
"0.66059965",
"0.6595081",
"0.65834326",
"0.6566037",
"0.6498072",
"0.64649034",
"0.64576846",
"0.6456391",
"0.64451593",
"0.64435536",
"0.64435536",
"0.64435536",
"0.64435536",
"0.64435536",
"0.... | 0.7094588 | 0 |
DELETE /food_notes/1 or /food_notes/1.json | def destroy
@food_note.destroy
respond_to do |format|
format.html { redirect_to food_notes_url, notice: "Food note was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @note = Note.find(params[:id])\n @note.destroy\n respond_to do |format|\n format.htm... | [
"0.6969425",
"0.69627833",
"0.6951786",
"0.69389474",
"0.69389474",
"0.69389474",
"0.69389474",
"0.6938638",
"0.6931408",
"0.69281197",
"0.68914276",
"0.68875414",
"0.681012",
"0.6806027",
"0.6769968",
"0.67570716",
"0.6689195",
"0.666257",
"0.663094",
"0.66286683",
"0.661516... | 0.7117399 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_food_note
@food_note = FoodNote.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def food_note_params
params.require(:food_note).permit(:food_id, :note_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
WHAT DO WE KNOW numbers can be neg, you want the biggest diff of two nubmer next to each other WHAT DO WE NOT KNOW The ansewer WHAT TOOLS? abs to find the diff (1?) recurrsion? EXMAPLES findlargestdrop([1,4,23,5,43,312,42]) findlargestdrop([1,4,24]) findlargestdrop([1,4,23,5,43,312,42]) findlargestdrop([1,4,23,5,43,312... | def findlargestdrop(arr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def big_diff(array)\n value1 = array.max\n array.delete(array.max)\n value2 = array.max\n return (value1 - value2).abs\nend",
"def problem_66\n max = [0,0]\n (2..1000).each do |d|\n top,bot = d.sqrt_frac {|t,b| (t*t - d*b*b) == 1}\n next unless top\n max = [max,[top,d]].max\n puts \"#{d} #{top}... | [
"0.699534",
"0.6971299",
"0.69188184",
"0.6735001",
"0.66621447",
"0.6618581",
"0.654216",
"0.65090233",
"0.64903307",
"0.648361",
"0.6422334",
"0.64189583",
"0.6405065",
"0.6402998",
"0.6400996",
"0.638763",
"0.63798785",
"0.63538885",
"0.6335785",
"0.6335772",
"0.6270379",
... | 0.64382637 | 10 |
The Xcoordinate of the mouse. | def x
@data[:x]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouseX()\n @view__.mouseX\n end",
"def mouse_x; mouseX; end",
"def mouse_x; mouseX; end",
"def mouse_x\n end",
"def pmouseX()\n @view__.pmouseX\n end",
"def x\n @position.x\n end",
"def mouse_x=(value); self.set_mouse_x(value); end",
"def mouseX; end... | [
"0.80393755",
"0.79722315",
"0.79722315",
"0.77474546",
"0.75509584",
"0.75396615",
"0.7471054",
"0.7419963",
"0.73922366",
"0.73922366",
"0.7365339",
"0.73495233",
"0.7212633",
"0.69628054",
"0.68604743",
"0.6840436",
"0.6764806",
"0.6742792",
"0.6724684",
"0.6721532",
"0.67... | 0.0 | -1 |
The Ycoordinate of the mouse. | def y
@data[:y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouseY()\n @view__.mouseY\n end",
"def mouse_y\n end",
"def mouseY; end",
"def y\n @position.y\n end",
"def pmouseY()\n @view__.pmouseY\n end",
"def y\n position.y if position\n end",
"def y\n position.y if position\n end",
"def y\n @point[1... | [
"0.7991177",
"0.7838697",
"0.78135675",
"0.7704475",
"0.75833106",
"0.74527913",
"0.74527913",
"0.72621477",
"0.72450614",
"0.71354914",
"0.7027232",
"0.70270735",
"0.6967427",
"0.6961099",
"0.69159925",
"0.6915197",
"0.69096494",
"0.6866872",
"0.68603915",
"0.6840371",
"0.68... | 0.6093085 | 77 |
Both coordinate of the mouse | def position
[x, y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_x; mouseX; end",
"def mouse_x; mouseX; end",
"def mouse_position\n mouse_state.position\n end",
"def mouse_y\n end",
"def mouse_x\n end",
"def mouse_coords\n # For some reason, Gosu's mouse_x/mouse_y return Floats, so round it off\n [\n (mouse_x.round ... | [
"0.7896273",
"0.7896273",
"0.7836356",
"0.7623401",
"0.7547549",
"0.7473387",
"0.7464005",
"0.7396805",
"0.7276202",
"0.7077802",
"0.7000537",
"0.6926599",
"0.6706547",
"0.6703099",
"0.6654873",
"0.6654177",
"0.6649432",
"0.66466105",
"0.652797",
"0.652372",
"0.6505171",
"0... | 0.6326456 | 31 |
Determines whether the button _key_ is being pressed again. "Pressed again" is seen as time having passed between the button being not pressed and being pressed. If the button is being pressed, returns +TRUE+. If not, returns +FALSE+. | def trigger? key=:any
return @data.include? :down if key == :any
@data[key] == :down
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pressed?(key)\n p = button_down?(key)\n if p\n if @unpress.include?(key)\n p = false\n else\n @unpress.push(key)\n end\n end\n return p\n end",
"def press?(key)\r\n\t\treturn ow_dt_i_press(key) if !VALUES.has_key?(key)\r\n\t\treturn true unless Ke... | [
"0.74088746",
"0.7267295",
"0.72435963",
"0.7224355",
"0.70576996",
"0.6987257",
"0.6949183",
"0.69405276",
"0.6862287",
"0.67785627",
"0.65616196",
"0.6519832",
"0.6441004",
"0.6327865",
"0.63110495",
"0.6305266",
"0.6273205",
"0.6270132",
"0.62643504",
"0.6262549",
"0.61883... | 0.0 | -1 |
Determines whether the button _key_ is currently being pressed. If the button is being pressed, returns +TRUE+. If not, returns +FALSE+. | def press? key=:any
return @data.include? :on if key == :any
@data[key] != :off
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pressed?(key)\n @input[key].detect { |k| @game.button_down?(k) }\n end",
"def pressed?(key)\n p = button_down?(key)\n if p\n if @unpress.include?(key)\n p = false\n else\n @unpress.push(key)\n end\n end\n return p\n end",
"def key_presse... | [
"0.8061114",
"0.80230147",
"0.79468143",
"0.79092246",
"0.7789654",
"0.77835035",
"0.76983535",
"0.7412914",
"0.7411148",
"0.72213393",
"0.7209564",
"0.7181598",
"0.71704745",
"0.7141631",
"0.7116467",
"0.71034145",
"0.7099182",
"0.6970342",
"0.67960364",
"0.67867893",
"0.676... | 0.6411973 | 27 |
Determines whether the button _key_ is currently being releassed. If the button is being released, returns +TRUE+. If not, returns +FALSE+. | def release? key=:any
return @data.include? :up if key == :any
@data[key] == :up
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button_released?(btn)\n @prev_down[btn] and not @down[btn]\n end",
"def pressed?(key)\n p = button_down?(key)\n if p\n if @unpress.include?(key)\n p = false\n else\n @unpress.push(key)\n end\n end\n return p\n end",
"def key_released... | [
"0.82616585",
"0.79804397",
"0.7891316",
"0.764051",
"0.7457385",
"0.74125195",
"0.73985904",
"0.7058023",
"0.70225555",
"0.69703466",
"0.6952106",
"0.6924547",
"0.6874409",
"0.68604416",
"0.6849554",
"0.6836314",
"0.67329603",
"0.6731795",
"0.6719267",
"0.6701129",
"0.664792... | 0.65775156 | 22 |
DO NOT TOUCH TEST BELOW!!! custom expect function to handle tests List count : keeps track out how many tests pass and how many total in the form of a two item array i.e., [0, 0] String name : describes the test Function test : performs a set of operations and returns a boolean indicating if test passed | def expect(count, name, test)
count[1] = count[1] + 1
result = 'false'
err_msg = nil
begin
if test()
result = ' true'
count[0] = count[0] + 1
end
rescue NameError => e
MyModule::Logger.error("Error loading the deployer #{class_name}. This deployer it's not installed!")
rescue Standa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_count\n @tests.count\n end",
"def test_size\n assert_equal(3, @list.size)\n end",
"def test_truthy_count(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test[:text], options)\n expect(matches)\n .to eq(test[:matches].length),\n \"E... | [
"0.6772666",
"0.6643067",
"0.6562063",
"0.65485364",
"0.654757",
"0.654757",
"0.654757",
"0.654757",
"0.654757",
"0.6541895",
"0.64823735",
"0.64514357",
"0.64511585",
"0.6368339",
"0.6361865",
"0.63542",
"0.6346955",
"0.6259691",
"0.6256476",
"0.62330925",
"0.62330925",
"0... | 0.65157306 | 10 |
Access the description associated with the type of this location. | def type_description
type = LocationType.find_by_code(self.location_type_code)
if (type)
type.description
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_description\n LOCATION_DESCRIPTION\n end",
"def description\n return geo_concern.description.first if geo_concern.description.first\n \"A #{geo_concern.human_readable_type.downcase} object.\"\n end",
"def description\n @ole.Description\n end",
"def desc... | [
"0.76734686",
"0.7661107",
"0.7281522",
"0.7281522",
"0.72160345",
"0.7113386",
"0.7099257",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
"0.7064342",
... | 0.8829302 | 0 |
def initialize_mines place_mines(generate_mines) end | def set_all_cell_adjacent_mines
@board.each_with_index do |row, row_index|
@board[row_index].each_with_index do |column, column_index|
set_cell_adjacent_mines(row_index,column_index)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(num_mines)\n @num_mines = num_mines\n end",
"def add_random_mines(num_mines)\n add_mines(get_random_mines(num_mines)) \n end",
"def place_mines\n\t\t(0...@size).to_a.shuffle.slice(0,@total_mines).each do |rand|\n\t\t\tmine_row = rand / @width\n\t\t\tmine_col = rand % @width\n\t\... | [
"0.7835077",
"0.7378752",
"0.70953494",
"0.6977085",
"0.6940663",
"0.6823477",
"0.6669177",
"0.66391575",
"0.6451994",
"0.6408107",
"0.6306962",
"0.6244883",
"0.6197712",
"0.61477566",
"0.6097559",
"0.6093338",
"0.5986067",
"0.5980771",
"0.594394",
"0.59392726",
"0.5930567",
... | 0.5609251 | 30 |
GET /goods_costs/1 GET /goods_costs/1.xml | def show
@goods_cost = GoodsCost.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @goods_cost }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cost }\n end\n\n end",
"def new\n @goods_cost = GoodsCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml ... | [
"0.6616822",
"0.64051527",
"0.63937503",
"0.6208192",
"0.61877704",
"0.6150333",
"0.61414665",
"0.6129408",
"0.6044586",
"0.5986361",
"0.59849256",
"0.59432995",
"0.5914488",
"0.5897615",
"0.5893074",
"0.5893074",
"0.5892866",
"0.5870844",
"0.58691746",
"0.5846398",
"0.582717... | 0.7112841 | 0 |
GET /goods_costs/new GET /goods_costs/new.xml | def new
@goods_cost = GoodsCost.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @goods_cost }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @costing = Costing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @costing }\n end\n end",
"def new\n @cost = Cost.new(:date => params[:date],\n :user_id => current_user.id)\n respond_to do |format|\n format.... | [
"0.7062879",
"0.70407456",
"0.6977286",
"0.6903434",
"0.6820332",
"0.67964154",
"0.67897326",
"0.6781218",
"0.6764174",
"0.67269564",
"0.6693525",
"0.6657631",
"0.6629127",
"0.6599038",
"0.6580916",
"0.6518333",
"0.65172267",
"0.65000683",
"0.6500028",
"0.64944476",
"0.649040... | 0.7631221 | 0 |
POST /goods_costs POST /goods_costs.xml | def create
@goods_cost = GoodsCost.new(params[:goods_cost])
respond_to do |format|
if @goods_cost.save
format.html { redirect_to(@goods_cost, :notice => 'GoodsCost was successfully created.') }
format.xml { render :xml => @goods_cost, :status => :created, :location => @goods_cost }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cost = Cost.new(params[:cost])\n respond_to do |format|\n if @cost.save\n format.html { redirect_to(@cost, :notice => 'Cost was successfully updated.') }\n format.xml { render :xml => @cost, :status => :created, :location => @cost }\n else\n format.html { render ... | [
"0.6385719",
"0.6351183",
"0.61471325",
"0.6105058",
"0.609223",
"0.60376215",
"0.6029054",
"0.59796536",
"0.5974105",
"0.5953283",
"0.5947685",
"0.5938601",
"0.5928825",
"0.58982486",
"0.58490515",
"0.584123",
"0.5827727",
"0.58153707",
"0.57965934",
"0.5755346",
"0.57418317... | 0.66115105 | 0 |
PUT /goods_costs/1 PUT /goods_costs/1.xml | def update
@goods_cost = GoodsCost.find(params[:id])
respond_to do |format|
if @goods_cost.update_attributes(params[:goods_cost])
format.html { redirect_to(@goods_cost, :notice => 'GoodsCost was successfully updated.') }
format.xml { head :ok }
else
format.html { render :ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n if @cost.update_attributes(params[:cost])\n format.html { redirect_to(@cost, :notice => 'Cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n ... | [
"0.6301847",
"0.60969675",
"0.60964215",
"0.6093659",
"0.59946704",
"0.59852296",
"0.5982533",
"0.59644353",
"0.59509",
"0.5946782",
"0.5897954",
"0.5892043",
"0.5873583",
"0.58531886",
"0.58470964",
"0.5836866",
"0.58205336",
"0.579026",
"0.5771237",
"0.5771237",
"0.57246345... | 0.66507024 | 0 |
DELETE /goods_costs/1 DELETE /goods_costs/1.xml | def destroy
@goods_cost = GoodsCost.find(params[:id])
@goods_cost.destroy
respond_to do |format|
format.html { redirect_to(goods_costs_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cost = Cost.find(params[:id])\n @cost.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"home\") }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(... | [
"0.65907747",
"0.6570075",
"0.6555175",
"0.655015",
"0.6548801",
"0.65189373",
"0.6448839",
"0.6404404",
"0.6299359",
"0.6278638",
"0.62001085",
"0.6190853",
"0.6189067",
"0.6183196",
"0.61498517",
"0.61442465",
"0.61430156",
"0.6137874",
"0.6134442",
"0.61156654",
"0.6110151... | 0.71933645 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_itinerary
@participant = Participant.find(params[:participant_id])
@itinerary = @participant.itinerary
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 itinerary_params
params.require(:itinerary).permit(:transportation, :company, :flight_number, :departure, :arrival, :airport_arrival, :airport_departure)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
GET /time_points/1 GET /time_points/1.json | def show
@time_point = TimePoint.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @time_point }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end",
"def index\n @data_points = DataPoint.recent # cached_recent\n\n respond_to do |format|\n format.html # index.html.erb\n forma... | [
"0.6938148",
"0.66686106",
"0.65116173",
"0.64285743",
"0.6356858",
"0.6291912",
"0.628865",
"0.62825286",
"0.6264017",
"0.6233052",
"0.621189",
"0.6174358",
"0.6174358",
"0.6173194",
"0.61716616",
"0.61636925",
"0.6153644",
"0.61512405",
"0.61486155",
"0.6138621",
"0.6134928... | 0.7633102 | 0 |
GET /time_points/new GET /time_points/new.json | def new
@time_point = TimePoint.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @time_point }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @planned_time = PlannedTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_time }\n end\n end",
"def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n form... | [
"0.7597987",
"0.7331173",
"0.7312347",
"0.7184096",
"0.7175659",
"0.71171397",
"0.71171397",
"0.71171397",
"0.7102773",
"0.70951825",
"0.7076117",
"0.70490813",
"0.70473874",
"0.70169747",
"0.70141214",
"0.6999612",
"0.69894356",
"0.6976766",
"0.6969646",
"0.69571996",
"0.692... | 0.81992763 | 0 |
POST /time_points POST /time_points.json | def create
@time_point = TimePoint.new(params[:time_point])
respond_to do |format|
if @time_point.save
format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }
format.json { render json: @time_point, status: :created, location: @time_point }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end",
"def schedule_point\n validate(\n point: :security_json\n )\n\n custom_experiment = (@experiment.type == 'manual_points')\n ... | [
"0.65344083",
"0.65225345",
"0.63852805",
"0.6353994",
"0.62241775",
"0.6199105",
"0.61931646",
"0.6164316",
"0.6136063",
"0.61295134",
"0.60787505",
"0.6060546",
"0.6049438",
"0.5922618",
"0.59009016",
"0.58935887",
"0.5881319",
"0.5842385",
"0.5837063",
"0.58368784",
"0.580... | 0.73892164 | 0 |
PUT /time_points/1 PUT /time_points/1.json | def update
@time_point = TimePoint.find(params[:id])
respond_to do |format|
if @time_point.update_attributes(params[:time_point])
format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }
format.json { head :no_content }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\t@outcome_timepoint.update_attributes(params[:outcome_timepoint])\n end",
"def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @tim... | [
"0.6700458",
"0.6517849",
"0.65173185",
"0.64999485",
"0.63526",
"0.62521666",
"0.62458134",
"0.6238681",
"0.62222487",
"0.6192157",
"0.61885875",
"0.61781365",
"0.61703163",
"0.6170176",
"0.61656153",
"0.6159461",
"0.6131586",
"0.6126573",
"0.6119261",
"0.6104926",
"0.610291... | 0.7450215 | 0 |
DELETE /time_points/1 DELETE /time_points/1.json | def destroy
@time_point = TimePoint.find(params[:id])
@time_point.destroy
respond_to do |format|
format.html { redirect_to time_points_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @touchpoint = Touchpoint.find(params[:id])\n @touchpoint.destroy\n\n respond_to do |format|\n format.html { redirect_to touchpoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { red... | [
"0.70324504",
"0.6998365",
"0.6974754",
"0.6967816",
"0.69249326",
"0.69155306",
"0.69060445",
"0.6884105",
"0.6864779",
"0.68606246",
"0.68593097",
"0.68562603",
"0.6853878",
"0.6834053",
"0.68206906",
"0.6811515",
"0.68045014",
"0.6799466",
"0.67988074",
"0.67972434",
"0.67... | 0.7838091 | 0 |
'e' is the limit of this series: 1 + 1/1! + 1/2! + 1/3! ... determine the factorial value of a given number | def factorial(num)
total=1
for i in (1..num)
total = total * i
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factorial(number)\n if number >= 1000\n return final = 0\n elsif\n number >=1\n array = Array.new\n (number + 1).times do |i|\n array.push(i)\n end\n array.shift\n final = 1.0\n array.each { |i| final *= i }\n return final\nelse\n return final = 1\nend\nend",
"def factorial(number)\n if number == 0\n ... | [
"0.74262",
"0.7315684",
"0.73023677",
"0.7290402",
"0.7290233",
"0.7285955",
"0.72629935",
"0.7255208",
"0.7252786",
"0.7251338",
"0.725022",
"0.7237678",
"0.7214305",
"0.7212143",
"0.72057885",
"0.7179841",
"0.71774524",
"0.71625745",
"0.7152237",
"0.7147891",
"0.7147695",
... | 0.0 | -1 |
The given block is passed to the TabbedPane The given dimensions are used to create the window. The TabbedPane is placed at 0,0 and fills the window. | def initialize config={}, &block
h = config.fetch(:height, 0)
w = config.fetch(:width, 0)
t = config.fetch(:row, 0)
l = config.fetch(:col, 0)
@window = Canis::Window.new :height => h, :width => w, :top => t, :left => l
@form = Form.new @window
config[:row] = config[:col] = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize\n # We need to nuke ncurses to pick up the new dimensions\n Curses.def_prog_mode\n Curses.close_screen\n Curses.reset_prog_mode\n height, width = Curses.dimensions\n \n # Resize tabs \n @tabs.resize(\n :width => width,\n :height => height\n )\n ... | [
"0.5840394",
"0.5692833",
"0.55903405",
"0.5489726",
"0.5483623",
"0.5413193",
"0.54068446",
"0.53378963",
"0.5303852",
"0.52832484",
"0.52685755",
"0.5216177",
"0.5151729",
"0.5131813",
"0.5090869",
"0.5089306",
"0.50835556",
"0.50658923",
"0.5059673",
"0.5046023",
"0.503363... | 0.654935 | 0 |
returns button index Call this after instantiating the window | def run
@form.repaint
@window.wrefresh
return handle_keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n project.pick_windows.index(self) + 1\n end",
"def buttons; end",
"def last_button\n last_ele UIAButton\n end",
"def window_handles; end",
"def first_button\n first_ele UIAButton\n end",
"def initIndices\n #Generation des indices de colonne\n 0.upto(@taille-1) do |i|\... | [
"0.6927849",
"0.66871136",
"0.64783984",
"0.63174045",
"0.6287836",
"0.6152757",
"0.60535777",
"0.60481787",
"0.60178506",
"0.59156775",
"0.58867997",
"0.5883731",
"0.58487993",
"0.5829006",
"0.58180934",
"0.5812137",
"0.58011585",
"0.578149",
"0.57715523",
"0.57640237",
"0.5... | 0.0 | -1 |
set up client, sleep time | def initialize(routing, client_class)
super
WorklingRabbitMQSubscriber.sleep_time = Workling.config[:sleep_time] || 0.2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n _connect\n sleep 1\n end",
"def start\n loop do\n now = Time.now\n msg = \"%02d:%02d:%02d\" % [now.hour, now.min, now.sec]\n @mutex.synchronize {\n\t@clients.each { |c|\n # If the connection is closed while writing this could occur. Just\n # the nature of as... | [
"0.6990377",
"0.6676028",
"0.6447",
"0.6368094",
"0.62687993",
"0.61543334",
"0.61194336",
"0.6106098",
"0.6057675",
"0.6055052",
"0.6051557",
"0.6042683",
"0.6042683",
"0.6029874",
"0.59762037",
"0.5951627",
"0.5931181",
"0.5902368",
"0.5891305",
"0.5890666",
"0.58904636",
... | 0.58019173 | 35 |
Starts main Invoker Loop. The invoker runs until stop() is called. | def listen
connect do
routes.each do |queue|
@client.subscribe(queue) do |args|
run(queue, args)
end
end
end
while (!Thread.current[:shutdown]) do
sleep(self.class.sleep_time)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n loop do\n run\n end\n end",
"def start\n @log.info \"starting trader\"\n @should_terminate = false\n iterate()\n end",
"def start\n main_loop\n end",
"def start\n while not @stopped\n puts \"Waiting for something to happen\"\n sleep... | [
"0.7039444",
"0.703021",
"0.6927032",
"0.686682",
"0.6664662",
"0.6655018",
"0.66518337",
"0.66310847",
"0.66087776",
"0.6573964",
"0.6515238",
"0.64885974",
"0.64690083",
"0.6411841",
"0.64023113",
"0.6388816",
"0.63830006",
"0.63786614",
"0.63634616",
"0.63586795",
"0.63482... | 0.0 | -1 |
Gracefully stops the Invoker. The currently executing Jobs should be allowed to finish. | def stop
Thread.current[:shutdown] = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop\n Juggler::Runner.stop.callback {\n Juggler.logger.info \"Exited cleanly\"\n EM.stop\n }.errback {\n t = Juggler.shutdown_grace_timeout\n Juggler.logger.info \"Force exited after #{t}s with tasks running\"\n EM.stop\n }\n end",
"def stop\n log(:d... | [
"0.6959449",
"0.68166834",
"0.6809751",
"0.6779631",
"0.67657614",
"0.67226064",
"0.67226064",
"0.6672264",
"0.6585015",
"0.65321547",
"0.652614",
"0.64365804",
"0.6409854",
"0.64056134",
"0.6385158",
"0.63513464",
"0.6343289",
"0.6335679",
"0.63267606",
"0.63137114",
"0.6303... | 0.0 | -1 |
TODO: ensure only one processor can checkout a checkpoint. Use a row level lock / for update? | def checkout(processor_name:, event_types: nil)
Checkpoint.new(
database: @database,
name: processor_name,
event_types: event_types
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkpoint_helper(checkpointer, sequence_number = nil)\n checkpointer.checkpoint(sequence_number)\n rescue Aws::KCLrb::CheckpointError => e\n # Here, we simply retry once.\n # More sophisticated retry logic is recommended.\n checkpointer.checkpoint(sequence_number) if sequence_number\n end",
"d... | [
"0.62241745",
"0.61721545",
"0.6131597",
"0.6118163",
"0.5843103",
"0.5843103",
"0.579338",
"0.57817817",
"0.56918645",
"0.5628025",
"0.55453986",
"0.54784477",
"0.5476966",
"0.54720026",
"0.5459849",
"0.5459849",
"0.5459849",
"0.5441853",
"0.5407899",
"0.540768",
"0.54023755... | 0.0 | -1 |
FIXME_AK: texts is not good name. | def spam?
texts.count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def texts; end",
"def texts=(texts); end",
"def texts=(texts); end",
"def text text\n end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"de... | [
"0.8358451",
"0.7531032",
"0.7531032",
"0.7479647",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.71284395",
"0.68972063",
"0.6809077",
"... | 0.0 | -1 |
Test simple conversion from standard to semver. | def test_standard_to_semver_simple
value_ = ::Versionomy.parse('1.2')
value2_ = value_.convert(:semver)
assert_equal(@semver_format, value2_.format)
assert_equal([1, 2, 0, ''], value2_.values_array)
value_ = ::Versionomy.parse('1.2.4')
value2_ = value_.convert(:semver)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_semver_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0beta3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versiono... | [
"0.8077396",
"0.8051551",
"0.80155385",
"0.80098754",
"0.7985546",
"0.7962485",
"0.79004973",
"0.78305507",
"0.77165174",
"0.73676467",
"0.7359137",
"0.726705",
"0.7122989",
"0.6978606",
"0.6811286",
"0.66394705",
"0.65118515",
"0.64965105",
"0.64893734",
"0.6437167",
"0.6377... | 0.8274648 | 0 |
Test conversion from standard to semver with a beta version | def test_standard_to_semver_beta
value_ = ::Versionomy.parse('1.2b3')
value2_ = value_.convert(:semver)
assert_equal([1, 2, 0, 'b3'], value2_.values_array)
value_ = ::Versionomy.parse('1.2 beta 3')
value2_ = value_.convert(:semver)
assert_equal([1, 2, 0, 'beta3'], value2_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_semver_to_standard_beta\n value_ = ::Versionomy.parse('1.2.0b3', :semver)\n value2_ = value_.convert(:standard)\n assert_equal([1, 2, 0, 0, :beta, 3, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2.4beta3', :semver)\n value2_ = value_.convert(:standard)\n ... | [
"0.8424887",
"0.8007514",
"0.7829497",
"0.7699581",
"0.76358116",
"0.747247",
"0.7409501",
"0.7199127",
"0.7167471",
"0.7162761",
"0.7150546",
"0.69808555",
"0.69728404",
"0.6954759",
"0.6912336",
"0.6888097",
"0.68117267",
"0.6752081",
"0.6727286",
"0.6683008",
"0.6661739",
... | 0.85565156 | 0 |
Test conversion from standard to semver with a "v" prefix | def test_standard_to_semver_with_v
value_ = ::Versionomy.parse('v1.2.3')
value2_ = value_.convert(:semver)
assert_equal([1, 2, 3, ''], value2_.values_array)
value_ = ::Versionomy.parse('V 1.2.3')
value2_ = value_.convert(:semver)
assert_equal([1, 2, 3, ''], value2_.values... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_semver_simple\n value_ = ::Versionomy.parse('1.2')\n value2_ = value_.convert(:semver)\n assert_equal(@semver_format, value2_.format)\n assert_equal([1, 2, 0, ''], value2_.values_array)\n value_ = ::Versionomy.parse('1.2.4')\n value2_ = value_.convert(... | [
"0.72329164",
"0.7064236",
"0.7038632",
"0.7027075",
"0.698634",
"0.6979328",
"0.67788774",
"0.67344564",
"0.6629036",
"0.6603498",
"0.6565407",
"0.6523348",
"0.64814156",
"0.6418917",
"0.63665116",
"0.6358042",
"0.63398176",
"0.6315856",
"0.63073516",
"0.62453187",
"0.622958... | 0.7966648 | 0 |
Test conversion from standard to semver with an expectation of failure | def test_standard_to_semver_fail
value_ = ::Versionomy.parse('1.2.3.4', :standard)
assert_raises(::Versionomy::Errors::ConversionError) do
value_.convert(:semver)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_semver_to_standard_fail\n value_ = ::Versionomy.parse('1.2.3c4', :semver)\n assert_raises(::Versionomy::Errors::ConversionError) do\n value_.convert(:standard)\n end\n end",
"def test_standard_to_semver_inequality_comparison\n assert_operator(::Versionomy.parse(... | [
"0.81698626",
"0.816256",
"0.811768",
"0.8087627",
"0.79793197",
"0.78946644",
"0.75998855",
"0.75973135",
"0.75545585",
"0.73390234",
"0.7329654",
"0.7310541",
"0.71983945",
"0.7025615",
"0.695702",
"0.6797825",
"0.67036843",
"0.669982",
"0.6647276",
"0.6635244",
"0.6614079"... | 0.82651967 | 0 |
Test simple conversion from semver to standard. | def test_semver_to_standard_simple
value_ = ::Versionomy.parse('1.2', :semver)
value2_ = value_.convert(:standard)
assert_equal(@standard_format, value2_.format)
assert_equal([1, 2, 0, 0, :final, 0, 0], value2_.values_array)
value_ = ::Versionomy.parse('1.2.4', :semver)
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_semver_simple\n value_ = ::Versionomy.parse('1.2')\n value2_ = value_.convert(:semver)\n assert_equal(@semver_format, value2_.format)\n assert_equal([1, 2, 0, ''], value2_.values_array)\n value_ = ::Versionomy.parse('1.2.4')\n value2_ = value_.convert(... | [
"0.8355749",
"0.8036129",
"0.80219185",
"0.7997595",
"0.7980345",
"0.795972",
"0.789575",
"0.7882683",
"0.78513503",
"0.74506783",
"0.7338285",
"0.72626054",
"0.7210544",
"0.68171525",
"0.6781612",
"0.6707959",
"0.66191345",
"0.6438666",
"0.6332053",
"0.63282645",
"0.63154554... | 0.8381711 | 0 |
Test conversion from semver to standard with a beta version | def test_semver_to_standard_beta
value_ = ::Versionomy.parse('1.2.0b3', :semver)
value2_ = value_.convert(:standard)
assert_equal([1, 2, 0, 0, :beta, 3, 0], value2_.values_array)
value_ = ::Versionomy.parse('1.2.4beta3', :semver)
value2_ = value_.convert(:standard)
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_semver_beta\n value_ = ::Versionomy.parse('1.2b3')\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 0, 'b3'], value2_.values_array)\n value_ = ::Versionomy.parse('1.2 beta 3')\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 0, 'beta3... | [
"0.85692924",
"0.78966177",
"0.77038807",
"0.7582876",
"0.75267833",
"0.7419029",
"0.7314887",
"0.72950166",
"0.7150735",
"0.70956784",
"0.7055041",
"0.7026453",
"0.70224506",
"0.7014727",
"0.6996353",
"0.6791902",
"0.6769884",
"0.6705904",
"0.6691109",
"0.66706735",
"0.66005... | 0.85421735 | 1 |
Test conversion from rubygems to standard with an expectation of failure | def test_semver_to_standard_fail
value_ = ::Versionomy.parse('1.2.3c4', :semver)
assert_raises(::Versionomy::Errors::ConversionError) do
value_.convert(:standard)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rubygems_to_standard_fail\n value_ = ::Versionomy.parse('1.2.b.3.4.5', :rubygems)\n assert_raises(::Versionomy::Errors::ConversionError) do\n value_.convert(:standard)\n end\n value_ = ::Versionomy.parse('1.2.c.3', :rubygems)\n assert_raises(::Versionomy::Errors... | [
"0.68311024",
"0.64639384",
"0.64639384",
"0.6337843",
"0.63360435",
"0.6273486",
"0.6273486",
"0.62327117",
"0.62327117",
"0.6202757",
"0.61290145",
"0.6125404",
"0.6106366",
"0.604602",
"0.60104805",
"0.59949046",
"0.5960084",
"0.59340733",
"0.5929243",
"0.59118205",
"0.590... | 0.5552312 | 74 |
Test conversion when there aren't unparse_params | def test_standard_to_semver_without_unparse_params
value_ = ::Versionomy.create([1,2,3], :standard)
value2_ = value_.convert(:semver)
assert_equal([1, 2, 3, ''], value2_.values_array)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_params; true; end",
"def unparse_params\n @_unparse_params ? @_unparse_params.dup : nil\n end",
"def unconverted_fields?() @unconverted_fields end",
"def valid_params?; end",
"def parse_parameters; end",
"def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n ... | [
"0.6356637",
"0.63314927",
"0.6218071",
"0.6202152",
"0.608118",
"0.5992453",
"0.5964933",
"0.5905451",
"0.5886379",
"0.58446985",
"0.58028424",
"0.57631236",
"0.57485425",
"0.5748202",
"0.56961095",
"0.5686789",
"0.56832266",
"0.56808317",
"0.5624807",
"0.56059664",
"0.55863... | 0.0 | -1 |
Test conversion between semver and rubygems | def test_semver_and_rubygems
value_ = ::Versionomy.create([1,2,3], :semver)
value2_ = value_.convert(:rubygems)
assert_equal([1, 2, 3, 0, 0, 0, 0, 0], value2_.values_array)
value_ = ::Versionomy.create([1,2,3], :rubygems)
value2_ = value_.convert(:semver)
assert_equal([1,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_semver_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2.0', :semver))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.0beta3', :semver))\n end",
"def test_standard_to_semver_inequality_comparison\n ... | [
"0.733466",
"0.73196834",
"0.7281482",
"0.7213052",
"0.7119469",
"0.69838375",
"0.69651234",
"0.69635326",
"0.68556917",
"0.67677754",
"0.6763679",
"0.67616946",
"0.6760783",
"0.6734215",
"0.6698676",
"0.6678331",
"0.6660359",
"0.66417676",
"0.66403645",
"0.6574504",
"0.65610... | 0.73534465 | 0 |
Test equality comparisons between semver and standard | def test_semver_to_standard_equality_comparison
assert_operator(::Versionomy.parse('1.2.0', :semver), :==, ::Versionomy.parse('1.2'))
assert_operator(::Versionomy.parse('1.2.0b3', :semver), :==, ::Versionomy.parse('1.2b3'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_semver_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2.0', :semver))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.0beta3', :semver))\n end",
"def test_standard_to_semver_inequality_comparison\n ... | [
"0.86275727",
"0.842371",
"0.8391934",
"0.7231559",
"0.7163141",
"0.7141014",
"0.71078575",
"0.7097644",
"0.7058847",
"0.70329934",
"0.6961858",
"0.69272727",
"0.68308496",
"0.6829932",
"0.6786794",
"0.6736493",
"0.6725176",
"0.6621568",
"0.6614301",
"0.65931195",
"0.6565746"... | 0.87070066 | 0 |
Test inequality comparisons between semver and standard | def test_semver_to_standard_inequality_comparison
assert_operator(::Versionomy.parse('1.2.3', :semver), :<, ::Versionomy.parse('1.2.4'))
assert_operator(::Versionomy.parse('1.2.0b3', :semver), :>, ::Versionomy.parse('1.2b2'))
assert_operator(::Versionomy.parse('1.2.0', :semver), :>, ::Versionomy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_semver_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :semver), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :==, ::Versionomy.parse('1.2b3'))\n end",
"def test_standard_to_semver_equality_comparison\n ... | [
"0.83965075",
"0.8261123",
"0.82288146",
"0.6913445",
"0.6746281",
"0.6591334",
"0.65315396",
"0.6522962",
"0.65169066",
"0.6516811",
"0.6497466",
"0.6486159",
"0.6476094",
"0.6470608",
"0.6447511",
"0.64194834",
"0.6406784",
"0.6375143",
"0.6360564",
"0.6307057",
"0.63003606... | 0.82311934 | 2 |
Test equality comparisons between standard and rubygems | def test_standard_to_semver_equality_comparison
assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2.0', :semver))
assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.0beta3', :semver))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_rubygems_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2', :rubygems))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.beta.3', :rubygems))\n end",
"def test_rubygems_to_standard_equality_compariso... | [
"0.76449245",
"0.76020914",
"0.7200081",
"0.7033406",
"0.69728786",
"0.69262296",
"0.67757887",
"0.67283636",
"0.6684099",
"0.653708",
"0.6448908",
"0.6329334",
"0.62994957",
"0.62972426",
"0.6212985",
"0.61767143",
"0.61729044",
"0.60761774",
"0.60739106",
"0.6062343",
"0.60... | 0.61879635 | 15 |
Test inequality comparisons between standard and rubygems | def test_standard_to_semver_inequality_comparison
assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :semver))
assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0beta3', :semver))
assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_standard_to_rubygems_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2', :rubygems))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.beta.3', :rubygems))\n end",
"def test_rubygems_to_standard_equality_compariso... | [
"0.71769035",
"0.71605164",
"0.71602833",
"0.69525516",
"0.68179697",
"0.66745585",
"0.6589414",
"0.65855736",
"0.6528031",
"0.65185004",
"0.6438018",
"0.63957775",
"0.6387017",
"0.6336806",
"0.628713",
"0.626526",
"0.6242252",
"0.6227006",
"0.6209601",
"0.6160829",
"0.612181... | 0.6199452 | 19 |
If all of our session variables are set then yes, craigslist has the proper session variables. | def craigslist_has_session?
(session[:min_price] && session[:max_price] && session[:query]) ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_session?\n session\n end",
"def session_loaded?\n\t\treturn @session || self.request.session_loaded?\n\tend",
"def single_session?\n ENV['SINGLE_SESSION'].nil? ? false : ENV['SINGLE_SESSION'].upcase == 'TRUE'\n end",
"def check_session\n \n # check session for cart exists?\n if sessi... | [
"0.6332251",
"0.625949",
"0.6256885",
"0.620236",
"0.61375326",
"0.6048874",
"0.6004856",
"0.5979167",
"0.59491783",
"0.59152454",
"0.59136766",
"0.5908896",
"0.58960855",
"0.58739173",
"0.58195394",
"0.5805993",
"0.5804241",
"0.5792388",
"0.57766056",
"0.57766056",
"0.577660... | 0.7753264 | 0 |
Save our parameters (GET variables) as session variables if they're set | def save_session(params, session)
session[:zip] = params[:zip] if params[:zip]
session[:min_price] = params[:min_price].to_i if params[:min_price]
session[:max_price] = params[:max_price].to_i if params[:max_price]
session[:query] = params[:query].split(' ').join('+') if params[:query]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_parameters_in_session\n [:start_date, :end_date, :persons].each do |parameter|\n session[parameter] = params[parameter]\n end\n end",
"def save_request\n session[:old_saved_params] = session[:saved_params] || {};\n saved_params = params.reject { |k, v| !(v.kind_of?(String) || v.... | [
"0.72206074",
"0.7202706",
"0.7139747",
"0.7139747",
"0.7139747",
"0.6891478",
"0.68725276",
"0.6851817",
"0.680672",
"0.6803889",
"0.6772557",
"0.6772557",
"0.6772557",
"0.67624515",
"0.67541707",
"0.6743189",
"0.66711855",
"0.6671111",
"0.6656318",
"0.65865576",
"0.65796125... | 0.7168361 | 2 |
encrypts password and creates account Author :: Sushil Review :: Shivam | def register
enc_password = Authentication::Encryptor.digest(password)
account = Authentication::Account.find_or_initialize_by({email: username})
account.assign_attributes({'encrypted_password' => enc_password, 'gid' => gid})
account.roles.concat(role.to_a).uniq!
account.save!
{'acco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end",
"def create_hashed... | [
"0.71404934",
"0.7085608",
"0.68224007",
"0.6804605",
"0.6800943",
"0.6740094",
"0.6708303",
"0.670236",
"0.6676149",
"0.66574067",
"0.6649726",
"0.6649726",
"0.6649726",
"0.6649726",
"0.6649726",
"0.6646477",
"0.6644159",
"0.6632104",
"0.66237557",
"0.6611748",
"0.6577124",
... | 0.0 | -1 |
depends_on "cmake" => :build | def install
bin.install "jsonfilter.sh" => "jsonfilter"
bin.install "jsontocsv.py" => "jsontocsv"
bin.install "tomltojsonfilter.sh" => "tomltojsonfilter"
bin.install "yamltojsonfilter.sh" => "yamltojsonfilter"
bin.install "csvtojson.sh" => "csvtojson"
bin.install "jsontotomlfilter.sh" => "jsonto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_depends_on\n depends_on\n end",
"def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend",
"def ... | [
"0.6862918",
"0.67779785",
"0.6605081",
"0.6427604",
"0.6401638",
"0.6370821",
"0.62428576",
"0.6164104",
"0.6164104",
"0.6134335",
"0.6026515",
"0.6026515",
"0.6026515",
"0.594891",
"0.59437174",
"0.5839825",
"0.5780695",
"0.5748207",
"0.57473993",
"0.57118607",
"0.56998265"... | 0.0 | -1 |
Set the config from the profile | def initialize(argv=[], openstack_server_create=OpenstackServerCreate.new)
super(argv) # Thanks, mixlib-cli
# This loads the config
configure_chef
@profiles = YAMLProfiles.new(config[:yaml_config])
@openstack_server_create = openstack_server_create
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_config\n @me = current_user\n @profile = Profile.find_by user_id: current_user.id\n @preference = Preference.find_by user_id: current_user.id\n end",
"def set_profile\n end",
"def set_profile\n @profile = current_user.profile\n end",
"def set_profile\n @profile = cur... | [
"0.7898009",
"0.7430086",
"0.7061746",
"0.7061746",
"0.7061746",
"0.7061746",
"0.70594186",
"0.703136",
"0.70030093",
"0.6868604",
"0.6813634",
"0.6745399",
"0.6687351",
"0.6648101",
"0.66263676",
"0.66024446",
"0.65963936",
"0.65724534",
"0.6564817",
"0.65428036",
"0.6529305... | 0.0 | -1 |
was closed, this bug is fixed in Chef 11. | def work_around_chef_10_bug
return if Chef::VERSION >= "11.0.0"
[:ssh_user, :ssh_port, :ssh_gateway, :identity_file,
:host_key_verify].each do |attribute|
config[attribute] = config_from_knife_or_default attribute
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize chef_recipe\n super(chef_recipe.cookbook_name, chef_recipe.recipe_name, chef_recipe.run_context)\n\n # TODO: Support other distributions besides 'linux'\n node.default[\"serf\"][\"binary_url\"] = File.join node[\"serf\"][\"base_binary_url\"], \"#{node[\"serf\"][\"version\"]}\", \"serf_#{nod... | [
"0.6154659",
"0.6061431",
"0.58883893",
"0.5875801",
"0.5875801",
"0.5814499",
"0.5811804",
"0.57449186",
"0.5705544",
"0.5695687",
"0.567106",
"0.5649798",
"0.55901724",
"0.5567378",
"0.5567216",
"0.5560449",
"0.5549893",
"0.55119056",
"0.5500671",
"0.5497488",
"0.54687154",... | 0.65988165 | 0 |
puts suma2(2,3,5,15) puts suma2(numeros) gets() | def calculadora(uno,dos,tres=0, opciones= {})
if(opciones['suma']==1)
return uno +dos+tres
end
if(opciones['multiplica']==1)
return uno * dos *tres
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Suma\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n puts \"\\nSuma: #{numero1 + numero2}\"\n end",
"def add_function \n\tputs \"Enter the numbers\"\n\tn1 = gets.to_i\n\tn2 = gets.to_i\n\tputs \"The sum is #{n1+n2}\... | [
"0.79124856",
"0.7873768",
"0.74720854",
"0.73643714",
"0.73092693",
"0.7246837",
"0.7243256",
"0.7243083",
"0.72095996",
"0.7203886",
"0.72009164",
"0.7194801",
"0.7158826",
"0.7147373",
"0.7129544",
"0.71105033",
"0.7101539",
"0.7093745",
"0.7069201",
"0.7068744",
"0.705627... | 0.0 | -1 |
GET /confs GET /confs.json | def playtest_conf
# @conf = Conf.where(game_id: params[:game_id]).sample #take a random Conf of that game
@conf = find_playtest_conf
respond_to do |format|
if @conf
format.html { redirect_to @conf }
format.json { render :playtest_conf, status: :ok }
else
format.json { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @confs = Conf.all\n end",
"def index\n @confs = Conf.all\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n @concerts = Concert.all\n end",
... | [
"0.6662934",
"0.6662934",
"0.6005858",
"0.570545",
"0.570545",
"0.570545",
"0.570545",
"0.569999",
"0.5611746",
"0.56073433",
"0.5576804",
"0.5575623",
"0.5573868",
"0.5556435",
"0.55558974",
"0.5496405",
"0.5483461",
"0.5462099",
"0.54568183",
"0.545456",
"0.5437905",
"0.5... | 0.0 | -1 |
GET /confs GET /confs.json | def index
@confs = Conf.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all... | [
"0.6005858",
"0.570545",
"0.570545",
"0.570545",
"0.570545",
"0.569999",
"0.5611746",
"0.56073433",
"0.5576804",
"0.5575623",
"0.5573868",
"0.5556435",
"0.55558974",
"0.5496405",
"0.5483461",
"0.5462099",
"0.54568183",
"0.545456",
"0.5437905",
"0.5413018",
"0.5391233",
"0.5... | 0.6662934 | 1 |
GET /confs/1 GET /confs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @confs = Conf.all\n end",
"def index\n @confs = Conf.all\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def show\n @concurso = Concurso.find(params[:id... | [
"0.6443468",
"0.6443468",
"0.6147963",
"0.5986059",
"0.5848508",
"0.58327085",
"0.5794953",
"0.57903105",
"0.57835025",
"0.5712808",
"0.5675341",
"0.5660603",
"0.56449187",
"0.56075126",
"0.559557",
"0.55931777",
"0.55902356",
"0.55866426",
"0.55866426",
"0.55866426",
"0.5586... | 0.0 | -1 |
POST /confs POST /confs.json | def create
@conf = Conf.new(conf_params)
canSave = true;
if (request.format == :json)
if (params[:params].blank?)
canSave = false;
logger.debug "empty parameters"
else
params[:params].each do |p|
@conf.params.new(name: p[:name], value: p[:value])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connections_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_post ...\"\n end\n \n # resource path\n path = \"/connections\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query... | [
"0.57099146",
"0.5621342",
"0.54720706",
"0.5404053",
"0.53409165",
"0.53409165",
"0.52912885",
"0.5285501",
"0.5216065",
"0.52008337",
"0.5199109",
"0.5171589",
"0.5140917",
"0.5133456",
"0.51329434",
"0.5118276",
"0.5094863",
"0.50878525",
"0.5081592",
"0.50667906",
"0.5046... | 0.5104916 | 16 |
PATCH/PUT /confs/1 PATCH/PUT /confs/1.json | def update
respond_to do |format|
if @conf.update(conf_params)
format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }
format.json { render :show, status: :ok, location: @conf }
else
format.html { render :edit }
format.json { render json: @conf.errors,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @co... | [
"0.6131631",
"0.58757806",
"0.58650094",
"0.57324004",
"0.56994444",
"0.56730384",
"0.5665652",
"0.5662698",
"0.56410086",
"0.56293476",
"0.5603216",
"0.55681914",
"0.5552941",
"0.55523574",
"0.5510106",
"0.5510106",
"0.5480862",
"0.548055",
"0.5448659",
"0.54451567",
"0.5431... | 0.5295508 | 48 |
DELETE /confs/1 DELETE /confs/1.json | def destroy
@conf.destroy
respond_to do |format|
format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end",
"def de... | [
"0.6973774",
"0.68388814",
"0.6610493",
"0.6547327",
"0.6324185",
"0.6318519",
"0.62812966",
"0.62557966",
"0.62299395",
"0.62259686",
"0.6221686",
"0.62170625",
"0.6212719",
"0.6203776",
"0.6201653",
"0.619718",
"0.61942685",
"0.61942685",
"0.61942685",
"0.61942685",
"0.6192... | 0.65960664 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.