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 /tours/1 GET /tours/1.json | def show
# Get tour information from the model so we use it in the show view
hash = Tour.handle_show(params[:id], current_user.id)
@tour = hash[:tour]
@seats_available = hash[:seats_available]
@seats_waitlisted = hash[:seats_waitlisted]
@user_tour = hash[:user_tour]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tours = Tour.find(params[:id])\n end",
"def index\n @tours = Tour.all\n end",
"def index\n @tours = Tour.all\n end",
"def index\n #@tours = Tour.all\n end",
"def index\n @tours = Tour.find(1,2,3,4)\n end",
"def index\n @tours = Tour.all\n if params[:search]\n @s... | [
"0.76017433",
"0.7459113",
"0.7459113",
"0.7353131",
"0.71196204",
"0.6803102",
"0.6773846",
"0.6754985",
"0.67062265",
"0.669323",
"0.6625073",
"0.6524155",
"0.6485118",
"0.64557034",
"0.6430808",
"0.64117706",
"0.6383489",
"0.6343115",
"0.6271126",
"0.62682503",
"0.6247308"... | 0.0 | -1 |
POST /tours POST /tours.json | def create
# if image(s) attached they will be found inside tour_params
@tour = Tour.new(tour_params)
respond_to do |format|
if @tour.save
# Save the current user to the new tour's list of users... this creates the association record in the user_tours table
@tour.users << current_user
format.html { redirect_to @tour, notice: 'Tour was successfully created.' }
format.json { render :show, status: :created, location: @tour }
else
format.html { render :new }
format.json { render json: @tour.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tour = current_user.tours.new(params[:tour])\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, :notice => 'Tour was successfully created.' }\n format.xml { render :xml => @tour, :status => :created, :location => @tour }\n format.json { ren... | [
"0.6760751",
"0.66702574",
"0.65213275",
"0.6514009",
"0.6290698",
"0.6244058",
"0.6244058",
"0.6225952",
"0.6214439",
"0.6198587",
"0.6171875",
"0.6141954",
"0.61197436",
"0.61145175",
"0.60679406",
"0.6041542",
"0.6030725",
"0.5990762",
"0.59786594",
"0.59362704",
"0.587088... | 0.6383303 | 4 |
PATCH/PUT /tours/1 PATCH/PUT /tours/1.json | def update
respond_to do |format|
# if image(s) attached they will be found inside tour_params
if @tour.update(tour_params)
format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }
format.json { render :show, status: :ok, location: @tour }
else
format.html { render :edit }
format.json { render json: @tour.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @tour = Tour.find(params[:id])\n\n respond_to do |format|\n if @tour.update_attributes(params[:tour])\n format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.64515835",
"0.6234317",
"0.620462",
"0.6192293",
"0.6192293",
"0.61782444",
"0.61735815",
"0.6166202",
"0.6142134",
"0.6128434",
"0.6121596",
"0.61191964",
"0.6104709",
"0.6104709",
"0.6103473",
"0.609755",
"0.6092677",
"0.6072948",
"0.6031876",
"0.6031763",
"0.60260326",
... | 0.0 | -1 |
DELETE /tours/1 DELETE /tours/1.json | def destroy
if params[:picture_id]
delete_picture(params[:picture_id])
respond_to do |format|
format.html { redirect_to tour_url(@tour.id), notice: 'Image was successfully destroyed.' }
format.json { head :no_content }
end
else
@tour.destroy
respond_to do |format|
format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tour = Tour.find_by_url(params[:id])\n @tour.destroy\n\n respond_to do |format|\n format.html { redirect_to(tours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @tour = Tour.find(params[:id])\n @tour = Tour.find_by_permalink(params[:id])\n @tour.de... | [
"0.7524152",
"0.7401713",
"0.73962617",
"0.73065335",
"0.73065335",
"0.73065335",
"0.73065335",
"0.73065335",
"0.73065335",
"0.7300691",
"0.72590744",
"0.70217735",
"0.6994736",
"0.69651663",
"0.69564503",
"0.6949785",
"0.694778",
"0.69398916",
"0.69348764",
"0.6925001",
"0.6... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_tour
@tour = Tour.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 tour_params
params.require(:tour).permit(:id, :name, :description, :created_at, :updated_at, :price,
:booking_deadline, :from_date, :to_date, :total_seats,
:op_email, :op_phone, :status, :my_tours,
images: [],
tour_locations_attributes: [:id, :country, :state_or_province, :_destroy])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.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 |
=begin def oldTry(node) if node.catch_variable catch_label = uniqid output :pushcatch, catch_label end finally_label = uniqid if node.finally_statements output :pushfinally, finally_label end end_label = uniqid compile node.try_statements no exceptions? clean up output :popcatch if node.catch_variable output :jmp, finally_label if node.catch_variable output :".label", catch_label output :".catch", node.catch_variable.intern output :popcatch compile node.catch_statements end output :".label", finally_label if node.finally_statements output :popfinally compile node.finally_statements output :endfinally end end =end | def Or(node)
compile node.left
output :dup
end_label = uniqid
output :jit, end_label
output :pop
compile node.right
output :".label", end_label
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n return_value = TryStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _fi... | [
"0.7351828",
"0.715183",
"0.63941544",
"0.63938165",
"0.6237953",
"0.61896646",
"0.60590124",
"0.60400766",
"0.6012873",
"0.5948162",
"0.58561623",
"0.58211255",
"0.57986385",
"0.57661474",
"0.5625289",
"0.55531716",
"0.5535168",
"0.5517831",
"0.5500568",
"0.549377",
"0.53804... | 0.0 | -1 |
returns the data at given point | def get(x,y)
# Translate, bottom left ist 0,0
y = (height-1) - y
@data[y][x]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](point)\n @array[point.first][point.last]\n end",
"def get_data_at(index)\n $test_logger.log(\"Get data from location #{index}\")\n raise \"No data available\" if !@data\n raise \"No data found at index '#{index}'\" if @data.length<index+1 \n BioPacket.swap_dword(@data[index])\n ... | [
"0.6598435",
"0.645354",
"0.6391928",
"0.6326121",
"0.6297932",
"0.62318087",
"0.6225296",
"0.6220375",
"0.6154763",
"0.6126146",
"0.6109078",
"0.6086364",
"0.6078728",
"0.605098",
"0.5980493",
"0.5888469",
"0.5883405",
"0.5768054",
"0.5748424",
"0.57231975",
"0.5715154",
"... | 0.6231815 | 5 |
pull counts of c_i^d | def pull(_d, _i)
c = @c[_d][_i]
# pull from @Cp
@Cp[_d][c] -= 1
# pull from @Ce
vkey = Array.new(@d){|d| 0}
vkey[_d] = _i
begin
ckey = vkey2ckey(vkey)
@Ce[ckey][ @A[vkey] ] -= 1
end while (vkey = succ_vkey_d(vkey, _d)) != nil
@c[_d][_i] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n Daru::Vector.new(values)\n end",
"def nucleotide_counts\n hash = {}\n @valid_inputs.each do |i|\n hash[i] = @dna.count i\n end\n hash\n end",
"def... | [
"0.6221522",
"0.60579544",
"0.59308094",
"0.5926389",
"0.5891223",
"0.58639765",
"0.5863213",
"0.58004236",
"0.5788489",
"0.5787701",
"0.5784478",
"0.57788604",
"0.57771915",
"0.57741016",
"0.57190967",
"0.5714841",
"0.569104",
"0.56842476",
"0.5672665",
"0.5663135",
"0.56438... | 0.0 | -1 |
push counts of c_i^d = k | def push(_d, _i, _k)
abort("invalid push") if @c[_d][_i] != nil
@c[_d][_i] = _k
# push to @Cp
@Cp[_d][_k] += 1
# push to @Ce
vkey = Array.new(@d){|d| 0}
vkey[_d] = _i
begin
ckey = vkey2ckey(vkey)
@Ce[ckey][ @A[vkey] ] += 1
end while (vkey = succ_vkey_d(vkey, _d)) != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend",
"def accum_counts(counts)\n each_byte do |b| counts[b - ?a] += 1 if b >= ?a && b <= ?z end\n end",
"def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n... | [
"0.60302407",
"0.58939534",
"0.58923584",
"0.57873565",
"0.5749837",
"0.57431436",
"0.57389754",
"0.57326794",
"0.57213223",
"0.5686016",
"0.56297314",
"0.56034267",
"0.5586053",
"0.5566902",
"0.5560124",
"0.54522985",
"0.5439403",
"0.54251623",
"0.54156923",
"0.5397596",
"0.... | 0.73087424 | 0 |
about keys (patterns) ckey normal successor | def succ_ckey(_ckey)
for d in 0..@d-1
if _ckey[d] < @n[d]-1
_ckey[d] += 1
return _ckey
else
_ckey[d] = 0
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys(pattern = T.unsafe(nil)); end",
"def key_matcher(pattern, options); end",
"def keygens; end",
"def possible_keys(key); end",
"def transform_keys(&block); end",
"def keys(*) end",
"def transform_keys!(&block); end",
"def key_coercions; end",
"def keys() end",
"def handle_key(key); end",
... | [
"0.6783487",
"0.6698949",
"0.6498288",
"0.64583194",
"0.64489335",
"0.63294196",
"0.6300498",
"0.62518764",
"0.6181938",
"0.6149464",
"0.6079396",
"0.6059791",
"0.6059791",
"0.6059791",
"0.6059791",
"0.6047211",
"0.6047211",
"0.6047211",
"0.6047211",
"0.6047211",
"0.5910849",... | 0.0 | -1 |
successor with fixed point | def succ_ckey_d(_ckey, _d)
for d in 0..@d-1
next if d == _d
if _ckey[d] < @n[d]-1
_ckey[d] += 1
return _ckey
else
_ckey[d] = 0
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def takfp x, y, z\n return z unless y < x\n takfp( takfp(x-1.0, y, z),\n takfp(y-1.0, z, x),\n takfp(z-1.0, x, y))\nend",
"def act_f()\n (y() >= 0) ? 1.0 : -1.0;\n end",
"def calc_tip(p, r)\n \n t = p.round(-1)/10\n \n case \n when r == 0\n t -= 1\n when r == 1\n t +... | [
"0.60306406",
"0.5910319",
"0.5785487",
"0.57501876",
"0.57475793",
"0.5743277",
"0.56843805",
"0.56843805",
"0.5681312",
"0.5681312",
"0.5667428",
"0.5628756",
"0.56141144",
"0.5605369",
"0.55984056",
"0.5595164",
"0.5575031",
"0.554584",
"0.554584",
"0.554584",
"0.551895",
... | 0.0 | -1 |
successor with fixed point | def succ_vkey_d(_vkey, _d)
for d in 0..@d-1
next if d == _d
if _vkey[d] < @m[d]-1
_vkey[d] += 1
return _vkey
else
_vkey[d] = 0
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def takfp x, y, z\n return z unless y < x\n takfp( takfp(x-1.0, y, z),\n takfp(y-1.0, z, x),\n takfp(z-1.0, x, y))\nend",
"def act_f()\n (y() >= 0) ? 1.0 : -1.0;\n end",
"def calc_tip(p, r)\n \n t = p.round(-1)/10\n \n case \n when r == 0\n t -= 1\n when r == 1\n t +... | [
"0.6031295",
"0.59098715",
"0.5786817",
"0.5750682",
"0.57472545",
"0.5743697",
"0.5686179",
"0.5686179",
"0.56802845",
"0.56802845",
"0.5668836",
"0.56283504",
"0.56164235",
"0.5606677",
"0.5600116",
"0.5595461",
"0.5574722",
"0.55440944",
"0.55440944",
"0.55440944",
"0.5519... | 0.0 | -1 |
cal log marginal likelihood | def cal_log_ml
lml = 0
# log p(c^d | \alpha)
for d in 0..@d-1
lml += cal_log_Z(@c[d], @a)
end
# log p(A | c, \beta)
@Ce.keys.each do |ckey|
lml += cal_log_Z(@Ce[ckey], @b)
end
lml -= @Ce.size * cal_log_Z(Array.new(@v){|v| 0}, @b)
lml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _log_likelihood x,y,b \n sum = 0\n x.row_size.times{|i|\n xi = Matrix.rows([x.row(i).to_a.collect{|v| v.to_f}])\n y_val = y[i,0].to_f\n sum += log_likelihood_i xi, y_val, b\n }\n\n sum\n end",
"def log_likelihood_i(xi,yi,b)\n ... | [
"0.67267185",
"0.62142074",
"0.6121376",
"0.60136694",
"0.578968",
"0.57686424",
"0.5716097",
"0.5686498",
"0.55817014",
"0.55808157",
"0.5564415",
"0.55126923",
"0.547832",
"0.54488754",
"0.5436698",
"0.5428239",
"0.5417961",
"0.5405465",
"0.5386149",
"0.53357977",
"0.530324... | 0.7073148 | 0 |
GET /videos GET /videos.xml | def index
@devices = Address.find(:all)
if params.has_key?(:device_id)
@videos = Video.find(:all,
:conditions =>["device_id = ?", params[:device_id]],
:order => "timestamp DESC")
else
@videos = Video.find(:all, :order => "timestamp DESC")
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @videos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @videos.to_xml }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n ... | [
"0.75634027",
"0.71446943",
"0.69122803",
"0.6910946",
"0.6910946",
"0.6910946",
"0.69004256",
"0.6890343",
"0.6870868",
"0.68705004",
"0.686812",
"0.6768202",
"0.6739545",
"0.6706381",
"0.6651797",
"0.6583376",
"0.6536348",
"0.6536348",
"0.65333235",
"0.65057504",
"0.6493457... | 0.6011314 | 92 |
GET /videos/1 GET /videos/1.xml | def show
@video = Video.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @video }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @videos.to_xml }\n end\n end",
"def show\n @video = Video.find(params[:id])\n\n ... | [
"0.71213084",
"0.71006984",
"0.7077252",
"0.7075795",
"0.7075795",
"0.7075795",
"0.705557",
"0.6751679",
"0.67459095",
"0.6678883",
"0.6652542",
"0.6649166",
"0.66300887",
"0.66205186",
"0.6600312",
"0.6598148",
"0.65639853",
"0.6441869",
"0.6441869",
"0.64399385",
"0.6405574... | 0.69500834 | 7 |
GET /videos/new GET /videos/new.xml | def new
@video = Video.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @video }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def new\n @v... | [
"0.76469165",
"0.7640834",
"0.7640834",
"0.7394197",
"0.731504",
"0.7281704",
"0.71484494",
"0.70745224",
"0.7013342",
"0.70122296",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.70112634",
"0.... | 0.75565237 | 3 |
POST /videos POST /videos.xml | def create
flash[:notice] = ''
if params.has_key?(:file)
register_device params[:device_id]
@video = Video.new(:video => params[:file],
:upload_password => params[:upload_password],
:device_id => params[:device_id],
:timestamp => params[:timestamp],
:annotation => params[:annotation]
)
else
@video = Video.new(params[:upload])
@video.timestamp = DateTime.now.to_i
end
respond_to do |format|
if @video.save
format.html { redirect_to :action => 'index' }
format.xml { render :xml => @video, :status => :created, :location => @video }
else
format.html do
flash[:notice] = 'Upload Error.'
redirect_to :action => "index"
end
format.xml { render :xml => @video.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_videos\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location ... | [
"0.66142994",
"0.65725774",
"0.6564629",
"0.6564629",
"0.6456166",
"0.6373349",
"0.6363365",
"0.63510555",
"0.6274081",
"0.62259245",
"0.6222633",
"0.61974967",
"0.6190147",
"0.6190147",
"0.6190147",
"0.6190147",
"0.61785895",
"0.61785895",
"0.61785895",
"0.61785895",
"0.6178... | 0.5762875 | 82 |
PUT /videos/1 PUT /videos/1.xml | def update
@video = Video.find(params[:id])
respond_to do |format|
if @video.update_attributes(params[:video])
format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @video.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_video(video_id, title, description, method = HTTP_PUT)\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n }\n request_xml += %{<_method>put</_method>} if method != HTTP_PUT\n request_xml += %{\n <video>\n <title>#{title}</t... | [
"0.7267848",
"0.671543",
"0.6669843",
"0.6669843",
"0.6558015",
"0.6542283",
"0.63800794",
"0.63272005",
"0.63272005",
"0.6298002",
"0.6298002",
"0.6298002",
"0.6298002",
"0.6298002",
"0.6298002",
"0.6298002",
"0.6275951",
"0.6271524",
"0.6219029",
"0.6213495",
"0.6183151",
... | 0.66321284 | 4 |
DELETE /videos/1 DELETE /videos/1.xml | def destroy
@video = Video.find(params[:id])
@video.destroy
respond_to do |format|
format.html { redirect_to(videos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.h... | [
"0.7525619",
"0.7525619",
"0.7525619",
"0.7524308",
"0.7485395",
"0.7438152",
"0.73762953",
"0.73364335",
"0.7129987",
"0.7118853",
"0.6972403",
"0.6958324",
"0.69554806",
"0.695143",
"0.695143",
"0.69233537",
"0.69233537",
"0.69233537",
"0.69233537",
"0.69233537",
"0.6923353... | 0.7507358 | 4 |
grab google to access google for user data | def google_token
x = self.authentications.find_by(provider: 'google_oauth2')
return x.token unless x.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_details_from_google_oauth2\n\t\t# To Do\n\t\tself.user.has_google = true\n\t\tself.user.save\n\tend",
"def import_profile_from_google\n # forthcoming\n end",
"def auth_google\n @attributes[:auth_google]\n end",
"def get_user_info()\n return_map = nil\n if session[:google_unique] !=... | [
"0.70599234",
"0.68542886",
"0.6695554",
"0.65548927",
"0.6415024",
"0.62403667",
"0.6227571",
"0.6159301",
"0.61578625",
"0.6132184",
"0.61205184",
"0.60578567",
"0.60172325",
"0.60172325",
"0.60036004",
"0.5971567",
"0.5946125",
"0.59445536",
"0.59415406",
"0.5934195",
"0.5... | 0.5469474 | 71 |
grab facebook to access facebook for user data | def fb_token
x = self.authentications.where(:provider => :facebook).first
return x.token unless x.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end",
"def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username... | [
"0.76710546",
"0.75397986",
"0.7503707",
"0.7441458",
"0.72270674",
"0.72043335",
"0.7197348",
"0.7142691",
"0.71241647",
"0.70425606",
"0.69708836",
"0.6957169",
"0.69492",
"0.69468606",
"0.69244057",
"0.69076586",
"0.68735605",
"0.6867984",
"0.6843972",
"0.68013275",
"0.673... | 0.0 | -1 |
Create Portfolio after sign up | def create_portfolio
@user = User.last
@portfolio = Portfolio.new
@user.portfolio = @portfolio
@user.save
@portfolio.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @portfolio = Portfolio.new(portfolio_params)\n @portfolio.user = current_user\n @portfolio.save\n redirect_to portfolios_path\n end",
"def create\n @user = User.find(current_user.id)\n @portfolio = @user.portfolios.new(portfolio_params)\n\n @portfolio.save\n redirect_to port... | [
"0.7819454",
"0.7574676",
"0.75654054",
"0.731147",
"0.7281913",
"0.72338015",
"0.7152069",
"0.70759106",
"0.7046227",
"0.698251",
"0.6973377",
"0.6947983",
"0.6867119",
"0.6826884",
"0.6746863",
"0.6725744",
"0.67071706",
"0.6686586",
"0.6653073",
"0.6649722",
"0.66370326",
... | 0.78604203 | 0 |
Returns true if the current user is following the other user | def following?(other_user)
following.include?(other_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n ... | [
"0.8636335",
"0.8587318",
"0.8587318",
"0.8587318",
"0.85868174",
"0.85868174",
"0.85868174",
"0.85868174",
"0.84926015",
"0.8484561",
"0.84795225",
"0.84779507",
"0.84779507",
"0.84779507",
"0.84779507",
"0.84779507",
"0.84779507",
"0.84779507",
"0.84779507",
"0.84779507",
"... | 0.0 | -1 |
append a new Score (or Markup) | def <<(score)
@content << score
if score.is_a? Score
@scores << score
sid = score.headers['id']
if sid
if @scores_by_id.has_key? sid
raise ArgumentError.new("More than one score with id '#{sid}'.")
end
@scores_by_id[sid] = score
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_score_to_output(score, adj_start_to_current_start=false)\n score.notes.each do |note| \n dup_note = set_added_note_attrs note\n if adj_start_to_current_start\n dup_note.start(dup_note.start + @current_start) \n end\n @out_notes << dup_note\n end\n if not score.nil? &&... | [
"0.695755",
"0.6863422",
"0.68363094",
"0.6421934",
"0.6349373",
"0.6249684",
"0.61867344",
"0.6133096",
"0.58973604",
"0.5862484",
"0.58181137",
"0.5793141",
"0.5785152",
"0.5764463",
"0.57620573",
"0.5732018",
"0.5729956",
"0.572953",
"0.57293624",
"0.5473634",
"0.54728436"... | 0.6818752 | 3 |
GET /schoolclasses/1 GET /schoolclasses/1.json | def show
@schoolclass = Schoolclass.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @schoolclass }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end",
"def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n en... | [
"0.7824359",
"0.7518366",
"0.75055057",
"0.73523563",
"0.7185839",
"0.68708754",
"0.6861611",
"0.6851329",
"0.68487114",
"0.6650509",
"0.6650509",
"0.65533996",
"0.65050083",
"0.64843845",
"0.64511657",
"0.64191383",
"0.641253",
"0.6379158",
"0.6367003",
"0.6359515",
"0.63522... | 0.78391814 | 0 |
GET /schoolclasses/new GET /schoolclasses/new.json | def new
@schoolclass = Schoolclass.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @schoolclass }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_class }\n end\n end",
"def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rende... | [
"0.8186771",
"0.813327",
"0.7530987",
"0.7530987",
"0.75097907",
"0.7479836",
"0.7405693",
"0.732036",
"0.7269546",
"0.7236531",
"0.722363",
"0.7220031",
"0.71494496",
"0.71483105",
"0.7148163",
"0.7095364",
"0.70575887",
"0.70448697",
"0.70258254",
"0.70223063",
"0.7021761",... | 0.8184719 | 1 |
POST /schoolclasses POST /schoolclasses.json | def create
@schoolclass = Schoolclass.new(params[:schoolclass])
respond_to do |format|
if @schoolclass.save
format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }
format.json { render json: @schoolclass, status: :created, location: @schoolclass }
else
format.html { render action: "new" }
format.json { render json: @schoolclass.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }... | [
"0.7602586",
"0.73850614",
"0.68936133",
"0.6857708",
"0.6785983",
"0.6615852",
"0.6565927",
"0.65261465",
"0.65056866",
"0.6500984",
"0.64996314",
"0.6489415",
"0.6489415",
"0.6479692",
"0.64769685",
"0.6449867",
"0.6448041",
"0.6443338",
"0.6423649",
"0.640711",
"0.63762796... | 0.75350237 | 1 |
PUT /schoolclasses/1 PUT /schoolclasses/1.json | def update
@schoolclass = Schoolclass.find(params[:id])
respond_to do |format|
if @schoolclass.update_attributes(params[:schoolclass])
format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @schoolclass.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_classes_url, notice: 'Class was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.75379795",
"0.74619305",
"0.7293535",
"0.70673627",
"0.70673627",
"0.6641032",
"0.65808344",
"0.6577612",
"0.65368724",
"0.6466882",
"0.64667374",
"0.64667374",
"0.6442209",
"0.6427981",
"0.6409784",
"0.6402281",
"0.6373682",
"0.6371725",
"0.6371725",
"0.6371725",
"0.63717... | 0.75529194 | 0 |
DELETE /schoolclasses/1 DELETE /schoolclasses/1.json | def destroy
@schoolclass = Schoolclass.find(params[:id])
@schoolclass.destroy
respond_to do |format|
format.html { redirect_to schoolclasses_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_class.destroy\n respond_to do |format|\n format... | [
"0.8061161",
"0.79784995",
"0.7889176",
"0.7889176",
"0.73943055",
"0.7377076",
"0.73629004",
"0.7356273",
"0.735389",
"0.735389",
"0.7290641",
"0.7275605",
"0.7273691",
"0.7221712",
"0.7167595",
"0.7156748",
"0.7156748",
"0.7156748",
"0.7156748",
"0.7135215",
"0.71255416",
... | 0.80867434 | 0 |
FUNCTIONS SECTION FUNCTION: section_looper PURPOSE: Iterate the process on all sections PARAMETERS: email_body: Get content of the email to generate RETURNS: / | def section_looper(email_body)
section = [:first_section, :second_section, :third_section]
section.each do |section|
type_looper(email_body, section)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_looper(email_body, section)\n type = [:new_features, :improvements, :tasks, :bugs]\n \n type.each do |cType|\n tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body... | [
"0.6385215",
"0.57354605",
"0.57348484",
"0.529475",
"0.52321064",
"0.52304584",
"0.50928223",
"0.5091631",
"0.50468063",
"0.5020342",
"0.49834192",
"0.49819717",
"0.49706936",
"0.49700984",
"0.4970024",
"0.49690086",
"0.49573338",
"0.4954731",
"0.49545157",
"0.49358028",
"0.... | 0.83576405 | 0 |
FUNCTION: type_looper PURPOSE: Itearate the process on all type of tickets PARAMETERS: email_body: Get content of the email to generate section: Current section to iterate on RETURNS: / | def type_looper(email_body, section)
type = [:new_features, :improvements, :tasks, :bugs]
type.each do |cType|
tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body[section][cType])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_looper(email_body)\n section = [:first_section, :second_section, :third_section]\n\n section.each do |section|\n type_looper(email_body, section)\n end\nend",
"def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details)\n i = 0\n\n File.open(file).read... | [
"0.7281999",
"0.6319089",
"0.5115296",
"0.5028149",
"0.4963669",
"0.49442703",
"0.4907207",
"0.48945594",
"0.4881189",
"0.48711103",
"0.48128298",
"0.48034742",
"0.4789139",
"0.47480574",
"0.4737166",
"0.47207668",
"0.47063154",
"0.4703522",
"0.46566662",
"0.46546182",
"0.465... | 0.81906307 | 0 |
FUNCTION: tickets_looper PURPOSE: Iterate on all lines of sprint files (last and next sprints) PARAMETERS: email_body: Get content of the email to generate section: Current section to iterate on type: ? file: ? statuses: ? tickets: ? ticket_details: ? RETURNS: / | def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details)
i = 0
File.open(file).readlines.each do |cLine|
# Check if the file has been added
if cLine.include?(type) && statuses.inject(false) { |memo, status| cLine.downcase.include?(status.downcase) || memo }
unless $tickets_list.include?(cLine.split("\t")[1]) || $tickets_list.include?(cLine.split("\t")[1] + " <span style='color: #FF6A77'>⇨ " + cLine.split("\t")[4] + "</span>")
if cLine.split("\t")[4].downcase == "done"
tickets << cLine.split("\t")[1]
else
tickets << cLine.split("\t")[1] + " <span style='color: #FF6A77'>⇨ " + cLine.split("\t")[4] + "</span>"
end
i = i + 1
end
end
end
if i > 0
$tickets_list = tickets + ($tickets_list - tickets)
ticket_details[:nb_tickets] = i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_looper(email_body, section)\n type = [:new_features, :improvements, :tasks, :bugs]\n \n type.each do |cType|\n tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body... | [
"0.61876667",
"0.5540164",
"0.53832775",
"0.5038448",
"0.49030867",
"0.47823453",
"0.47660002",
"0.47210208",
"0.46933335",
"0.46853894",
"0.46736747",
"0.4673664",
"0.45883363",
"0.45359203",
"0.4525512",
"0.4515053",
"0.4487482",
"0.44786972",
"0.4473849",
"0.44706592",
"0.... | 0.7760518 | 0 |
FUNCTION: pluralize PURPOSE: Add the pluralize PARAMETERS: word: The word to check if we need to add plural of not nb: Number to identify plural RETURNS: Current string with adjustment on plural word | def pluralize(word, nb)
if (nb > 1)
return "#{word}s"
else
return "#{word}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluralize(word); end",
"def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each do |(rule, replacement)| \n break if result.gsub!(rule, replacement)\n end\n res... | [
"0.8291213",
"0.7874297",
"0.7760038",
"0.7757809",
"0.7757809",
"0.7733956",
"0.7672149",
"0.75080585",
"0.74505484",
"0.7440822",
"0.73560196",
"0.7138265",
"0.70662105",
"0.7050328",
"0.70469284",
"0.6951704",
"0.69056594",
"0.6899908",
"0.6888621",
"0.6883731",
"0.6871323... | 0.804285 | 1 |
FUNCTION: getfilename PURPOSE: Determine the filename with current date PARAMETERS: / RETURNS: Path of the file to create serving to add all information of the sprint update | def getfilename()
current_time = Time.new.strftime("%Y-%m-%d")
# Create filename
filename = current_time + "_sprint_update_CS.html"
# Create folder with all file of sprint update
foldername = "History"
Dir.mkdir(foldername) unless File.exists?(foldername)
return File.join(".", foldername, filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end",
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_curren... | [
"0.74618983",
"0.74618983",
"0.7234299",
"0.7227529",
"0.7157259",
"0.71547526",
"0.71396947",
"0.71308124",
"0.7087508",
"0.70554817",
"0.6999715",
"0.69842774",
"0.69481206",
"0.69449836",
"0.69214165",
"0.6884821",
"0.6883223",
"0.6862304",
"0.684564",
"0.68437064",
"0.680... | 0.81904453 | 0 |
Get root nodes count/array for explorer tree | def x_get_tree_roots(count_only, _options)
objects = []
objects.push(:id => "asrv",
:text => _("Active Services"),
:icon => "pficon pficon-folder-close",
:load_children => true,
:tip => _("Active Services"))
objects.push(:id => "rsrv",
:text => _("Retired Services"),
:icon => "pficon pficon-folder-close",
:load_children => true,
:tip => _("Retired Services"))
count_only_or_objects(count_only, objects)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end",
"def x_get_tree_roots\n count_only_or_objects(false, StorageCluster.all)\n end",
"def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end",
"def get_number_of_root_elements(eleme... | [
"0.76894385",
"0.7564059",
"0.7150193",
"0.7136118",
"0.7069378",
"0.70347905",
"0.70306265",
"0.6932372",
"0.6925589",
"0.69245976",
"0.69080853",
"0.68787706",
"0.6833141",
"0.68173724",
"0.68168944",
"0.68070954",
"0.68012446",
"0.6789951",
"0.67724264",
"0.6772102",
"0.67... | 0.7035114 | 5 |
Creates an instance of a Cluster class, initialized with defaults or the provided points and/or centroid. Params: :points An array of Point objects that will become the members of the cluster. :centroid A Point object representing the centroid of the cluster. Returns: A Cluster instance. | def initialize(params = {})
self.points = params[:points] || []
self.centroid = params[:centroid] || nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(points=[])\n @iterations = 3\n @cluster_count = 0\n @points = points\n @clusters = []\n @logger = Log4r::Logger.new('Clusterer')\n @logger.add('default')\n \n # R... | [
"0.61567456",
"0.57494426",
"0.5444567",
"0.5435973",
"0.5412673",
"0.5357415",
"0.5237831",
"0.5223695",
"0.5154099",
"0.5043205",
"0.49439824",
"0.4931941",
"0.49198112",
"0.4798184",
"0.47895426",
"0.4767987",
"0.4761733",
"0.47542825",
"0.47532475",
"0.4727614",
"0.472761... | 0.5963908 | 1 |
Returns the number of points in the cluster. Returns: A Fixnum equal to the number of points in the cluster. | def size
self.points.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_points\n @size * @size\n end",
"def n\n points.size\n end",
"def size\n\t\t@clusters.size\n\tend",
"def cluster_annotation_count\n self.cluster_groups.map {|c| c.cell_annotations.size}.reduce(0, :+)\n end",
"def total_points\n self.user_points.reduce(0) { |sum, points| sum + poin... | [
"0.7359832",
"0.7251844",
"0.69580716",
"0.6860715",
"0.67471915",
"0.674463",
"0.66980547",
"0.6485827",
"0.6418411",
"0.629915",
"0.6299086",
"0.6251382",
"0.6245883",
"0.6243909",
"0.6237761",
"0.62288785",
"0.6148581",
"0.61330235",
"0.61277264",
"0.6116006",
"0.6055679",... | 0.64755934 | 8 |
Calculates the number of dimensions for the points in the cluster. All points in the cluster should have the same number of dimensions. Returns: A Fixnum equal to the number of coordinates that the first point in the cluster. | def dimensionality
return nil if self.points.count == 0
self.points.first.dimensions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions\n self.coords.count\n end",
"def num_points\n @size * @size\n end",
"def size\n\t\t@clusters.size\n\tend",
"def length\n grid_shape.length\n end",
"def n\n points.size\n end",
"def cluster_annotation_count\n self.cluster_groups.map {|c| c.cell_annotations.size}.red... | [
"0.6990923",
"0.6841318",
"0.6609939",
"0.65020794",
"0.6500633",
"0.6363131",
"0.6260901",
"0.62242085",
"0.6208721",
"0.620424",
"0.61857384",
"0.61842376",
"0.6155246",
"0.6117672",
"0.61124384",
"0.60909027",
"0.6064525",
"0.60413134",
"0.6038652",
"0.5982167",
"0.5960458... | 0.6589093 | 3 |
Calculates a range for each dimension such that it covers all coordinates in that dimension for all points in the cluster. Returns: An Array of Range objects, sucn that each range_i covers point.coords_i, for all points. | def dimensional_ranges
points = self.points.map &:coords
points.transpose.map { |d| d.min.to_f..d.max.to_f }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_coords_in(minmax, coord=[], coords=[])\n if minmax.empty?\n coords << coord\n else\n min, max = minmax[0]\n (min..max).each do |dim_coord|\n all_coords_in(minmax[1..-1], coord + [dim_coord], coords)\n end\n end\n coords\n end",
"def convert_all_ranges\n if self.... | [
"0.644344",
"0.5969025",
"0.5824408",
"0.582361",
"0.5816668",
"0.5792295",
"0.57451147",
"0.56550246",
"0.5614021",
"0.5585035",
"0.554071",
"0.55277926",
"0.5515443",
"0.54791194",
"0.5463592",
"0.5430055",
"0.5415276",
"0.5402412",
"0.53921646",
"0.53666866",
"0.53626174",... | 0.7443832 | 0 |
Adds the specified Point object to this cluster, removing it from any other clusters first. In the future we may make it possible for a point to belong to more than one Cluster, or for a point to have a fuzzy relationship with clusters. Params: point the Point object that should be added to this cluster. Returns: This Cluster instance. | def add_point(point)
point.cluster.remove_point point if point.cluster
self.points << point
point.cluster = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <<(point)\n @points << ensure_point_is_location_object(point)\n @points.uniq!\n self\n end",
"def add_to_point point\n add_to_point! point.dup\n end",
"def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unle... | [
"0.73217535",
"0.69854754",
"0.6917421",
"0.68061155",
"0.67658496",
"0.6754942",
"0.65452325",
"0.64526933",
"0.6427863",
"0.6403132",
"0.63457894",
"0.6309248",
"0.62558997",
"0.61804616",
"0.6139067",
"0.60212547",
"0.5910567",
"0.5857493",
"0.5713876",
"0.5705562",
"0.565... | 0.8310775 | 0 |
Removes the specified Point object from this cluster. Note that if two points with the same coordinates are members of the cluster, only the one with the same memory address will be removed. (Removal is done by instance equality which is based on the memory address not coordinate equality.) Params: point the Point object that should be removed from this cluster. Returns: nil | def remove_point(point)
self.points.delete point
point.cluster = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(p)\n @first = counterclockwise(@first) if @first.equal?(p)\n @first = nil if @first.equal?(p)\n @neighbors.delete(p)\n end",
"def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end",
"def remove... | [
"0.6343471",
"0.5907696",
"0.5858198",
"0.56060785",
"0.5529343",
"0.5511267",
"0.5491795",
"0.5482285",
"0.53937984",
"0.53906137",
"0.53814256",
"0.53576195",
"0.53563154",
"0.5354377",
"0.5319888",
"0.52398646",
"0.5208203",
"0.5185692",
"0.51625717",
"0.51625717",
"0.5156... | 0.84225297 | 0 |
Determines whether the specified point is a member of this cluster. Like \remove_point, this is done by instance equality (memory address), not coordinate equality. Params: point the Point object whose membership we wish to test. Returns True if the point is a member of the cluster, False otherwise. | def include?(point)
self.points.include? point
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains?(point)\n point.inside?(self)\n end",
"def contains?(point)\n contains_xy?(point.x, point.y)\n end",
"def point_inside?(point)\n Geom.point_in_polygon_2D(point, hexagon(position, RADIUS), true)\n end",
"def point_is_inside(point)\n result = false\n vertex1 = @points... | [
"0.72043335",
"0.716633",
"0.7044048",
"0.7005432",
"0.67497003",
"0.65100276",
"0.6342464",
"0.6304478",
"0.6262158",
"0.6246827",
"0.61500615",
"0.61324",
"0.6099664",
"0.60705036",
"0.60604066",
"0.5995715",
"0.5947682",
"0.5922017",
"0.5920738",
"0.5884041",
"0.58539253",... | 0.61849046 | 10 |
Function borrowed from smart_hashdump | def get_system_proc
# Make sure you got the correct SYSTEM Account Name no matter the OS Language
local_sys = resolve_sid("S-1-5-18")
system_account_name = "#{local_sys[:domain]}\\#{local_sys[:name]}"
# Processes that can Blue Screen a host if migrated in to
dangerous_processes = ["lsass.exe", "csrss.exe", "smss.exe"]
session.sys.process.processes.each do |p|
# Check we are not migrating to a process that can BSOD the host
next if dangerous_processes.include?(p["name"])
next if p["pid"] == session.sys.process.getpid
next if p["pid"] == 4
next if p["user"] != system_account_name
return p
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def dump_hash(hash, context = CoderContext.new)\n # Symbolizing keys to unlock *... | [
"0.707597",
"0.707597",
"0.707597",
"0.707597",
"0.707597",
"0.707597",
"0.707597",
"0.6689132",
"0.6592332",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6584434",
"0.6554643",
"0.6554643",
"0.65524... | 0.0 | -1 |
load_and_authorize_resource GET /game_alphabets GET /game_alphabets.json | def index
@game_alphabets = GameAlphabet.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end",
"def index\n @alphabets = Alphabet.all\n end",
"def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end",
"def lett... | [
"0.7761794",
"0.69334084",
"0.62090445",
"0.62068486",
"0.6199391",
"0.6199386",
"0.6175006",
"0.61218184",
"0.61218184",
"0.606902",
"0.5921776",
"0.5847844",
"0.5835356",
"0.5808569",
"0.58034414",
"0.5765683",
"0.5726098",
"0.5703627",
"0.57005197",
"0.5629907",
"0.5605382... | 0.71056765 | 1 |
GET /game_alphabets/1 GET /game_alphabets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end",
"def index\n @game_alphabets = GameAlphabet.all\n end",
"def index\n @alphabets = Alphabet.all\n end",
"def english_word(attempt)\n url = \"https://wagon-dictionary.he... | [
"0.7664251",
"0.7207166",
"0.6819757",
"0.6522696",
"0.6259619",
"0.61740476",
"0.6120231",
"0.6110008",
"0.6030476",
"0.60230756",
"0.6009434",
"0.599795",
"0.59481627",
"0.588637",
"0.58741385",
"0.58741385",
"0.5852589",
"0.5831381",
"0.581172",
"0.5797616",
"0.57841015",
... | 0.0 | -1 |
POST /game_alphabets POST /game_alphabets.json | def create
@game_alphabet = GameAlphabet.new(game_alphabet_params)
respond_to do |format|
if @game_alphabet.save
format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully created.' }
format.json { render action: 'show', status: :created, location: @game_alphabet }
else
format.html { render action: 'new' }
format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end",
"def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end",
"def game_params\n params.require(:game).permit(:letters)... | [
"0.7253304",
"0.69218963",
"0.6432131",
"0.6400679",
"0.6142293",
"0.60437787",
"0.60307974",
"0.5991438",
"0.59512025",
"0.58851767",
"0.5871188",
"0.58694416",
"0.5745431",
"0.5745431",
"0.5743061",
"0.57265365",
"0.5697366",
"0.56455",
"0.56125814",
"0.55449474",
"0.549332... | 0.64646405 | 2 |
PATCH/PUT /game_alphabets/1 PATCH/PUT /game_alphabets/1.json | def update
respond_to do |format|
if @game_alphabet.update(game_alphabet_params)
format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n\tGameAlphabet.delete_game_alphabets(@game.id)\n\tTimer.delete_game_timers(@game.id)\n\t if @game.update(game_params)\n\t #@alphabets = ['s','y','z','a','b']\n\t @alphabets = ['الف' , 'ب' , 'پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , '... | [
"0.65018547",
"0.63964003",
"0.6322317",
"0.5881074",
"0.58541435",
"0.58275914",
"0.581786",
"0.57623035",
"0.5753232",
"0.57061666",
"0.5646209",
"0.5645754",
"0.5602462",
"0.55933595",
"0.5565832",
"0.55248165",
"0.5502193",
"0.54931694",
"0.54881835",
"0.54822016",
"0.548... | 0.707947 | 0 |
DELETE /game_alphabets/1 DELETE /game_alphabets/1.json | def destroy
@game_alphabet.destroy
respond_to do |format|
format.html { redirect_to game_alphabets_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @alphabet.destroy\n respond_to do |format|\n format.html { redirect_to alphabets_url, notice: 'Alphabet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_... | [
"0.68337625",
"0.65308505",
"0.6520827",
"0.6441445",
"0.64321023",
"0.63990873",
"0.6390668",
"0.63752997",
"0.63562566",
"0.63177323",
"0.62914115",
"0.62773186",
"0.62600774",
"0.6230565",
"0.6228064",
"0.62231183",
"0.62030023",
"0.6192674",
"0.61836994",
"0.6176086",
"0.... | 0.7739876 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_game_alphabet
@game_alphabet = GameAlphabet.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 game_alphabet_params
params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)
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 |
return user member by id | def get_member(_user_id)
user_participants.where(id: _user_id).take
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_member_by_id(id)\n @board.members.find { |m| m.id == id }\n end",
"def member(id)\n space_memberships.find_by(user_id: id)\n end",
"def get_member(id)\n is_admin? ? ::Refinery::Memberships::Member.find(id) : current_refinery_user\n end",
"def get_user(id)\n @users[id]\n... | [
"0.828159",
"0.82316464",
"0.82199925",
"0.7739596",
"0.7631772",
"0.75175834",
"0.74912727",
"0.7456474",
"0.74503964",
"0.74027056",
"0.7293004",
"0.7265817",
"0.7233544",
"0.7204741",
"0.7191809",
"0.7190397",
"0.7170296",
"0.716617",
"0.7164408",
"0.7161669",
"0.7133149",... | 0.7844152 | 3 |
check if user_id is in current conversation | def is_in_conversation?(_user_id)
conversation_members.where(user_id: _user_id).any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_by?(user)\n from_user_id == user&.id\n end",
"def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end",
"def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversatio... | [
"0.7299198",
"0.7231549",
"0.7068452",
"0.70051",
"0.69285077",
"0.68953055",
"0.68942624",
"0.6828195",
"0.6828195",
"0.6819626",
"0.68095887",
"0.67378473",
"0.673119",
"0.6685123",
"0.66744745",
"0.6656612",
"0.6654996",
"0.66523147",
"0.66236967",
"0.66088057",
"0.6571263... | 0.8621658 | 0 |
check if user_id is admin from current conversation | def is_admin?(_user_id)
conversation_members.admin.where(user_id: _user_id).any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend",
"def admin_user\n @current_user.admin?\n end",
"def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end",
"def admin_user\n (current_user.present? && current_user.admin?)\n end",
"def admin_user?\n if curr... | [
"0.78232646",
"0.734285",
"0.7296295",
"0.7212587",
"0.7212086",
"0.7202949",
"0.72008276",
"0.71941465",
"0.7188969",
"0.7172338",
"0.7138661",
"0.71316415",
"0.71249884",
"0.7095167",
"0.70883363",
"0.70812905",
"0.70787835",
"0.7078168",
"0.7071933",
"0.70621085",
"0.70384... | 0.86353064 | 0 |
add a new participant to the current conversation user_ids: (Array) new participants ID current_user: user who is adding the new participant | def add_participant(_user_ids, _current_user = nil)
update(new_members: _user_ids.is_a?(Array) ? _user_ids : [_user_ids], updated_by: _current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n particip... | [
"0.7643294",
"0.7124458",
"0.7001229",
"0.68382394",
"0.6800617",
"0.6722664",
"0.6548295",
"0.6525721",
"0.6512752",
"0.638485",
"0.63684577",
"0.6291235",
"0.62403136",
"0.6214687",
"0.6189608",
"0.6174519",
"0.61706316",
"0.6160917",
"0.6121028",
"0.60921985",
"0.60032094"... | 0.8498038 | 0 |
remove a participant from current conversation user_id: user id who is leaving the group | def leave_conversation(_user_id)
_updated_by = updated_by
self.updated_by = nil
conversation_members.where(user_id: _user_id).take.destroy!
self.updated_by = _updated_by
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_participant(user) # :nodoc:\n id = user.to_s.downcase\n unless @participant_ids.include?(id)\n logger.warning(\"Attempted to remove a participant who was not in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participa... | [
"0.762961",
"0.7430907",
"0.7077803",
"0.7070717",
"0.6992048",
"0.6844692",
"0.6834485",
"0.6813345",
"0.6765522",
"0.67617375",
"0.6748411",
"0.6736423",
"0.6725016",
"0.6714764",
"0.6700518",
"0.66651964",
"0.6566175",
"0.65532833",
"0.651133",
"0.6504711",
"0.6451893",
... | 0.736392 | 2 |
check if current conversation is a group conversation | def is_group_conversation?
group_title.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def group?\n type == :group_id\n end",
"def group?\n type == :group_id\n end",
"def in_group?(group)\n ... | [
"0.68405974",
"0.68405974",
"0.67577523",
"0.67577523",
"0.67383814",
"0.6635502",
"0.6622683",
"0.6622683",
"0.6613604",
"0.660063",
"0.6564338",
"0.65473104",
"0.65115345",
"0.6505596",
"0.6484703",
"0.6484046",
"0.64710736",
"0.6445479",
"0.6444146",
"0.64360994",
"0.63634... | 0.7886707 | 0 |
add a message sent from Bot | def add_bot_message(message)
messages.notification.create(sender_id: User.bot_id, body: message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_message(name, message)\n\t\tend",
"def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end",
"def message(options)\n @sent_messages << options[:text]\n end",
"def send_message(message); end",
"def send_message(message); end",
"de... | [
"0.71807367",
"0.6894628",
"0.68368524",
"0.6793057",
"0.6793057",
"0.67133904",
"0.6705784",
"0.6675791",
"0.6658184",
"0.6643782",
"0.66180044",
"0.6607805",
"0.6591836",
"0.6574539",
"0.65744114",
"0.65706927",
"0.6564723",
"0.65646774",
"0.651196",
"0.6507823",
"0.6447554... | 0.7620624 | 0 |
add a message _user_id: sender id | def send_message(_user_id, message, extra_data = {})
messages.create!({sender_id: _user_id, body: message}.merge(extra_data))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id=(user_id); @message_impl.setUserId user_id; end",
"def send_message_to(_user, _message, extra_data = {})\n return if _user.id == id # skip send message to self\n Conversation.get_single_conversation(id, _user.id).send_message(id, _message, extra_data)\n end",
"def send_message(to_user, conte... | [
"0.7130977",
"0.702478",
"0.7009058",
"0.689858",
"0.6893213",
"0.6836311",
"0.66877353",
"0.66082627",
"0.65985245",
"0.65744346",
"0.65359706",
"0.64976954",
"0.64968634",
"0.6470018",
"0.6446893",
"0.643502",
"0.6415428",
"0.64149505",
"0.6408142",
"0.6400727",
"0.63836414... | 0.75429964 | 0 |
return all mending messages for user | def count_pending_messages_for(_user)
Rails.cache.fetch(get_unread_cache_key_for(_user.id), expires_in: 1.week.from_now) do
_member = conversation_members.where(user_id: _user).take
if _member.present?
messages.where('messages.created_at > ?', _member.last_seen).count
else
0
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_messages\r\n self.users_messaged + self.users_messaged_by\r\n end",
"def all_messages\r\n self.users_messaged + self.users_messaged_by\r\n end",
"def messages_from user\n backend.messages_page(user).messages\n end",
"def all_messages\n Message.all\n end... | [
"0.74776715",
"0.74776715",
"0.68494064",
"0.6770832",
"0.67529804",
"0.6693435",
"0.6684952",
"0.66789603",
"0.6633031",
"0.6602989",
"0.6586655",
"0.65579593",
"0.6537718",
"0.6464599",
"0.6422633",
"0.64035875",
"0.63832265",
"0.63832265",
"0.6363067",
"0.6332161",
"0.6329... | 0.0 | -1 |
return cache key unread messages for user member | def get_unread_cache_key_for(_user_id)
"cache-count_pending_messages_for-#{id}-#{(last_activity || Time.current).to_i}-#{_user_id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unread_messages(user)\n Rails.cache.fetch(\"#{cache_key_with_version}/unread_messages/#{user.id}\") do\n Message.unread_by(user).where(chat_room: self).where.not(user: user).to_a\n end\n end",
"def unread_chats_count_cache_key\n \"#{self.cache_key}/unread_chats_count\"\n end",
"def count_pe... | [
"0.7219761",
"0.7171557",
"0.71668696",
"0.71536136",
"0.70160645",
"0.6866475",
"0.66438717",
"0.65122837",
"0.64741737",
"0.6407556",
"0.636092",
"0.630194",
"0.6278316",
"0.6201542",
"0.6185977",
"0.5996763",
"0.599096",
"0.59581995",
"0.5945157",
"0.5942546",
"0.592076",
... | 0.8371134 | 0 |
join to a public conversation group | def join!(_user_id)
if !is_private?
if banned_users.where(user_id: _user_id).any?
errors.add(:base, 'You were banned from this group.')
false
else
add_participant(_user_id)
end
else
errors.add(:base, 'This is a private group, please contact to administrator.')
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_group(id)\n\t\t\t#id: ID of the group to join\n\t\t\toptions = {\"id\" => id}\n\t\t\tdata = oauth_request(\"/group/join\", options, \"post\")\n\t\tend",
"def join\n @group = Group.find(params[:id])\n\n if !current_user.is_member_of?(@group)\n current_user.join!(@group)\n flash[:notice] =... | [
"0.7028185",
"0.6993417",
"0.6823392",
"0.6823392",
"0.67838544",
"0.6742465",
"0.66802955",
"0.6629272",
"0.65393525",
"0.64969456",
"0.6335918",
"0.63108796",
"0.62746626",
"0.61751705",
"0.6120427",
"0.6115082",
"0.60974723",
"0.609582",
"0.60954434",
"0.60903084",
"0.6070... | 0.6513065 | 9 |
check if current conversation has enough members to exist | def is_valid?
is_group_conversation? ? user_participants.count >= 1 : user_participants.count >= 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_members?\n self.members.count > 0\n end",
"def ensure_conversation_members\n convo = Conversation.where(availability_id: id).first\n if convo\n convo.conversation_members.create(user: user, admin: admin) if convo.conversation_members.where(user: user).first.nil?\n end\n end",
"def ve... | [
"0.7368867",
"0.71844834",
"0.7150458",
"0.6788403",
"0.6552314",
"0.6529718",
"0.6521204",
"0.64746785",
"0.64307797",
"0.64015716",
"0.6372366",
"0.63213927",
"0.63060844",
"0.6304082",
"0.62970036",
"0.625701",
"0.6233059",
"0.62132126",
"0.62043387",
"0.6193539",
"0.61919... | 0.6519091 | 7 |
triggers instant notification to all subscribers to conversation channel | def trigger_instant_notification(key, data)
PubSub::Publisher.new.publish_to(public_key, key, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_subscribers\n NotificationSubscription.notify(self)\n end",
"def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end",
"def notify_subscribers\n NewAnswerNotificationMailer.notify_subscribers\n end",
"def subscribe_channels\n @channels.each { |channel| subs... | [
"0.6838305",
"0.6679473",
"0.6444159",
"0.6392926",
"0.63536465",
"0.6348268",
"0.6326981",
"0.63025975",
"0.62738454",
"0.6271598",
"0.6204482",
"0.6173919",
"0.6169095",
"0.61656386",
"0.61560804",
"0.61180896",
"0.61115265",
"0.6054896",
"0.6054896",
"0.60308975",
"0.60112... | 0.0 | -1 |
return the public key of this content | def public_key
Base64.encode64("conversation_#{id}").gsub(/(=|\n)/, '') << id.to_s.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_key\n @pub\n end",
"def public_key\n @priv.public_key\n end",
"def get_public_key\n return @public_key\n end",
"def public_key\n @public_key.to_der\n end",
"def public_key\n return @children['public-key'][:value]\n end",
"def public_key_data\n @... | [
"0.86189103",
"0.84844714",
"0.8320904",
"0.83162844",
"0.827178",
"0.8198206",
"0.8149033",
"0.8129014",
"0.8073511",
"0.8073511",
"0.8015189",
"0.8015189",
"0.78855234",
"0.78288394",
"0.77737325",
"0.77567965",
"0.77567965",
"0.77567965",
"0.7723202",
"0.77060354",
"0.7672... | 0.70178205 | 32 |
ban a member from current conversation group | def ban_member(_user_id)
unless is_in_conversation?(_user_id)
errors.add(:base, "This user is not member of current group")
return false
end
unless is_group_conversation?
errors.add(:base, "This is not a conversation group")
return false
end
banned_users.create(user_id: _user_id)
del_member(_user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ban!\n MTurkUtils.ban_user self\n end",
"def ban_group\n banned_group = PreviaGroup.find(params[:previa_group_id])\n BanGroupFromGroup.call(@previa_group, banned_group)\n\n respond_to do |format|\n format.html { redirect_to @previa_group, notice: 'El grupo de previa fue bloqueado con éxito.... | [
"0.70904666",
"0.6986597",
"0.69524926",
"0.6900115",
"0.6833348",
"0.6833348",
"0.67607754",
"0.6615547",
"0.6580129",
"0.6530699",
"0.6421638",
"0.6383988",
"0.637283",
"0.6359341",
"0.6323711",
"0.6323711",
"0.6308084",
"0.62976444",
"0.62763244",
"0.62065524",
"0.6166832"... | 0.79552454 | 0 |
delete an existent member from current group | def del_member(_user_id)
update!(del_members: [_user_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end",
"def... | [
"0.785572",
"0.75620145",
"0.75526994",
"0.7393694",
"0.7355496",
"0.7355496",
"0.73111975",
"0.73063576",
"0.7269686",
"0.7249298",
"0.71673745",
"0.7129943",
"0.70111686",
"0.70106167",
"0.6993205",
"0.69469255",
"0.6925154",
"0.69133437",
"0.6890658",
"0.6865842",
"0.68505... | 0.72280467 | 10 |
send instant notifications for start typing | def start_typing(_user)
PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'start_typing', {source: {id: id}, user: _user.as_basic_json(:now)}, {foreground: true})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_typing(data); end",
"def start_typing(data); end",
"def start_typing\n API::Channel.start_typing(@bot.token, @id)\n end",
"def start_typing(token, channel_id)\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/typing\",\n nil,\n Authorizatio... | [
"0.76182014",
"0.76182014",
"0.75194216",
"0.6636829",
"0.6444439",
"0.63481843",
"0.5942958",
"0.58620864",
"0.5420129",
"0.53828186",
"0.53645146",
"0.53613037",
"0.53605044",
"0.529463",
"0.527212",
"0.5256911",
"0.52463955",
"0.522275",
"0.5167252",
"0.51645935",
"0.51556... | 0.69296753 | 3 |
send instant notifications for stop typing | def stop_typing(_user)
PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'stop_typing', {source: {id: id}, user: {id: _user.id}}, {foreground: true})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_typing\n PubSub::Publisher.new.publish_for(conversation.user_participants.online.where.not(id: sender.id), 'stop_typing', {source: {id: conversation_id}, user: {id: sender.id}}, {foreground: true})\n end",
"def start_typing(data); end",
"def start_typing(data); end",
"def typing(recipient:)\n\t\... | [
"0.69841737",
"0.6149496",
"0.6149496",
"0.58092123",
"0.5680132",
"0.5670255",
"0.5641455",
"0.56201845",
"0.5503337",
"0.5445626",
"0.54041046",
"0.53622854",
"0.5352317",
"0.5321119",
"0.52746415",
"0.5264371",
"0.52412313",
"0.52366",
"0.5235099",
"0.5219051",
"0.5197758"... | 0.6624377 | 1 |
create default message after group was created | def generate_welcome_message
if default_message.present?
messages.notification.create(sender_id: owner_id, body: default_message)
else
messages.notification.create(sender_id: owner_id, body: "#{owner.full_name(false)} created this conversation group.") if is_group_conversation?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group = Group.find(params[:message][:group_id])\n\n # @message = current_user.messages.build(params[:message])\n\n @message = current_user.messages.build(content: params[:message][:content], picture: params[:message][:picture])\n # Group.find(params[:message][:group_id]).messages << @mess... | [
"0.6610715",
"0.6553855",
"0.6473169",
"0.6460432",
"0.6399084",
"0.6390135",
"0.6381072",
"0.6350813",
"0.6350813",
"0.62970865",
"0.6278066",
"0.62121356",
"0.6178017",
"0.6157355",
"0.6081889",
"0.6061881",
"0.60579675",
"0.60546786",
"0.6052238",
"0.60520756",
"0.6043146"... | 0.75084144 | 0 |
only for single conversations | def verify_members
conversation_members << conversation_members.new(user_id: owner_id, is_admin: true)
errors.add(:base, "Required two members to create a 1 to 1 conversation.") if !is_group_conversation? && ((new_members || []) + [owner_id]).delete_empty.map(&:to_i).uniq.count < 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conversations\n Conversation.where(\"sender_id = ? or recipient_id = ?\",self.id,self.id)\n end",
"def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end",
"def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end",
"def conversations\n ... | [
"0.7146301",
"0.714032",
"0.714032",
"0.7110651",
"0.7077107",
"0.67990476",
"0.6738198",
"0.67297983",
"0.6636499",
"0.6635097",
"0.6604334",
"0.65808874",
"0.65128946",
"0.65044904",
"0.6499315",
"0.6475913",
"0.64590836",
"0.64113516",
"0.64113516",
"0.64113516",
"0.641135... | 0.0 | -1 |
specifies number of minutes remaining | def get_time_remaining
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes_remaining\n time_elapsed = (Time.new - @start_time) / 60\n (@total_paid * 60 - time_elapsed).floor\n end",
"def minutes() 60 * seconds end",
"def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predicte... | [
"0.77680886",
"0.7713077",
"0.7649952",
"0.74174297",
"0.74010336",
"0.73654073",
"0.73183006",
"0.718702",
"0.7151018",
"0.7117252",
"0.7117252",
"0.70953375",
"0.70412093",
"0.7016962",
"0.7008105",
"0.6902535",
"0.6895499",
"0.68919617",
"0.68895185",
"0.68888056",
"0.6877... | 0.7353875 | 6 |
I worked on this challenge [by myself, with: Riley Scheid]. Your Solution Below | def leap_year? (year)
if year % 4 != 0
return false
elsif year % 100 != 0
return true
elsif year % 400 != 0
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(sec... | [
"0.6505725",
"0.63606966",
"0.6249834",
"0.6213748",
"0.6203788",
"0.6199545",
"0.6152524",
"0.61518013",
"0.6146651",
"0.61459666",
"0.61348665",
"0.613256",
"0.6127185",
"0.6125308",
"0.6105568",
"0.61053413",
"0.610206",
"0.6083887",
"0.6079074",
"0.6075531",
"0.6071808",
... | 0.0 | -1 |
Returns true if the document has code callouts | def has_callouts?
parser = REXML::Parsers::PullParser.new(File.new(@docbook_file))
while parser.has_next?
el = parser.pull
if el.start_element? and (el[0] == "calloutlist" or el[0] == "co")
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_code?\n code != nil\n end",
"def has_source_code_info?\n file_descriptor_proto.has_field?(:source_code_info)\n end",
"def documented?\n return true if @received_nodoc\n return false if @comment_location.empty?\n @comment_location.any? { |comment, _| not comment.empty? }\n end",
... | [
"0.6282136",
"0.58863693",
"0.58442706",
"0.5786657",
"0.57627934",
"0.5745519",
"0.5724832",
"0.5724832",
"0.56664175",
"0.566509",
"0.5627609",
"0.5601201",
"0.55927086",
"0.55607563",
"0.5542513",
"0.5497151",
"0.5466728",
"0.54513615",
"0.54509765",
"0.5432641",
"0.535471... | 0.7357287 | 0 |
takes player name and url params constructs url and uses Nokogiri to open connection with required parameters returns array of form [Games, AB, Runs, Hits, 2B, 3B, HR, RBI, BB, HBP, CS, SH, SF, GDP, BA, OBA, Slug%, OPS] | def scrape
player = params[:player]
url = params[:url]
endDate = params[:EndDate]
filler = '&GameType=all&PlayedFor=0&PlayedVs=0&Park=0&PlayerID='
id = Player.find_by_name(player).number.to_s
fullUrl = url + '&EndDate=' + endDate + filler + id
page = Nokogiri::HTML(open(fullUrl))
totalsArray = getTotals(page)
render :text => totalsArray.to_json()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_top_ps3_games(url)\n games = []\n page = fetch_html(url)\n return games if page.nil? # return early if there's problem parsing\n\n page.css('div.main_stats').each do |prod|\n title = prod.css('h3.product_title a').text\n score = prod.css('span.metascore_w').text\n games << {tit... | [
"0.6517306",
"0.6478251",
"0.631979",
"0.6286722",
"0.6268174",
"0.6190286",
"0.6109161",
"0.60837585",
"0.6017299",
"0.59208345",
"0.5904583",
"0.586569",
"0.58397734",
"0.5823365",
"0.5814529",
"0.5803674",
"0.5800477",
"0.5793399",
"0.5792",
"0.5764296",
"0.5735375",
"0.... | 0.6198181 | 5 |
parses tables on web page and assembles response array | def getTotals(page)
totalsRow = page.css("table.dbd")[0].css("tr.toprow").last
games = totalsRow.css("td.letter")[0].text.to_i
# From Totals Row
ab = totalsRow.css("td.number")[1].text.to_i
runs = totalsRow.css("td.number")[2].text.to_i
hits = totalsRow.css("td.number")[3].text.to_i
dbl = totalsRow.css("td.number")[4].text.to_i
tpl = totalsRow.css("td.number")[5].text.to_i
hr = totalsRow.css("td.number")[6].text.to_i
rbi = totalsRow.css("td.number")[7].text.to_i
bb = totalsRow.css("td.number")[8].text.to_i
hbp = totalsRow.css("td.number")[10].text.to_i
cs = totalsRow.css("td.number")[13].text.to_i
sh = totalsRow.css("td.number")[14].text.to_i
sf = totalsRow.css("td.number")[15].text.to_i
gdp = totalsRow.css("td.number")[16].text.to_i
# From Summary Row
ba = page.css("table.dbd")[1].css("tr")[1].css("td")[0].text.to_f
oba = page.css("table.dbd")[1].css("tr")[1].css("td")[1].text.to_f
slug = page.css("table.dbd")[1].css("tr")[1].css("td")[2].text.to_f
ops = oba.to_f + slug.to_f
solution = [games,ab,runs,hits,dbl,tpl,hr,rbi,bb,hbp,cs,sh,sf,gdp,ba,oba,slug,ops]
vorp = calcVORP(solution)
solution << vorp
return solution
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_web(table_cells)\nend",
"def parse_table(doc)\n rows = doc.css('table#listUsersTable tbody tr')\n data = rows.map do |row|\n id, name, details = row.search('td')\n url = details.search('a').first['href']\n {id: id.content, name: name.content, registry_url: BASE_URL + url}\n end\nend",
"de... | [
"0.710579",
"0.6862717",
"0.6862717",
"0.67812145",
"0.6695856",
"0.6676961",
"0.6653643",
"0.6611994",
"0.6611994",
"0.66039133",
"0.65435886",
"0.6533872",
"0.6455378",
"0.64538455",
"0.6438571",
"0.64370793",
"0.64185846",
"0.6411954",
"0.6381558",
"0.6381558",
"0.6381558"... | 0.0 | -1 |
Searches database and compares to search string; returns similar results | def search
@matches = []
pattern = params[:search].downcase
find = Regexp.new(Regexp.quote(pattern))
Player.all.each do |p|
player_matches = false
if p.name.downcase =~ find
player_matches = true
@matches << [p.name]
break
end
end
render :text => @matches.to_json()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_similar_strings(query, threshold)\n\t\t# 1. Get the user dictionary id to retrieve similar tmers to the query.\n\t\tbasedic = @db::Dictionary.select(:id).where(:title => @dic_name).all\n \n if basedic.present?\n userdic = @db::UserDictionary.select(:id).where(:dictionary_id => basedic.first... | [
"0.6943976",
"0.66796184",
"0.6669005",
"0.653046",
"0.64215106",
"0.63629746",
"0.63232327",
"0.6284507",
"0.62591994",
"0.62377656",
"0.61852473",
"0.61755526",
"0.61700743",
"0.61698115",
"0.61622316",
"0.61392",
"0.613904",
"0.613904",
"0.61105245",
"0.6102245",
"0.609516... | 0.5713843 | 71 |
calculating VORP comparing runs produced for replacement player vs. selected player, then normalize for 150 game season formula adapted from | def calcVORP(statsArray)
#constants
lgBA = 0.253
lgOBP = 0.317
lgSLG = 0.396
lgRunsPerOut = 0.1633
replaceR = 0.8
replaceRadical = (25 * lgOBP * lgSLG) / (1 - lgBA)
replaceRoot = (replaceRadical ** (1/3.0))
replaceP = (0.1073-(0.11 * replaceR)) * replaceRoot
ab = statsArray[1]
hits = statsArray[3]
cs = statsArray[10]
sh = statsArray[11]
sf = statsArray[12]
gdp = statsArray[13]
totalOuts = ab - hits + cs + sh + sf + gdp
totalSeasons = (statsArray[0].to_f) / 150
adjustedOuts = (totalOuts / totalSeasons)
runsProduced = (lgRunsPerOut * adjustedOuts)
replaceRunsProduced = (replaceR * runsProduced)
walks = statsArray[8]
hbp = statsArray[9]
doubles = statsArray[4]
triples = statsArray[5]
homeRuns = statsArray[6]
totalBases = hits + doubles + (2 * triples) + (3 * homeRuns) + walks + hbp
runsCreated = ((hits + walks) * totalBases) / (ab + walks)
adjustedRunsCreated = (runsCreated / totalSeasons)
vorp = (adjustedRunsCreated - replaceRunsProduced)
return vorp.round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def least_accurate_team(seasonasstring) # shots in game team stats\n #inverse of above\n end",
"def oppg\n (opp_possessions.to_f)/games\n end",
"def oppg\n (opp_possessions.to_f)/games\n end",
"def recompute_team\n teams = CollegiateResult.where(:year => @year).all\n teams.each do |team|\n c... | [
"0.61966324",
"0.6085875",
"0.6085875",
"0.6063497",
"0.5908922",
"0.59044",
"0.58793205",
"0.5878793",
"0.5838307",
"0.57961273",
"0.57791847",
"0.57746035",
"0.57484806",
"0.5710608",
"0.5669978",
"0.566497",
"0.56545335",
"0.56449217",
"0.56404686",
"0.5626321",
"0.5624581... | 0.6263473 | 0 |
Update properties of this object | def update!(**args)
@site = args[:site] if args.key?(:site)
@verification_method = args[:verification_method] if args.key?(:verification_method)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@identifier = args[:identifier] if args.key?(:identifier)
@type = args[:type] if args.key?(:type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012568",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.67404634",
"0.6709981",
"0.6709981",
"0.66964126",
"0.66964126",
"0.66964126",
"0.66964126",
"0.6619218",
"0.6570895",
"0.6539287",
"0.6517026",
"0.63946927",
"0.63901657",
"0.63901657",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@verification_method = args[:verification_method] if args.key?(:verification_method)
@token = args[:token] if args.key?(:token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@items = args[:items] if args.key?(:items)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@id = args[:id] if args.key?(:id)
@owners = args[:owners] if args.key?(:owners)
@site = args[:site] if args.key?(:site)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@identifier = args[:identifier] if args.key?(:identifier)
@type = args[:type] if args.key?(:type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012568",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.6918917",
"0.67404634",
"0.6709981",
"0.6709981",
"0.66964126",
"0.66964126",
"0.66964126",
"0.66964126",
"0.6619218",
"0.6570895",
"0.6539287",
"0.6517026",
"0.63946927",
"0.63901657",
"0.63901657",
"0.63328... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.comment_mailer.new_comment.subject | def new_comment(rep, c_u, content)
@current_user = c_u
@content = content
@rep = rep
mail to: rep.user.email, subject: "Ripetizione per '#{rep.course.name}'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n e... | [
"0.7054389",
"0.7048295",
"0.6907896",
"0.6832532",
"0.68022054",
"0.67697823",
"0.6599975",
"0.6594343",
"0.6585258",
"0.6551703",
"0.65402216",
"0.64974725",
"0.6496766",
"0.64936936",
"0.64936936",
"0.64936936",
"0.64936936",
"0.6491419",
"0.64622784",
"0.64622784",
"0.646... | 0.0 | -1 |
Sets the attribute content_type_db_path | def content_type_db_path=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attachment_content_type=(value)\n self.content_type=value\n end",
"def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end",
"def content_type=(value)\n @content_type = value\n end",
"de... | [
"0.6289128",
"0.6219748",
"0.6199551",
"0.6135668",
"0.6132708",
"0.6067474",
"0.606524",
"0.6064842",
"0.60540867",
"0.6016864",
"0.6015564",
"0.5944689",
"0.5937697",
"0.58732784",
"0.58732784",
"0.5795332",
"0.5745594",
"0.5618715",
"0.5617794",
"0.5611179",
"0.5605457",
... | 0.8190598 | 1 |
Returns the value of attribute ext_db_path. source://mini_mime//lib/mini_mime.rb20 | def ext_db_path; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ext_db_path=(_arg0); end",
"def ext_db_path=(_arg0); end",
"def ext\n @ext ||= File.extname(path)\n end",
"def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end",
"def ext_path\n \"/#{@file.bucket}/#{@file.name}\"\n end",
"def con... | [
"0.7334237",
"0.7333733",
"0.66358954",
"0.6597917",
"0.6575811",
"0.6510848",
"0.6510848",
"0.63989675",
"0.63763756",
"0.6374886",
"0.6374886",
"0.6374886",
"0.6374886",
"0.63449854",
"0.631336",
"0.6271865",
"0.6263179",
"0.6249302",
"0.6240995",
"0.62256783",
"0.619985",
... | 0.7712467 | 1 |
Sets the attribute ext_db_path | def ext_db_path=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ext_db_path; end",
"def ext_db_path; end",
"def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end",
"def default_database_file_path=(file_path)\n\t\t\t@default_database_file_path = file_path\n\t\tend",
"def set_d... | [
"0.78596187",
"0.78596187",
"0.66641337",
"0.65256745",
"0.63663983",
"0.6299413",
"0.5958631",
"0.5946366",
"0.5946366",
"0.57527965",
"0.5747584",
"0.5663391",
"0.5639228",
"0.5637322",
"0.56135833",
"0.56046647",
"0.5601055",
"0.5571381",
"0.5559642",
"0.5559642",
"0.55230... | 0.7895364 | 1 |
lifted from marcandre/backports source://mini_mime//lib/mini_mime.rb127 | def lookup_uncached(val); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negotiate_mime(order); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type=(_); end",
"def mime... | [
"0.6959443",
"0.64763504",
"0.64763504",
"0.64763504",
"0.6364328",
"0.62668884",
"0.62668884",
"0.62668884",
"0.62668884",
"0.6247269",
"0.6083188",
"0.60533684",
"0.59577924",
"0.5935162",
"0.5929907",
"0.59135294",
"0.59135294",
"0.58856237",
"0.5881559",
"0.58698",
"0.584... | 0.0 | -1 |
Returns the value of attribute content_type. source://mini_mime//lib/mini_mime.rb31 | def content_type; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type\n instance_read(:content_type)\n end",
"def content_type\n @mime_type\n end",
"def content_type\n @mime_type || @heads['content-type']\n end",
"def content_type\n return @content_type\n end",
"def content_type\n @content_type ||=\n... | [
"0.8374838",
"0.823714",
"0.8218396",
"0.8185867",
"0.81830573",
"0.80453855",
"0.8023832",
"0.7974987",
"0.7971284",
"0.7932373",
"0.79038745",
"0.7889736",
"0.7887338",
"0.78531736",
"0.78133416",
"0.7807741",
"0.77947146",
"0.77947146",
"0.7791832",
"0.7774186",
"0.7740159... | 0.7326336 | 83 |
Sets the attribute content_type | def content_type=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type=(value)\n @content_type = value\n end",
"def content_type=(content_type); end",
"def content_type=(type)\n @content_type = type\n end",
"def content_type=(new_content_type)\n write_attribute(:content_type, new_content_type)\n end",
"def content_typ... | [
"0.8802819",
"0.86074495",
"0.8489716",
"0.843544",
"0.8331165",
"0.8311967",
"0.82400024",
"0.8239851",
"0.8239851",
"0.8196885",
"0.8129728",
"0.8129728",
"0.8129728",
"0.8129728",
"0.80998695",
"0.80701995",
"0.80701995",
"0.8060694",
"0.80258304",
"0.79890436",
"0.7942831... | 0.6991175 | 62 |
Returns the value of attribute encoding. source://mini_mime//lib/mini_mime.rb31 | def encoding; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoding\n @attributes[:encoding]\n end",
"def encoding\n @content[pn(:Encoding)]\n end",
"def meta_encoding; end",
"def meta_encoding; end",
"def encoding\n if @encoding.blank?\n if !self.http_headers.blank?\n if self.http_headers['content-type'] =~ /charset=([... | [
"0.8212461",
"0.7614022",
"0.71493614",
"0.71493614",
"0.69041586",
"0.6846234",
"0.6846234",
"0.67814547",
"0.6751211",
"0.67070156",
"0.67070156",
"0.6698964",
"0.6657833",
"0.6657833",
"0.65677744",
"0.65677744",
"0.6538383",
"0.65209985",
"0.6510921",
"0.6491617",
"0.6491... | 0.67556757 | 19 |
Sets the attribute encoding | def encoding=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta_encoding=(encoding); end",
"def meta_encoding=(encoding); end",
"def encoding=(enc); end",
"def encoding\n @attributes[:encoding]\n end",
"def manage_meta_set_encoding encoding\n @manage_meta_encoding = encoding\n end",
"def encoding=(enc)\n return unless super\n encoding_u... | [
"0.7376397",
"0.7376397",
"0.73691785",
"0.7342777",
"0.7166655",
"0.7103592",
"0.69235164",
"0.69235164",
"0.6684824",
"0.6684824",
"0.6621973",
"0.66046613",
"0.66046613",
"0.6464441",
"0.638313",
"0.63790923",
"0.63775164",
"0.6318219",
"0.6306703",
"0.6301071",
"0.6301071... | 0.6274879 | 24 |
Returns the value of attribute extension. source://mini_mime//lib/mini_mime.rb31 | def extension; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end",
"def file_extension; end",
"def file_extension; end",
"def file_extension; end",
"def file_extension\n self.class.file_extension\n end",
"def extension\n split_extension(filename)[1] ... | [
"0.8063065",
"0.7421122",
"0.7421122",
"0.7421122",
"0.73660505",
"0.7337381",
"0.72885555",
"0.72528535",
"0.72528535",
"0.72528535",
"0.7207102",
"0.71923804",
"0.7182855",
"0.7134607",
"0.7107855",
"0.7077193",
"0.7053387",
"0.70439863",
"0.70192146",
"0.7006751",
"0.69672... | 0.0 | -1 |
Sets the attribute extension | def extension=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_attribute1=(value)\n @extension_attribute1 = value\n end",
"def extension=(extension)\n instance_set(:extension, extension)\n end",
"def extension_attribute3=(value)\n @extension_attribute3 = value\n end",
"def extension_attribute14=(v... | [
"0.742453",
"0.734967",
"0.71110153",
"0.7061434",
"0.705553",
"0.7041232",
"0.703116",
"0.70078224",
"0.69560146",
"0.69391716",
"0.69026536",
"0.6895247",
"0.6874074",
"0.6844641",
"0.6844641",
"0.6844641",
"0.6840875",
"0.6768211",
"0.67635477",
"0.67188257",
"0.66895163",... | 0.0 | -1 |
This will both create and update any merchants | def create_update(user)
merchant_list.each do |m|
# Look for merchants that this affiliate account is actively associated with.
if m['Association_Status'] == 'active'
merchant = do_db(m)
user.merchants << merchant unless user.merchants.include?(merchant)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merchants=(merchants)\n assert_unloaded\n @merchants = Array(merchants)\n end",
"def put_merchants_into_iso_group\n if @merchants\n @logger.info(\"Puting merchants into ISO groups\")\n @merchants.each do |merchant|\n unless (merchant.emp_agent.empty? || merchant.emp_a... | [
"0.64741534",
"0.645472",
"0.5900176",
"0.58992934",
"0.58387935",
"0.5817",
"0.5794663",
"0.5778153",
"0.57429475",
"0.5719455",
"0.57098025",
"0.5692008",
"0.56396145",
"0.55900717",
"0.55840194",
"0.55569285",
"0.5553731",
"0.5553731",
"0.5551272",
"0.5546224",
"0.5539523"... | 0.70734984 | 0 |
Get the list of merchant accounts at AvantLink, and cycle through each. | def merchant_list
@merchant_list ||= @api.associations
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_accounts\n acc_obj_arr = []\n accounts.each do |link|\n link.click\n puts \"Accessing account: #{acc_name}\"\n wait_to_load\n puts 'Loading transactions data'\n scroll_to_bottom\n puts '>Transactions data successfully loaded'\n puts 'Fetching transactions'\n ... | [
"0.6429872",
"0.6415981",
"0.6352174",
"0.62583464",
"0.61870044",
"0.6182167",
"0.6182167",
"0.6178533",
"0.6125062",
"0.60945296",
"0.60756516",
"0.60674167",
"0.6016855",
"0.5978605",
"0.597151",
"0.5958466",
"0.59241843",
"0.5922495",
"0.5884513",
"0.58387387",
"0.5820655... | 0.6233115 | 4 |
GET /inputs GET /inputs.json | def index
@inputs = Input.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inputs = Input.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inputs }\n end\n end",
"def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end",
"def inputs\n @inputs ||= JSON.parse(inputs_json || \"null\")... | [
"0.7307861",
"0.72687864",
"0.7177548",
"0.69802463",
"0.6778512",
"0.6466119",
"0.6393088",
"0.6108451",
"0.6105455",
"0.6087893",
"0.60466534",
"0.60245204",
"0.6020036",
"0.5980527",
"0.59731275",
"0.59616494",
"0.59074455",
"0.58554316",
"0.58506215",
"0.572571",
"0.57212... | 0.67656076 | 7 |
GET /inputs/1 GET /inputs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inputs = Input.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inputs }\n end\n end",
"def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end",
"def index\n extras = ActiveModel::Type::Boolean.new.cast... | [
"0.7046096",
"0.690899",
"0.66496444",
"0.6568536",
"0.65620923",
"0.65620923",
"0.65620923",
"0.6519063",
"0.61565924",
"0.6131882",
"0.6054822",
"0.59919184",
"0.585011",
"0.5848895",
"0.58375615",
"0.5765737",
"0.5745527",
"0.57173413",
"0.5716149",
"0.571158",
"0.56919396... | 0.0 | -1 |
POST /inputs POST /inputs.json | def create
@input = Input.new(input_params)
respond_to do |format|
if @input.save
format.html { redirect_to @input, notice: 'Input was successfully created.' }
format.json { render action: 'show', status: :created, location: @input }
else
format.html { render action: 'new' }
format.json { render json: @input.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inputs\n @inputs ||= JSON.parse(inputs_json || \"null\")\n end",
"def create(inputs)\n inputs = [inputs] unless inputs.is_a? Array\n inputs = inputs.map { |input| Clarinet::Utils.format_input(input) }\n\n data = @app.client.inputs_create inputs\n Clarinet::Inputs.new data[:inputs]\n ... | [
"0.6775562",
"0.636587",
"0.62419254",
"0.61635983",
"0.612818",
"0.6123627",
"0.60074013",
"0.5908479",
"0.58784807",
"0.58212495",
"0.5811382",
"0.58099604",
"0.5734061",
"0.5734061",
"0.5734061",
"0.5724214",
"0.57193756",
"0.5718871",
"0.5677981",
"0.56707954",
"0.5647658... | 0.6258298 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.