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 |
|---|---|---|---|---|---|---|
PATCH/PUT /admin/water_types/1 PATCH/PUT /admin/water_types/1.json | def update
respond_to do |format|
if @water_type.update(water_type_params)
format.html { redirect_to admin_water_types_path, notice: 'Water type was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.h... | [
"0.694129",
"0.6497361",
"0.6417336",
"0.62906504",
"0.6266134",
"0.6167786",
"0.6159998",
"0.6140665",
"0.6123037",
"0.61129165",
"0.6111624",
"0.61017054",
"0.60919577",
"0.6080612",
"0.6079973",
"0.6075806",
"0.60743845",
"0.60678303",
"0.60667884",
"0.60535014",
"0.604773... | 0.7598819 | 0 |
DELETE /admin/water_types/1 DELETE /admin/water_types/1.json | def destroy
@water_type.destroy
respond_to do |format|
format.html { redirect_to admin_water_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n ... | [
"0.7447096",
"0.7009371",
"0.69577855",
"0.6955348",
"0.69468623",
"0.6937247",
"0.6840331",
"0.6835962",
"0.68315196",
"0.6825287",
"0.6822474",
"0.6816679",
"0.6809839",
"0.6808384",
"0.6806305",
"0.680508",
"0.6802739",
"0.68005526",
"0.6784436",
"0.6780875",
"0.6778791",
... | 0.791873 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_water_type
@water_type = WaterType.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 water_type_params
params.require(:water_type).permit(:category)
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 Facebook session, default to retrieve session from cookies. | def fgraph_session(app_id = fgraph_config['app_id'],
app_secret = fgraph_config['app_secret'])
return @fgraph_session if @fgraph_session
@fgraph_session = fgraph_session_cookies(app_id, app_secret)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_session\n @facebook_session ||=\n returning Facebooker::Session.create do |session|\n # Facebook sessions are only good for 1 hour after storing\n # secure_with! associates a session key to a\n # Facebooker::Session object\n session.secure_with!(session_key, faceboo... | [
"0.7456869",
"0.71574455",
"0.7040288",
"0.68258095",
"0.65658134",
"0.6545192",
"0.64756626",
"0.64594346",
"0.64313203",
"0.6378672",
"0.63560957",
"0.6313596",
"0.6309833",
"0.6290455",
"0.6290455",
"0.6290455",
"0.62790847",
"0.6269938",
"0.62258697",
"0.62103385",
"0.621... | 0.6976226 | 3 |
Return Facebook session cookies. | def fgraph_session_cookies(app_id = fgraph_config['app_id'],
app_secret = fgraph_config['app_secret'])
return @fgraph_session_cookies if @fgraph_session_cookies
return if @fgraph_session_cookies == false
fbsr_cookie = request.cookies["fbsr_#{app_id}"]
if app_id.blank? or app_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session_cookie(response)\n response.get_fields('set-cookie').each do |cookie|\n return cookie if cookie =~ /JSESSIONID/\n end\n end",
"def cookies\n request.cookies\n end",
"def cookies # :doc:\n request.cookie_jar\n end",
"def cookies\n request.cook... | [
"0.6882193",
"0.68795204",
"0.68056744",
"0.6786501",
"0.6779826",
"0.67172956",
"0.6689022",
"0.66176903",
"0.6596921",
"0.655965",
"0.65473485",
"0.649913",
"0.64927584",
"0.6484419",
"0.6483179",
"0.6476958",
"0.64757603",
"0.643027",
"0.64169216",
"0.6363449",
"0.63218445... | 0.76712817 | 0 |
Currently logged in facebook user | def fgraph_current_user
return @fgraph_current_user if @fgraph_current_user
@fgraph_current_user = fgraph_client.me
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_user\n (session[:facebook_session] && session[:facebook_session].session_key) ? session[:facebook_session].user : nil\n end",
"def current_user\n User.find_by(facebook_id: params[:facebook_id])\n end",
"def fb_user\n FbGraph::User.me(fb_token)\n end",
"def facebook\n @fb_user ||= ... | [
"0.8013515",
"0.7971193",
"0.79577935",
"0.77732134",
"0.7712436",
"0.73788476",
"0.7345002",
"0.73027647",
"0.72627836",
"0.72530174",
"0.7244148",
"0.72174126",
"0.7206616",
"0.71906716",
"0.71661425",
"0.7129779",
"0.7122869",
"0.7111266",
"0.71088886",
"0.7095568",
"0.708... | 0.78437316 | 3 |
Return FGraph::Client instance initialized with settings set in fgraph.yml. Initialized with :access_token as well if Facebook session exists. | def fgraph_client
return @fgraph_client if @fgraph_client
@fgraph_client = FGraph::Client.new(
:client_id => fgraph_config['app_id'],
:client_secret => fgraph_config['app_secret'],
:access_token => fgraph_access_token
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_client\n FacebookClient.new FB_CONFIG[:client_id], FB_CONFIG[:secret_id],\n session[:access_token]\n end",
"def facebook_client\n @facebook_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"facebook\").first\n Koala::Facebook::API.new(provider.access_tok... | [
"0.79964745",
"0.770901",
"0.76938254",
"0.7347595",
"0.7182449",
"0.7104874",
"0.69417804",
"0.68794703",
"0.66535705",
"0.63625413",
"0.6285677",
"0.62213886",
"0.61581635",
"0.613132",
"0.61245537",
"0.61096334",
"0.6043826",
"0.603449",
"0.60335326",
"0.60305864",
"0.6030... | 0.7824747 | 1 |
Return Facebook object picture url: ==== Type Options square 50x50 (default) small 50 pixels wide, variable height normal 100 pixels wide, variable height large 200 pixels wide, variable height | def fgraph_picture_url(id, type=nil)
id = FGraph.get_id(id)
url = "http://graph.facebook.com/#{id}/picture"
url += "?type=#{type}" if type
url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fb_image_url(type='square')\n \"http://graph.facebook.com/#{fb_user_id}/picture?type=#{type}\" \n end",
"def fb_image_url(size = nil)\n url = \"http://graph.facebook.com/#{self.fbid}/picture\"\n url = \"#{url.split('?')[0]}?type=large\" if size\n url\n end",
"def image_url \n if fb_id\n ... | [
"0.7842328",
"0.7815546",
"0.77136266",
"0.7527257",
"0.7516916",
"0.74983454",
"0.73465705",
"0.72740895",
"0.7122548",
"0.70988756",
"0.704341",
"0.7022261",
"0.69446784",
"0.6920548",
"0.6904667",
"0.68746346",
"0.6864658",
"0.67836124",
"0.6778428",
"0.67634684",
"0.67105... | 0.7207505 | 8 |
Translates YMD.. hash into an array [Y, M, D, h, m, s] (or nil). | def value_as_array(item, format: "YMDhms")
value = raw_value(item)
return nil if value.nil?
defaults = {}
format.each_char { |c| defaults[c] = "" }
defaults.map do |key, default_value|
value[key] || default_value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_array(hash)\n array = []\n hash.each do |h|\n temp =[]\n h.each do |key,value|\n if key == \"month\"\n temp << value\n end\n if key == \"day\"\n temp << value\n end\n if key == \"year\"\n temp << value\n end\n end\n ... | [
"0.5932289",
"0.5467929",
"0.5257923",
"0.51974636",
"0.5104911",
"0.50614786",
"0.50329506",
"0.5001176",
"0.5000135",
"0.49782506",
"0.49584043",
"0.49069735",
"0.48949328",
"0.4892178",
"0.48701683",
"0.48690745",
"0.48648188",
"0.485048",
"0.48354816",
"0.4827065",
"0.481... | 0.48207778 | 20 |
Translates YMD.. hash into an integer number (or nil). | def value_as_int(item)
components = value_as_array(item)
return nil if components.nil?
(0..(components.length - 1)).collect { |i| components[i].to_s.present? ? components[i] * 10**(10 - 2 * i) : 0 }.sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id_from_hash(h)\n return nil if h.blank?\n # new format\n return h.to_i if h =~ /^[0-9]*$/\n # old format\n (uid, *code) = Base64.decode64(h).split(DIVIDER)\n code = code.join(DIVIDER)\n code == encode(uid) ? uid.to_i : nil\n end",
"def hash_as_num(hexencoded_hash)\n\t\t\tSoil.digest_cl... | [
"0.64813143",
"0.6225753",
"0.6056649",
"0.60335785",
"0.5872577",
"0.5872577",
"0.58213496",
"0.57808566",
"0.5749112",
"0.57205975",
"0.5628457",
"0.5574517",
"0.5500517",
"0.54303765",
"0.53879476",
"0.5377733",
"0.5377733",
"0.5355624",
"0.53156984",
"0.52979803",
"0.5286... | 0.0 | -1 |
GET /namesearches/1 GET /namesearches/1.json | def show
@namesearch = Namesearch.find(params[:id])
@search_url = 'http://api.douban.com/v2/movie/search?q='
# 获得电影名检索结果
@result_name = JSON.parse(open(URI.encode(@search_url + @namesearch.name)).read)
# 获得检索结果的第一个的ID
@movie_id = @result_name['subjects'][0]['id']
# 获得特定电影的条目信息
@subjec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def searchByName\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\t\t\tresults = Doctor.where(\"first_name LIKE ?\", \"%#{prms['name'][0]}%\")\n\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\... | [
"0.7181259",
"0.70549524",
"0.69860214",
"0.69088537",
"0.6768913",
"0.67533046",
"0.6697073",
"0.6691854",
"0.6690842",
"0.6581366",
"0.65591943",
"0.65543044",
"0.6528278",
"0.63844115",
"0.6372947",
"0.63609916",
"0.63324416",
"0.63069",
"0.6272275",
"0.62698656",
"0.62661... | 0.5952269 | 65 |
GET /namesearches/new GET /namesearches/new.json | def new
@namesearch = Namesearch.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @namesearch }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n... | [
"0.7211115",
"0.7211115",
"0.7211115",
"0.7211115",
"0.7211115",
"0.70444834",
"0.6973065",
"0.6904293",
"0.68971366",
"0.68201333",
"0.6720886",
"0.6715015",
"0.67054874",
"0.66996133",
"0.66993874",
"0.6687315",
"0.66106623",
"0.6552418",
"0.6445713",
"0.6442833",
"0.644238... | 0.786216 | 0 |
POST /namesearches POST /namesearches.json | def create
@namesearch = Namesearch.new(params[:namesearch])
respond_to do |format|
if @namesearch.save
format.html { redirect_to @namesearch, notice: 'Namesearch was successfully created.' }
format.json { render json: @namesearch, status: :created, location: @namesearch }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @namesearch = Namesearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @namesearch }\n end\n end",
"def index\n @search_name = params[:search_name]\n\n if @search_name\n conditions = @search_name.split(' ').map { |n| \"name ilike... | [
"0.63650614",
"0.62386763",
"0.6167234",
"0.6110236",
"0.60654736",
"0.6018751",
"0.597934",
"0.59765303",
"0.589976",
"0.5896858",
"0.58062536",
"0.5791065",
"0.57794344",
"0.57364565",
"0.5724136",
"0.5721238",
"0.5714232",
"0.57077086",
"0.56907755",
"0.56401944",
"0.56378... | 0.7209912 | 0 |
PUT /namesearches/1 PUT /namesearches/1.json | def update
@namesearch = Namesearch.find(params[:id])
respond_to do |format|
if @namesearch.update_attributes(params[:namesearch])
format.html { redirect_to @namesearch, notice: 'Namesearch was successfully updated.' }
format.json { head :no_content }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @saved_search = SavedSearch.find(params[:id])\n\n respond_to do |format|\n @saved_search.name = params[:name]\n @saved_search.query = params[:query]\n if @saved_search.save\n format.html { redirect_to :channels, :notice => 'Your channel was successfully saved.' }\n f... | [
"0.62797344",
"0.6129907",
"0.6110252",
"0.5982808",
"0.5924569",
"0.57956314",
"0.57208174",
"0.5716713",
"0.5669821",
"0.563989",
"0.5597882",
"0.55845886",
"0.55308324",
"0.55146766",
"0.5498815",
"0.54959875",
"0.54851127",
"0.5472326",
"0.546366",
"0.546366",
"0.546366",... | 0.69061285 | 0 |
DELETE /namesearches/1 DELETE /namesearches/1.json | def destroy
@namesearch = Namesearch.find(params[:id])
@namesearch.destroy
respond_to do |format|
format.html { redirect_to namesearches_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_conten... | [
"0.69649386",
"0.69649386",
"0.69649386",
"0.69649386",
"0.69649386",
"0.6948718",
"0.6907927",
"0.68648857",
"0.68560255",
"0.6846809",
"0.6806209",
"0.6795798",
"0.6795798",
"0.6795798",
"0.6795798",
"0.6790171",
"0.67883897",
"0.6741584",
"0.6741584",
"0.6726186",
"0.67252... | 0.7573842 | 0 |
helper :all helper :remaining_days | def set_csrf_cookie_for_ng
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remaining_hours\n \n end",
"def get_days_remaining_with\n remaining = self.user.days_remaining(from_date)\n if !is_actually_deduced? && !is_non_deduce_leave\n remaining -= actual_leave_days\n end\n return remaining\n end",
"def remaining_hours_by_day\n values_by_day(0, true) { |x| ... | [
"0.66240513",
"0.65941405",
"0.62860143",
"0.6262433",
"0.61958516",
"0.6185596",
"0.6159353",
"0.6100919",
"0.60984135",
"0.60984135",
"0.60984135",
"0.60984135",
"0.60817873",
"0.6031143",
"0.60185266",
"0.6001331",
"0.5990624",
"0.5971333",
"0.596035",
"0.592466",
"0.58551... | 0.0 | -1 |
=begin AUTHOR: Robert DiCicco DATE : 20221213 Challenge 195 Special Integers ( Ruby ) SAMPLE OUTPUT ruby .\SpecialIntegers.rb Input: $n = 15 Output: 14 Input: $n = 35 Output: 32 =end | def CheckUniqDigits(n)
h1 = Hash.new
arr = n.digits
for onedig in arr
h1.key?(onedig) ? (return 0) : (h1[onedig] = 1)
end
return 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend",
"def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.tim... | [
"0.67833734",
"0.6602077",
"0.65538627",
"0.6498917",
"0.64987147",
"0.64828867",
"0.642796",
"0.6407691",
"0.63320124",
"0.6311836",
"0.6292231",
"0.6282347",
"0.6259192",
"0.6256303",
"0.62509394",
"0.62433714",
"0.6238665",
"0.619728",
"0.61719215",
"0.6144962",
"0.6139124... | 0.0 | -1 |
GET /books GET /books.xml | def index
@users = User.find(:all)
for user in @users
1.upto(Book::CATALOG) {|number| book = Book.new
book.user_id = user.id
book.order = number
if user.show?
book.browse = true
else
if Book::FREE.include?(number)
book.browse = true
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @... | [
"0.73627794",
"0.73627794",
"0.72706676",
"0.7072142",
"0.69962823",
"0.69962823",
"0.69962823",
"0.69962823",
"0.69962823",
"0.69962823",
"0.69962823",
"0.69962823",
"0.69947857",
"0.69882584",
"0.6977281",
"0.69141436",
"0.6750683",
"0.67164165",
"0.6696208",
"0.66693354",
... | 0.0 | -1 |
GET /books/1 GET /books/1.xml | def show
@book = Book.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @book }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @... | [
"0.7231676",
"0.7231676",
"0.71467936",
"0.6978274",
"0.6909488",
"0.69064456",
"0.6901158",
"0.6724836",
"0.66245013",
"0.6582863",
"0.6570298",
"0.6517742",
"0.6496875",
"0.64867955",
"0.6444452",
"0.6421318",
"0.64028686",
"0.6379371",
"0.63556826",
"0.6345796",
"0.6325588... | 0.69135594 | 9 |
GET /books/new GET /books/new.xml | def new
@book = Book.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @book }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n e... | [
"0.7726794",
"0.7712759",
"0.7696091",
"0.7695337",
"0.74430114",
"0.7400474",
"0.7352465",
"0.73275614",
"0.7275875",
"0.7216575",
"0.7214585",
"0.7214585",
"0.7203346",
"0.7149397",
"0.7065911",
"0.70650506",
"0.7035856",
"0.70275307",
"0.70275307",
"0.7017469",
"0.7017469"... | 0.77142745 | 7 |
POST /books POST /books.xml | def create
@book = Book.new(params[:book])
respond_to do |format|
if @book.save
flash[:notice] = 'Book was successfully created.'
format.html { redirect_to(@book) }
format.xml { render :xml => @book, :status => :created, :location => @book }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"d... | [
"0.64735734",
"0.63259125",
"0.63145036",
"0.6279059",
"0.6279059",
"0.62249845",
"0.6168752",
"0.6118882",
"0.60447836",
"0.6018247",
"0.6014773",
"0.6011587",
"0.59690285",
"0.5956018",
"0.5932124",
"0.5923077",
"0.5887944",
"0.5869931",
"0.58627284",
"0.58506817",
"0.58506... | 0.62693274 | 6 |
PUT /books/1 PUT /books/1.xml | def update
@book = Book.find(params[:id])
respond_to do |format|
if @book.update_attributes(params[:book])
flash[:notice] = 'Book was successfully updated.'
format.html { redirect_to(@book) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n ... | [
"0.69026035",
"0.6665767",
"0.6470257",
"0.6382407",
"0.63386166",
"0.63386166",
"0.63386166",
"0.63145113",
"0.62971383",
"0.629104",
"0.6276371",
"0.61820596",
"0.61772746",
"0.6175763",
"0.61755365",
"0.6159481",
"0.61328745",
"0.6129997",
"0.61277676",
"0.6065382",
"0.603... | 0.6370943 | 7 |
DELETE /books/1 DELETE /books/1.xml | def destroy
@book = Book.find(params[:id])
@book.destroy
respond_to do |format|
format.html { redirect_to(books_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html... | [
"0.71593237",
"0.7099362",
"0.7075945",
"0.69317365",
"0.688333",
"0.6850703",
"0.6757763",
"0.67482287",
"0.67395467",
"0.6714943",
"0.66620773",
"0.6661422",
"0.6630076",
"0.6625732",
"0.66145194",
"0.6606668",
"0.660115",
"0.6593277",
"0.6590445",
"0.65893984",
"0.658862",... | 0.7139202 | 9 |
Creates a new MyMovieLibra::MovieList object | def initialize(path)
super
@movies = load_data(path).map { |movie| Movie.create(self, movie) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_movie_from_regular_list(movie)\n @movie.new(\n movie[1], # id\n parse_time(movie[2]), # created_at\n movie[5].titleize, # title\n movie[7].split(\", \"), # directors\n nil, ... | [
"0.67124206",
"0.6572002",
"0.6571149",
"0.6249888",
"0.61867005",
"0.6089651",
"0.5944521",
"0.59069383",
"0.58082795",
"0.57993144",
"0.5765651",
"0.5749121",
"0.56774294",
"0.5657285",
"0.5625445",
"0.55836296",
"0.55721796",
"0.5536055",
"0.5512303",
"0.5505546",
"0.55007... | 0.0 | -1 |
Write an uploaded image sequence to the specified filename | def write_upload_to_file(uploaded_file, filename)
FileUtils.mkdir_p(dir_path) unless File.directory?(dir_path)
file_path = Rails.root.join(dir_path, filename)
File.open(file_path, 'wb') do |file|
file.write(uploaded_file.read)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_image id, name_suffix=\"\"\n m_begin \"write_image\"\n filename = \"./temp/\" +id.to_s+name_suffix+\".gif\"\n get_image(id).write(filename)\n m_end \"write_image\"\n end",
"def write_image(filename, decoded_image)\r\n\r\n f = File.new \"./public/images/blog/#{filename}\", \"wb\"\r\n ... | [
"0.6743674",
"0.6237253",
"0.6224626",
"0.6146627",
"0.6131343",
"0.61208916",
"0.6120459",
"0.6087156",
"0.6025893",
"0.6004379",
"0.5953447",
"0.59288067",
"0.59205174",
"0.58880156",
"0.58834153",
"0.5870269",
"0.5809643",
"0.57976407",
"0.57925975",
"0.57862276",
"0.57302... | 0.59815186 | 10 |
Find the dimensions of the image and update the dataset | def find_image_dimensions
file_path = Rails.root.join(dir_path, self.image_sequence)
File.readlines(file_path).each do |line|
if /DimSize =/ =~ line
self.width,self.height,self.frames = line.split(" ")[-3..-1]
break
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dimensions!\n if RMAGICK_SUPPORTED\n #MES- Turn the blob into an ImageMagick object\n img = Magick::Image.from_blob(data).first\n if img.nil?\n raise \"Error: could not get imagemagick image from picture #{self.id}'s data\"\n end\n \n #KS- grab width & height and sav... | [
"0.759653",
"0.73615676",
"0.70301193",
"0.70213693",
"0.697749",
"0.6968519",
"0.6899589",
"0.68396777",
"0.6811361",
"0.6799556",
"0.6709974",
"0.6619329",
"0.65992135",
"0.6590891",
"0.6572552",
"0.6572552",
"0.65602225",
"0.6547807",
"0.6541943",
"0.64802426",
"0.64431995... | 0.7103771 | 2 |
Create frame and thumbnail for .mha file | def create_frame_and_thumbnail
if (File.extname(self.image_sequence) == ".mha")
file_path = Rails.root.join(dir_path, self.image_sequence)
result = system(Rails.root.join('scripts','mha_to_png','bin',"MhaToPng #{file_path} 1").to_s)
base_name = File.basename(file_path, ".mha"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_thumbnail path, img\n img = img.resize_to_fit 200,200\n img.write path\n end",
"def make\n Paperclip.log(\"*********** Label Thumbnail Processor...\")\n dst = Tempfile.new([@basename, @format].compact.join(\".\"))\n dst.binmode\n\n # first create the name text image\n ... | [
"0.6217943",
"0.6215628",
"0.61888355",
"0.61743546",
"0.59648436",
"0.5947003",
"0.5905514",
"0.58679646",
"0.58415717",
"0.58378893",
"0.582653",
"0.58250886",
"0.58028835",
"0.58003885",
"0.57862693",
"0.5784496",
"0.57545084",
"0.5747417",
"0.57459736",
"0.57026327",
"0.5... | 0.8371216 | 0 |
Create a zip file containing the ground truth and image sequence | def create_zip
require 'zip'
zip_files = [self.ground_truth, self.image_sequence, self.config_file]
if self.acceptable_segmentation_region.present?
zip_files.push(self.acceptable_segmentation_region)
end
zip_filename = Rails.root.join(dir_path, "#{self.name}.zip")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zipSequenceFiles()\n puts \"Zipping sequence files\"\n zipCmd = \"bzip2 *sequence.txt\"\n `#{zipCmd}`\n end",
"def zipSequenceFiles()\n puts \"Zipping sequence files\"\n zipCmd = \"bzip2 *sequence.txt\"\n `#{zipCmd}`\n end",
"def process_and_create_zip_file\n @project = Project.find(... | [
"0.68056726",
"0.68056726",
"0.67476445",
"0.66868424",
"0.63304514",
"0.6193522",
"0.6192446",
"0.61781055",
"0.61547816",
"0.61462975",
"0.6105637",
"0.6052246",
"0.60095775",
"0.59497964",
"0.5902536",
"0.5884303",
"0.58611506",
"0.5791068",
"0.5791068",
"0.57460606",
"0.5... | 0.74299383 | 0 |
Custom validation to ensure proper image format | def proper_image_sequence_format
if not image_sequence =~ /\.mha\z/
errors.add(:image_sequence, "must be in .mha format currently")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end",
"def avatar_must_be_in_correct_format\n return unless avatar.present?\n\n # FileMagic.mime { |fm| fm.file(avatar.path) }\n valid_format = [\"image/png\", \"image/jpg\", \"image/jpeg\"].include?(avatar.content_type) && ... | [
"0.7535572",
"0.7499285",
"0.7481655",
"0.7445809",
"0.7408874",
"0.7356624",
"0.7341169",
"0.73252934",
"0.7260407",
"0.7219463",
"0.711569",
"0.7098983",
"0.70704746",
"0.70508635",
"0.7047203",
"0.69803095",
"0.6969806",
"0.6969617",
"0.6969617",
"0.6969606",
"0.69513774",... | 0.6743058 | 28 |
depending on version get_product_class should return us right class, namespaced or not | def initialize(klass, find_operators = true, loader_object = nil, options = {:instance_methods => true})
super(klass, find_operators, loader_object, options)
@@image_klass ||= DataShift::SpreeHelper::get_spree_class('Image')
@@option_type_klass ||= DataShift::SpreeHelper::get_spree_class('OptionType... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def products_container_class(scenario)\n make_class(products_container(scenario).split(' ').join('.'))\n end",
"def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end",
"def full_implementation_class_name\n full_item_type_name.ns_camelize\n end",
"def ... | [
"0.65857786",
"0.6533694",
"0.65271205",
"0.6296722",
"0.6055539",
"0.6051375",
"0.60402185",
"0.6029253",
"0.5981367",
"0.59778583",
"0.59148407",
"0.59057987",
"0.5895397",
"0.5883306",
"0.5871437",
"0.58502716",
"0.58426464",
"0.5835001",
"0.5835001",
"0.58279204",
"0.5822... | 0.0 | -1 |
Special case for Images A list of entries for Images. Multiple entries can be delimited by Delimiters::multi_assoc_delim Each entry can with a optional 'alt' value, seperated from pat5h by Delimiters::name_value_delim Example => path_1:alt text|path_2:more alt blah blah|path_3:the alt text for this path | def add_images( record )
#save_if_new
# different versions have moved images around from Prod to Variant
owner = DataShift::SpreeHelper::get_image_owner(record)
get_each_assoc.each do |image|
#TODO - make this Delimiters::attributes_start_delim and support {alt=> 'blah, :position => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gallery(string_list, gallery_name, alt_text = '')\n gallery_return = ''\n photos = string_list.split(/\\ +/)\n photos_text = alt_text.split(',')\n photos.each_with_index do |photo, index|\n gallery_return += link_to(image_tag('thumb/todd_ramirez_' + photo,\n ... | [
"0.542849",
"0.5416751",
"0.5276373",
"0.52353996",
"0.5217842",
"0.51160157",
"0.50540483",
"0.5031443",
"0.5008851",
"0.49884874",
"0.498298",
"0.4825824",
"0.48174322",
"0.481118",
"0.48104656",
"0.48019892",
"0.4794588",
"0.47603095",
"0.4746552",
"0.47438964",
"0.4736084... | 0.47837663 | 17 |
I use the entire domain, just change to find_by_subdomain and pass only the subdomain | def current_website
subdomain ||= request.subdomain
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subdomain_for(params)\n \n organization = params[:organization]\n email = params[:email]\n \n organization = Organization.find_by_email(email) if email\n \n if organization && organization.association then\n organization.association.subdomain \n else\n ''\n end\n ... | [
"0.7473458",
"0.7374615",
"0.73686475",
"0.7350802",
"0.7215578",
"0.70764714",
"0.6988437",
"0.6921836",
"0.6918557",
"0.6907522",
"0.688321",
"0.6875915",
"0.685511",
"0.6829385",
"0.6815768",
"0.6803945",
"0.6773706",
"0.67723674",
"0.67643636",
"0.6762128",
"0.6753115",
... | 0.6293687 | 54 |
it should have expected worstcase space complexity of O(1) | def solution n
gap = 0
max = 0
while n > 0 && n % 2 != 1
n = n / 2
end
while n > 0
if n % 2 == 0
gap += 1
else
if gap > max
max = gap
end
gap = 0
end
n = n / 2
end
max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))... | [
"0.6909766",
"0.68706185",
"0.6604878",
"0.66011024",
"0.65608686",
"0.65329564",
"0.6514373",
"0.64931846",
"0.6462505",
"0.64609486",
"0.6428609",
"0.63814485",
"0.6357991",
"0.6356659",
"0.63553095",
"0.635305",
"0.63472515",
"0.6339555",
"0.6336313",
"0.63278544",
"0.6324... | 0.0 | -1 |
=begin terminal command basic \ u juan:1234 \ HTTP Basic: Access denied. =end basic authentication def authenticate authenticate_or_request_with_http_basic do | user, password | user == "juan" && password == "juan" end end =begin terminal command using email basic \ | def current_user
@current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end",
"def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\"... | [
"0.7973585",
"0.7753898",
"0.7609395",
"0.7594029",
"0.7581656",
"0.757666",
"0.7565243",
"0.7412295",
"0.7385878",
"0.737851",
"0.7348242",
"0.7309002",
"0.7282406",
"0.7259482",
"0.71710634",
"0.7169326",
"0.71636415",
"0.7137678",
"0.71328497",
"0.70760226",
"0.70385146",
... | 0.0 | -1 |
Finds nontrashed widget by `params[:id]` | def find_story
@story = Story.friendly.find(params[:id])
@film = @story.films.new
@films = @story.films.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_widget(widget_id)\n find {|node| node.name.to_s == widget_id.to_s}\n end",
"def find_widget widget_description\n @widgets.find widget_description\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('widget', 'get'... | [
"0.71271646",
"0.6517092",
"0.6296905",
"0.62528217",
"0.6088664",
"0.59999055",
"0.59136665",
"0.5912603",
"0.5912603",
"0.5832957",
"0.57763076",
"0.5756893",
"0.5702738",
"0.568496",
"0.56338507",
"0.5586917",
"0.55807984",
"0.55670375",
"0.55577046",
"0.55536044",
"0.5541... | 0.0 | -1 |
If the widget has a draft, load that version of it | def reify_story
@story = @story.draft.reify if @story.draft?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draft\n @version_object = PageVersion.find_draft_for_page(self.page)\n\n unless @page_version\n @version_object = PageVersion.create_draft_for_page(self.page)\n end\n \n @version_object\n end",
"def draft\n self.versions.last\n end",
"def draft_content\n @draft_content || (s... | [
"0.64519763",
"0.62163925",
"0.6199897",
"0.59215957",
"0.58775645",
"0.5849446",
"0.5849446",
"0.5849446",
"0.5849446",
"0.5838393",
"0.58315045",
"0.5712787",
"0.5706669",
"0.56713545",
"0.56543005",
"0.5651528",
"0.5579842",
"0.55581856",
"0.5545692",
"0.55147094",
"0.5500... | 0.0 | -1 |
rendered in create, in the authenticated_controller. | def text_representation
self.signed_request[:signature].to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n redirect_or_render authorization.authorize\n end",
"def create\n render :new\n end",
"def render_create_success\n render json: @resource, status: :created\n end",
"def handle_create_json_response\n render @authenticated ? 'create' : 'invalid'\n end",
"def create... | [
"0.7196829",
"0.6765934",
"0.67623967",
"0.6703397",
"0.66659015",
"0.6657547",
"0.66014785",
"0.65291244",
"0.65291244",
"0.65291244",
"0.65291244",
"0.65291244",
"0.65291244",
"0.65291244",
"0.65291244",
"0.65291244",
"0.6485793",
"0.6481591",
"0.6458514",
"0.6444598",
"0.6... | 0.0 | -1 |
render a list of messages | def render
_header do
_h1 'Agenda Backchannel'
end
# convert date into a localized string
datefmt = proc do |timestamp|
return Date.new(timestamp).
toLocaleDateString({}, month: 'short', day: 'numeric', year: 'numeric')
end
if Chat.log.empty?
if Chat.backlog_fetched
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messages_html\n messages = redis.lrange(MESSAGE_LIST_KEY, 0, 100)\n puts \"messages = #{messages}\"\n\n list_html = messages.map do |message|\n message = JSON.parse(message)\n \"<p><b>#{message['client_id']}:</b> #{message['body']}</p>\"\n end.join\n\n last_message = JSON.parse(message... | [
"0.7640698",
"0.709316",
"0.6893438",
"0.67607754",
"0.67562306",
"0.6702155",
"0.66930395",
"0.6611984",
"0.6607891",
"0.6595625",
"0.6557781",
"0.6557781",
"0.6557781",
"0.6557781",
"0.653936",
"0.6532897",
"0.652418",
"0.652181",
"0.64844567",
"0.6455191",
"0.6437552",
"... | 0.64759564 | 19 |
highlight mentions of my id | def mention(text)
return text.gsub(/<.*?>|\b(#{escapeRegExp(User.userid)})\b/) do |match|
match[0] == '<' ? match : "<span class=mention>#{match}</span>"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def mention_link_filter(text, base_url='/', issueid_pattern)\n self.class.mentioned_issues_in(text, issueid_pattern) do |match, issueid|\n link = link_to_mentioned_issue(issueid)\n link ? match.sub(\"\\##{issueid}\"... | [
"0.6307329",
"0.6307329",
"0.6307329",
"0.61249727",
"0.6029857",
"0.5931678",
"0.59194887",
"0.5888734",
"0.5859382",
"0.5819364",
"0.58062184",
"0.5778263",
"0.5777973",
"0.57603675",
"0.56780964",
"0.5663453",
"0.5663453",
"0.56325704",
"0.5616796",
"0.5613099",
"0.5590027... | 0.6833404 | 0 |
on initial display, fetch backlog | def mounted()
Main.scrollTo = -1
Chat.fetch_backlog()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backlog; end",
"def backlog; end",
"def backlog\n get_stories_by_iteration(\"backlog\")\n end",
"def enqueue_pending_output; end",
"def enter_pending; end",
"def work!\n loop do\n if inside_operating_window?\n fetch\n check_for_history_request\n else\n ... | [
"0.7212157",
"0.7212157",
"0.6215261",
"0.61696726",
"0.59445953",
"0.5938795",
"0.5845275",
"0.57605517",
"0.57605517",
"0.57605517",
"0.5732579",
"0.5727085",
"0.56933415",
"0.5674562",
"0.5673358",
"0.56702214",
"0.56702214",
"0.5662574",
"0.5660163",
"0.5654318",
"0.56543... | 0.0 | -1 |
if we are at the bottom of the page, keep it that way | def beforeUpdate()
if
window.pageYOffset + window.innerHeight >=
document.documentElement.scrollHeight
then
Main.scrollTo = -1
else
Main.scrollTo = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fallen_off_bottom?\n self.y > $window.height\n end",
"def show_bottom_of_page\n driver.execute_script('window.scrollTo(0,document.body.scrollHeight)')\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def ... | [
"0.7427244",
"0.7036759",
"0.69851524",
"0.69772613",
"0.69231236",
"0.6877293",
"0.68727744",
"0.6870656",
"0.68690145",
"0.6833406",
"0.6828284",
"0.68224764",
"0.67768335",
"0.67506886",
"0.6722834",
"0.6719088",
"0.66921103",
"0.6669991",
"0.66506785",
"0.66481876",
"0.65... | 0.5963033 | 45 |
count fish in the river | def fish_count()
return @fish.length()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def river_count\n return @fishes.count\nend",
"def count\n @forest.count(&:negative?)\n end",
"def food_count()\nreturn @stomach.count()\nend",
"def test_bear_food_count\n @river.add_fish(@fish1)\n @river.add_fish(@fish2)\n @bear.fishes_for_fish(@river)\n @bear.bear_food_count\n assert_eq... | [
"0.7880406",
"0.72020787",
"0.71386844",
"0.69168586",
"0.6847867",
"0.67241657",
"0.671038",
"0.6627831",
"0.662495",
"0.65392274",
"0.6526848",
"0.6520094",
"0.6489078",
"0.64882183",
"0.644941",
"0.6432031",
"0.6432031",
"0.6432031",
"0.6420412",
"0.6396233",
"0.6395995",
... | 0.7906191 | 0 |
add fish to the river | def river_held_fish(fish)
@fish << Fish_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eat_fish_from_river(fish, river)\n @stomach.push(fish)\n river.lose_fish(fish)\n end",
"def take_fish_from_river(river)\n fish = river.get_fish()\n @stomach << fish if !fish.nil?\n end",
"def add_fish (fish)\n @fish_population << fish\n\n end",
"def eat_fish(fish)\n @stomach << f... | [
"0.7658457",
"0.70392376",
"0.70103145",
"0.6982146",
"0.6741489",
"0.6526513",
"0.6388796",
"0.63308936",
"0.62786806",
"0.6175854",
"0.6172822",
"0.6134743",
"0.61110485",
"0.61110485",
"0.61028737",
"0.60447377",
"0.59802765",
"0.5899619",
"0.587479",
"0.58197975",
"0.5808... | 0.72697204 | 1 |
remove fishes from the river | def remove_fish_river()
@fish.slice(index,1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fish_eaten(eat_fish)\n fish = find_fish(eat_fish)\n fishes.delete(fish)\nend",
"def fish_removed()\n @fish_count.pop()\n end",
"def bear_eats_fish(river_name)\n eaten_fish = river_name.remove_fish()\n @bear_stomach.push(eaten_fish)\n #A one liner (usually prefer two lines for more ... | [
"0.63112295",
"0.6061026",
"0.60142434",
"0.6006736",
"0.568867",
"0.5684137",
"0.5520731",
"0.54809505",
"0.5467253",
"0.54568434",
"0.5456554",
"0.5456554",
"0.5456554",
"0.5456554",
"0.544962",
"0.5445835",
"0.5434961",
"0.53744704",
"0.53703254",
"0.5346639",
"0.5344233",... | 0.5792984 | 4 |
remove fish from river | def get_fish() # bear will takes the fish#
return @fish1.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_fish(bear)\n bear.is_a?(Bear) ? fishes_in_the_water.shift : \"Shoo, fish are only for the bears.\"\n end",
"def remove_fish_river()\n @fish.slice(index,1)\nend",
"def bear_eats_fish(river_name)\n eaten_fish = river_name.remove_fish()\n @bear_stomach.push(eaten_fish)\n #A one liner (usu... | [
"0.65980875",
"0.6466737",
"0.6466516",
"0.6452429",
"0.64122295",
"0.6177631",
"0.6130924",
"0.6047236",
"0.60013616",
"0.5966507",
"0.5942929",
"0.5895655",
"0.5895655",
"0.5895655",
"0.5895655",
"0.5872071",
"0.57791275",
"0.57576984",
"0.57365716",
"0.5694348",
"0.56374",... | 0.0 | -1 |
Returns a VirusTotalApi::URLReport instance | def initialize(api_key:, resource:)
super(api_key: api_key)
@resource = resource
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_report(url)\n URLReport.new(api_key: @api_key, resource: url).response\n end",
"def getUrlReport(url)\n\t\t\tresponse = RestClient.post(\n\t\t\t\t'https://www.virustotal.com/vtapi/v2/url/report',\n\t\t\t\t'resource' => url,\n\t\t\t\t'apikey' => @key )\n\t\t\tJSON.parse(response)\n\t\tend",
"def... | [
"0.7770671",
"0.7413681",
"0.67703146",
"0.5931102",
"0.5796334",
"0.57242006",
"0.5667947",
"0.56639576",
"0.5650508",
"0.56399304",
"0.5638772",
"0.5622643",
"0.5621517",
"0.56187874",
"0.5616269",
"0.5613252",
"0.5591344",
"0.5586085",
"0.55652636",
"0.5534892",
"0.5496498... | 0.0 | -1 |
Creates a new chart object | def initialize(frame, options = {})
@style = 18
@view_3D = nil
@graphic_frame = frame
@graphic_frame.anchor.drawing.worksheet.workbook.charts << self
@series = SimpleTypedList.new Series
@show_legend = true
@legend_position = :r
@display_blanks_as = :gap
@series_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chart\n @chart ||= Chart.new(settings)\n end",
"def new\n @series = Series.new\n end",
"def new\n @chart = Chart.new\n respond_with(@chart)\n end",
"def add_chart(chart_type, options) \n @object = GraphicFrame.new(self, chart_type, options)\n @object.chart\n end",
"... | [
"0.72489434",
"0.7040115",
"0.67557836",
"0.6724575",
"0.6670832",
"0.6603872",
"0.65878546",
"0.6503221",
"0.646145",
"0.64436597",
"0.644151",
"0.64375496",
"0.6433587",
"0.642866",
"0.6427557",
"0.6425359",
"0.64248616",
"0.64248616",
"0.64248616",
"0.64117044",
"0.639015"... | 0.5686139 | 88 |
Configures the vary_colors options for this chart | def vary_colors=(v) Axlsx.validate_boolean(v); @vary_colors = v; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_colors\n store.change_colors(@colors)\n end",
"def setcolorrep(*)\n super\n end",
"def force_colors!(colors: true)\n @force_colors = colors\n end",
"def default_options\n { \n :x => 20,\n :y => 20,\n :gauge_color => \"ff... | [
"0.584572",
"0.5617548",
"0.5586374",
"0.5557755",
"0.54434484",
"0.54251665",
"0.53834486",
"0.5350686",
"0.53286964",
"0.5299317",
"0.5255505",
"0.5244717",
"0.5183377",
"0.51825947",
"0.5158434",
"0.5123502",
"0.51053697",
"0.5090998",
"0.50885886",
"0.5087618",
"0.5068332... | 0.6738156 | 0 |
The relationship object for this chart. | def relationship
Relationship.new(self, CHART_R, "../#{pn}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relationship\n return @relationship\n end",
"def relationship\n relationship? ? children[1] : nil\n end",
"def relationship\n response[\"relationship\"]\n end",
"def relationship=(value)\n @relationship = value\n end",
"def... | [
"0.8140249",
"0.78014696",
"0.77432853",
"0.7271626",
"0.72641444",
"0.72641444",
"0.72641444",
"0.71796864",
"0.70964915",
"0.6942292",
"0.68743414",
"0.68738383",
"0.68724716",
"0.68405277",
"0.6814307",
"0.6814307",
"0.6755055",
"0.66092855",
"0.6598706",
"0.65963143",
"0.... | 0.7528967 | 3 |
The index of this chart in the workbooks charts collection | def index
@graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @chart.series.index(self)\n end",
"def index\n @worksheet.index\n end",
"def index\n @anchor.drawing.worksheet.workbook.images.index(self)\n end",
"def index\n @worksheet.workbook.drawings.index(self)\n end",
"def idx\n @ob.get_idx\n end",
"def index\n ... | [
"0.7090841",
"0.67436075",
"0.67134655",
"0.6680936",
"0.66704124",
"0.6479607",
"0.62342376",
"0.6202274",
"0.618633",
"0.61727303",
"0.61549234",
"0.6128577",
"0.611751",
"0.60736644",
"0.6022645",
"0.5997274",
"0.59638375",
"0.5951435",
"0.59277576",
"0.5892919",
"0.583555... | 0.80294925 | 1 |
The part name for this chart | def pn
format(CHART_PN, index + 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basename\n @chart_data.title\n .strip\n .gsub(/\\s+/, '_')\n .downcase\n end",
"def event_name(period)\n \"kline-#{period}\"\n end",
"def locate part_name\n @parts[part_name]\n end",
"def part_title\n self.has_part && self.has_part.title... | [
"0.65848225",
"0.64740175",
"0.6421469",
"0.63878626",
"0.6332706",
"0.6286857",
"0.6247469",
"0.62459946",
"0.61901027",
"0.6178035",
"0.6164032",
"0.61049205",
"0.61016756",
"0.60838807",
"0.60806364",
"0.60645354",
"0.60645354",
"0.60493094",
"0.60222536",
"0.6014313",
"0.... | 0.0 | -1 |
The title object for the chart. | def title=(v)
DataTypeValidator.validate "#{self.class}.title", [String, Cell], v
if v.is_a?(String)
@title.text = v
elsif v.is_a?(Cell)
@title.cell = v
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title\n data['title'].to_s\n end",
"def title\n @data['title']\n end",
"def title\n @hash[\"Title\"]\n end",
"def title\n @title ||= self.class.non_namespaced_classname\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : ... | [
"0.7716868",
"0.7681036",
"0.7623922",
"0.759543",
"0.7569885",
"0.75031924",
"0.75031924",
"0.73763424",
"0.7376234",
"0.7376234",
"0.7376234",
"0.7376234",
"0.7376234",
"0.7376234",
"0.7376234",
"0.7288892",
"0.72812",
"0.7260333",
"0.7231204",
"0.71856153",
"0.7178039",
... | 0.6766937 | 100 |
The size of the Title object of the chart. | def title_size=(v)
@title.text_size = v unless v.to_s.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title_font_size=(value)\n @title_font.size = value\n end",
"def title_width\n line_headings.values.collect {|l| l.to_s.length}.max + 8\n end",
"def size\n label.to_s.downcase.sub(/\\s+/,'_')\n end",
"def size\n \"#{width}x#{height}\"\n end",
"def size\n \"#{... | [
"0.7534945",
"0.7178291",
"0.65150124",
"0.6370073",
"0.6370073",
"0.63285524",
"0.624534",
"0.61676615",
"0.61146504",
"0.6083977",
"0.6066742",
"0.60445195",
"0.6042985",
"0.6028114",
"0.5993918",
"0.5977236",
"0.59682333",
"0.5955121",
"0.5955121",
"0.5948076",
"0.59409976... | 0.7432009 | 1 |
Show the legend in the chart | def show_legend=(v) Axlsx.validate_boolean(v); @show_legend = v; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legend\n title\n end",
"def legend_html\n \"<h3 class='legend'>#{self.to_s}</h3>\" unless default?\n end",
"def legend=(value)\n @legend = value\n end",
"def set_legend\n return set_labels if type.to_s =~ /pie|pie_3d|meter/\n\n if legend.is_a?(Array)\n... | [
"0.79396915",
"0.77541727",
"0.7574505",
"0.7442077",
"0.7399435",
"0.7399212",
"0.7288223",
"0.7255247",
"0.71615547",
"0.7047956",
"0.70427996",
"0.70023507",
"0.69868344",
"0.6968554",
"0.6908914",
"0.6860498",
"0.6772177",
"0.67221445",
"0.6705632",
"0.66823655",
"0.66544... | 0.7087742 | 9 |
How to display blank values | def display_blanks_as=(v) Axlsx.validate_display_blanks_as(v); @display_blanks_as = v; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compact_blank; end",
"def compact_blank!; end",
"def skip_blanks?() @skip_blanks end",
"def show_blanks(results)\n\t\tputs \"#{results}\\n\".center(53)\n\tend",
"def compact_blank\n reject { |_k, v| v.blank? }\n end",
"def blank?\n @values.blank?\n end",
"d... | [
"0.74687356",
"0.7211871",
"0.6933414",
"0.69197404",
"0.6718065",
"0.6679311",
"0.66720086",
"0.66500413",
"0.6588095",
"0.6582902",
"0.6525151",
"0.6525151",
"0.6496631",
"0.6493641",
"0.645275",
"0.64420027",
"0.6423397",
"0.6404536",
"0.6392541",
"0.63745975",
"0.6343212"... | 0.72051233 | 2 |
backwards compatibility to allow chart.to and chart.from access to anchor markers | def to
@graphic_frame.anchor.to
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(drawing, options={})\n @drawing = drawing\n drawing.anchors << self \n @from, @to = Marker.new, Marker.new(:col => 5, :row=>10)\n end",
"def to_point\n Straightedge::Mark.new(*self)\n end",
"def initialize(drawing, options = {})\n @drawing = drawing\n dr... | [
"0.5738247",
"0.5559023",
"0.5394751",
"0.5302333",
"0.5302333",
"0.52494",
"0.51429236",
"0.5121749",
"0.5093022",
"0.5017886",
"0.500767",
"0.4987529",
"0.4968187",
"0.4965616",
"0.49445313",
"0.49442732",
"0.49346635",
"0.49245393",
"0.4920453",
"0.49135822",
"0.49120647",... | 0.54409385 | 3 |
backwards compatibility to allow chart.to and chart.from access to anchor markers | def from
@graphic_frame.anchor.from
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(drawing, options={})\n @drawing = drawing\n drawing.anchors << self \n @from, @to = Marker.new, Marker.new(:col => 5, :row=>10)\n end",
"def to_point\n Straightedge::Mark.new(*self)\n end",
"def to\n @graphic_frame.anchor.to\n end",
"def to\n @graph... | [
"0.5738805",
"0.55586725",
"0.5440698",
"0.5440698",
"0.53950727",
"0.5248847",
"0.51442754",
"0.51212054",
"0.5092438",
"0.501725",
"0.5006873",
"0.49868783",
"0.4968966",
"0.49661738",
"0.49438143",
"0.49428037",
"0.4935713",
"0.49248475",
"0.49194983",
"0.49132013",
"0.491... | 0.5303044 | 6 |
Adds a new series to the chart's series collection. | def add_series(options = {})
@series_type.new(self, options)
@series.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_series(series)\n type_check(series, :series)\n Series.create(series)\n end",
"def add_series(series)\n if (@data[0]) then\n # Require that all column names are identical\n raise \"Column names do not match!\" unless ((@data[0].xlabel == series.xlabel) && (@data[0].ylabel == seri... | [
"0.8441053",
"0.7724199",
"0.7642649",
"0.7494341",
"0.7494341",
"0.66297585",
"0.6603581",
"0.63298583",
"0.6071467",
"0.6019887",
"0.6018016",
"0.60021627",
"0.5994953",
"0.57579416",
"0.5751114",
"0.5720675",
"0.56805015",
"0.563971",
"0.56343895",
"0.5621968",
"0.56129694... | 0.7635625 | 3 |
Assigns a background color to chart area | def bg_color=(v)
DataTypeValidator.validate(:color, Color, Color.new(rgb: v))
@bg_color = v
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def background_color(color); end",
"def draw_background\n\t\tcolor = self.colour_scheme.background\t\n\t\t@canvas.new_image(@canvas_width, @canvas_height) { self.background_color = color }\n\tend",
"def background_color=(value)\n @background_color = value\n end",
"def background_col... | [
"0.6643718",
"0.6613506",
"0.6442428",
"0.64352447",
"0.6410769",
"0.63410425",
"0.6299171",
"0.6233323",
"0.6206808",
"0.6201117",
"0.606939",
"0.605268",
"0.60113966",
"0.5954069",
"0.595323",
"0.5941647",
"0.5925632",
"0.5919329",
"0.5910178",
"0.58796895",
"0.5873946",
... | 0.52525467 | 66 |
Whether only data from visible cells should be plotted. | def plot_visible_only=(v) Axlsx.validate_boolean(v); @plot_visible_only = v; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axes_visible?\n @debug_axes\n end",
"def axes_visible?\n @debug_axes\n end",
"def visible?\n end",
"def visible?\n true\n end",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def visible?\n @a.nonzero?\n end",
"def visible\n... | [
"0.678281",
"0.678281",
"0.6537419",
"0.65187097",
"0.6506298",
"0.6506298",
"0.64972085",
"0.6481909",
"0.6379454",
"0.63646907",
"0.6358796",
"0.6339538",
"0.63008106",
"0.62883216",
"0.6237097",
"0.6167853",
"0.615143",
"0.615143",
"0.6150738",
"0.6139913",
"0.6134174",
... | 0.7652652 | 0 |
Whether the chart area shall have rounded corners. | def rounded_corners=(v) Axlsx.validate_boolean(v); @rounded_corners = v; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inside_rect? outer, tolerance = 0.0\n Geometry.inside_rect? self, outer, tolerance\n end",
"def surrounds(shape)\n shape.points.each do |point|\n return false unless point_is_inside(point)\n end\n return true\n end",
"def is_border?(); @type == GRT_BORDER; end",
"def circle?()\n ... | [
"0.6132715",
"0.601986",
"0.59637046",
"0.59463906",
"0.58238316",
"0.5814243",
"0.576261",
"0.5737318",
"0.56033826",
"0.55854696",
"0.54614717",
"0.5446098",
"0.5439711",
"0.5430813",
"0.5411489",
"0.5397539",
"0.5395734",
"0.5387519",
"0.53763604",
"0.5370058",
"0.5366786"... | 0.6590107 | 0 |
This is a short cut method to set the anchor start marker position If you need finer granularity in positioning use This helper method acceps a fairly wide range of inputs exampled below | def start_at(x = 0, y = 0)
@graphic_frame.anchor.start_at(x, y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchor( val )\n case val\n when :c; @anchor = :middle\n when :l; @anchor = :start\n when :r; @anchor = :end\n else @anchor = :start\n end\n self\n end",
"def start_at(x, y = nil)\n @anchor.start_at x, y\n @anchor.fr... | [
"0.67881185",
"0.66354775",
"0.6272919",
"0.6168144",
"0.59732777",
"0.59722847",
"0.59394467",
"0.58326435",
"0.5814319",
"0.57745695",
"0.57464397",
"0.57276964",
"0.5726309",
"0.5726309",
"0.5699171",
"0.5687187",
"0.5680727",
"0.5668785",
"0.56655574",
"0.5656748",
"0.564... | 0.5503948 | 30 |
This is a short cut method to set the end anchor position If you need finer granularity in positioning use graphic_frame.anchor.to.colOff / rowOff | def end_at(x = 10, y = 10)
@graphic_frame.anchor.end_at(x, y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_at(x, y=0)\n x, y = *parse_coord_args(x, y)\n @graphic_frame.anchor.to.col = x\n @graphic_frame.anchor.to.row = y\n end",
"def to\n @graphic_frame.anchor.to\n end",
"def to\n @graphic_frame.anchor.to\n end",
"def anchor_rect anchor_x, anchor_y\n current_w = self... | [
"0.7357277",
"0.6694182",
"0.6694182",
"0.6130427",
"0.6128603",
"0.6068259",
"0.60468453",
"0.6016632",
"0.59822273",
"0.597691",
"0.59765685",
"0.59765685",
"0.59402287",
"0.59396327",
"0.59016126",
"0.56922674",
"0.56842756",
"0.56142527",
"0.56120443",
"0.55892223",
"0.55... | 0.73039263 | 1 |
sets the view_3D object for the chart | def view_3D=(v) DataTypeValidator.validate "#{self.class}.view_3D", View3D, v; @view_3D = v; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setwindow3d(*)\n super\n end",
"def axes3d(*)\n super\n end",
"def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end",
"def jb_visualize3d(an, bn, tn)\n Visualizer::Cube.new(an, bn, tn, self).visualize\n end",
"def set_unity3d\n @unity3d = ... | [
"0.7063655",
"0.6393444",
"0.61356175",
"0.5964476",
"0.5959669",
"0.59131044",
"0.5725928",
"0.5651846",
"0.5634495",
"0.56213963",
"0.56135315",
"0.56135315",
"0.55999535",
"0.5557421",
"0.5518038",
"0.5492624",
"0.54666036",
"0.5462154",
"0.5450964",
"0.5439043",
"0.539301... | 0.8338289 | 0 |
Check if a particular controller is the current one args One or more controller names to check (using path notation when inside namespaces) Examples On TreeController current_controller?(:tree) => true current_controller?(:commits) => false current_controller?(:commits, :tree) => true On Admin::ApplicationController cu... | def current_controller?(*args)
args.any? do |v|
v.to_s.downcase == controller.controller_name || v.to_s.downcase == controller.controller_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_controller?(*args)\n args.any? { |v| v.to_s.downcase == controller.controller_path }\n end",
"def current_controller?(*args)\n false if controller.class.name.include?('::')\n\n args.any? { |v| v.to_s.downcase == controller.controller_name }\n end",
"def current_controller?(names)\n na... | [
"0.86525863",
"0.8647324",
"0.8392037",
"0.81844187",
"0.81844187",
"0.8042617",
"0.75803095",
"0.7579395",
"0.75755686",
"0.75458074",
"0.7516139",
"0.7374912",
"0.7374912",
"0.7166207",
"0.7072905",
"0.7042646",
"0.7028457",
"0.6998178",
"0.6952924",
"0.6948621",
"0.6777678... | 0.881772 | 1 |
Check if current controller is under the given namespace namespace One or more controller names to check (using path notation when inside namespaces) Examples On Admin::ApplicationController current_namespace?(:application) => false current_namespace?('admin/application') => true current_namespace?('gitlab/application'... | def current_namespace?(namespace)
controller.controller_path.start_with? namespace.to_s.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_namespace?(*args)\n namespace = controller.controller_path.split('/').first\n args.any? { |v| v.to_s.downcase == namespace }\n end",
"def current_controller?(names)\n names.include?(current_controller)\n end",
"def current_controller?(*args)\n false if controller.class.name.include?('... | [
"0.8430445",
"0.73802704",
"0.6980681",
"0.69669694",
"0.69669694",
"0.69183075",
"0.69183075",
"0.69111425",
"0.6572317",
"0.6565636",
"0.64941406",
"0.64544773",
"0.62935406",
"0.62699175",
"0.61710197",
"0.6160479",
"0.61361104",
"0.6057568",
"0.60408384",
"0.59946275",
"0... | 0.86389697 | 0 |
Check if a particular action is the current one args One or more action names to check Examples On Projectsnew current_action?(:new) => true current_action?(:create) => false current_action?(:new, :create) => true | def current_action?(*args)
args.any? { |v| v.to_s.downcase == action_name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_action?(url)\n return url.split('/')[2] == action_name\n end",
"def available_action?(action_name); end",
"def current_controller_action_in?(*args)\n controller = params[\"controller\"]\n action = params[\"action\"]\n\n if args.size == 1\n if args.first.is_a?(Array)\n ... | [
"0.7178823",
"0.70774573",
"0.7046303",
"0.7022752",
"0.68702364",
"0.6869936",
"0.68429285",
"0.67817634",
"0.67690504",
"0.65591556",
"0.65443635",
"0.65312874",
"0.6410122",
"0.6347559",
"0.633968",
"0.631912",
"0.63126516",
"0.6307664",
"0.62986207",
"0.62467",
"0.6206398... | 0.8155522 | 3 |
Returns true if the user has just been activated. | def pending?
@activated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activated?\n self.user && self.user.activated?\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_... | [
"0.82779944",
"0.7811497",
"0.78046334",
"0.7778806",
"0.7778806",
"0.7754977",
"0.7733789",
"0.77285266",
"0.76869",
"0.76713103",
"0.76694673",
"0.76535684",
"0.76535684",
"0.76535684",
"0.76535684",
"0.76535684",
"0.76535684",
"0.76535684",
"0.76535684",
"0.76535684",
"0.7... | 0.67725015 | 94 |
Encrypts the password with the user salt | def encrypt(password)
self.class.encrypt(password, salt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n ... | [
"0.8456656",
"0.83809954",
"0.837295",
"0.83666867",
"0.8361271",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83539045",
"0.8353123",
"0.83147633",
"0.8314556",
"0.83011955",
"0.82853645",
"0.8279242",
"0.8253498",
"0.82321554",
"0.8... | 0.0 | -1 |
These create and unset the fields required for remembering users between browser closes | def remember_me
remember_me_for 2.weeks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forgets\n update_attribute(:remember_digest, nil)\n end",
"def after_save\n cookies['global_properties_for_user'] = nil\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:... | [
"0.655833",
"0.64576274",
"0.6433039",
"0.6433039",
"0.63186485",
"0.6318346",
"0.62982345",
"0.62982345",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
"0.6266504",
... | 0.0 | -1 |
sync user data with salesforce | def salesforce_sync
sf_user = Contact.find(:first, :conditions => ['email = ?', self.email]) || Contact.new()
sf_user.email = self.email
sf_user.remote_id__c = self.id
sf_user.remote_login__c = self.login
sf_user.first_name = self.first_name || 'not specified'
sf_user.la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_salesforceuser\n @salesforceuser = Salesforceuser.find(params[:id])\n end",
"def sync_datas_process\n SyncDatas.sync(self)\n # user = self\n end",
"def send_to_ds!\n uas_user_obj = uas_user || create_uas_user\n integration_id = uas_user_obj.user_id # \"UAS100127\"\n \n if con... | [
"0.66760874",
"0.6630006",
"0.62427276",
"0.61991227",
"0.61639047",
"0.6086297",
"0.606709",
"0.60233337",
"0.60145396",
"0.59847695",
"0.5978419",
"0.5959564",
"0.5950019",
"0.58934706",
"0.5877258",
"0.58698606",
"0.5836666",
"0.5825465",
"0.5810997",
"0.58000845",
"0.5781... | 0.7278047 | 0 |
return the rarity of the item | def rarety
return @item_rarety
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rarity\r\n 6\r\n end",
"def rarity\n self.sets.first[1]\n end",
"def getRarity(defindex = \"\")\n item = nil\n item = $itemh[\"items_game\"][\"items\"][defindex]\n if(!item.nil?)\n if(!item[\"item_rarity\"].nil?)\n return item[\"item_rarity\"].to_s\n else\n retu... | [
"0.80666447",
"0.7822164",
"0.74577945",
"0.684932",
"0.63821596",
"0.63201064",
"0.62068194",
"0.60658574",
"0.6044612",
"0.58548224",
"0.5814041",
"0.58077025",
"0.57351017",
"0.5694773",
"0.56840175",
"0.5678142",
"0.56759304",
"0.56667584",
"0.5660523",
"0.5620622",
"0.55... | 0.68865985 | 3 |
Set Equipment with ID is_weapon: Whether it is a weapon item_id: Weapon/armor ID | def set_equip(is_weapon, item_id)
@class = is_weapon ? RPG::Weapon : RPG::Armor
@item_id = item_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_equip(is_weapon, item_id)\r\n @class = is_weapon ? RPG::Weapon : RPG::Armor\r\n @item_id = item_id\r\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(pa... | [
"0.8431853",
"0.70440066",
"0.70440066",
"0.70440066",
"0.6942516",
"0.6773132",
"0.6762902",
"0.6759775",
"0.6612433",
"0.64137346",
"0.64137346",
"0.6348465",
"0.6232929",
"0.6228341",
"0.621515",
"0.62049377",
"0.6204048",
"0.6195385",
"0.61637926",
"0.61541283",
"0.612012... | 0.84500074 | 0 |
Set Rarety of the item with a ID 0: normal (white) 1: socked (grey) 2: magic (blue) 3: rare (yellow) 4: unique (gold) 5: collection (green) | def set_rarety(rarety_id)
@item_rarety = rarety_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_item_color\n @item_color = ItemColor.find(params[:id])\n end",
"def set_item(item_id)\n @kind = 2\n @item_id = item_id\n end",
"def put_colour_to(item, color)\n item.colorize(color: :\"#{color}\")\n end",
"def set_item\n # 出品機能未実装のため仮置き\n @item = Item.find(params[:id])\... | [
"0.7053375",
"0.69751406",
"0.60743505",
"0.59423345",
"0.5906534",
"0.5906534",
"0.59053576",
"0.59053576",
"0.59050465",
"0.58958906",
"0.58958906",
"0.58958906",
"0.5882109",
"0.58519787",
"0.581891",
"0.5816488",
"0.57956797",
"0.5786368",
"0.57858086",
"0.57853734",
"0.5... | 0.64958704 | 2 |
To avoid conflicts with different JSON libaries | def to_json(*a)
%Q[{"metric_id":#{metric_id || 'null'},"metric_name":#{metric_name.to_json},"scope":#{scope.to_json || 'null'}}]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DISABLED_test_json\n require 'json'\n require 'json/pure'\n my_hash = JSON.parse('{\"hello\": \"goodbye\"}')\n JSON.generate(my_hash)\n end",
"def json_ld; end",
"def extension\r\n\t\t\"json\"\r\n\tend",
"def apply_json_trait(value); end",
"def supports_json?\n false\n end",
... | [
"0.67436737",
"0.670377",
"0.66427714",
"0.6628155",
"0.6522305",
"0.6522305",
"0.64965016",
"0.64622295",
"0.6435855",
"0.64316905",
"0.6416507",
"0.63810444",
"0.6329924",
"0.62577105",
"0.6239929",
"0.6227475",
"0.62215173",
"0.6211734",
"0.6119536",
"0.6118249",
"0.608841... | 0.0 | -1 |
Run these essential steps before saving, so that any fatal exception halt the creation of the playlist. | def before_save
prepare_attributes
find_song_groups!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n db_playlist = context.user.playlists.create(name: context.playlist_name)\n # if the user has auto_sync on then update the playlist record with the spotify playlist info\n # the backup_spotify_playlist context will not be present if user.auto_sync is false\n db_playlist.update_with_spotify(co... | [
"0.5862109",
"0.56478244",
"0.563151",
"0.5569344",
"0.5511764",
"0.54264444",
"0.5379174",
"0.5377988",
"0.53483826",
"0.53483826",
"0.534809",
"0.5317571",
"0.531557",
"0.5304953",
"0.52862746",
"0.52685773",
"0.5258631",
"0.5228139",
"0.5224731",
"0.52149236",
"0.52148694"... | 0.0 | -1 |
Have to add songs after save due to the Playlist needing to have a primary key (generated at time of save). Lame. | def after_save
songs = @song_groups.sort_by{ |group| cost_of group }.first
# Sort em
direction = final - initial > 0 ? :asc : :desc
songs = songs.sort_by(&facet)
songs = songs.reverse if direction == :desc
songs.each_with_index do |song, position|
MrEko::PlaylistEntry.create(:playlist_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end",
"def save \n# # - this method will add Song instances to the @@all array\n @@all << ... | [
"0.7519394",
"0.7162532",
"0.7160561",
"0.71322775",
"0.7100893",
"0.7078421",
"0.7053858",
"0.6997554",
"0.69663364",
"0.6960598",
"0.6953528",
"0.69431835",
"0.69398314",
"0.69146156",
"0.6904965",
"0.68969977",
"0.68969977",
"0.68969977",
"0.68969977",
"0.68969977",
"0.689... | 0.6837651 | 25 |
How bad is the passed group of songs with respect to the TimedPlaylist's facet and length contraints? | def cost_of(song_group)
# Make sure we're sorted by the facet
song_group.sort!{ |a,b| a[facet] <=> b[facet] }
first_song_distance_to_target = song_group.first[facet] - initial
last_song_distance_to_target = final - song_group.last[facet]
# Calculate the facet differences between each song
dif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long_tracks\n @tracks.select { |track| track.duration_ms > 240_000 }\n end",
"def added_songs(playlist)\n valid_songs(changes[\"playlists\"][\"update\"][playlist[\"id\"]][\"song_ids\"])\nend",
"def test_valid_parse\n test_songs, test_kits = SongParserTest.generate_test_data()\n \n assert_equa... | [
"0.57123196",
"0.56618434",
"0.5630876",
"0.556978",
"0.55677325",
"0.5536789",
"0.55321133",
"0.55161506",
"0.5500131",
"0.5466771",
"0.5416996",
"0.54025036",
"0.5375808",
"0.5349999",
"0.5345893",
"0.5340956",
"0.5323016",
"0.5319035",
"0.5310112",
"0.5278361",
"0.52758646... | 0.5942777 | 0 |
Check that this session has an established FHIR client connection. | def check_server_connection
session[:foo] = "bar" unless session.id
raise "session.id is nil" unless session.id
unless @client = ClientConnections.get(session.id.public_id)
redirect_to root_path, flash: { error: "Please connect to a formulary server" }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_client\n unless client\n raise ClientNotSetup\n end\n unless client.connected?\n if raise_on_error\n raise ClientNotConnected\n else\n @logger.error 'Client not connected! Check internet connection'\n return false\n ... | [
"0.740931",
"0.7214294",
"0.70784366",
"0.69792426",
"0.69047207",
"0.6823241",
"0.6823241",
"0.6781201",
"0.6767416",
"0.67584133",
"0.6708732",
"0.6688835",
"0.6592668",
"0.6572823",
"0.6570032",
"0.6570032",
"0.6568445",
"0.6567835",
"0.6545386",
"0.65408003",
"0.6512971",... | 0.7054122 | 4 |
Performs pagination on the drug formulary list, reading 20 formularies from the server at a time. | def update_page(page, bundle)
new_bundle = page.eql?('previous') ? previous_bundle(bundle) : bundle.next_bundle
return (new_bundle.nil? ? bundle : new_bundle)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pager(method,filter_param,per_page=500)\n \n deviations = DeviationSearch.search(session[:deviation_search],0,per_page)\n count = deviations.first[:count]\n if count > 0\n pages = (count / per_page.to_f).ceil\n if count < per_page\n per_page=count\n end\n pages.times do |... | [
"0.5990855",
"0.5987801",
"0.5974042",
"0.5930932",
"0.5902782",
"0.58764553",
"0.5867725",
"0.5860122",
"0.584838",
"0.5847881",
"0.58346415",
"0.5817669",
"0.5817669",
"0.58037883",
"0.5799047",
"0.57927245",
"0.5791933",
"0.5781904",
"0.57773006",
"0.5776383",
"0.5753867",... | 0.0 | -1 |
Retrieves the previous 20 formularies from the current position in the bundle. FHIR::Bundle in the fhirclient gem only provides direct support for the next bundle, not the previous bundle. | def previous_bundle(bundle)
link = bundle.previous_link
if link.present?
new_bundle = @client.parse_reply(bundle.class, @client.default_format,
@client.raw_read_url(link.url))
bundle = new_bundle unless new_bundle.nil?
end
return bundle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_bundle\n url = session[:previous_bundle]\n\n if url.present?\n @client.parse_reply(FHIR::Bundle, @client.default_format,\n @client.raw_read_url(url))\n end\n end",
"def previous_list\n @_previous ? @resource.list(abs_url: @_previous) : nil\n end",
"d... | [
"0.65411234",
"0.61150545",
"0.60098493",
"0.5724016",
"0.56582266",
"0.56289905",
"0.552534",
"0.54950714",
"0.54569125",
"0.5429079",
"0.5424809",
"0.54161954",
"0.5372272",
"0.5366636",
"0.5318148",
"0.5314241",
"0.5311368",
"0.52826107",
"0.52675116",
"0.52249306",
"0.522... | 0.5890653 | 3 |
Modify the method from the previous exercise so it ignores nonalphabetic characters when determining whether it should uppercase or lowercase each letter. The nonalphabetic characters should still be included in the return value; they just don't count when toggling the desired case. | def staggered_case(string)
chars = string.chars.map(&:downcase)
n = 0
m = 0
results = []
chars.size.times do
if n.even? && chars[m] =~ /[A-Za-z]/
results << chars[m].upcase
n += 1
m += 1
elsif chars[m] =~ /[A-Za-z]/
results << chars[m]
n += 1
m += 1
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def staggered_case_not_count_non_alphabetic(string)\n need_upper = true\n string.split('').map do |char| \n if char =~ /[a-zA-z]/\n transformed_char = need_upper ? char.upcase : char.downcase\n need_upper = !need_upper\n transformed_char\n else\n char\n end\n end.join\nend",
"def ... | [
"0.75504047",
"0.7362862",
"0.73525393",
"0.72261846",
"0.7190506",
"0.7152907",
"0.7114122",
"0.708606",
"0.70839375",
"0.70795584",
"0.70761895",
"0.70482713",
"0.7034847",
"0.70267683",
"0.7013389",
"0.70031625",
"0.6972227",
"0.6961736",
"0.69599694",
"0.69576824",
"0.695... | 0.0 | -1 |
Made obsolete by the new Ferret def test_invalid_search get :search, :q => "" assert_response :success assert_tag "p", :content => /Invalid character in search./ end | def test_not_searching_passwords
get :search, :q => "foobar"
assert_response :success
# This would find 10 matches if searching the password field.
assert_tag "p", :content => /Found 0 matches./
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search\n get :search,\n :query => 'furrowend'\n assert_response :success\n #TODO: Figure out why this doesn't work\n #assert_tag :tag => 'Location'\n end",
"def test_no_query_search\n assert_raises(RuntimeError) { DuckDuckGo::search({:bad => :hash}) }\n end",
"def test_search\n ... | [
"0.71486604",
"0.70244706",
"0.68284315",
"0.66602963",
"0.66419643",
"0.65823185",
"0.65219504",
"0.6428441",
"0.64141804",
"0.63725966",
"0.6336961",
"0.6183565",
"0.61137694",
"0.61137694",
"0.60917395",
"0.60699475",
"0.60699475",
"0.606577",
"0.6022915",
"0.6010223",
"0.... | 0.7779356 | 0 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.interview_date_decision_notification.subject | def interview_date_decision_notification(interviewee, interviewer, datetime)
@interviewee = interviewee
@interviewer = interviewer
@datetime = datetime
mail to: [interviewee.email, interviewer.email], subject: "#{interviewee.name} さんの面接日時が確定しました"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}... | [
"0.6756692",
"0.66754377",
"0.65893424",
"0.6456226",
"0.6326234",
"0.6324647",
"0.63114554",
"0.6310288",
"0.62931573",
"0.6265622",
"0.6263265",
"0.6256038",
"0.62537724",
"0.61470765",
"0.6124995",
"0.6123497",
"0.61175114",
"0.61062354",
"0.61037046",
"0.6076334",
"0.6075... | 0.58771455 | 39 |
TODO See all publics and yours privates | def all
self.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def internal; end",
"def suivre; end",
"def public; end",
"def public; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def private_method\n end",
"def implementat... | [
"0.8302845",
"0.6985306",
"0.67643964",
"0.66289806",
"0.65399534",
"0.6525898",
"0.6525898",
"0.6472006",
"0.6472006",
"0.6472006",
"0.6472006",
"0.64664274",
"0.64631385",
"0.64616513",
"0.64616513",
"0.6377728",
"0.6330843",
"0.6314529",
"0.6314529",
"0.63115203",
"0.63115... | 0.0 | -1 |
Initializes the thread manager. | def initialize(framework)
self.framework = framework
self.monitor = spawn_monitor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_threadpool\n EM.threadpool_size = @poolsize\n end",
"def thread_mgr\n @_thread_mgr ||= OpenStruct.new({\n :threads => [],\n :lock => Mutex.new\n })\n end",
"def initialize_threading\n @worker_pool = nil\n \n \n #\n # Define the entity thread, wit... | [
"0.7103627",
"0.69856375",
"0.67637676",
"0.6719589",
"0.66335887",
"0.6529875",
"0.6517317",
"0.6465248",
"0.6419248",
"0.6375797",
"0.63625365",
"0.6276933",
"0.6250596",
"0.6241749",
"0.61612725",
"0.6152176",
"0.61224276",
"0.61030185",
"0.6089711",
"0.60662615",
"0.60418... | 0.5430361 | 86 |
Spawns a monitor thread for removing dead threads | def spawn_monitor
::Thread.new do
begin
::Thread.current[:tm_name] = "Thread Monitor"
::Thread.current[:tm_crit] = true
while true
::IO.select(nil, nil, nil, 1.0)
self.each_index do |i|
state = self[i].alive? rescue false
self[i] = nil if not state
end
self.delete(nil)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_monitor\n self.monitor = monitor_thread if not self.monitor\n end",
"def monitor\n return Thread.new do\n while true do\n Thread.list.each do |thr|\n joined = thr.join(1)\n end\n end\n end\n end",
"def spawn_watch_thread\n @watch_thread... | [
"0.67141736",
"0.669943",
"0.6592667",
"0.64298654",
"0.64287996",
"0.6378607",
"0.6307385",
"0.61128676",
"0.6057202",
"0.6045744",
"0.5931607",
"0.58306015",
"0.58119756",
"0.5681499",
"0.5676119",
"0.5640222",
"0.56364095",
"0.5618113",
"0.5602332",
"0.557812",
"0.5576629"... | 0.7460924 | 0 |
Spawns a new thread | def spawn(name, crit, *args, &block)
t = nil
if block
t = ::Thread.new(name, crit, caller, block, *args) do |*argv|
::Thread.current[:tm_name] = argv.shift.to_s
::Thread.current[:tm_crit] = argv.shift
::Thread.current[:tm_call] = argv.shift
::Thread.current[:tm_time] = Time.now
begin
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end",
"def spawn_thread\n Thread.new{ run_thread }.tap do |t|\n t.abort_on_exception = true\n end\n end",
"def start_new_thread(username, params = {})\n $LOG.i \"running... | [
"0.75345105",
"0.72112286",
"0.71916777",
"0.68713653",
"0.6735537",
"0.6568612",
"0.6530169",
"0.65131193",
"0.65100306",
"0.64988416",
"0.64945483",
"0.6469457",
"0.64234936",
"0.64151007",
"0.6313742",
"0.62933",
"0.6287236",
"0.62838167",
"0.6252935",
"0.62495196",
"0.622... | 0.6286906 | 17 |
Registers an existing thread | def register(t, name, crit)
t[:tm_name] = name
t[:tm_crit] = crit
t[:tm_call] = caller
t[:tm_time] = Time.now
self << t
t
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hsdq_threads_add(thread)\n hsdq_threads.add thread\n end",
"def register(mutex)\n locks.add(mutex)\n end",
"def add_thread_definition(name, &block)\n puts \"Adding thread definition #{name}\"\n @worker_thread_definitions[name] = block\n end",
"def mark_thread(username, thread... | [
"0.65294945",
"0.6518577",
"0.6182392",
"0.6112366",
"0.5926719",
"0.5753945",
"0.57157665",
"0.5697646",
"0.5685029",
"0.5668017",
"0.5551441",
"0.5512031",
"0.5512031",
"0.54921657",
"0.5447275",
"0.54229057",
"0.54222816",
"0.54079473",
"0.5405723",
"0.5386889",
"0.5324836... | 0.50145984 | 60 |
Updates an existing thread | def update(ut, name, crit)
ti = nil
self.each_index do |i|
tt = self[i]
next if not tt
if ut.__id__ == tt.__id__
ti = i
break
end
end
t = self[ti]
if not t
raise RuntimeError, "Thread not found"
end
t[:tm_name] = name
t[:tm_crit] = crit
t
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_thread\n self.update_attribute(:thread, self.id) unless self.thread\n end",
"def update_thread\n # Kill thread if it exists\n thread && @thread.kill\n @thread = Thread.new do\n loop do\n message = recv\n @state[message.command] = message.value\n yie... | [
"0.7994681",
"0.7112646",
"0.67120403",
"0.66881436",
"0.66059005",
"0.66035795",
"0.65867",
"0.6411346",
"0.6411346",
"0.6266133",
"0.61790466",
"0.6127175",
"0.61246616",
"0.61210227",
"0.6106395",
"0.6089223",
"0.6053068",
"0.6044956",
"0.6044118",
"0.59921116",
"0.5958317... | 0.6046544 | 17 |
Kills a thread by index | def kill(idx)
self[idx].kill rescue false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_thread\n # TODO: ideally this would be unshift, but Queues don't have that. Come up with an alternative.\n @queue << Directive::SUICIDE_PILL\n end",
"def kill\n\n threads.each { |t| t.raise(KillSignal) }\n end",
"def kill\n send(:kill)\n end",
"def kill(obj_id)\n if ... | [
"0.68591857",
"0.67788196",
"0.6597295",
"0.6415035",
"0.6410645",
"0.6405555",
"0.63585633",
"0.6354827",
"0.6351398",
"0.6302953",
"0.6272353",
"0.6239773",
"0.6193013",
"0.6181605",
"0.6149337",
"0.6147421",
"0.6112199",
"0.6044741",
"0.6021155",
"0.59582394",
"0.5939016",... | 0.768064 | 0 |
Assign clusterwide used prefix. | def prefix pref_name
@context['prefix'] = pref_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_prefix_to(a)\n Kamelopard.id_prefix = a\n end",
"def auto_prefix\n # Add our IPv6 prefix.\n if (v6prefix == V6AUTO)\n Role.logger.info(\"Network: Creating automatic IPv6 prefix for #{name}\")\n user = User.admin.first\n # this config code really needs to move to Crowbar base\n ... | [
"0.70826054",
"0.70524085",
"0.68568444",
"0.68509245",
"0.67964536",
"0.6762685",
"0.6743575",
"0.66832376",
"0.6551808",
"0.6543634",
"0.6493696",
"0.648498",
"0.64268565",
"0.63239884",
"0.62616855",
"0.6207966",
"0.6205324",
"0.6168783",
"0.6158518",
"0.6130922",
"0.61295... | 0.66616344 | 8 |
display is defined on Object, so using display_duck | def display_duck
raise NotImplementedError, "Define this in the subclass"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display\n # Don't no why i thought i would need that. or if i need this.\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\r\n end",
"def display\n puts self\n end",
"def display\n @object.send(Innsights.user... | [
"0.74244124",
"0.7357387",
"0.7357387",
"0.7240608",
"0.72271055",
"0.7138648",
"0.7136131",
"0.7122572",
"0.71048355",
"0.6950954",
"0.6802971",
"0.6799582",
"0.67967415",
"0.6710166",
"0.6707371",
"0.6682544",
"0.6678751",
"0.6628461",
"0.66215515",
"0.66083646",
"0.6572406... | 0.7363987 | 1 |
GET /odeme/akademists/1 GET /odeme/akademists/1.json | def show
@tarih = Takvim.all
# var olan kodlar
@odeme_akademist = Odeme::Akademist.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @odeme_akademist }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artists\n render :nothing => true and return if params[:id].nil?\n\n if ( params[:meta] == 'tattoos' )\n @artist = Artist.find(params[:id], :include => :tattoos)\n render :json => @artist.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n ... | [
"0.63902223",
"0.63740945",
"0.6295004",
"0.6155849",
"0.6100318",
"0.6061909",
"0.5958203",
"0.5877093",
"0.5822119",
"0.58191437",
"0.5755493",
"0.5729983",
"0.5701217",
"0.5681641",
"0.5670211",
"0.5662474",
"0.56600344",
"0.56302106",
"0.5597236",
"0.5595969",
"0.5587866"... | 0.5280452 | 57 |
GET /odeme/akademists/new GET /odeme/akademists/new.json | def new
@lecture = Lecture.all
if @lecture.any?
@odeme_akademist = Odeme::Akademist.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @odeme_akademist }
end
else
flash[:notice] = "Lütfen akademisyenin katılacağı programa ders ekleyiniz.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end",
"def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist }\n end\n end"... | [
"0.678635",
"0.6776513",
"0.6711648",
"0.6531903",
"0.6510686",
"0.64906126",
"0.64846754",
"0.6478669",
"0.64253616",
"0.64253616",
"0.64096606",
"0.64096606",
"0.6389413",
"0.6366926",
"0.6362592",
"0.6361558",
"0.6359927",
"0.6359927",
"0.6359927",
"0.6359927",
"0.6355089"... | 0.0 | -1 |
POST /odeme/akademists POST /odeme/akademists.json | def create
@odeme_akademist = Odeme::Akademist.new(params[:odeme_akademist])
respond_to do |format|
if @odeme_akademist.save
format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully created.' }
format.json { render json: @odeme_akademist, status: :created, location:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end",
"def create\n @artistum = Artistum.new(artistum_params)\n\n respond_to do |format|\n if @artistum.save\n current_user.update(artista_id: @artistum.id)\n format.html { redirect_to @art... | [
"0.5637282",
"0.5588303",
"0.5553273",
"0.54267824",
"0.5418047",
"0.5363392",
"0.53050256",
"0.52953666",
"0.5288128",
"0.52840364",
"0.5274254",
"0.5239158",
"0.5238256",
"0.5234403",
"0.5194009",
"0.5180956",
"0.5169619",
"0.51646996",
"0.5151896",
"0.5148328",
"0.5140564"... | 0.5838699 | 0 |
PUT /odeme/akademists/1 PUT /odeme/akademists/1.json | def update
@odeme_akademist = Odeme::Akademist.find(params[:id])
respond_to do |format|
if @odeme_akademist.update_attributes(params[:odeme_akademist])
format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully updated.' }
format.json { head :no_content }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path ... | [
"0.63186127",
"0.6216808",
"0.61791635",
"0.5964936",
"0.5802292",
"0.577326",
"0.57680166",
"0.5759454",
"0.5734466",
"0.5724467",
"0.5706498",
"0.5694799",
"0.56922776",
"0.56543654",
"0.56246746",
"0.5608129",
"0.5600759",
"0.5600039",
"0.55958605",
"0.55839443",
"0.557273... | 0.6265749 | 1 |
DELETE /odeme/akademists/1 DELETE /odeme/akademists/1.json | def destroy
@odeme_akademist = Odeme::Akademist.find(params[:id])
@odeme_akademist.destroy
respond_to do |format|
format.html { redirect_to odeme_akademists_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n client.delete(\... | [
"0.7190984",
"0.70235527",
"0.6919683",
"0.67853045",
"0.6698163",
"0.66118044",
"0.65602475",
"0.6539186",
"0.65203226",
"0.64999956",
"0.6499683",
"0.6484448",
"0.6477032",
"0.64765954",
"0.6474961",
"0.64672583",
"0.64631385",
"0.6452457",
"0.64421415",
"0.64323527",
"0.64... | 0.7399174 | 0 |
Move to a specific position. x: 015000, y: 010000 | def move(s, x, y, isTextMode)
if isTextMode
puts "# move(sp, #{x}, #{y})"
puts "PA#{x.to_i()},#{y.to_i()};"
else
s.puts "PA#{x.to_i()},#{y.to_i()};"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to(x, y); end",
"def move_to(x, y, speed = 2)\n @new_x = x\n @new_y = y\n @speed = speed\n end",
"def move_to (x, y)\n @x, @y = x, y\n end",
"def moveto(x, y)\n #@ox = x; @oy = y\n @x = x % $game_map.width\n @y = y % $game_map.height\n #kk20\n @real_x = @x * 128 + 64... | [
"0.79744774",
"0.7810198",
"0.75735843",
"0.756378",
"0.7549152",
"0.7499053",
"0.74944097",
"0.74510646",
"0.74015534",
"0.7397111",
"0.73481566",
"0.73335415",
"0.73187",
"0.729605",
"0.72745174",
"0.72349817",
"0.71882224",
"0.71845084",
"0.718384",
"0.71801996",
"0.714748... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.