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 /posts GET /posts.json | def index
@posts = Post.order('created_at DESC')
.paginate(page: params[:page])
.per_page(20)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n ... | [
"0.7866441",
"0.7495791",
"0.7495306",
"0.7495306",
"0.7489588",
"0.7432039",
"0.72869164",
"0.72869164",
"0.72869164",
"0.7256786",
"0.72528964",
"0.7247789",
"0.7246812",
"0.7222598",
"0.72050935",
"0.72050786",
"0.717125",
"0.7170204",
"0.71652704",
"0.71227247",
"0.711610... | 0.0 | -1 |
GET /posts/1 GET /posts/1.json | def show
@post = Post.find_by_short_id!(params[:id])
@short_url = @post.short_id_url
@comments = Comment.ordered_for_post_or_thread_for_user(@post.id, nil,
current_user)
respond_to do |format|
format.html {
@comment = Comment.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
... | [
"0.7711948",
"0.7354794",
"0.7344257",
"0.7338857",
"0.7324135",
"0.72940344",
"0.7277004",
"0.7257037",
"0.7162784",
"0.71600854",
"0.71564883",
"0.71564883",
"0.7120693",
"0.7095693",
"0.7095693",
"0.7095693",
"0.70951295",
"0.70724344",
"0.7061728",
"0.704619",
"0.70333374... | 0.0 | -1 |
GET /posts/new GET /posts/new.json | def new
@post = Post.new
@post.user ||= current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\... | [
"0.8041974",
"0.80156785",
"0.79855186",
"0.7931169",
"0.79215",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"... | 0.0 | -1 |
POST /posts POST /posts.json | def create
@post = Post.new(params[:post])
@post.user ||= current_user
if @post.save
Vote.vote_thusly_on_post_or_comment_for_user_because(1, @post.id, nil, current_user.id, nil)
flash[:success] = "Your post has been submitted successfully."
redirect_to @post.comments_url
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @po... | [
"0.74463975",
"0.73221767",
"0.73072433",
"0.7123966",
"0.7015686",
"0.701327",
"0.69841874",
"0.6939327",
"0.69313824",
"0.69053805",
"0.68196476",
"0.6812792",
"0.6793222",
"0.6792862",
"0.6779654",
"0.6779654",
"0.67625546",
"0.67602354",
"0.67515427",
"0.6735786",
"0.6698... | 0.0 | -1 |
PUT /posts/1 PUT /posts/1.json | def update
return redirect_to @post.comments_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n title = params[:title]\n body ... | [
"0.730712",
"0.7121667",
"0.6814235",
"0.66412306",
"0.66166633",
"0.66057837",
"0.6581644",
"0.656272",
"0.6549959",
"0.65330195",
"0.651011",
"0.64858186",
"0.644467",
"0.6430717",
"0.6413994",
"0.6384365",
"0.6381423",
"0.63646674",
"0.6364095",
"0.6363726",
"0.6361106",
... | 0.0 | -1 |
DELETE /posts/1 DELETE /posts/1.json | def destroy
@post = Post.find(params[:id])
@post.destroy
if @post.user != current_user
flash[:notice] = "You can't delete this post."
respond_to do |format|
format.html { redirect_to :back }
format.json { head :no_content }
end
else
@post.destroy
respond_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: param... | [
"0.8046927",
"0.76904076",
"0.7584888",
"0.7580699",
"0.7568424",
"0.75054324",
"0.7504039",
"0.74757856",
"0.746826",
"0.74662447",
"0.7464773",
"0.7460266",
"0.7460266",
"0.7460266",
"0.7460266",
"0.7458692",
"0.7458692",
"0.7458692",
"0.7458692",
"0.7458692",
"0.7458692",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.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 event_params
params.require(:event).permit(:title, :description, :place, :start_date, :end_date, :photo)
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 |
GET /top_categories GET /top_categories.json | def index
@top_categories = TopCategory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n respond_to do |format|\n format.json {render :json => @top_category.to_json }\n end\n end",
"def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ... | [
"0.73308915",
"0.7193247",
"0.7076633",
"0.70690656",
"0.687003",
"0.68142366",
"0.6798671",
"0.67972434",
"0.6787344",
"0.67836356",
"0.6773029",
"0.6752894",
"0.66947705",
"0.66684854",
"0.66497964",
"0.6622069",
"0.66161156",
"0.6600748",
"0.6588248",
"0.65825546",
"0.6561... | 0.7706875 | 0 |
GET /top_categories/1 GET /top_categories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @top_categories = TopCategory.all\n end",
"def show\n respond_to do |format|\n format.json {render :json => @top_category.to_json }\n end\n end",
"def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n ... | [
"0.7538207",
"0.751674",
"0.73643917",
"0.70883894",
"0.6980906",
"0.6868069",
"0.6865291",
"0.6779928",
"0.6716228",
"0.6706402",
"0.6684126",
"0.6613624",
"0.6611974",
"0.6599264",
"0.6585189",
"0.6571046",
"0.6558174",
"0.6557665",
"0.6524788",
"0.65118945",
"0.6499474",
... | 0.0 | -1 |
POST /top_categories POST /top_categories.json | def create
@top_category = TopCategory.new(category_params)
# @top_category = current_user.top_categories.build(category_params)
respond_to do |format|
if @top_category.save
# flash[:success] = "product top_category created!"
format.html { redirect_to @top_category, notice: ' top_cate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end",
"def create\n @top_category = TopCategory.new(top_category_params)\n\n respond_to do |fo... | [
"0.71250665",
"0.6999443",
"0.6664739",
"0.6568813",
"0.64659715",
"0.6284578",
"0.62502915",
"0.6157862",
"0.6129151",
"0.6057964",
"0.60532993",
"0.6010274",
"0.59898424",
"0.5972075",
"0.5937929",
"0.59085315",
"0.5888195",
"0.5871551",
"0.5868221",
"0.58515555",
"0.578709... | 0.6478265 | 4 |
PATCH/PUT /top_categories/1 PATCH/PUT /top_categories/1.json | def update
respond_to do |format|
if @top_category.update(category_params)
format.html { redirect_to @top_category, notice: ' top_category was successfully updated.' }
format.json { render :show, status: :ok, location: @top_category }
else
format.html { render :edit }
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @top_category.update(top_category_params)\n format.json { render :show, status: :ok, location: @top_... | [
"0.7318362",
"0.7118337",
"0.70140386",
"0.6569826",
"0.6510815",
"0.6460105",
"0.62460876",
"0.621384",
"0.6208081",
"0.61861295",
"0.61576027",
"0.613898",
"0.613898",
"0.6132425",
"0.6122244",
"0.6104992",
"0.60662013",
"0.60642105",
"0.6063169",
"0.60541415",
"0.6011448",... | 0.686252 | 3 |
DELETE /top_categories/1 DELETE /top_categories/1.json | def destroy
@top_category.destroy
respond_to do |format|
format.html { redirect_to top_categories_url, notice: ' top_category was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @top_category.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"... | [
"0.76076674",
"0.7314728",
"0.73079324",
"0.72955656",
"0.729554",
"0.7158945",
"0.7129153",
"0.70562047",
"0.7039033",
"0.7027267",
"0.7000123",
"0.69897485",
"0.69896585",
"0.69838214",
"0.6971835",
"0.69611174",
"0.69516546",
"0.6930539",
"0.691083",
"0.6895203",
"0.688111... | 0.74202603 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_category
@top_category = TopCategory.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def category_params
params.require(:top_category).permit(:name, :shortDescription, :enabled, :deleted, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Enforces access right checks for individuals resources after_filter :verify_authorized, :except => :index, unless: :devise_controller? Enforces access right checks for collections after_filter :verify_policy_scoped, :only => :index | def after_sign_in_path_for(resource)
dashboard_index_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end",
"def ensure_authorization_performed(options = {})\n after_filter(options.slice(:only, :except)) do |controller_instance|\n controller_instance.ensure_authorization_performe... | [
"0.7098833",
"0.6947324",
"0.6853211",
"0.6805642",
"0.67625034",
"0.67385745",
"0.67149055",
"0.6694648",
"0.6680258",
"0.66731375",
"0.65954554",
"0.65949833",
"0.6560842",
"0.6552878",
"0.652022",
"0.649562",
"0.64863753",
"0.64633644",
"0.64544976",
"0.6441046",
"0.642126... | 0.0 | -1 |
Rysuje slot na powerupa | def draw_powerup_slot(x, y, img, params = {})
x1 = x
x2 = x + @scene.width * 0.05
y1 = y
y2 = y + @scene.width * 0.05
params.merge!(scale: @scene.width * 0.05 / img.width)
draw_window(x, y, x1, x2, y1, y2, img, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_powerup_slots\n 10.times do |i|\n x = @scene.width * 0.01 + i * @scene.width * 0.07\n y = @scene.width * 0.01\n j = @scene.player.powerups[i] ? 1 : 0\n draw_powerup_slot(x, y, @powerups_imgs[i][j], img_color: Gosu::Color.rgba(255, 255, 255, 100))\n @numbers[i].draw(\n @s... | [
"0.6782328",
"0.62881577",
"0.60351753",
"0.59512174",
"0.5843867",
"0.57333565",
"0.57308763",
"0.56398594",
"0.56378204",
"0.55822676",
"0.5562987",
"0.55378217",
"0.5531742",
"0.5525838",
"0.5525334",
"0.5514625",
"0.5487586",
"0.54704213",
"0.5459039",
"0.54535866",
"0.54... | 0.6576508 | 1 |
Rysuje informacje o przegranej | def game_over
@scene.window.cursor = true
x = 0
y = @scene.height * 0.3
x1 = 0
x2 = @scene.width
y1 = @scene.height * 0.3
y2 = @scene.height * 0.6
draw_window(x, y, x1, x2, y1, y2, @game_over_img)
load_gm_btns unless @no_button && @yes_button
@no_button.draw
@yes_button.dra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def informational?; end",
"def info; end",
"def info; end",
"def details; end",
"def info\n\tend",
"def Com6 # Recuperation Info\n \n end",
"def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end",
"def display_details()\n ... | [
"0.66396576",
"0.66263586",
"0.66263586",
"0.6561418",
"0.65051603",
"0.64239204",
"0.64128596",
"0.64128596",
"0.6183747",
"0.617891",
"0.617891",
"0.617891",
"0.6121216",
"0.6030023",
"0.6024118",
"0.6007824",
"0.5993921",
"0.59744126",
"0.5967097",
"0.5961237",
"0.5940589"... | 0.0 | -1 |
Pokazuje sloty na powerupy. | def show_powerup_slots
10.times do |i|
x = @scene.width * 0.01 + i * @scene.width * 0.07
y = @scene.width * 0.01
j = @scene.player.powerups[i] ? 1 : 0
draw_powerup_slot(x, y, @powerups_imgs[i][j], img_color: Gosu::Color.rgba(255, 255, 255, 100))
@numbers[i].draw(
@scene.width *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Power)\n\tend",
"def drink_vodka\n power_down(3)\n end",
"def poweroff(s)\n s.puts \"PU;\"\n sleep 0.1\nend",
"def power_down\n send_to_vm('system_powerdown')\n end",
"def poweron(s, level)\n sleep 0.1\n s.puts \"PD#{level.to_i(... | [
"0.6488439",
"0.6480406",
"0.6443694",
"0.6413262",
"0.64105505",
"0.62106913",
"0.6162923",
"0.6150955",
"0.5837029",
"0.5816774",
"0.5795205",
"0.57820576",
"0.57468396",
"0.5736542",
"0.5669699",
"0.5667509",
"0.5666014",
"0.5666014",
"0.56564903",
"0.56428856",
"0.5617174... | 0.5179978 | 67 |
Register a new device to the devices list devices hash defining a new device and it's regex. you may assign multiple devices here. Examples: register(iphone: /iphone/i) register(iphone: /iphone/i, ipad: /ipad/i) | def register(devices)
@devices.merge! devices
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end",
"def device(name, params = {})\n Celluloid::Logger.info \"Registering device '#{name}'...\"\n self.device_types ||= []\n self.device_types << {:name => name}.merge(params)\n ... | [
"0.68583995",
"0.6509158",
"0.6435363",
"0.6319768",
"0.6274836",
"0.6159216",
"0.6131237",
"0.608944",
"0.5983358",
"0.59760386",
"0.5970957",
"0.58521307",
"0.58058614",
"0.578428",
"0.5776126",
"0.57669747",
"0.57669747",
"0.57669747",
"0.57596815",
"0.5747299",
"0.5742086... | 0.6682058 | 2 |
Returns the regex for the device | def device(device)
@devices[device]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_regex\n if ENV.include?(\"rex\")\n if ENV['rex'].scan(/\\/.+\\//)\n rex = Regexp.new ENV['rex'].scan(/\\/(.+)\\//).to_s\n else\n rex = ENV['rex']\n end\n else\n rex = $regexes[:antonym]\n end\n return rex\n end",
"def to_regex_str\n pattern\n ... | [
"0.6950656",
"0.6908495",
"0.65555596",
"0.65555054",
"0.65555054",
"0.65505207",
"0.6526688",
"0.65021646",
"0.6427664",
"0.6394552",
"0.6355057",
"0.6308424",
"0.628819",
"0.626049",
"0.62116945",
"0.6198143",
"0.61976606",
"0.616215",
"0.61498195",
"0.5957185",
"0.59042114... | 0.0 | -1 |
Another easier solution: def zip(matrices) matrices.transpose end | def prizz_proc(arr, prc1, prc2)
arr.select do |el|
prc1.call(el) != prc2.call(el)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose() end",
"def transpose(matrix)\narray1 = []\narray2 = []\narray3 = []\nretrun_matrix = []\n\nmatrix.each do |element_1, element_2, element_3|\n array1 << element_1\n array2 << element_2\n array3 << element_3\n end \n retrun_matrix << array1 \n retrun_matrix << array2\n retrun_matrix <<... | [
"0.70564705",
"0.70457476",
"0.6934629",
"0.68917733",
"0.6842774",
"0.67988145",
"0.6784171",
"0.67808545",
"0.6774572",
"0.6754127",
"0.6726787",
"0.6724681",
"0.6712453",
"0.66839063",
"0.66544664",
"0.66371286",
"0.6624057",
"0.6610774",
"0.6607959",
"0.6604221",
"0.65799... | 0.0 | -1 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
if name_hash.length == 0
nil
else
smallest_num = nil
smallest_num_key = nil
name_hash.collect do |key, value|
if smallest_num == nil
smallest_num = value
smallest_num_key = key
elsif smallest_num > value
smallest_num = value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.82060164 | 66 |
PATCH/PUT /insurances/1 PATCH/PUT /insurances/1.json | def update
@insurance = @case.insurance
respond_to do |format|
if @insurance.update(insurance_params)
format.html { redirect_to case_insurances_path(@case), notice: 'insurance was successfully updated.' }
format.json { render :show, status: :ok, location: @insurance }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n ... | [
"0.6768296",
"0.6689509",
"0.6615706",
"0.65904325",
"0.6474107",
"0.64696765",
"0.6459746",
"0.6436415",
"0.6425305",
"0.6401637",
"0.6401595",
"0.63678324",
"0.63629884",
"0.6356155",
"0.6348413",
"0.63091433",
"0.6300738",
"0.62802845",
"0.6274621",
"0.6260476",
"0.6253477... | 0.63963133 | 11 |
Write a method that takes a string argument and returns a new string that contains the value of the original string with all consecutive duplicate characters collapsed into a single character. Examples: | def crunch(words)
words.split.map! do|word|
word.squeeze
end.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_char_collapse(str)\n i = 0\n while i < str.length\n if i == 0\n new_str = \"\"\n end\n\n if i != str.length-1\n if str[i] == str[i+1]\n new_str += str[i+2..-1]\n str = new_str\n i = 0\n else\n new_str += str[i]\n i += 1\n end\n else\n ... | [
"0.777811",
"0.77749217",
"0.7635363",
"0.7606961",
"0.7548001",
"0.7548001",
"0.75179994",
"0.7509759",
"0.7475628",
"0.74612707",
"0.7446267",
"0.7446267",
"0.73523974",
"0.732738",
"0.732328",
"0.7287801",
"0.72639763",
"0.72503173",
"0.7153071",
"0.71300775",
"0.7128689",... | 0.0 | -1 |
Return nodos adyacentes disponibles | def adyacentes(nodo, analisados)
adyacentes = []
@graph[nodo].each do |n|
adyacentes << n[0] if analisados[n[0]] == false
end
adyacentes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_ids() ; ext_info[:nodes] ; end",
"def nodes\n core_client.get_nodes\n end",
"def nodes\n @conn.nodes\n end",
"def nodes\n TestLab::Node.all\n end",
"def singleton_nodes\n all_node_ids = Node_Query.new(analysis_window: aw).run.first[:objects].collect{|n| n.id}.un... | [
"0.66091645",
"0.6403159",
"0.62676424",
"0.6238713",
"0.62113816",
"0.61593384",
"0.61488044",
"0.60498506",
"0.60498506",
"0.60498506",
"0.6047035",
"0.6020899",
"0.60084546",
"0.6006937",
"0.6006937",
"0.59853375",
"0.5960744",
"0.59554785",
"0.5950454",
"0.592106",
"0.591... | 0.6655777 | 0 |
Return boolean if there is a no analisado | def analisados(analisados)
analisados.each do |_n, value|
return true if value == false
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aye?\n true\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def result?\n false\n end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def tengo_propietario\n ... | [
"0.70494527",
"0.69951224",
"0.6961068",
"0.69099665",
"0.680721",
"0.6790025",
"0.6779203",
"0.6768432",
"0.67547804",
"0.67316175",
"0.671111",
"0.6706282",
"0.6670298",
"0.66642976",
"0.66569054",
"0.66556126",
"0.6655369",
"0.6649369",
"0.66411674",
"0.66344506",
"0.66323... | 0.6692959 | 12 |
Return boolean if there is a no analisado | def menorTemporal(temporal, analisados)
menor = INFINITY
letra = ''
temporal.each do |n, value|
if value < menor && !value.nil? && !analisado(n, analisados)
letra = n
end
end
letra
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aye?\n true\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def result?\n false\n end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def tengo_propietario\n ... | [
"0.70494527",
"0.69951224",
"0.6961068",
"0.69099665",
"0.680721",
"0.6790025",
"0.6779203",
"0.6768432",
"0.67547804",
"0.67316175",
"0.671111",
"0.6706282",
"0.6692959",
"0.6670298",
"0.66642976",
"0.66569054",
"0.66556126",
"0.6655369",
"0.6649369",
"0.66411674",
"0.663445... | 0.0 | -1 |
Set the previous variable and return the shortest path from "a" to dest | def shortest_paths(dest)
position = dest
final = {}
analisados = {}
route = []
route << dest
@previous['a'] = -1
@nodes.each do |n|
analisados[n] = false
end
analisados[position] = true
while analisados(analisados)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_path_to(dest_node)\n return unless has_path_to?(dest_node)\n path = []\n while (dest_node != @node) do\n path.unshift(dest_node)\n dest_node = @edge_to[dest_node]\n end\n path.unshift(@node)\n end",
"def shortest_way(source, dest)\n\t\t@source = source\n dijkstra sou... | [
"0.7170346",
"0.71147186",
"0.7104639",
"0.70993966",
"0.70434946",
"0.69345015",
"0.6829749",
"0.67537045",
"0.67428803",
"0.6679792",
"0.6634349",
"0.64279014",
"0.6401152",
"0.6361677",
"0.632847",
"0.6324271",
"0.6317887",
"0.6300922",
"0.62491584",
"0.621048",
"0.6204966... | 0.72792274 | 0 |
This method is called whenever the command is executed | def execute
if @env.show_help
show_help
return SUCCESS_RESULT
end
return ARGUMENT_ERROR_RESULT unless init == SUCCESS_RESULT
if @mdbci_config.node_names.size != 1
@ui.error('Invalid node specified')
return ARGUMENT_ERROR_RESULT
end
recipe_name = ProductAttributes.recipe_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def before_exec_command\n end",
"def set_commands; end",
"def commands; end",
"def command_start; end",
"def command_start; end",
"def command_start; end",
"def sup... | [
"0.7606447",
"0.7606447",
"0.7606447",
"0.7606447",
"0.7606447",
"0.7606447",
"0.73779136",
"0.7289273",
"0.7275151",
"0.7255945",
"0.7255945",
"0.7255945",
"0.710811",
"0.70267713",
"0.69965607",
"0.69965607",
"0.69265825",
"0.6918236",
"0.69132364",
"0.69039464",
"0.6884652... | 0.0 | -1 |
Print brief instructions on how to use the command | def show_help
info = <<~HELP
'install_product' Install a product onto the configuration node.
mdbci install_product --product product --product-version version config/node
HELP
@ui.info(info)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alive_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [alive | a] <name=> checks if an animal is alive by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [alive | a] name... | [
"0.77632964",
"0.7712296",
"0.76913303",
"0.7657461",
"0.765294",
"0.76093996",
"0.752868",
"0.75171393",
"0.745996",
"0.7442375",
"0.7433295",
"0.74039805",
"0.73974633",
"0.73695844",
"0.7344375",
"0.7334915",
"0.73049045",
"0.7293231",
"0.7287401",
"0.7284225",
"0.7281091"... | 0.0 | -1 |
Initializes the command variable | def init
if @args.first.nil?
@ui.error('Please specify the node')
return ARGUMENT_ERROR_RESULT
end
@mdbci_config = Configuration.new(@args.first, @env.labels)
result = NetworkSettings.from_file(@mdbci_config.network_settings_file)
if result.error?
@ui.error(result.error)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize command\n @command = command\n end",
"def initialize(command)\n @command = command\n end",
"def initialize\n load_commands\n end",
"def initialize(name, command)\r\n super(name)\r\n @command = command\r\n end",
"def ___init_command\n @cobj.ad... | [
"0.8097254",
"0.7809925",
"0.75206774",
"0.75051624",
"0.7386676",
"0.71359104",
"0.70914406",
"0.70463336",
"0.7045909",
"0.70283604",
"0.69991106",
"0.69716716",
"0.6954846",
"0.69355786",
"0.69355786",
"0.69355786",
"0.685999",
"0.68573296",
"0.6838256",
"0.6838256",
"0.68... | 0.0 | -1 |
Using the Ruby language, have the function TrappingWater(arr) take the array of nonnegative integers stored in arr, and determine the largest amount of water that can be trapped. The numbers in the array represent the height of a building (where the width of each building is 1) and if you imagine it raining, water will... | def trapping_water(arr)
tallest2, tallest1 = arr.max(2).sort
idx1, idx2 = nil, nil
arr.each_with_index do |building, idx|
if [tallest2, tallest1].include?(building)
if idx1.nil?
idx1 = idx
elsif idx2.nil?
idx2 = idx
end
end
end
between = arr[idx1 + 1...idx2]
between... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def water(arr)\n\tright = Array.new(arr.length) \n\tleft = Array.new(arr.length) \n\tn = arr.length\n\twater = 0\n\n\tleft[0] = arr[0]\n\t(1...arr.length).each do |i|\n\t\tleft[i] = [left[i-1], arr[i]].max\n\t\tputs \"left array #{left}\"\n\tend\n\tright[n-1] = arr[n-1]\n\t(n-2).downto(0) do |i|\n\t\tright[i] = [r... | [
"0.71212983",
"0.7106419",
"0.7059652",
"0.68956745",
"0.68183327",
"0.6700988",
"0.6694798",
"0.6596994",
"0.65689826",
"0.6493337",
"0.642961",
"0.64209133",
"0.64114404",
"0.6217261",
"0.61934435",
"0.6154525",
"0.6152363",
"0.60687643",
"0.6060839",
"0.6052908",
"0.604867... | 0.8368651 | 0 |
Handle to the RethinkDB::RQL query DSL helper | def r
@r ||= ::RethinkDB::RQL.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(_tql)\n raise NotImplementedError.new\n end",
"def query(query_definition)\n return\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w)... | [
"0.6939854",
"0.67869955",
"0.6644738",
"0.65688765",
"0.6265773",
"0.6204122",
"0.61864877",
"0.6095923",
"0.60843796",
"0.6076154",
"0.60240036",
"0.5994835",
"0.59947205",
"0.5981191",
"0.5952731",
"0.5886916",
"0.5841937",
"0.5835869",
"0.5828224",
"0.5828224",
"0.5815896... | 0.7281441 | 0 |
Triangle Determine whether a triangle can be built from a given set of edges. | def solution(a)
return 0 if a.length < 3
a.sort.each_cons(3) { |e| return 1 if e[0] + e[1] > e[2] }
return 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_triangle?(side1, side2, side3)\n\tif ((side1 + side2 > side3) && (side2 + side3 > side1) && (side3 + side1 > side2))\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def valid_triangle?(a, b, c)\n a + b > c && b + c > a && c + a > b\nend",
"def valid_triangle? triple\n a, b, c = triple\n ... | [
"0.7494309",
"0.7447337",
"0.74458265",
"0.7436055",
"0.7436055",
"0.7436055",
"0.7382249",
"0.7382218",
"0.73733413",
"0.73070645",
"0.72523",
"0.7216522",
"0.71918327",
"0.71896344",
"0.71715796",
"0.71715766",
"0.7146372",
"0.7116894",
"0.7116556",
"0.7105176",
"0.7092441"... | 0.0 | -1 |
Sets up test for debugging | def setup_test(operations, ot_type_name)
operations.make
operations.each do |op|
output_collection = op.output('PCR Plate').collection
rows = output_collection.dimensions[0]
sample_names = ['RP', '2019-nCoVPC_N1', '2019-nCoVPC_N2']
(rows/(sample_names.length)).times do
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n # Each debugger test has its own debugger instance.\n @debugger = Google::Cloud::Debugger.new\n debugger_credentials = @debugger.service.credentials\n debugger_channel_cred = GRPC::Core::ChannelCredentials.new.compose \\\n GRPC::Core::CallCredentials.new debugger_credentials.... | [
"0.75918645",
"0.7348249",
"0.7258401",
"0.7129275",
"0.70699793",
"0.70398825",
"0.7001116",
"0.6957864",
"0.6928055",
"0.68926966",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",
"0.6855845",... | 0.0 | -1 |
Populate a collection with qPCR Reactions | def setup_stripwell_plate(collection:, method:, program_name:, group_size:)
collection.associate(:program_name, program_name)
collection.associate(:group_size, group_size)
qpcr_reaction = Sample.find_by_name('Test qPCR Reaction')
layout_generator = PlateLayoutGeneratorFactory.build(
group_size: g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retractions=(retractions = [])\n [retractions].flatten.each do |id|\n self.retract << PubSubItem.new(id, nil, self.document)\n end\n end",
"def reactions\n [\n {count: self.like_count, users: self.likers, type: \"like\"},\n {count: self.funnies.size, users: self.... | [
"0.6855209",
"0.652098",
"0.601891",
"0.5992613",
"0.5619862",
"0.5536701",
"0.5489907",
"0.53744644",
"0.5285818",
"0.5146652",
"0.5047897",
"0.50120157",
"0.50120157",
"0.49664202",
"0.49185786",
"0.49150386",
"0.49126783",
"0.49126783",
"0.49126783",
"0.49080625",
"0.48909... | 0.0 | -1 |
ensure Joke exists (register it in our database) find_or_create_by for idempotency (handle backed up requests) | def perform(opts)
Joke.find_or_create_by(
can_i_haz_id: opts[:can_i_haz_id]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_or_create_by\n end",
"def find_or_create!()\n end",
"def find_or_create_by_name(name)\n obj = self.find_by_name(name)\n if obj == nil\n obj = self.create(name)\n end\n obj\n end",
"def find_or_create_by_name(name_to_find)\n found = self.find_by_name(name_to_find)\n if f... | [
"0.6861552",
"0.684847",
"0.6471584",
"0.6434708",
"0.6350502",
"0.6286281",
"0.62820506",
"0.6269757",
"0.6227048",
"0.62024367",
"0.6088097",
"0.60750663",
"0.6045815",
"0.6035441",
"0.60328573",
"0.5979402",
"0.5974858",
"0.5948192",
"0.5822461",
"0.5752817",
"0.5741609",
... | 0.6048708 | 12 |
GET /scheduled_employes/new GET /scheduled_employes/new.json | def new
@scheduled_employee = ScheduledEmployee.new(params[:scheduled_employee])
respond_to do |format|
format.html # new.html.erb
format.json { render json: @scheduled_employee }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @employ = Employ.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employ }\n end\n end",
"def new\n @emp_job = EmpJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emp_job }\n end... | [
"0.72065556",
"0.7138918",
"0.70324135",
"0.70306456",
"0.7015563",
"0.68799",
"0.68295497",
"0.68295497",
"0.68295497",
"0.68265337",
"0.67917633",
"0.6785022",
"0.6785022",
"0.6782421",
"0.6755065",
"0.6748491",
"0.67452806",
"0.6735075",
"0.6731376",
"0.6726589",
"0.672658... | 0.7575585 | 0 |
POST /scheduled_employes POST /scheduled_employes.json | def create
@scheduled_employee = ScheduledEmployee.new(params[:scheduled_employee])
respond_to do |format|
if @scheduled_employee.save
format.html { redirect_to @scheduled_employee, notice: 'Scheduled employe was successfully created.' }
format.json { render json: @scheduled_employee, sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n Cutofftotalsalary.create(cutoff_id: Cutoff.last.id, employee_name: @employee.name, sss: @employee.sss, philhealth: @employee.philhealth, pagibig: @employee.pagibig, withholding_tax: @employee... | [
"0.6227349",
"0.62110835",
"0.6166642",
"0.6111867",
"0.60846406",
"0.60716915",
"0.6042675",
"0.603407",
"0.6032441",
"0.6029094",
"0.6016304",
"0.5982814",
"0.5924387",
"0.5865355",
"0.5851994",
"0.58031553",
"0.5802465",
"0.57751364",
"0.5764389",
"0.57627887",
"0.57442707... | 0.6799586 | 0 |
PUT /scheduled_employes/1 PUT /scheduled_employes/1.json | def update
@scheduled_employee = ScheduledEmployee.find(params[:id])
respond_to do |format|
if @scheduled_employee.update_attributes(params[:scheduled_employe])
format.html { redirect_to @scheduled_employee, notice: 'Scheduled employe was successfully updated.' }
format.json { head :no_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n ... | [
"0.62960184",
"0.62114906",
"0.60322106",
"0.6027741",
"0.6024267",
"0.6022083",
"0.6012276",
"0.6005871",
"0.6000168",
"0.5971707",
"0.5971225",
"0.59226024",
"0.5917455",
"0.59126174",
"0.58928454",
"0.5852242",
"0.585071",
"0.58476806",
"0.58111364",
"0.57998323",
"0.57980... | 0.7136603 | 0 |
DELETE /scheduled_employes/1 DELETE /scheduled_employes/1.json | def destroy
@scheduled_employee = ScheduledEmployee.find(params[:id])
@scheduled_employee.destroy
respond_to do |format|
format.html { redirect_to employees_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @employ = Employ.find(params[:id])\n @employ.destroy\n\n respond_to do |format|\n format.html { redirect_to employs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employe.destroy\n respond_to do |format|\n format.html { redirect_to employes_... | [
"0.73342645",
"0.72224",
"0.7194438",
"0.71272224",
"0.711315",
"0.69925827",
"0.69925827",
"0.6917364",
"0.69032073",
"0.68411994",
"0.68360424",
"0.68148834",
"0.68148834",
"0.68148834",
"0.68148834",
"0.68148834",
"0.68148834",
"0.68148834",
"0.6784999",
"0.67775124",
"0.6... | 0.74087405 | 0 |
For simplicity, we'll consider an email valid when it satisfies all of the following: | def is_valid_email(str)
str.count("@") == 1 ? nil : (return false)
at = at_index(str)
check_dot(str, at) ? nil : (return false)
check_numbers(str, at) ? (return true) : (return false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_check\n if !email =~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n errors.add :base, \"Email is in an invalid format.\"\n end\n end",
"def email_is_valid?(email)\n email =~ /[^@ \\t\\n\\r]+@[a-zA-Z0-9\\.-]{3,}$/\n end",
"def email_validate\n if !normalized_email.include? '@'\n ... | [
"0.78894573",
"0.78430104",
"0.77251107",
"0.76997554",
"0.7672842",
"0.76564515",
"0.76515657",
"0.76418364",
"0.7574662",
"0.7557308",
"0.7554693",
"0.75482",
"0.7521353",
"0.75185674",
"0.75056124",
"0.75003624",
"0.7494294",
"0.74835443",
"0.7480192",
"0.7462874",
"0.7418... | 0.7089153 | 62 |
GET /createdtranslations GET /createdtranslations.json | def index
@createdtranslation = Createdtranslation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_translations\n end",
"def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end",
"def translations\n @translations ||= {}\n end",
"def create\n @createdtranslation = Createdtranslation.new(createdtranslation_params)\n\n respo... | [
"0.71702904",
"0.6593293",
"0.6391575",
"0.6258099",
"0.62511504",
"0.6160847",
"0.60743403",
"0.6059093",
"0.6049676",
"0.59995675",
"0.59852844",
"0.59216434",
"0.5913651",
"0.59128815",
"0.59126294",
"0.58712226",
"0.580378",
"0.57990515",
"0.57955533",
"0.579173",
"0.5786... | 0.68369687 | 1 |
GET /createdtranslations/1 GET /createdtranslations/1.json | def show
@createdtranslation = Createdtranslation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_translations\n end",
"def index\n @createdtranslation = Createdtranslation.all\n end",
"def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end",
"def index\n @example_translations = ExampleTranslation.all\n end",
"def index\n ... | [
"0.7030798",
"0.68286324",
"0.66576207",
"0.65251356",
"0.6310535",
"0.62833506",
"0.62663424",
"0.6247286",
"0.62395996",
"0.62063015",
"0.6156073",
"0.6147844",
"0.61467224",
"0.6095751",
"0.607037",
"0.60320765",
"0.5991921",
"0.59801286",
"0.5945394",
"0.5937845",
"0.5894... | 0.65817004 | 3 |
creations should not be modified as this will generate a new request to the API, instead a new creation should be generated GET /createdtranslations/1/edit def edit end POST /createdtranslations POST /createdtranslations.json | def create
@createdtranslation = Createdtranslation.new(createdtranslation_params)
respond_to do |format|
if @createdtranslation.save
format.html { redirect_to @createdtranslation, notice: 'Creation was successfully created.' }
format.json { render :show, status: :created, location: @crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_translations\n end",
"def createdtranslation_params\n params.require(:createdtranslation).permit(:totranslate, :translated, :language1, :language2, :title, :creator_id_id)\n end",
"def create\n\t\t@admin_translatee = Admin::Translatee.new(params[:admin_translatee])\n\n\t\trespond_to do |for... | [
"0.74431825",
"0.67338544",
"0.6707799",
"0.6437984",
"0.64001006",
"0.6277254",
"0.62732595",
"0.62334013",
"0.6232438",
"0.6222819",
"0.6215041",
"0.6158648",
"0.6097748",
"0.6067717",
"0.60033196",
"0.5998653",
"0.59985",
"0.59567446",
"0.5947217",
"0.5927356",
"0.5861914"... | 0.63888156 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_createdtranslation
@createdtranslation = Createdtranslation.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 createdtranslation_params
params.require(:createdtranslation).permit(:totranslate, :translated, :language1, :language2, :title, :creator_id_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Assign container to a LXCFS worker This method blocks until the LXCFS instance is available for use. | def assign_ctrc(ctrc)
return unless ctrc.ct.lxcfs.enable
worker, created = get_or_create_worker(ctrc)
worker.start if created
request_save
worker.wait
ctrc.lxcfs_worker = worker
ctrc.save
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(&block)\n @mutex.synchronize do\n assert_active\n\n begin\n if @idle_threads.empty?\n thread = create\n else\n thread = @idle_threads.pop\n @idle_size = @idle_threads.length\n end\n end until thread.st... | [
"0.5406946",
"0.53722835",
"0.52529055",
"0.5190627",
"0.50570935",
"0.5027171",
"0.49792188",
"0.496386",
"0.4946513",
"0.49314323",
"0.48875237",
"0.48858654",
"0.48687428",
"0.4847159",
"0.48368388",
"0.48232132",
"0.4822087",
"0.47921252",
"0.4784849",
"0.47713372",
"0.47... | 0.59004796 | 0 |
puts pop['France']; def validate errors.add_to_base "Your date(s) cannot be validated" if departureOnThe.blank? || returnOnThe.blank? end def is_same_day_flight_with_ok_periods? departureOnThe == returnOnThe end Validates departure and return date combination | def is_in_the_past?
departureOnThe > returnOnThe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vdate_amount\n \n if(incomeFromSal && !vdate_is_valid_amount_range?(incomeFromSal))\n errors.add(incomeFromSal,'Salary Income is out of valid range.')\n end\n \n if(famPension && !vdate_is_valid_amount_range?(famPension))\n errors.add(famPension,'Family Pension is out of valid range.')\n end\n\n... | [
"0.6662883",
"0.6630864",
"0.6612121",
"0.6545373",
"0.65131164",
"0.64779764",
"0.64103675",
"0.6410084",
"0.6409971",
"0.6406796",
"0.63580763",
"0.63193953",
"0.6311371",
"0.630423",
"0.6296761",
"0.62881905",
"0.62854534",
"0.62854534",
"0.62845755",
"0.62839144",
"0.6280... | 0.5844234 | 82 |
Validate number of passangers | def validate
errors.add_to_base "That was tricky! Passangers must be an integer between 1 and 10 inclusive.\nYou tried:"+passengersToBoard.to_s if number_of_passangers?
#errors.add("passengers", "tried:"+passengersToBoard.to_s) if number_of_passangers?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n letter_count = password.count letter\n letter_count <= max && letter_count >= min\n end",
"def valid_password_count(...) = valid_passwords(...).size",
"def passport_is_valid(passport)\n passport.length == @data_object.aff_passport_length && passport =~ /^\\d+$/ \n end",
"def passFinde... | [
"0.7146553",
"0.6952447",
"0.69521827",
"0.6719454",
"0.6664321",
"0.6616582",
"0.6503744",
"0.6503744",
"0.6466058",
"0.6400933",
"0.63615763",
"0.63292664",
"0.6325815",
"0.63171464",
"0.6309415",
"0.6301518",
"0.62991655",
"0.62864614",
"0.6272642",
"0.6269858",
"0.6269358... | 0.740202 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_storage
@storage = Storage.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 |
Recursively renders a breadcrumb for a given +RDoc::CodeObject+ by properly creating a relative link to the parent namespace elements. | def breadcrumb(object, level = 0)
path = ("../" * level) + object.name + ".html"
link = link_to(object.name, path)
if object.parent.kind_of?(RDoc::TopLevel)
link
else
breadcrumb(object.parent, level+1) + " > " + link
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def breadcrumb\n add_breadcrumb \"Users\", persons_path if @rider.book\n add_breadcrumb \"Master book\", master_riders_path if @rider.is_master?\n\n add_breadcrumb @rider.book.person.first_name, person_path(@rider.book.person) if @rider.book\n add_breadcrumb @rider.book.number, person_book_path(@rider.... | [
"0.63734156",
"0.6341664",
"0.6326168",
"0.6236581",
"0.62133276",
"0.60819376",
"0.6075262",
"0.60712767",
"0.6040823",
"0.6030455",
"0.5919402",
"0.59114355",
"0.5858726",
"0.5854547",
"0.5834168",
"0.5757966",
"0.57524204",
"0.57442755",
"0.57354784",
"0.5731973",
"0.57223... | 0.7642022 | 0 |
Shortcut to generate a simple HTML link. For example: link_to('foo', 'bar') => 'foo' :sig: String, String > String | def link_to(text, href)
%(<a href="#{href}">#{text}</a>)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to(arg)\n text =\n if arg.respond_to?(:name)\n arg.name\n else arg.to_s\n end\n\n Doc::HTML.escape_html(text)\n end",
"def link_to( title, href )\n \"<a h... | [
"0.74198234",
"0.72791463",
"0.7230085",
"0.71838546",
"0.7049556",
"0.7029254",
"0.69593215",
"0.69099593",
"0.68806213",
"0.6841827",
"0.68384385",
"0.6811412",
"0.679838",
"0.6765871",
"0.6754303",
"0.6712772",
"0.6693078",
"0.6687145",
"0.6675908",
"0.65712655",
"0.655745... | 0.6764903 | 14 |
Creates a SEO friendly description for the SEO description tags (i.e. a truncated version of the code object's description with HTML tags stripped out). | def seo_desc(description)
return "" if description.empty?
truncate(strip_tags(description.gsub("\n", " ").strip))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"... | [
"0.7529582",
"0.7240937",
"0.7116405",
"0.70673513",
"0.69909024",
"0.6973203",
"0.696009",
"0.69212246",
"0.6890794",
"0.6883124",
"0.68790025",
"0.6806526",
"0.67965764",
"0.6791093",
"0.6788569",
"0.6783417",
"0.6770772",
"0.6766683",
"0.67648613",
"0.6753812",
"0.6753812"... | 0.7734655 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def casting_params
params.require(:casting).permit(:role, :member_id, :production_id, :position_id, :bio_type_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /blogs GET /blogs.json | def index
@blogs = Blog.order("created_at DESC")
@all_tags = Tag.get_tags_count
@tags_for_meta = []
Tag.all.select("description").each { |element| @tags_for_meta << element.description}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"... | [
"0.792584",
"0.78847367",
"0.7775105",
"0.7775105",
"0.7726639",
"0.7464413",
"0.74023044",
"0.7384139",
"0.7153107",
"0.7057764",
"0.7057764",
"0.7047844",
"0.69886667",
"0.69883066",
"0.69488406",
"0.69013923",
"0.69013923",
"0.6867563",
"0.6867563",
"0.68664086",
"0.680928... | 0.0 | -1 |
GET /blogs/1 GET /blogs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"... | [
"0.7668065",
"0.76622367",
"0.7618243",
"0.7618243",
"0.74593633",
"0.7318865",
"0.7246023",
"0.72279066",
"0.72088677",
"0.7126308",
"0.7126308",
"0.7075884",
"0.7075884",
"0.7030288",
"0.69877493",
"0.6927684",
"0.6927684",
"0.6876707",
"0.6849766",
"0.68361264",
"0.6805816... | 0.0 | -1 |
POST /blogs POST /blogs.json | def create
@blog = Blog.new(blog_params)
respond_to do |format|
if @blog.save
@blog.short_body = @blog.body_area.to_plain_text.first(250)
@blog.save!
format.html { redirect_to @blog, notice: 'Blog was successfully created.' }
format.json { render :show, status: :created, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @blog = Blog.new(blog_params)\n if @blog.save\n render json: @blog\n else\n render json: @blog.errors, status: :unprocessable_entity\n end\n end",
"def create\n blog = Blog.create(blog_params)\n\n if blog.save\n render json: blog, status: :created\n else\n r... | [
"0.73365957",
"0.7330025",
"0.7256558",
"0.70070374",
"0.6968081",
"0.6956533",
"0.6930565",
"0.6895657",
"0.68654335",
"0.68490136",
"0.6810272",
"0.6790769",
"0.674611",
"0.6701701",
"0.66593015",
"0.65951836",
"0.6585578",
"0.657624",
"0.65568227",
"0.6541476",
"0.6540712"... | 0.0 | -1 |
PATCH/PUT /blogs/1 PATCH/PUT /blogs/1.json | def update
respond_to do |format|
if @blog.update(blog_params)
@blog.short_body = @blog.body_area.to_plain_text.first(250)
@blog.save!
format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }
format.json { render :show, status: :ok, location: @blog }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n# @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n format.html { redirect_to @blog, :notice => 'Blogs was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n... | [
"0.6881168",
"0.68394965",
"0.6742763",
"0.6696249",
"0.6603105",
"0.65579444",
"0.6553949",
"0.64963955",
"0.64240855",
"0.64240855",
"0.64162266",
"0.63654304",
"0.6319746",
"0.6308801",
"0.6308801",
"0.6308801",
"0.6296783",
"0.6295313",
"0.62857836",
"0.6258216",
"0.62478... | 0.0 | -1 |
DELETE /blogs/1 DELETE /blogs/1.json | def destroy
@blog.destroy
respond_to do |format|
format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @myblog = Myblog.find(params[:id])\n @myblog.destroy\n\n respond_to do |format|\n format.html { redirect_to myblogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myblog = Myblog.find(params[:id])\n @myblog.destroy\n\n respond_to do |format|\n... | [
"0.7591418",
"0.7591418",
"0.75384784",
"0.7526589",
"0.7487473",
"0.7435315",
"0.7435315",
"0.74247",
"0.74132967",
"0.73540103",
"0.73130524",
"0.7284774",
"0.7267551",
"0.7243752",
"0.72221744",
"0.72018826",
"0.72018826",
"0.720114",
"0.7198911",
"0.7190515",
"0.71884525"... | 0.7224026 | 19 |
Use callbacks to share common setup or constraints between actions. | def set_blog
@blog = Blog.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def blog_params
params.require(:blog).permit(:title,
:blog_id,
:main_image,
:body_area,
:tag_name,
:date,
... | {
"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 |
creates a submit button with btn, post casses appended and puts to a formgroup submit | def submit(label,options={})
@template.content_tag :div, class: "form-group submit" do
klass=((options[:class]||"").split(" ")+["btn form-control post"]).join(" ")
super(label,options.merge(class:klass))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_button(label = 'submit', options = {})\n @template.content_tag 'div',\n @template.submit_tag(label.to_s.humanize),\n :class => 'form_buttons'\n end",
"def submit_button(form, args = {})\n classes = \"btn btn-primary #{args.delete(:class)}\".strip!\n label = args.delete(:lab... | [
"0.70395166",
"0.6788268",
"0.676293",
"0.6751711",
"0.6725036",
"0.6632478",
"0.6578937",
"0.6565085",
"0.65257657",
"0.64697087",
"0.64520854",
"0.6443141",
"0.6435662",
"0.64323246",
"0.6421308",
"0.6377737",
"0.63604605",
"0.63309926",
"0.6330017",
"0.6317436",
"0.6311067... | 0.68474764 | 1 |
Write the zone database files to the target folder | def write_zones(target)
raise ArgumentError, "Directory #{target} does not exist" unless target.exist?
@config.zones.each do |z|
with_file(target,z.name) { |io| z.write(io) }
end
@config.arpas.each do |a|
with_file(target,a.name) {|io| a.write(io)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export path\n File.write path, to_zonefile\n end",
"def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end",
"def save_to_file\n\t\tFile.open(SOURCE_PATH + DATABASE_NAME, 'a') do |file| \n\t\t\tfile.puts(\"#{@street_address}|\" + \\\n\t\t\t\t\t\t\"#{@house_type}|\" + \\\n\t\t... | [
"0.62589425",
"0.6136342",
"0.6060763",
"0.58990145",
"0.5772812",
"0.57457215",
"0.57393885",
"0.5738243",
"0.5735594",
"0.57162315",
"0.5676869",
"0.5668538",
"0.5637025",
"0.56124675",
"0.55875194",
"0.5569683",
"0.55473316",
"0.5530452",
"0.55019474",
"0.55009294",
"0.549... | 0.7055183 | 0 |
If array has odd number, middle element of sorted array is median If array has even number, average of 2 middle element is the median | def median_index(arr_size)
(arr_size-1)/2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median(array)\n array.sort!\n length = array.length\n if length % 2 == 1\n # odd length, return the middle number\n return array[length / 2]\n else\n # even number, average the two middle numbers\n item1 = array[length / 2 - 1]\n item2 = array[length / 2]\n return mean([item1, item2])\n ... | [
"0.90128726",
"0.89767706",
"0.8876345",
"0.8838194",
"0.88315153",
"0.8828522",
"0.8767956",
"0.873451",
"0.87135714",
"0.8651871",
"0.8649875",
"0.8637554",
"0.86350006",
"0.86040175",
"0.8600327",
"0.85837454",
"0.85751677",
"0.8572892",
"0.8525067",
"0.8512157",
"0.850473... | 0.771671 | 60 |
Redefine equality based on +to_a+. | def eql?(other)
to_a.eql? other.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n self.class === other and to_a == other.to_a\n end",
"def ==(other)\n to_a == other.to_a\n end",
"def ===(other); end",
"def === obj\n #This is a stub, used for indexing\n end",
"def ==(other)\n size == other.size && to_a == other.to_a\n end",
"def ==(o)\n ... | [
"0.7593823",
"0.70816916",
"0.6653195",
"0.6590096",
"0.6451173",
"0.6440728",
"0.64064455",
"0.6351679",
"0.6346853",
"0.6327137",
"0.63105744",
"0.63105744",
"0.6285056",
"0.6285056",
"0.6256261",
"0.62499475",
"0.62499475",
"0.62499475",
"0.62499475",
"0.62499475",
"0.6249... | 0.66987854 | 2 |
Determine works added to or removed from the work being updated. | def changed_memberships(env, work_members)
existing_member_ids = env.curation_concern.member_ids
members_attributes = work_members.values
changed_member_ids(members_attributes, existing_member_ids)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def influences_these_works\n find_related_frbr_objects( :is_an_influence_on, :which_works?) \n end",
"def work_influences\n find_related_frbr_objects( :is_influenced_by, :which_works?) \n end",
"def events_worked_and_managed\n Distribution.get_events_worked(self.id) + Distrib... | [
"0.631835",
"0.59347063",
"0.5850118",
"0.56893253",
"0.5684651",
"0.5672085",
"0.56423765",
"0.5600358",
"0.55470425",
"0.5538358",
"0.5488475",
"0.5471385",
"0.54645",
"0.5366564",
"0.5334883",
"0.531975",
"0.53135276",
"0.5307241",
"0.5289663",
"0.5281733",
"0.5237158",
... | 0.0 | -1 |
Returns an Array of the id's of works added to or removed from the work being updated. | def changed_member_ids(members_attributes, existing_member_ids)
changed = []
members_attributes.each do |attributes|
next if attributes['id'].blank?
if existing_member_ids.include?(attributes['id'])
changed << attributes['id'] if has_destroy_flag?(attributes)
else
changed << at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work_id_list\n query = { params: { q: \"member_of_collection_ids_ssim:#{id} AND has_model_ssim:Work\", fl: \"id\", rows: \"100000\" } }\n results = solr.select(query)\n results['response']['docs'].flat_map(&:values)\n end",
"def upserted_ids\n @results[UPSERTED_IDS] || []\n ... | [
"0.62269396",
"0.6110322",
"0.60851365",
"0.5926057",
"0.59106064",
"0.5900953",
"0.58982515",
"0.5894836",
"0.58739",
"0.58516765",
"0.5832916",
"0.5778678",
"0.5752276",
"0.57500786",
"0.5707716",
"0.5698282",
"0.5671421",
"0.5613023",
"0.55841744",
"0.5580952",
"0.5557018"... | 0.0 | -1 |
Copied from Hyrax::Actors::AttachMembersActorhas_destroy_flag? Determines if a hash contains a truthy _destroy key. rubocop:disable Naming/PredicateName | def has_destroy_flag?(hash)
ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_destroy_flag?( hash )\n ActiveFedora::Type::Boolean.new.cast( hash['_destroy'] )\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_dest... | [
"0.8343963",
"0.83021057",
"0.83021057",
"0.82565767",
"0.82447344",
"0.7879332",
"0.703301",
"0.703301",
"0.69177324",
"0.69177324",
"0.6195561",
"0.61738706",
"0.6166166",
"0.6082717",
"0.60380936",
"0.6002451",
"0.59865403",
"0.59072715",
"0.58774817",
"0.58401006",
"0.583... | 0.8227499 | 5 |
define student inuput method | def input_students
puts "Please enter the names of the students and their cohort"
puts "To finish, just hit return twice"
puts "\nEnter Name:"
# create empty array
name = STDIN.gets.chomp
month = ''
# while name isn't empty, repeat
while !name.empty? do
while !MONTHS.include?(month)
puts "En... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_displayer\n print_header\n print_students_list\n print_footer\nend",
"def show_students\n print_header\n print_student_list\n print_footer\nend",
"def show_students\n print_header\n print_student_list\n print_footer\nend",
"def show_students\n print_header\n print_students\n print_foo... | [
"0.70685434",
"0.6902433",
"0.6902433",
"0.6875748",
"0.6839223",
"0.68140006",
"0.68140006",
"0.68140006",
"0.66418916",
"0.66269803",
"0.658622",
"0.65460026",
"0.6539779",
"0.6539779",
"0.65388316",
"0.6471234",
"0.6402834",
"0.6376935",
"0.63555783",
"0.63299906",
"0.6322... | 0.0 | -1 |
Update image on before save | def update_image
if ActiveRecord::Type::Boolean.new.cast(@remove_image)
self.image = nil
self.image_content_type = nil
elsif @image_file
self.image = @image_file.read
self.image_content_type = @image_file.content_type
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_image(image)\n self.avatar = image\n save!\n end",
"def update_db_record\n img_file = file.to_file\n img = ::Magick::Image::read(img_file).first\n model.height = img.rows\n model.width = img.columns\n \n new_filename = model.imageable.filename( file.extension )\n new_file =... | [
"0.7594469",
"0.7311863",
"0.69898915",
"0.68331087",
"0.68197924",
"0.67772466",
"0.6755348",
"0.6751422",
"0.6744184",
"0.67357135",
"0.67316055",
"0.6730627",
"0.67092067",
"0.67062014",
"0.6677185",
"0.66737443",
"0.6662049",
"0.666028",
"0.6655764",
"0.6644429",
"0.66409... | 0.6961773 | 3 |
Send message to other user | def send_message(to_user, content)
from_messages.create!(to_user_id: to_user.id, content: content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, t... | [
"0.78312373",
"0.74674106",
"0.72606903",
"0.71756643",
"0.7168229",
"0.7155572",
"0.70994234",
"0.69662434",
"0.69641393",
"0.69337314",
"0.69331694",
"0.6900288",
"0.6877342",
"0.6735348",
"0.6713874",
"0.67113805",
"0.6673688",
"0.6673688",
"0.6673163",
"0.66699994",
"0.66... | 0.6870803 | 13 |
Cleans up resources used by the generator | def close
@queue_filler.exit
@queue.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n end",
"def cleanup\n end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup!; end",
"def cleanup!; end",
"def cleanup\r\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n ... | [
"0.7685128",
"0.7685128",
"0.7647977",
"0.7647977",
"0.7647977",
"0.7647977",
"0.76367056",
"0.76367056",
"0.76275265",
"0.7609124",
"0.7609124",
"0.7609124",
"0.7609124",
"0.7538124",
"0.7538124",
"0.7538124",
"0.741469",
"0.71302414",
"0.71302414",
"0.7068592",
"0.705086",
... | 0.0 | -1 |
show all customers belonging to a user | def index
@customers = @user.customers.all
render json: @customers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @customers = Customer.where(user_id: current_user.id)\n end",
"def index\n @customers = User.where(:authority => 'customer')\n end",
"def index\n @users = User.fetch_all_customers\n end",
"def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordina... | [
"0.81284803",
"0.77653927",
"0.77412",
"0.7567269",
"0.7563229",
"0.7436127",
"0.7436127",
"0.7434163",
"0.74204326",
"0.72488844",
"0.72201824",
"0.7214057",
"0.70809937",
"0.70608157",
"0.7036255",
"0.701295",
"0.6987474",
"0.6982512",
"0.6968067",
"0.69671565",
"0.69558895... | 0.73856634 | 9 |
create a new customer | def create
@customer = @user.customers.build(customer_params)
if @customer.save
render json: @customer, status: :created
else
render json: @customer.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end",
"def create_customer(options = {})... | [
"0.87255305",
"0.8317782",
"0.82044494",
"0.81929344",
"0.8158758",
"0.8158758",
"0.8094952",
"0.8056036",
"0.796329",
"0.7953399",
"0.7852371",
"0.78515565",
"0.7821936",
"0.7820245",
"0.7763814",
"0.7760206",
"0.77491117",
"0.7747516",
"0.7741732",
"0.77319026",
"0.7730784"... | 0.7877372 | 10 |
ensure user account is active | def active_for_authentication?
super && !deleted_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_active_user\n unless current_user && current_user.status == UserStatus::ACTIVE\n flash[:alert]= I18n.t 'auth.msg.lock_account'\n redirect_to new_user_sessions_url\n return false\n end\n end",
"def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end",... | [
"0.78213364",
"0.7303474",
"0.7297301",
"0.727173",
"0.7261119",
"0.7185702",
"0.71846473",
"0.7181096",
"0.71403736",
"0.7088061",
"0.7037424",
"0.7034981",
"0.7020022",
"0.7000048",
"0.6978506",
"0.6971606",
"0.69567406",
"0.695545",
"0.6951371",
"0.6951099",
"0.6938816",
... | 0.0 | -1 |
provide a custom message for a deleted account | def inactive_message
!deleted_at ? super : :deleted_account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inactive_message\n \t!delete_flag ? super : :deleted_account\n end",
"def inactive_message\n\t\t\t!delete_flag ? super : :deleted_account\n\t\tend",
"def inactive_message\n \t!deleted_at ? super : :deleted_account\n end",
"def inactive_message\n \t!deleted_at ? super : :deleted_account\n end",
"d... | [
"0.77490103",
"0.761186",
"0.7341333",
"0.7341333",
"0.7335921",
"0.7304492",
"0.72610474",
"0.7252312",
"0.72507036",
"0.7237712",
"0.72362304",
"0.72050923",
"0.69030046",
"0.6700996",
"0.6640928",
"0.66021645",
"0.65377337",
"0.64666146",
"0.6447453",
"0.6447453",
"0.63670... | 0.73685765 | 15 |
end 2. The total amount of money each driver has made | def driver_total_earnings(data_hash)
each_total_earnings = {}
data_hash.each do |driver, rides_array|
rides_array.reduce(0) do |sum_of_earnings, ride_details_hash|
sum_of_earnings += ride_details_hash[:cost]
each_total_earnings[driver] = sum_of_earnings
end
end
each_total_earnings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount; end",
"def money_earned_by_driver(driver)\n sum = 0.0\n\n driver.each do |money|\n earned = money[:cost]\n sum += earned.round(2)\n end\n\n return sum\nend",
"def investment\n if buy_price\n num_of_shares * buy_price\n end\n end",
"def amount_owed\n total_price - amount... | [
"0.7216821",
"0.71928895",
"0.71544445",
"0.707447",
"0.7069472",
"0.7028018",
"0.69801664",
"0.6978672",
"0.69663346",
"0.69433945",
"0.6942903",
"0.69296515",
"0.6870009",
"0.6850453",
"0.68400836",
"0.6832562",
"0.6820951",
"0.68197036",
"0.6814004",
"0.67996866",
"0.67977... | 0.0 | -1 |
how can i use reduce in this one without modifying the sum value 3. The average rating for each driver | def drivers_average_ratings_hash(data_hash)
each_driver_average_rating = {}
data_hash.each do |driver, rides_array|
sum_of_ratings = 0
rides_array.each do |ride|
sum_of_ratings += ride[:rating]
end
each_driver_average_rating[driver] = (sum_of_ratings / rides_array.length.to_f).round(1)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_rating(driver)\n sum = 0.0\n \n driver.each do |find_rating|\n driver_rating = find_rating[:rating]\n sum += driver_rating\n end\n\n average = sum / driver.length\n\n return average\nend",
"def average_rating(drivers)\n average_rate = []\n drivers.each do |driver|\n result = 0.0\n ... | [
"0.77955365",
"0.75776875",
"0.75159043",
"0.7487111",
"0.7355896",
"0.73115236",
"0.73010004",
"0.72349405",
"0.7203034",
"0.7200042",
"0.71386737",
"0.70952475",
"0.7073099",
"0.70705855",
"0.7042955",
"0.7038213",
"0.7026146",
"0.7004235",
"0.6989846",
"0.6985204",
"0.6977... | 0.6782533 | 37 |
what about ties? 4. Which driver made the most money? | def driver_who_earned_most(earnings_hash)
driver_who_earned_most = ""
most_earned_so_far = 0
earnings_hash.each do |driver, total_earnings|
if total_earnings > most_earned_so_far
most_earned_so_far = total_earnings
driver_who_earned_most = driver
end
end
driver_who_earned_most
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_driver_with_most_money(earned_per_each_driver)\n max_earned = earned_per_each_driver.max_by do |current_driver|\n current_driver[:driver_earned]\n end\n\n puts \"\\nDriver #{max_earned[:driver_id]} earned the most money $#{max_earned[:driver_earned]}.\"\nend",
"def driver_with_highest_income(all... | [
"0.7323977",
"0.7010691",
"0.7006897",
"0.7001611",
"0.69072276",
"0.69045305",
"0.68828577",
"0.68582004",
"0.67260355",
"0.6721574",
"0.6719476",
"0.6684279",
"0.66719645",
"0.66691285",
"0.66562116",
"0.66562086",
"0.6653544",
"0.6651573",
"0.66482776",
"0.66336364",
"0.66... | 0.7001986 | 3 |
try using find_all method on array 5. Which driver has the highest average rating? | def return_driver_who_had_highest_ave_rating(drivers_average_ratings)
highest_rating = drivers_average_ratings.each_value.max
driver_with_highest_average_rating = ""
drivers_average_ratings.each do |driver, ave_rating|
if ave_rating == highest_rating
driver_with_highest_average_rating = driver
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highest_average_rating(all_rides)\n all_ratings = drivers_average_rating(all_rides)\n highest_rating = all_ratings.values.max\n driver = all_ratings.key(highest_rating)\n puts \"#{driver} has the highest average rating: #{highest_rating.round(2)}\"\nend",
"def find_highest_average_rating(ride_data)\n dr... | [
"0.7666135",
"0.7425907",
"0.7412162",
"0.72981954",
"0.72830474",
"0.72815764",
"0.72691613",
"0.725729",
"0.7251146",
"0.7210123",
"0.72055596",
"0.7159357",
"0.7113972",
"0.70883894",
"0.6919937",
"0.6897104",
"0.6703241",
"0.663228",
"0.6631236",
"0.66271305",
"0.6595508"... | 0.75615674 | 1 |
USERS Enters users data per a given set of test data | def enter_pahma_users(test_data)
users = test_data[UseOfCollections::USER_GRP.name] || [UseOfCollections.empty_user]
prep_fieldsets_for_test_data([fieldset(UseOfCollections::USER_GRP.name)], users)
users.each_with_index do |user, index|
enter_auto_complete(user_name_input(index), user_name_options(in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_users(test_data)\n users = test_data[CoreUseOfCollectionsData::USER_GRP.name] || [CoreUseOfCollectionsData.empty_user]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::USER_GRP.name)], users)\n\n users.each_with_index do |user, index|\n logger.i... | [
"0.70134825",
"0.67769736",
"0.66842794",
"0.6639067",
"0.6607368",
"0.6545218",
"0.65018505",
"0.6457336",
"0.6306099",
"0.62721264",
"0.6192115",
"0.6191121",
"0.6189597",
"0.6107406",
"0.610279",
"0.60416794",
"0.6029497",
"0.60209984",
"0.5998435",
"0.59935635",
"0.597046... | 0.6008897 | 18 |
OCCASIONS Enters occasions per a given set of test data | def enter_pahma_occasions(test_data)
occasions = test_data[UseOfCollections::OCCASION_LIST.name] || [{ UseOfCollections::OCCASION.name => ''}]
prep_fieldsets_for_test_data([fieldset(UseOfCollections::OCCASION_LIST.name)], occasions)
occasions.each_with_index do |occasion, index|
enter_auto_complete(oc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_occasions(test_data)\n occasions = test_data[CoreUseOfCollectionsData::OCCASION_LIST.name] || [{CoreUseOfCollectionsData::OCCASION.name => ''}]\n occasions.each_with_index { |occasion, index| verify_values_match(occasion[CoreUseOfCollectionsData::OCCASION.name], element_value(occasion_input index)... | [
"0.6667795",
"0.66651464",
"0.6657743",
"0.64520264",
"0.5657711",
"0.5128094",
"0.5081924",
"0.50161386",
"0.5003963",
"0.49939463",
"0.49630982",
"0.4942076",
"0.4942076",
"0.4942076",
"0.49415475",
"0.49330622",
"0.4888488",
"0.48785657",
"0.48690873",
"0.4866526",
"0.4858... | 0.6071771 | 4 |
AUTHORIZATIONS Enters authorizations per a given set of test data | def enter_pahma_authorizations(test_data)
authorizations = test_data[UseOfCollections::AUTHORIZATION_GRP.name] || [UseOfCollections.empty_authorization]
prep_fieldsets_for_test_data([fieldset(UseOfCollections::AUTHORIZATION_GRP.name)], authorizations)
authorizations.each_with_index do |auth, index|
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_authorizations(test_data)\n authorizations = test_data[UseOfCollections::AUTHORIZATION_GRP.name] || [UseOfCollections.empty_authorization]\n authorizations.each_with_index do |auth, index|\n verify_values_match(auth[UseOfCollections::AUTHORIZED_BY.name], element_value(authorized_by_input inde... | [
"0.73917764",
"0.73689544",
"0.7341014",
"0.7311346",
"0.6076766",
"0.604605",
"0.6023774",
"0.5831744",
"0.5754662",
"0.56789225",
"0.5656369",
"0.56187046",
"0.5572657",
"0.5550023",
"0.5550023",
"0.5502608",
"0.5404071",
"0.5391954",
"0.5387276",
"0.53665113",
"0.53472084"... | 0.6958488 | 4 |
STAFF Enters staff per a given set of test data | def enter_pahma_staff(test_data)
staff = test_data[UseOfCollections::STAFF_GRP.name] || [UseOfCollections.empty_staff]
prep_fieldsets_for_test_data([fieldset(UseOfCollections::STAFF_GRP.name)], staff)
staff.each_with_index do |staf, index|
enter_auto_complete(staff_name_input(index), staff_name_option... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_staff(test_data)\n staff = test_data[UseOfCollections::STAFF_GRP.name] || [UseOfCollections.empty_staff]\n staff.each_with_index do |staf, index|\n verify_values_match(staf[UseOfCollections::STAFF_NAME.name], element_value(staff_name_input index))\n verify_values_match(staf[UseOfCollecti... | [
"0.70073766",
"0.69515795",
"0.6941025",
"0.6876773",
"0.6059186",
"0.58652544",
"0.566375",
"0.5659587",
"0.5653831",
"0.5571288",
"0.5562473",
"0.5562473",
"0.5532365",
"0.5530157",
"0.55047536",
"0.5497379",
"0.54577804",
"0.5394952",
"0.5387877",
"0.53351665",
"0.53174675... | 0.6671198 | 4 |
LOCATIONS Enters locations per a given set of test data | def enter_pahma_locations(test_data)
locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]
prep_fieldsets_for_test_data([fieldset(UseOfCollections::LOCATION_LIST.name)], locations)
locations.each_with_index do |location, index|
enter_auto_complete(lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_locations(test_data)\n locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::LOCATION_LIST.name)], locations)\n locations.each_with_in... | [
"0.7382622",
"0.7358205",
"0.7197582",
"0.7186002",
"0.66445935",
"0.65132487",
"0.65008503",
"0.6458574",
"0.64343363",
"0.64279574",
"0.6394133",
"0.6322496",
"0.6299176",
"0.6299176",
"0.6274033",
"0.61833894",
"0.61833894",
"0.61792886",
"0.6113836",
"0.6078811",
"0.60388... | 0.66213596 | 5 |
def same_vendor current_user.vendor_id end | def test_params
params.require(:test_sequence).permit(:name, :description, :type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_vendor?\n current_user && current_user.vendor\n end",
"def vendor\n Vendor.all.find do |vendor|\n vendor.id.to_i == @vendor_id.to_i\n end\n end",
"def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end",
"def vendor\n FarMar::Vendor.all.select { ... | [
"0.69665796",
"0.680443",
"0.6385271",
"0.6385271",
"0.63583666",
"0.6312771",
"0.62804043",
"0.6276655",
"0.6208024",
"0.6202038",
"0.61513764",
"0.61437285",
"0.61435175",
"0.6104461",
"0.60944945",
"0.6052024",
"0.60408777",
"0.6034448",
"0.6034448",
"0.60311836",
"0.60223... | 0.0 | -1 |
Returns the denominator (lcm of all components' denominators). | def denominator
ad = @a.denominator
bd = @b.denominator
ad.lcm(bd)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce!\n g = gcd(@numer, @denom)\n @numer /= g\n @denom /= g\n self\n end",
"def denom()\n\t\treturn @den\n\tend",
"def reduce\n divisor = mcd\n @num = @num / divisor\n @denom = @denom / divisor\n return self\n end",
"def lcm\n result = 1\n children.each... | [
"0.64117944",
"0.6380476",
"0.62658554",
"0.62475026",
"0.6243551",
"0.62400633",
"0.6161381",
"0.60748905",
"0.60236806",
"0.5990079",
"0.595297",
"0.5931105",
"0.5906011",
"0.5874939",
"0.5856951",
"0.58544594",
"0.5758487",
"0.56995445",
"0.5665733",
"0.5648387",
"0.563355... | 0.80482143 | 1 |
Returns the numerator. 1 1 1 3 46i12j+9k 3 2 1 4 12 < denominator | def numerator
an = @a.numerator
bn = @b.numerator
ad = @a.denominator
bd = @b.denominator
abd = ad.lcm(bd)
__new__(an * (abd / ad), bn * (abd / bd))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numerator() end",
"def denominator() end",
"def numerator\n @data[0]\n end",
"def return_rational(numerator)\n\t\tnumerator/36.to_r\n\tend",
"def curious_fraction(numerator,denominator)\n numerators = numerator.to_s.split('').map(&:to_i)\n denominators = denominator.to_s.split('').map(&:to_i)... | [
"0.7209104",
"0.6925646",
"0.6745478",
"0.64857024",
"0.6455098",
"0.6342259",
"0.6332808",
"0.632078",
"0.62799835",
"0.62799835",
"0.6238427",
"0.61938757",
"0.6153901",
"0.61130637",
"0.61120284",
"0.6094665",
"0.6030863",
"0.5935458",
"0.5921488",
"0.5895153",
"0.5883357"... | 0.6745586 | 2 |
Remove all breakpoints that we have recorded | def finalize
@list.each do |bp|
bp.related_bp.each { |bp| bp.remove! }
bp.remove!
end
clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_breakpoint(bp)\n if bp.kind_of? Breakpoint\n bp = [bp]\n end\n bp.each do |bp|\n @breakpoint_tracker.remove_breakpoint bp\n end\n end",
"def remove_breakpoint(bp)\n if bp.kind_of? Array\n removed = []\n bp.each do |bp|\n removed << @breakpoint_tracker... | [
"0.70068413",
"0.69175017",
"0.6594876",
"0.61134195",
"0.5977766",
"0.59603775",
"0.5883916",
"0.5695854",
"0.5686992",
"0.5683722",
"0.56790286",
"0.5669111",
"0.56594205",
"0.5655116",
"0.56536335",
"0.56418216",
"0.56097776",
"0.5609139",
"0.56015414",
"0.5594915",
"0.556... | 0.5604169 | 18 |
GET /refunds GET /refunds.xml | def index
@now = DateTime.new(Time.zone.now.year, Time.zone.now.month, Time.zone.now.day, Time.zone.now.hour, Time.zone.now.min, Time.zone.now.sec)
@start_date = params[:start_date].nil? ? DateTime.new(@now.year, @now.month, 1, 4, 0) : DateTime.parse(params[:start_date] + " 04:00:00")
@end_date = params[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def show\n @refund = Refund.find(params[:id])\n \n respond_to do |format|\n format.html { render :action => \"show\"}\n format.xml { render :xml => @refund }\n end\n end",
"def refund(tid, refund)\n begin\n ... | [
"0.7308406",
"0.7050245",
"0.6761996",
"0.665215",
"0.65770006",
"0.6534345",
"0.6527923",
"0.6527923",
"0.6484684",
"0.6437256",
"0.6377707",
"0.63237166",
"0.6283873",
"0.6281415",
"0.6281415",
"0.61804473",
"0.613729",
"0.61091745",
"0.6085655",
"0.60642004",
"0.6029438",
... | 0.59191066 | 25 |
GET /refunds/1 GET /refunds/1.xml | def show
@refund = Refund.find(params[:id])
respond_to do |format|
format.html { render :action => "show"}
format.xml { render :xml => @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest... | [
"0.6918127",
"0.6690772",
"0.6681883",
"0.6681883",
"0.66725296",
"0.6578474",
"0.6549463",
"0.6520928",
"0.6498157",
"0.6420281",
"0.6412169",
"0.6374997",
"0.627628",
"0.6199104",
"0.6186524",
"0.6186524",
"0.6172933",
"0.61628383",
"0.6093948",
"0.6073759",
"0.6051631",
... | 0.734297 | 0 |
POST /refunds POST /refunds.xml | def create
@refund = Refund.new(params[:refund])
@queued_coupon_refunds = Coupon.find(session[:queued_coupon_refunds])
# create wtd credits
if @refund.credit_amount > 0
@credit = Credit.new
@credit.promotion_code_id = PromotionCode::REFUND_CREDIT
@credit.value = @refund.credit_amo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_refund\n body = { action: \"refund\", key: @@access_key, gen_task_id: @task_id }\n post_request(body)\n end",
"def refund(params)\n request(Resources::RESOURCE_REFUND, HTTP_METHOD_POST, params)\n end",
"def refund(tid, refund)\n begin\n #creating url\n... | [
"0.7295757",
"0.7225523",
"0.7116441",
"0.6873209",
"0.68390113",
"0.6829843",
"0.67884046",
"0.6662127",
"0.6617225",
"0.65900296",
"0.65900296",
"0.6586639",
"0.6488102",
"0.6475745",
"0.647151",
"0.6380831",
"0.63688767",
"0.6341368",
"0.6339589",
"0.6324677",
"0.62923676"... | 0.6010256 | 38 |
Returns the header for the CSV file | def csv_header
[
'project key',
'key',
'summary',
'description',
'issue type',
'epic name'
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header\n @header ||= csv_rows.first\n end",
"def header\n @header ||= csv_rows.first\n end",
"def csv_header\n #empty by default\n []\n end",
"def csv_header\n #empty by default\n []\n end",
"def header\n @header ||= Header.new(\n column_definitions: config.column_... | [
"0.8550899",
"0.8550899",
"0.8286035",
"0.8286035",
"0.8039965",
"0.8013137",
"0.79709464",
"0.77668417",
"0.75171155",
"0.7373305",
"0.7360171",
"0.7342591",
"0.73295504",
"0.71355146",
"0.7061549",
"0.7054507",
"0.70106417",
"0.69421965",
"0.69385445",
"0.69034547",
"0.6863... | 0.7490926 | 9 |
Returns the CSV row for an issue in the CSV file | def csv_row(issue)
[
issue[:project_key],
issue[:key],
issue[:summary],
issue[:description],
issue[:issue_type],
issue[:epic_name]
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_row(csv_file, row)\n csv_data = CSV.read(csv_file)\n path = File.dirname(csv_file)\n\n csv_data[row-1]\n end",
"def get_references(parent_path, ref_id)\n\n FasterCSV.foreach(\"#{parent_path}/TbReference.csv\", :headers => true, :quote_char => '\"', :col_sep =>',', :row_sep =>:auto) do |row... | [
"0.64575523",
"0.6431746",
"0.6404584",
"0.60564345",
"0.5989814",
"0.5952792",
"0.59451944",
"0.5897762",
"0.5894486",
"0.5894486",
"0.57950544",
"0.57800406",
"0.56092834",
"0.560417",
"0.55802375",
"0.55585873",
"0.55575347",
"0.55575347",
"0.5552832",
"0.55482084",
"0.553... | 0.7651677 | 0 |
user commands already in shoes (the first two with another name | def pencolor args
is_step
stroke args
@fg_color = args
update_pen_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def supercommand!() __supercommand__ end",
"def shell_commands(cmd, args); end",
"def command_name; end",
"def subcommands(cmd); end",
"def subcommands(... | [
"0.7223734",
"0.68425924",
"0.68425924",
"0.68425924",
"0.68425924",
"0.68425924",
"0.68425924",
"0.6716688",
"0.6701811",
"0.6691718",
"0.66838586",
"0.66838586",
"0.667745",
"0.66384643",
"0.66251916",
"0.6624854",
"0.6601323",
"0.65913224",
"0.6488239",
"0.6459648",
"0.643... | 0.0 | -1 |
UI commands: should not be used by the user | def step
@queue.enq nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def cmd; end",
"def command_builder; end",
"def buttons; end",
"def subcommand() __subcommand__ end",
"def set_commands; end",
"def supercommand!() __... | [
"0.7162078",
"0.7087989",
"0.7087989",
"0.7087989",
"0.7087989",
"0.7087989",
"0.7087989",
"0.6549416",
"0.65235764",
"0.6484748",
"0.64437145",
"0.63955265",
"0.6380436",
"0.63541424",
"0.63172686",
"0.63116574",
"0.63109994",
"0.62832326",
"0.62574655",
"0.62526053",
"0.625... | 0.0 | -1 |
false if drawing directly the final result | def drawing?
@speed.nil? and not @paused
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw? \n end",
"def draw_completed? ; false ; end",
"def draw?\n if not won?\n return full?\n else\n return false\n end\n end",
"def draw?\n !(won?) && (full?)\n end",
"def draw?\n \t@game_over == true and @winner == false\n end",
"def draw?\n if (!won?) && (ful... | [
"0.74648756",
"0.74433494",
"0.67741936",
"0.66024417",
"0.65608454",
"0.6551197",
"0.65409195",
"0.6535323",
"0.6521198",
"0.65166986",
"0.6514451",
"0.6514284",
"0.649242",
"0.6490606",
"0.6487838",
"0.64747125",
"0.6450456",
"0.6446933",
"0.6436702",
"0.643454",
"0.6427539... | 0.6215413 | 44 |
Pass the socket object and a boolean indicating whether the socket is netbios or cifs | def initialize(socket, direct = false, versions = [1, 2, 3], always_encrypt: true, backend: nil)
self.socket = socket
self.direct = direct
self.versions = versions
self.shares = {}
self.server_max_buffer_size = 1024 # 4356 (workstation) or 16644 (server) expected
if (self.versions == [1] && bac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def socket?() end",
"def can_connect_to_socket?\n UNIXSocket.open(sockfile)\n rescue Errno::ECONNREFUSED\n false\n end",
"def socket_type\n\t\t\t\taddress.socktype\n\t\t\tend",
"def type?\n raise NotImplementedError, \"Socket type is not supported.\"\n end",
"def new_socket sock... | [
"0.66787064",
"0.6183172",
"0.60919005",
"0.60678756",
"0.5803497",
"0.5723414",
"0.5721183",
"0.5699063",
"0.56918913",
"0.568832",
"0.56487954",
"0.56376916",
"0.5635691",
"0.5590539",
"0.55497533",
"0.5540209",
"0.5517383",
"0.55042714",
"0.5500542",
"0.54935783",
"0.54782... | 0.5109538 | 66 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.