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 |
|---|---|---|---|---|---|---|
Method for list out the all the notes for case notes | def list_case_notes
@case_notes = CaseNote.where(case_id: params[:case_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def note_contents\n self.notes.each.map{|note| note.content}\n end",
"def note_contents\n self.notes.collect {|note| note.content}\n end",
"def notes\n\t\tNote.find(:all)\n\tend",
"def note_contents\n self.notes.collect do |note|\n note.content\n end\n end",
"def no... | [
"0.7297034",
"0.71660197",
"0.71538126",
"0.7112249",
"0.7070293",
"0.7058061",
"0.7034232",
"0.7001771",
"0.7001771",
"0.7001771",
"0.7001771",
"0.6980274",
"0.6980274",
"0.69337416",
"0.6865313",
"0.68471557",
"0.68416774",
"0.68416774",
"0.68416774",
"0.67872614",
"0.67626... | 0.79543084 | 0 |
Method for Find the particular case media | def find_case_media
@case_medium = CaseMedium.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_search\n\t\tcase_media = media_list(params[:searchterm])\n\t\t# check condition for case media is present or not.\n\t\tif case_media.present?\n\t\t# response to the JSON\n\t render json: { success: true, response: case_media.map(&:attachment).as_json }\n\t else\n\t render :json=> { success: ... | [
"0.7360341",
"0.6932584",
"0.67803365",
"0.67701054",
"0.67200583",
"0.65478635",
"0.65267617",
"0.65119743",
"0.6502364",
"0.6484707",
"0.6460521",
"0.63637006",
"0.63349265",
"0.62077665",
"0.6202807",
"0.6198848",
"0.61987346",
"0.61666876",
"0.6072424",
"0.6044142",
"0.60... | 0.76384044 | 0 |
Method for finding the all the case media for that particular case | def case_media_list
@case_media_attachments = @surgery_case.case_media.case_media_attachments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_case_media\n\t\t@case_medium = CaseMedium.find(params[:id])\n\tend",
"def media_search\n\t\tcase_media = media_list(params[:searchterm])\n\t\t# check condition for case media is present or not.\n\t\tif case_media.present?\n\t\t# response to the JSON\n\t render json: { success: true, response: case_... | [
"0.7559914",
"0.72688437",
"0.6615814",
"0.6565244",
"0.63985515",
"0.638573",
"0.62243885",
"0.6161579",
"0.6108393",
"0.6103565",
"0.6099376",
"0.6053506",
"0.6052446",
"0.6050184",
"0.60271835",
"0.6024836",
"0.6024341",
"0.6020826",
"0.60201037",
"0.5983203",
"0.5973687",... | 0.74531686 | 1 |
Method for list out the activities of the cases | def case_activity_list
@case_activitites = @surgery_case.case_activities
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case_list\n\t\t# listing the all the schedule cases with surgeon with ascending schedule date\n\t\t@cases = current_user.cases.order_by(:schedule_date=> :asc)\n\tend",
"def case_list\n\t\t# listing the all the schedule cases with surgeon with ascending schedule date\n\t\t@cases = current_user.cases.order_by(... | [
"0.6842716",
"0.6834979",
"0.6696051",
"0.6620781",
"0.65736127",
"0.65436924",
"0.6458165",
"0.6354061",
"0.630225",
"0.6291519",
"0.62710524",
"0.62576675",
"0.62532556",
"0.6201654",
"0.61710817",
"0.6141442",
"0.6113605",
"0.6110375",
"0.6105924",
"0.60990906",
"0.6089716... | 0.7894488 | 0 |
count no of tag for the media attachment | def count_tags
# checking the setting media tags is there or not
if current_user.setting
# count the media tag count id more than 0
if current_user.setting.media_tag_limit.to_i > 0
# count limit for that media attachment tag
@tag_count = current_user.setting.media_tag_limit.to_i
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_media\n general_data['nb_media']\n end",
"def media_attachment_count\n self.case_media_attachments.try(:count) <= 10\n end",
"def media_object_count\n @media_object_count ||= MediaObject.where(\"collection_ssim\" => name).count\n end",
"def tag_count\n tags.count\n end",
"... | [
"0.7732785",
"0.7369935",
"0.73229295",
"0.721687",
"0.71189094",
"0.69857293",
"0.6907034",
"0.6907034",
"0.6904453",
"0.6812205",
"0.6706704",
"0.6654535",
"0.6638329",
"0.66369194",
"0.66369194",
"0.66369194",
"0.66139185",
"0.6612019",
"0.6612019",
"0.6612019",
"0.6607894... | 0.8122417 | 0 |
TODO: test ineligible as well! | def eligible_by_checklist(release, bugs)
bugs.select do |b|
BugEligibility::CheckList.new(b, :release => release).pass_all?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def spec; end",
"def spec; end",
"def refutal()\n end",
"def weber; end",
"def isolated; end",
... | [
"0.77697027",
"0.6726519",
"0.6726519",
"0.6726519",
"0.6726519",
"0.66322166",
"0.64105713",
"0.62791216",
"0.62791216",
"0.62069243",
"0.62069243",
"0.61588",
"0.6153226",
"0.61435795",
"0.61435795",
"0.61223006",
"0.6083059",
"0.6083059",
"0.6081181",
"0.60809165",
"0.6036... | 0.0 | -1 |
GET /bars GET /bars.json | def index
@bars = Bar.all
@favorites = Favorite.all
unless user_signed_in? && current_user.admin?
flash[:notice] = "You don't have access to that page!"
redirect_to root_path
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user=current_user\n\t @bars = @user.bars\n\t bar_num = @user.bars.count\n\t logger.error \"Bar Num: #{bar_num}\"\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bars }\n\tend\n end",
"def show\n @bar = Bar.find(params[:id])\n\n resp... | [
"0.72386795",
"0.72198296",
"0.69175935",
"0.6853423",
"0.65902436",
"0.65740573",
"0.6515762",
"0.64918244",
"0.6453165",
"0.6426327",
"0.63420844",
"0.6336634",
"0.6336061",
"0.6326319",
"0.632369",
"0.63163364",
"0.6291883",
"0.62902635",
"0.6285665",
"0.6281162",
"0.62771... | 0.0 | -1 |
GET /bars/1 GET /bars/1.json | def show
@favorites = Favorite.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bar = Bar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bar }\n end\n end",
"def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render j... | [
"0.73013246",
"0.68385154",
"0.6795547",
"0.6666016",
"0.6608877",
"0.6584146",
"0.64391696",
"0.6393229",
"0.632269",
"0.6288084",
"0.6261231",
"0.61696637",
"0.61665386",
"0.6163381",
"0.614605",
"0.6109641",
"0.61066586",
"0.6087813",
"0.60857683",
"0.6036076",
"0.6034608"... | 0.0 | -1 |
POST /bars POST /bars.json | def create
unless user_signed_in? && current_user.admin?
flash[:notice] = "You don't have access to that page!"
redirect_to root_path
return
end
@bar = Bar.new(bar_params)
respond_to do |format|
if @bar.save
format.html { redirect_to @bar, notice: 'Bar was successfully created.' }
format.json { render :show, status: :created, location: @bar }
else
format.html { render :new }
format.json { render json: @bar.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bar = Bar.new(bar_params)\n\n respond_to do |format|\n if @bar.save\n format.html { redirect_to @bar, notice: 'Bar was successfully created.' }\n format.json { render :show, status: :created, location: @bar }\n else\n format.html { render :new }\n format.js... | [
"0.7014968",
"0.662295",
"0.66227573",
"0.64753866",
"0.6449411",
"0.6428121",
"0.6404496",
"0.6383054",
"0.6378862",
"0.6372109",
"0.63687557",
"0.63581836",
"0.6346759",
"0.6343093",
"0.6333858",
"0.6322754",
"0.6311558",
"0.62852985",
"0.6242323",
"0.6223681",
"0.6214065",... | 0.6185649 | 22 |
PATCH/PUT /bars/1 PATCH/PUT /bars/1.json | def update
unless user_signed_in? && current_user.admin?
flash[:notice] = "You don't have access to that page!"
redirect_to root_path
return
end
respond_to do |format|
if @bar.update(bar_params)
format.html { redirect_to @bar, notice: 'Bar was successfully updated.' }
format.json { render :show, status: :ok, location: @bar }
else
format.html { render :edit }
format.json { render json: @bar.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @bar.update(bar_params)\n format.html { redirect_to @bar, notice: 'Bar was successfully updated.' }\n format.json { render :show, status: :ok, location: @bar }\n else\n format.html { render :edit }\n format.json { render json: @bar.e... | [
"0.6684075",
"0.6506067",
"0.6500639",
"0.644502",
"0.63817614",
"0.6375095",
"0.63317263",
"0.6303229",
"0.62914604",
"0.62514454",
"0.62503135",
"0.6224283",
"0.6213656",
"0.62049496",
"0.61949426",
"0.61458516",
"0.6143883",
"0.6139413",
"0.61351144",
"0.61321795",
"0.6130... | 0.5913475 | 48 |
DELETE /bars/1 DELETE /bars/1.json | def destroy
unless user_signed_in? && current_user.admin?
flash[:notice] = "You don't have access to that page!"
redirect_to root_path
return
end
@bar.destroy
respond_to do |format|
format.html { redirect_to bars_url, notice: 'Bar was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # Make sure the request came from an admin\n unless session[:admin_id]\n redirect_to_home\n return\n end\n \n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :no_content }\n en... | [
"0.7242323",
"0.7178483",
"0.71769834",
"0.7164393",
"0.7164393",
"0.69899887",
"0.69877005",
"0.69764864",
"0.6967902",
"0.69498545",
"0.6949073",
"0.6912775",
"0.68906313",
"0.686742",
"0.68590975",
"0.68573594",
"0.684549",
"0.68403226",
"0.6836004",
"0.6823984",
"0.681419... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_bar
unless user_signed_in? && current_user.admin?
flash[:notice] = "You don't have access to that page!"
redirect_to root_path
return
end
@bar = Bar.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 bar_params
unless user_signed_in? && current_user.admin?
flash[:notice] = "You don't have access to that page!"
redirect_to root_path
return
end
params.require(:bar).permit(:name, :address, :phone_number, :avg_rating, :rating_id, :music, :sports, :dancing, :beer, :cocktails, :wine, :rooftop, :cheap_food, :food, :dress_code, :line, :popular_nights, :karaoke)
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.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
Return silo that this class's values will be stored in. | def lookup_silo_name
return "#{self.name.gsub('::', '__')}_dict"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values\n self\n end",
"def values\n @@values\n end",
"def value\n self\n end",
"def instance\n local.value\n end",
"def values\n self[:values]\n end",
"def values\n\n self.to_h.values\n end",
"def values\n end",
"def value... | [
"0.63798004",
"0.6335689",
"0.63341933",
"0.61863565",
"0.61419654",
"0.6138445",
"0.610632",
"0.6077791",
"0.60154635",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"0.60146475",
"... | 0.0 | -1 |
Return instance from cache matching +key+. If +key+ is undefined, returns array of all instances. | def lookup(key=nil)
silo = self.lookup_silo_name
dict = nil
ActiveRecord::Base.benchmark("Lookup: #{silo}#{key.ergo{'#'+to_s}}") do
dict = self.fetch_object(silo){
# FIXME Exceptions within this block are silently swallowed by something. This is bad.
self.find(:all, self.lookup_opts).inject(Dictionary.new){|s,v| s[v.send(self.lookup_key)] = v; s}
}
end
return key ? dict[key.with{kind_of?(Symbol) ? to_s : self}] : (dict.values || [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n @cache[key]\n end",
"def get(key)\n @cache[key]\n end",
"def get_cached_addresses(key)\n Rails.logger.debug \"PlaceSearchingController CACHE get for key #{get_cache_key(@traveler, key)}\"\n ret = Rails.cache.read(get_cache_key(@traveler, key))\n return ret.nil? ? [] ... | [
"0.6877802",
"0.6860248",
"0.6765141",
"0.6604616",
"0.64875466",
"0.6439303",
"0.6400897",
"0.63974994",
"0.63841707",
"0.6366213",
"0.63029087",
"0.6243919",
"0.61995924",
"0.61857265",
"0.6172512",
"0.6152545",
"0.6151372",
"0.6151372",
"0.61380994",
"0.6109676",
"0.610384... | 0.63067913 | 10 |
Message can have these keys: source full path to the source image file (master TIFF) to be processed format "jpeg" or "tiff" (only applies when mode is "patron" or "both"; defaults to "jpeg") unit_id (only applies when mode is "patron" or "both") actual_resolution resolution of master file (only applies when mode is "patron" or "both") desired_resolution resolution requested by customer for deliverables (only applies when mode is "patron" or "both"; defaults to highest possible) remove_watermark This option, set at the unit level, allows staff to to disable the inclusion of a watermark for the entire unit if the deliverable format is JPEG. Watermark Additions The following are n required and will only be used if format == 'jpeg'. call_number If the item gets a watermark, this value will be added to the notice title If the item gets a watermark, this value will be added to the notice. location If the item gets a watermark, this value will be added to the notice. personal_item If this is true, the watermark doesn't get written at all Most of these keys are optional, because there are reasonable defaults, but "source" is always required; "pid" is required if mode is "dl", "dlarchive" or "both"; order and unit numbers are required if mode is "patron" or "both". | def do_workflow(message)
raise "Parameter 'source' is required" if message[:source].blank?
raise "Parameter 'unit_id' is required" if message[:unit_id].blank?
raise "Parameter 'master_file_id' is required" if message[:master_file_id].blank?
source = message[:source]
master_file_id = message[:master_file_id]
# In order to construct the directory for deliverables, this processor must know the order_id
order_id = Unit.find(message[:unit_id]).order.id
if source.match(/\.tiff?$/) and File.file?(source)
format = message[:format].to_s.strip
if format.blank? or format =~ /^jpe?g$/i
suffix = '.jpg'
add_legal_notice = true
if message[:personal_item] || message[:remove_watermark]
add_legal_notice = false
end
elsif format =~ /^tiff?$/i
suffix = '.tif'
add_legal_notice = false
else
raise "Unexpected format value '#{message[:format]}'"
end
# format output path so it includes order number and unit number, like so: .../order123/54321/...
dest_dir = File.join(ASSEMBLE_DELIVERY_DIR, 'order_' + order_id.to_i.to_s, message[:unit_id].to_i.to_s)
FileUtils.mkdir_p(dest_dir)
dest_path = File.join(dest_dir, File.basename(source, '.*') + suffix)
# Simple case; just a copy of tif at full resolution. No imagemagick needed
if suffix == '.tif' && (desired_res.blank? or desired_res.to_s =~ /highest/i)
FileUtils.cp(source, dest_path)
on_success "Deliverable image for MasterFile #{master_file_id}."
return
end
tiff = Magick::Image.read(source).first
# Directly invoke Ruby's garbage collection to clear memory
GC.start
# make changes to original image, if applicable
new_tiff = nil
desired_res = message[:desired_resolution]
if desired_res.blank? or desired_res.to_s =~ /highest/i
# keep original resolution
logger.info("Keeping original resolution")
elsif desired_res.to_i > 0
if message[:actual_resolution].blank?
raise "actual_resolution is required when desired_resolution is specified"
end
# only downsize
if message[:actual_resolution].to_i > desired_res.to_i
logger().debug("Resampling image...")
new_tiff = tiff.resample(desired_res.to_i)
end
else
raise "Unexpected desired_resolution value '#{desired_res}'"
end
if add_legal_notice
logger().debug "Add legal notice"
notice = String.new
if message[:title].length < 145
notice << "Title: #{message[:title]}\n"
else
notice << "Title: #{message[:title][0,145]}... \n"
end
if message[:call_number]
notice << "Call Number: #{message[:call_number]}\n"
end
if message[:location]
notice << "Location: #{message[:location]}\n\n"
end
notice << "Under 17USC, Section 107, this single copy was produced for the purposes of private study, scholarship, or research.\nNo further copies should be made. Copyright and other legal restrictions may apply. Special Collections, University of Virginia Library."
# determine point size to use, relative to image width in pixels
point_size = (tiff.columns * 0.014).to_i # arrived at this by trial and error; not sure why it works, but it works
# determine height of bottom border (to contain six lines of text at that point size)
bottom_border_height = (point_size * 6).to_i # again, arrived at this by trial and error
# add border (20 pixels left and right, bottom_border_height pixels top and bottom)
bordered = tiff.border(20, bottom_border_height, 'lightgray')
# add text within bottom border
draw = Magick::Draw.new
draw.font_family = 'times'
draw.pointsize = point_size
draw.gravity = Magick::SouthGravity
draw.annotate(bordered,0,0,5,5,notice)
if bottom_border_height < 100
# Skip the writing of a watermarked new_tif because the watermark would be too small to read
else
# crop to reduce top border to 20 pixels
new_tiff = bordered.crop(Magick::SouthGravity, bordered.columns, bordered.rows - (bottom_border_height - 20))
end
end
new_tiff = tiff if new_tiff.nil?
# write output file
new_tiff.write(dest_path)
# Invoke Rmagick destroy! method to clear memory of legacy image information
new_tiff.destroy!
tiff.destroy!
on_success "Deliverable image for MasterFile #{master_file_id}."
else
raise "Source is not a .tif file: #{source}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata\n msg['metadata']||{}\n end",
"def extract_message(item)\n # message = item[\"message\"]\n # timestamp = DateTime.parse(item[\"@timestamp\"]).strftime(\"%Y-%m-%d %H:%M:%S\") rescue nil\n # from = REGEX_EMAIL.match(REGEX_FROM_EMAIL.match(message)[0])[0] rescue nil\n # to = RE... | [
"0.5867478",
"0.5701403",
"0.55726945",
"0.54672563",
"0.5460477",
"0.5373423",
"0.53716385",
"0.53550714",
"0.5323899",
"0.53073573",
"0.52865976",
"0.52428985",
"0.52315605",
"0.5222161",
"0.52190626",
"0.5218027",
"0.5144017",
"0.5140871",
"0.5133467",
"0.5121587",
"0.5117... | 0.5791893 | 1 |
runs reactor and starts amqp broker for receveing messages | def run
@output.print "Run, Forest, run!"
EM.synchrony do
print "Mapper has been started #{Time.now}"
AMQP.start do |connection|
print "AMQP started #{Time.now}"
channel = AMQP::Channel.new connection
queue = channel.queue(@config["broker"]["queue-name"], :auto_delete => true)
queue.subscribe do |payload|
print "Received message #{payload}"
connection.close {EM.stop} if payload == "stop"
Fiber.new{start}.resume if payload == "start"
Fiber.new {match}.resume if payload == 'match'
EM.defer {start_webserver} if payload == 'start_webserver'
EM.defer {start_search_server} if payload == 'start_solr'
EM.defer {stop_search_server} if payload == 'stop_solr'
EM.defer {add_db_to_search_index} if payload == 'index'
EM.defer {setup_storage} if payload == 'setup_storage'
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n unless EM.reactor_running?\n raise Cartan::Exception::ReactorNotRunning,\n \"The EventMachine reactor is not running!\"\n end\n\n @amqp = AMQP.connect(@config)\n @channel = AMQP::Channel.new(@amqp)\n @exchange = @channel.direct(@namespace, :auto_delete => true)\... | [
"0.74972266",
"0.70661634",
"0.6868892",
"0.6733044",
"0.66490424",
"0.6541127",
"0.64739895",
"0.64586467",
"0.64062876",
"0.6380385",
"0.6372795",
"0.6360872",
"0.63605356",
"0.6354811",
"0.628347",
"0.62771755",
"0.6241095",
"0.62055695",
"0.6204059",
"0.6200487",
"0.61836... | 0.6489386 | 6 |
webinterface for price managment on localhost:4567 | def start_webserver
stop_webserver
Webserver.run!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def index\n @init_url ... | [
"0.6306704",
"0.6306704",
"0.6228883",
"0.6212884",
"0.60383034",
"0.60313326",
"0.59212905",
"0.5904329",
"0.5827826",
"0.5827826",
"0.5799088",
"0.579591",
"0.572287",
"0.5711071",
"0.5681505",
"0.56715065",
"0.5667109",
"0.5661173",
"0.5658812",
"0.56476027",
"0.56358886",... | 0.0 | -1 |
match products from parsed pricelists and products from online shop | def match
EM::Synchrony::FiberIterator.new(@storage_item.all, @config["concurrency"]["iterator-size"].to_i).each do |product, iter|
link(product)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shopping_list(product, url)\n\t\tinit(url)\n\t\t@product = product\n\t\tshopping_list = Hash.new # initialize hash for merge\n\t\t# Loop to parse data on all pages\n\t\twhile !@parsed_temp[\"products\"].empty?\n\t\t\t# gets all variants of a product and puts in a list of hashes with unique id as key and price ... | [
"0.6906892",
"0.67261344",
"0.65332466",
"0.6497195",
"0.64971036",
"0.6396739",
"0.6390086",
"0.635667",
"0.6304536",
"0.62933886",
"0.6283774",
"0.62776893",
"0.626856",
"0.6257772",
"0.6231506",
"0.61849314",
"0.61810756",
"0.6178911",
"0.61756444",
"0.61716795",
"0.612976... | 0.0 | -1 |
compare two models from storage and shop databases | def check_models(shop_item_model, storage_item_model)
return false if (shop_item_model.nil? || shop_item_model.empty? || shop_item_model == "NULL") || (storage_item_model.empty? || storage_item_model.nil? || storage_item_model == "NULL")
p "#{shop_item_model} - #{storage_item_model}"
begin
shop_item_model["-"] = "" if shop_item_model.index "-"
storage_item_model["-"] = "" if storage_item_model.index "-"
rescue => e
p e
end
shop_item_model.downcase == storage_item_model.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(x,y)\n a = CachedProduct.find_by_product_id(x['product_id'].to_s)\n b = CachedProduct.find_by_product_id(y['product_id'].to_s)\n return a.max_small <=> b.max_small\n end",
"def stores? other\n (entity(false) == other) ||\n (id==other.id && klass==other.class)\n... | [
"0.60428125",
"0.59824646",
"0.5751945",
"0.57145846",
"0.5559768",
"0.5548764",
"0.5492296",
"0.54770094",
"0.5456029",
"0.5415115",
"0.5377973",
"0.53633505",
"0.5357198",
"0.5326675",
"0.5317017",
"0.5316434",
"0.52992284",
"0.52894413",
"0.5280469",
"0.52775604",
"0.52581... | 0.56838185 | 4 |
GET /assignments GET /assignments.json | def index
@assignments = Assignment.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @assignments }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t@assignments = Assignment.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @assignments }\n\t\tend\n\tend",
"def index\n render json: { assignments: [ @assignment.as_json ] }\n end",
"def index\n @assignments = Assignment.all\n e... | [
"0.7422523",
"0.74024993",
"0.7263",
"0.7263",
"0.7263",
"0.7263",
"0.72334564",
"0.71612847",
"0.7135233",
"0.709627",
"0.7018682",
"0.701819",
"0.6911628",
"0.68465835",
"0.6797737",
"0.6786622",
"0.6736829",
"0.6734642",
"0.6719681",
"0.6695457",
"0.6619329",
"0.6603378"... | 0.7212766 | 7 |
GET /assignments/1 GET /assignments/1.json | def show
@assignment = Assignment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @assignment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: { assignments: [ @assignment.as_json ] }\n end",
"def index\n @assignments = Assignment.all\n end",
"def index\n @assignments = Assignment.all\n end",
"def index\n @assignments = Assignment.all\n end",
"def index\n @assignments = Assignment.all\n end",
"de... | [
"0.7125503",
"0.7046229",
"0.7046229",
"0.7046229",
"0.7046229",
"0.7025589",
"0.7021485",
"0.6975889",
"0.69750583",
"0.69286937",
"0.68052363",
"0.67804945",
"0.67677546",
"0.675152",
"0.67488444",
"0.6739334",
"0.6728843",
"0.672769",
"0.67209077",
"0.66375554",
"0.6608673... | 0.6959988 | 11 |
GET /assignments/new GET /assignments/new.json | def new
@assignment = Assignment.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @assignment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @assignment = @user.assignments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assignment }\n end\n end",
"def new\n @assignment = @course.assignments.build\n \n respond_to do |format|\n format.html # new.html.erb\n for... | [
"0.78343546",
"0.777558",
"0.77698165",
"0.7766929",
"0.7704692",
"0.76783854",
"0.76528585",
"0.74774396",
"0.7416385",
"0.73649156",
"0.7342658",
"0.72392714",
"0.72361434",
"0.7226388",
"0.7187729",
"0.7156098",
"0.70555454",
"0.7038076",
"0.701987",
"0.7014235",
"0.699929... | 0.7756978 | 5 |
POST /assignments POST /assignments.json | def create
# transform dates from string to DateTime
params[:assignment].strptime_params! ['due', 'late']
files = params[:assignment][:files]
# remove extra params
params[:assignment].select!{ |key, val| not ['files'].include? key }
# save any added files
@assignment = Assignment.new(params[:assignment])
respond_to do |format|
if @assignment.save
# add assignment to related section
@section.assignments << @assignment
@section.save
format.html { redirect_to section_assignment_path(@section, @assignment), notice: 'Assignment was successfully created.' }
format.json { render json: @assignment, status: :created, location: @assignment }
else
format.html { render action: "new" }
format.json { render json: @assignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to this, edit should be used and user_assignment_controller for it\n respond_to do |format|\... | [
"0.69719887",
"0.6878845",
"0.68722147",
"0.6866222",
"0.68636656",
"0.68479973",
"0.68240887",
"0.6803592",
"0.6741433",
"0.6729679",
"0.6649603",
"0.6641474",
"0.660345",
"0.6590609",
"0.6520075",
"0.648458",
"0.6479206",
"0.64735156",
"0.6472296",
"0.6467634",
"0.64431983"... | 0.5907564 | 93 |
PUT /assignments/1 PUT /assignments/1.json | def update
# transform dates from string to DateTime
params[:assignment].strptime_params! ['due', 'late']
files = params[:assignment][:files]
# remove extra params
params[:assignment].select!{ |key, val| not ['files'].include? key }
@assignment = Assignment.find(params[:id])
respond_to do |format|
if @assignment.update_attributes(params[:assignment])
format.html { redirect_to section_assignment_path(@section, @assignment), notice: 'Assignment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @assignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @assignment.update(assignment_params)\n render json: @assignment, status: :ok\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def update\n @assignment = Assignment.find(params[:id])\n\n respond_to do |format|\n if @assignment.u... | [
"0.68878037",
"0.68042326",
"0.6744486",
"0.6728226",
"0.6728226",
"0.6656346",
"0.6569582",
"0.6556573",
"0.6550412",
"0.64858025",
"0.6474709",
"0.6453574",
"0.6453574",
"0.6453574",
"0.6453574",
"0.6453574",
"0.6405525",
"0.63590574",
"0.6327177",
"0.6314896",
"0.63118964"... | 0.0 | -1 |
DELETE /assignments/1 DELETE /assignments/1.json | def destroy
@assignment = Assignment.find(params[:id])
@section = @assignment.section
@assignment.destroy
respond_to do |format|
format.html { redirect_to section_path(@section) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @assignment = Assignment.find(params[:id])\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to assignments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @assignment = Assignment.find(params[:id])\n @assignment.destroy\n\n resp... | [
"0.7464364",
"0.7460015",
"0.7460015",
"0.7449983",
"0.73840106",
"0.7382044",
"0.73665506",
"0.73665506",
"0.7360332",
"0.7229486",
"0.7200699",
"0.71437484",
"0.71125346",
"0.7104871",
"0.71018755",
"0.7090273",
"0.70651245",
"0.70496243",
"0.70496243",
"0.70496243",
"0.704... | 0.68237585 | 40 |
+actor_classes+: a single class or array of classes that can be instantiated with no args and have a `perform` method. If an array is passed, the array size must batch the actor_args_array size. Return results array with element from each actor in the order of the actor_args_array rubocop:disable Metrics/ParameterLists | def initialize(actor_classes:, actor_args_array:,
serial_execution_indexes: nil, execute_serially: nil, job_class: nil, execution_block: nil)
@actor_classes = normalize_actor_classes!(actor_classes, actor_args_array)
@actor_args_array = actor_args_array
@serial_execution_indexes = serial_execution_indexes
@execute_serially = execute_serially.nil? ? calculate_execute_serially : execute_serially
@job_class = job_class || configuration.job_class
@execution_block = execution_block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_actor_results(result_key, actor_classes, actor_args_array)\n return [] if (num_results = actor_classes.length) == 0\n\n result_values = Array.new(num_results)\n result_count = 0\n\n configuration.redis_connector.with do |redis|\n begin\n Timeout.timeout(configuratio... | [
"0.6009639",
"0.54902947",
"0.4970599",
"0.49541363",
"0.4923198",
"0.48277026",
"0.46923342",
"0.46476433",
"0.46370235",
"0.46187255",
"0.46182433",
"0.45958096",
"0.4576046",
"0.45646876",
"0.45639366",
"0.45481727",
"0.45043418",
"0.45010298",
"0.44912204",
"0.44884562",
... | 0.56024516 | 1 |
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize | def wait_for_actor_results(result_key, actor_classes, actor_args_array)
return [] if (num_results = actor_classes.length) == 0
result_values = Array.new(num_results)
result_count = 0
configuration.redis_connector.with do |redis|
begin
Timeout.timeout(configuration.job_timeout) do
until result_count == num_results
_key, response = redis.blpop(result_key, configuration.job_timeout)
raise ParallelWorkforce::TimeoutError.new("Timeout waiting for Redis#blpop", result_values) if response.nil?
result_count += 1
index, value = parse_response!(response, actor_classes, actor_args_array)
result_values[index] = value
end
end
rescue Timeout::Error
raise ParallelWorkforce::TimeoutError.new("Timeout from ParallelWorkforce job", result_values)
end
end
result_values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def offences_by; end",
"def strategy; end",
"def used?; end",
"def custo... | [
"0.76554435",
"0.6289417",
"0.62294596",
"0.62294596",
"0.6180949",
"0.61590785",
"0.61590785",
"0.61590785",
"0.61590785",
"0.6128046",
"0.59565073",
"0.5945127",
"0.5893976",
"0.58213013",
"0.58213013",
"0.5809406",
"0.5809406",
"0.58067256",
"0.5794903",
"0.5734297",
"0.56... | 0.0 | -1 |
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength | def parse_response!(response, actor_classes, actor_args_array)
# NOTE: Always stored in Redis with Ruby marshaling, not serializer
message = Marshal.load(response)
if (error = message[:error])
raise ParallelWorkforce::ActorPerformError.new("Error received from parallel actor: #{error}")
elsif message[:error_revision]
# recoverable error
index = message[:index]
[index, execute_actor_serially(actor_classes[index], actor_args_array[index])]
else
begin
[message[:index], deserialize(message[:serialized_value])]
rescue ParallelWorkforce::SerializerError => e
ParallelWorkforce.log(:warn, "Cannot deserialize serialized_value: #{e}")
index = message[:index]
[index, execute_actor_serially(actor_classes[index], actor_args_array[index])]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def used?; end",
"def strategy; end",
"def suivre; end",
"def custom; en... | [
"0.7740887",
"0.6477707",
"0.6352394",
"0.6352394",
"0.6293078",
"0.62806356",
"0.62806356",
"0.62806356",
"0.62806356",
"0.627661",
"0.6029364",
"0.59916216",
"0.5971285",
"0.59688616",
"0.59688616",
"0.5940849",
"0.5893177",
"0.5893177",
"0.58764076",
"0.58398044",
"0.58355... | 0.0 | -1 |
GET /user/members GET /user/members.json | def index
@members = User::Member.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n ... | [
"0.8614721",
"0.8393227",
"0.81065446",
"0.7920573",
"0.76873523",
"0.75576985",
"0.7534073",
"0.7390538",
"0.73669934",
"0.73669934",
"0.722905",
"0.722905",
"0.722905",
"0.7214334",
"0.7152352",
"0.7145356",
"0.71320444",
"0.71245635",
"0.7068957",
"0.7010089",
"0.70081097"... | 0.70807016 | 18 |
GET /user/members/1 GET /user/members/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n ... | [
"0.8266098",
"0.75626457",
"0.74496967",
"0.7293915",
"0.7231291",
"0.7173324",
"0.7165235",
"0.7115483",
"0.7115483",
"0.7115483",
"0.7005046",
"0.70021695",
"0.69725466",
"0.6966581",
"0.6941324",
"0.6926466",
"0.69093883",
"0.69093883",
"0.6863803",
"0.68474627",
"0.684746... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user_member
@user_member = User::Member.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 |
After this test we're in capability mode and cannot escape. | def test_2_capsicum
refute Capsicum.sandboxed?
assert Capsicum.enter!
assert Capsicum.enter!
assert Capsicum.sandboxed?
assert_raises(Errno::ECAPMODE) do
File.new("/dev/null")
end
assert_raises(Errno::ECAPMODE) do
puts `ls`
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phase2_command_disabled?\r\n # If Escape Selected\r\n if @party_command_window.command == \r\n SDK::Scene_Commands::Scene_Battle::Escape\r\n # If it's not possible to escape\r\n return true unless $game_temp.battle_can_escape\r\n end\r\n return false\r\n end",
"def allow_in_post_... | [
"0.5892198",
"0.58254254",
"0.5786279",
"0.5594286",
"0.5594286",
"0.55467963",
"0.5541995",
"0.54887396",
"0.54887396",
"0.54887396",
"0.54768974",
"0.54526436",
"0.54380846",
"0.541122",
"0.54062235",
"0.5391542",
"0.5358127",
"0.53100586",
"0.52886975",
"0.5276932",
"0.527... | 0.5828329 | 1 |
GET /territories GET /territories.xml | def index
@territories = Territory.all
# default pagination is 30 items, so this pretty much never will be used
@news = New.paginate :page => (params[:page] || 1), :order => 'created_at DESC'
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @territories }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @territory = current_company.territories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territory }\n end\n end",
"def index\n @lotteries = Lottery.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.6450037",
"0.6367957",
"0.63650215",
"0.6217321",
"0.6193804",
"0.616103",
"0.6122318",
"0.6045588",
"0.60403895",
"0.6012637",
"0.60016507",
"0.5995385",
"0.5993023",
"0.59805703",
"0.5971578",
"0.5970448",
"0.5965401",
"0.5965363",
"0.5959322",
"0.5957393",
"0.59423286",... | 0.6806867 | 0 |
GET /territories/1 GET /territories/1.xml | def show
@territory = Territory.find params[:id]
respond_to do |format|
format.png do
# not used anymore
render :status => 501
end
format.html # show.html.erb
format.xml { render :xml => @territory }
format.js { render :partial => "territories/info" }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @territories = Territory.all\n # default pagination is 30 items, so this pretty much never will be used\n @news = New.paginate :page => (params[:page] || 1), :order => 'created_at DESC'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @territo... | [
"0.65554684",
"0.63803226",
"0.6130468",
"0.6121508",
"0.610951",
"0.6022604",
"0.60195076",
"0.600025",
"0.59631526",
"0.5961893",
"0.59245765",
"0.5922876",
"0.5921533",
"0.59053296",
"0.5890709",
"0.58689106",
"0.5860515",
"0.58601016",
"0.5847987",
"0.58452594",
"0.584213... | 0.0 | -1 |
GET /territories/new GET /territories/new.xml | def new
@territory = Territory.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @territory }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n r... | [
"0.69333524",
"0.6765123",
"0.67592686",
"0.67487586",
"0.6747105",
"0.67449576",
"0.6731737",
"0.6718501",
"0.6718456",
"0.66881466",
"0.6664194",
"0.6639346",
"0.66273093",
"0.66247135",
"0.6618222",
"0.6605666",
"0.6602351",
"0.658839",
"0.6579201",
"0.6571593",
"0.6560862... | 0.7065491 | 0 |
POST /territories POST /territories.xml | def create
@territory = Territory.new(params[:territory])
respond_to do |format|
if @territory.save
format.html do
flash[:notice] = 'Territory was successfully created.'
redirect_to(@territory)
end
format.xml { render :xml => @territory, :status => :created, :location => @territory }
format.js do
@territories = Territory.find :all;
render :partial => 'list', :locals => {:territories => @territories}
end
else
format.html { render :action => "new" }
format.xml { render :xml => @territory.errors, :status => :unprocessable_entity }
format.js {}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @territory = current_company.territories.build(params[:territory])\n if @territory.save\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end",
"def index\n @territories = Territory.all\n # default pagination is 30 ite... | [
"0.62205017",
"0.5474134",
"0.5421683",
"0.54210824",
"0.5366445",
"0.5327731",
"0.5276681",
"0.52758825",
"0.5272414",
"0.5268653",
"0.52670604",
"0.5262958",
"0.5255655",
"0.52540237",
"0.52529037",
"0.5248597",
"0.52358145",
"0.52199024",
"0.520841",
"0.52076703",
"0.51977... | 0.5511703 | 1 |
PUT /territories/1 PUT /territories/1.xml | def update
@territory = Territory.find(params[:id])
@territories = Territory.all
success = true
shapes = params[:territory][:shape] # all the shapes are saved when a territory changes
params[:territory][:shape] = params[:territory][:shape][params[:id]] # the shape of the territory we're updating
success &&= @territory.update_attributes(params[:territory]) # update all attributes of the territory
@territories.each do |t|
success &&= t.update_attribute(:shape, shapes[t.id.to_s]) # and the shape of the others
end
respond_to do |format|
if success
format.html do
flash[:notice] = 'Territory was successfully updated.'
redirect_to(@territory)
end
format.xml { head :ok }
format.js do
render :update do |page|
page << notify_msg("The territory was updated!")
# refresh the territories list
page['territories-list'].replace_html render(:partial => 'list',
:locals => {:territories => Territory.find(:all)})
# re-enable the submit button and change it's title
page['territory_submit'].enable()
page['territory_submit'].value = 'Save'
end
end
else
format.html { render :action => "edit" }
format.xml { render :xml => @territory.errors, :status => :unprocessable_entity }
format.js do
render :update do |page|
page << notify_error("The territory could not be updated!");
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @territory = current_company.territories.find(params[:id])\n\n # hack to determine new and deleted regions\n adjust_region_ids\n adjust_zipcode_ids\n\n if @territory.update_attributes(params[:territory])\n respond_with(@territory)\n else\n respond_with(@territory, :status =... | [
"0.6154066",
"0.59122145",
"0.5724571",
"0.56898344",
"0.5612635",
"0.5528421",
"0.55265355",
"0.5515352",
"0.5504996",
"0.55039746",
"0.5485568",
"0.54419374",
"0.5429716",
"0.54276234",
"0.539907",
"0.5380169",
"0.5358363",
"0.53542244",
"0.53472495",
"0.53363353",
"0.53087... | 0.0 | -1 |
DELETE /territories/1 DELETE /territories/1.xml | def destroy
@territory = Territory.find(params[:id])
@territory.destroy
respond_to do |format|
format.html { redirect_to(territories_url) }
format.xml { head :ok }
format.js do
render :update do |page|
page << notify_msg("Territory deleted!")
# refresh the list
page['territories-list'].replace_html render(:partial => 'list',
:locals => {:territories => Territory.find(:all)})
# update the map
page << "delete territories[#{@territory.id}];renderTerritories( $('canvas'), territories );"
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shelf = Shel... | [
"0.6760175",
"0.6555942",
"0.64466447",
"0.64268965",
"0.6401659",
"0.63986415",
"0.6398281",
"0.63940126",
"0.63411385",
"0.6322946",
"0.63214135",
"0.6300401",
"0.6300401",
"0.6298046",
"0.62931895",
"0.6291153",
"0.62607485",
"0.6255063",
"0.6254995",
"0.6254995",
"0.62410... | 0.0 | -1 |
Regenerates all the images cached on /public/images/map Should be called after creating, updating or destroying territories. | def generate_images width=500, height=350
# Base image with all territories shaded
canvas = Magick::Image.new(width, height, Magick::TextureFill.new(@@map_bg))
canvas.format = 'jpg'
gc = Magick::Draw.new
Territory.all.each do |t|
gc.fill("transparent")
if t.clan
gc.fill("rgb(#{t.clan.color_rgb.join(',')})")
gc.fill_opacity(0.25)
end
gc.stroke('rgb(64, 0, 0)')
gc.stroke_width(1)
if t.shape # uses svg-like shapes
s = t.shape.split(',')
path = "M #{s[0]} #{s[1]} "
s[2..-1].each_slice(2) do |p|
path << "L #{p[0]} #{p[1]} "
end
path << "z"
gc.path(path)
end
if t.clan
# draw the small icon for the clan if it exists
if t.clan.image_filename 16
gc.composite(t.position_x - 8, t.position_y - 8, 16, 16,
Magick::Image.read("#{RAILS_ROOT}/public/images/#{t.clan.image_filename(16)}").first)
else # or draw a circle of their color
gc.fill("rgb(#{t.clan.color_rgb.join(',')})")
gc.fill_opacity(1);
gc.circle(t.position_x, t.position_y, t.position_x + 5, t.position_y)
end
else
gc.circle(t.position_x, t.position_y, t.position_x + 5, t.position_y)
end
end
gc.draw(canvas)
canvas.write("#{RAILS_ROOT}/public/images/map/base.jpg"){ self.quality = 95 } # TODO tweak the quality
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_cached_images\n UserAssetService.remove_assets_from_remote(\"branding_groups/#{self.id}\")\n end",
"def build_maps\n build_image_maps\n build_flavor_maps\n end",
"def rebuild\n [\"jpeg\", \"jpg\", \"png\", \"gif\"].each do |type|\n p = \"#{@root}#{@ds}**#{@ds}*.#{type}\"\n Di... | [
"0.6150662",
"0.5834284",
"0.58094203",
"0.57948124",
"0.57830256",
"0.57799476",
"0.57797563",
"0.5712411",
"0.5670173",
"0.5645499",
"0.56419194",
"0.56271565",
"0.55799145",
"0.55730456",
"0.5572892",
"0.55534464",
"0.55212975",
"0.5484169",
"0.54661024",
"0.5428579",
"0.5... | 0.6097503 | 1 |
Overrides default devise behaviour to redirect user to his profile. | def after_sign_in_path_for(resource)
case resource
when Account then account_profile_path
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to_profile_if_logged_in\n if current_user && !current_user.admin?\n redirect_to user_path(current_user) and return\n end\n end",
"def redirect_signed_in_user\n redirect_to user_home_path if user_signed_in?\n end",
"def auth_user\n redirect_to new_user_registration_url unless use... | [
"0.71774375",
"0.70730567",
"0.704924",
"0.7002335",
"0.6958514",
"0.69402665",
"0.6931685",
"0.6876335",
"0.68333125",
"0.6821372",
"0.6781337",
"0.674294",
"0.67148894",
"0.67087585",
"0.6682035",
"0.66787463",
"0.666346",
"0.66406953",
"0.66334647",
"0.66323274",
"0.662885... | 0.6672238 | 16 |
Overrides default devise behaviour to provide custom path after admin sign out. | def after_sign_out_path_for(resource)
if resource.to_sym == :admin
new_admin_session_path
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n admin_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tif resource_class == SuperAdmin\n \t\tsuper_admin_dashboard_path\n \telse\n \troot_path\n\tend\n end",
"def after_sign_out_path_for(resource)\n if resource == :admin\n home... | [
"0.79698855",
"0.77663916",
"0.7754794",
"0.7729312",
"0.7718448",
"0.7718448",
"0.7704434",
"0.76928604",
"0.7655007",
"0.7648407",
"0.7628443",
"0.7612928",
"0.7597571",
"0.7585741",
"0.7585741",
"0.75691974",
"0.75691974",
"0.75691974",
"0.75691974",
"0.75691974",
"0.75525... | 0.8243191 | 0 |
Gets currently logged in account or affiliate. | def current_user
User::TYPES.each do |mapping|
user = self.send("current_#{mapping.to_s.downcase}")
return user unless user.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_account\n @current_account ||= (login_from_session || :false)\n end",
"def current_account\n load_session\n @current_account\n end",
"def current_account\n Account.find(session[:account_id]) if session[:account_id]\n end",
"def current_account\n Account.f... | [
"0.75329566",
"0.752487",
"0.75210154",
"0.75210154",
"0.747007",
"0.7459422",
"0.7446979",
"0.7437645",
"0.74240214",
"0.738715",
"0.7335507",
"0.73256916",
"0.7319452",
"0.7308501",
"0.73052424",
"0.7304349",
"0.7267809",
"0.7216023",
"0.72091264",
"0.7157476",
"0.7151284",... | 0.6544654 | 57 |
Determines whether account or affiliate is logged in. | def user_signed_in?
!!current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in?\n current_account != :false && current_account.active?\n end",
"def logged_in?\n\t\t!current_account.nil?\n\tend",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def logged_in?\n !current_account.nil?\n end",
"def logged_in?\n !cur... | [
"0.81376743",
"0.79747254",
"0.7843145",
"0.78338987",
"0.78338987",
"0.78338987",
"0.782029",
"0.76719785",
"0.7602972",
"0.7568123",
"0.7553463",
"0.7549161",
"0.7520471",
"0.7506066",
"0.7502376",
"0.7493496",
"0.7493496",
"0.7483743",
"0.7482071",
"0.7481442",
"0.74743265... | 0.0 | -1 |
Gets currently logged in user type (account, affiliate, guest). | def current_user_type
User::TYPES.each do |mapping|
user = send("current_#{mapping.to_s.downcase}")
return mapping unless user.nil?
end
:guest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_type\n return session[:user_type] if session[:user_type]\n # return logged_user.class.name if logged_user\n end",
"def account_type\n User.account_type(current_user)\n end",
"def user_type\n\t\tif (current_user.type == 'Trainer')\n\t\t\ttrainer\n\t\telsif (current_user.type == 'Client')... | [
"0.8281822",
"0.7960712",
"0.7910883",
"0.7764094",
"0.7624324",
"0.761131",
"0.76104975",
"0.75819516",
"0.74102736",
"0.7353017",
"0.729159",
"0.7278844",
"0.72606117",
"0.71658516",
"0.7101557",
"0.7094694",
"0.69526696",
"0.6892836",
"0.6744607",
"0.67106533",
"0.670787",... | 0.83345324 | 0 |
I worked on this challenge [by myself]. Your Solution Below | def array_concat(array_1, array_2)
# Your code here
new_array = Array.new
array_1.each do |entry|
if array_1.empty? == false
new_array.push(entry)
end
end
array_2.each do |entry|
if array_2.empty? == false
new_array.push(entry)
end
end
new_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def challenge; end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx]... | [
"0.6520691",
"0.6285745",
"0.6123464",
"0.60504824",
"0.60342795",
"0.59959674",
"0.5994609",
"0.59877974",
"0.59091043",
"0.5905259",
"0.58979493",
"0.58966595",
"0.5896646",
"0.5882337",
"0.5874321",
"0.5864841",
"0.586381",
"0.5861769",
"0.58608496",
"0.5857345",
"0.585325... | 0.0 | -1 |
TODO : need to add workday check | def call
task = Cultivation::Task.includes(:batch, :issues).find(@task_id)
batch_tasks = Cultivation::QueryTasks.call(task.batch).result
task = batch_tasks.detect { |t| t.id == task.id }
parent = task.parent(batch_tasks)
if task.indelible? && !parent.indelible?
errors.add(:id, "Special task \"#{task.name}\" cannot be deleted.")
false
elsif task.children(batch_tasks).present?
errors.add(:id, 'Task with sub-tasks cannot be deleted.')
false
elsif task.dependents(batch_tasks).present?
errors.add(:id, 'There are other task are depends on this task.')
false
elsif task.issues.present?
errors.add(:id, 'Task with issues cannot be deleted.')
false
elsif task.user_ids.present?
errors.add(:id, 'Task with assigned resouces cannot be deleted.')
false
elsif task.material_use.present?
errors.add(:id, 'This with assigned materials cannot be deleted')
false
elsif task
task.delete
# Call update on parent task to cascade duration changes.
Cultivation::UpdateTask.call(@current_user, parent)
@task_id
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def w_day; end",
"def wday() end",
"def all_day ; true ; end",
"def day() end",
"def cwday\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def week; end",
"def yday() end",
"def set_day_if_discarded; end",
"def day; end",
"def get_work_days\n puts \"Getting work days...... | [
"0.72282237",
"0.71818393",
"0.68700904",
"0.6725815",
"0.6716171",
"0.6595948",
"0.6595948",
"0.6526855",
"0.6497159",
"0.6474841",
"0.6441688",
"0.6404816",
"0.63605154",
"0.633075",
"0.6308747",
"0.629837",
"0.6280658",
"0.6280658",
"0.6280485",
"0.6266064",
"0.6253281",
... | 0.0 | -1 |
GET /kids GET /kids.json | def index
@kids = Kid.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @kids }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_kids\n render json: Parent.find(params[:id]).kids\n end",
"def index\n @kids = Kid.all\n end",
"def index\n @kids = Kid.all\n end",
"def show\n @kid = Kid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kid }\n ... | [
"0.79449385",
"0.7150662",
"0.7150662",
"0.65995157",
"0.6219207",
"0.6144341",
"0.6031003",
"0.59943765",
"0.59878707",
"0.5898522",
"0.5887852",
"0.57410365",
"0.5701439",
"0.568907",
"0.5672602",
"0.5671236",
"0.5664308",
"0.56425047",
"0.5638654",
"0.56334835",
"0.5605123... | 0.7596576 | 1 |
GET /kids/1 GET /kids/1.json | def show
@kid = Kid.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @kid }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_kids\n render json: Parent.find(params[:id]).kids\n end",
"def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end",
"def index\n @kids = Kid.all\n end",
"def index\n @kids = Kid.all\n e... | [
"0.74694854",
"0.74487484",
"0.6937826",
"0.6937826",
"0.6276641",
"0.6257764",
"0.6234232",
"0.62074816",
"0.61467046",
"0.61287177",
"0.6121604",
"0.607639",
"0.5992722",
"0.5991076",
"0.5975154",
"0.59435356",
"0.5884669",
"0.5807316",
"0.5792663",
"0.57611763",
"0.5750457... | 0.7062675 | 2 |
GET /kids/new GET /kids/new.json | def new
@kid = Kid.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @kid }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @skid = Skid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @skid }\n end\n end",
"def new\n @kid = Kid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kid }\n end\n end",
"de... | [
"0.70024127",
"0.6962232",
"0.6877209",
"0.68434936",
"0.6835145",
"0.6783744",
"0.6731858",
"0.6722688",
"0.669483",
"0.66729426",
"0.66640496",
"0.6631912",
"0.6607876",
"0.6560924",
"0.65229684",
"0.65054",
"0.6490277",
"0.6490277",
"0.6455362",
"0.64290875",
"0.6428928",
... | 0.77578425 | 0 |
POST /kids POST /kids.json | def create
@user = User.find(params[:kid].delete(:user_id))
@kid = Kid.create(params[:kid])
@kid.active = true
@kid.user = @user
if @kid.save
render json: @kid
else
render json: @kid.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @kid = Kid.create(kid_params)\n @parent = Parent.find(params[:parent_id])\n @parent.kids << @kid\n redirect_to parent_kids_path\n # render json: @kid, status: 201\n end",
"def create\n @kid = Kid.new(kid_params)\n\n respond_to do |format|\n if @kid.save\n format.htm... | [
"0.70460933",
"0.6420089",
"0.6271531",
"0.62637705",
"0.60416234",
"0.59333134",
"0.58094394",
"0.58094394",
"0.5778061",
"0.56860644",
"0.5661131",
"0.5656137",
"0.55519897",
"0.5507096",
"0.5463731",
"0.5420561",
"0.54152983",
"0.53677744",
"0.53546983",
"0.533931",
"0.529... | 0.65175 | 1 |
PUT /kids/1 PUT /kids/1.json | def update
if params[:kid][:id]
@kid = Kid.find(params[:kid][:id])
else
@kid = Kid.find_by_user_id_and_local_id(params[:kid][:user_id],params[:kid][:local_id])
end
params[:kid].delete(:user_id)
params[:kid].delete(:id)
if @kid.update_attributes(params[:kid])
render json: @kid
else
render json: @kid.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @kid = Kid.find(params[:id])\n\n respond_to do |format|\n if @kid.update_attributes(params[:kid])\n flash[:notice] = 'Kid was successfully updated.'\n format.html { redirect_to(@kid) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edi... | [
"0.6400292",
"0.6360066",
"0.6260237",
"0.6227688",
"0.6227688",
"0.6227688",
"0.6227688",
"0.6207255",
"0.60780215",
"0.60732245",
"0.6020745",
"0.60003257",
"0.59231883",
"0.5883792",
"0.5860519",
"0.58381134",
"0.5831539",
"0.5830224",
"0.5737278",
"0.5693982",
"0.5676831"... | 0.7134124 | 0 |
DELETE /kids/1 DELETE /kids/1.json | def destroy
@kid = Kid.find_by_user_id_and_local_id(params[:user_id],params[:id])
if @kid
@kid.active = false
@kid.save
end
render json: "deleted"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @kid.destroy\n respond_to do |format|\n format.html { redirect_to kids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kid = Kid.find(params[:id])\n @kid.destroy\n\n respond_to do |format|\... | [
"0.7421248",
"0.74143165",
"0.72265947",
"0.72129494",
"0.71745527",
"0.699718",
"0.6962627",
"0.69288766",
"0.68943226",
"0.68458635",
"0.68217415",
"0.67883044",
"0.67873234",
"0.6760104",
"0.6741986",
"0.6731585",
"0.6729509",
"0.6726013",
"0.67162",
"0.67040217",
"0.66924... | 0.6744669 | 14 |
both args are absolute (except from_uri, which may be virtual root) | def handle_uri(uri, reference, redirect_count)
uri = uri.normalize
new_report = nil
@mtx.synchronize do
unless report = @link_reports[uri.to_s]
report = @link_reports[uri.to_s] =
LinkReport.new(uri, skip_uri?(uri, reference))
new_report = report
end
report.references << reference
end
if new_report
if new_report.skip?
@control.log_skip(new_report)
elsif redirect_count > 2 # TODO hard-coded
new_report.error_message = "redirect limit exceeded"
else
@pool_queue.push_job do
crawl_uri(uri, new_report, redirect_count)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_path_from(from); end",
"def relative_path(from, to); end",
"def relative_url_root=(_arg0); end",
"def relative_url_root=(_arg0); end",
"def absolute_url(*args)\n url_path = args.shift\n if url_path.is_a?(String) && !url_path.start_with?('/')\n url_path = request.env['PAT... | [
"0.7112236",
"0.68004423",
"0.6778615",
"0.6778615",
"0.6700595",
"0.66574717",
"0.6650395",
"0.6610582",
"0.6572296",
"0.6572296",
"0.6572296",
"0.6572296",
"0.64714986",
"0.64317715",
"0.64170533",
"0.63963634",
"0.63626784",
"0.6342294",
"0.6334919",
"0.6334893",
"0.631908... | 0.0 | -1 |
400 => +400 400 => 400 | def stringify(integer)
sign = integer >= 0 ? '+' : '-'
"#{sign}#{integer.abs}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount_multiplier\n 1000\n end",
"def yay(number)\n return (number * 10) + 30\nend",
"def attack_bonus(lv)\n (110 * 3 * lv.to_f + 250) / 100 + 5\n end",
"def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"... | [
"0.6105816",
"0.5930419",
"0.5906492",
"0.585462",
"0.5842421",
"0.58215487",
"0.5806826",
"0.57395595",
"0.5736223",
"0.5705558",
"0.5679779",
"0.5668814",
"0.5668814",
"0.5649908",
"0.56418353",
"0.56418353",
"0.56418353",
"0.56418353",
"0.5608002",
"0.560161",
"0.55990016"... | 0.0 | -1 |
GET /historico_convercas GET /historico_convercas.json | def index
@historico_convercas = HistoricoConverca.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_historico_converca\n @historico_converca = HistoricoConverca.find(params[:id])\n end",
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def index\n @cooperativas = Coo... | [
"0.6669529",
"0.6357655",
"0.6308439",
"0.62423325",
"0.61358845",
"0.6130628",
"0.6121071",
"0.6092642",
"0.6084446",
"0.6082276",
"0.6077488",
"0.60425824",
"0.59993416",
"0.5960374",
"0.59501135",
"0.5919988",
"0.5874884",
"0.5874134",
"0.5862111",
"0.5859149",
"0.5844606"... | 0.75175244 | 0 |
GET /historico_convercas/1 GET /historico_convercas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @historico_convercas = HistoricoConverca.all\n end",
"def set_historico_converca\n @historico_converca = HistoricoConverca.find(params[:id])\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n fo... | [
"0.72141683",
"0.6692964",
"0.64200985",
"0.63653296",
"0.6365136",
"0.62924284",
"0.6134982",
"0.61234426",
"0.611933",
"0.6118973",
"0.6035082",
"0.603473",
"0.6022224",
"0.601866",
"0.59913266",
"0.59220594",
"0.58899856",
"0.5888997",
"0.5861242",
"0.58587503",
"0.5841253... | 0.0 | -1 |
POST /historico_convercas POST /historico_convercas.json | def create
@historico_converca = HistoricoConverca.new(historico_converca_params)
@historico_converca.user_id = current_user.id
respond_to do |format|
if @historico_converca.save
@historico_converca = HistoricoConverca.new
@historicos = Venda.where(cliente_id: params[:id], orcamento: true)
format.js { render :create, notice: 'Venda atualiza!', location: @historicos }
else
format.html { render 'vendas/new' }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def historico_converca_params\n params.require(:historico_converca).permit(:venda_id, :user_id, :descricao)\n end",
"def set_historico_converca\n @historico_converca = HistoricoConverca.find(params[:id])\n end",
"def index\n @historico_convercas = HistoricoConverca.all\n end",
"def create... | [
"0.6491221",
"0.62135583",
"0.612144",
"0.59619963",
"0.5842706",
"0.5742706",
"0.56791764",
"0.56747437",
"0.56545573",
"0.5581136",
"0.5566757",
"0.55325294",
"0.55007976",
"0.5491719",
"0.53961027",
"0.5379862",
"0.53360504",
"0.5328733",
"0.53244126",
"0.5305054",
"0.5299... | 0.6016372 | 3 |
PATCH/PUT /historico_convercas/1 PATCH/PUT /historico_convercas/1.json | def update
respond_to do |format|
if @historico_converca.update(historico_converca_params)
format.html { redirect_to @historico_converca, notice: 'Historico converca was successfully updated.' }
format.json { render :show, status: :ok, location: @historico_converca }
else
format.html { render :edit }
format.json { render json: @historico_converca.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @votaciones_hist.update(votaciones_hist_params)\n format.html { redirect_to @votaciones_hist, notice: 'Votaciones hist was successfully updated.' }\n format.json { render :show, status: :ok, location: @votaciones_hist }\n else\n format.html... | [
"0.63284343",
"0.6152291",
"0.61418116",
"0.61193615",
"0.60410917",
"0.6017577",
"0.6016185",
"0.599184",
"0.595193",
"0.59501153",
"0.5942194",
"0.59356844",
"0.592798",
"0.59180707",
"0.5912385",
"0.59104675",
"0.5900473",
"0.5899847",
"0.58990663",
"0.5897951",
"0.5894328... | 0.7088661 | 0 |
DELETE /historico_convercas/1 DELETE /historico_convercas/1.json | def destroy
@historico_converca.destroy
respond_to do |format|
format.html { redirect_to historico_convercas_url, notice: 'Historico converca was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @votaciones_hist.destroy\n respond_to do |format|\n format.html { redirect_to votaciones_hists_url, notice: 'Votaciones hist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historia_clinica.destroy\n respond_to do |format|\n ... | [
"0.6974564",
"0.6843663",
"0.6807995",
"0.6791274",
"0.6753674",
"0.67496544",
"0.66893893",
"0.6689356",
"0.6656842",
"0.663885",
"0.6631774",
"0.6625099",
"0.66204715",
"0.66177726",
"0.6603627",
"0.659905",
"0.6589831",
"0.65870225",
"0.65760636",
"0.6564462",
"0.65634626"... | 0.74531513 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_historico_converca
@historico_converca = HistoricoConverca.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def historico_converca_params
params.require(:historico_converca).permit(:venda_id, :user_id, :descricao)
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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
Defining Function of soap action | def celsius_to_fahrenheit
celsius = params[:value]
fahrenheit = (celsius * 9)/5 + 32
render :soap => fahrenheit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def soap_action(operation)\n operation\n end",
"def do_action(action, args = {})\n message = <<EOS\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://localhost/WebService/\">\n <soapenv:Header/>\n <soapenv:Body>\n <web:GetReport>\n <!--Opt... | [
"0.7350952",
"0.6840814",
"0.68334955",
"0.66242445",
"0.6541542",
"0.6455602",
"0.6367354",
"0.6350953",
"0.6329125",
"0.6328233",
"0.6328233",
"0.6232787",
"0.6213074",
"0.6108261",
"0.6038161",
"0.6008998",
"0.59986746",
"0.5981185",
"0.5976453",
"0.5976453",
"0.5976453",
... | 0.0 | -1 |
helper method(s) in application controller | def index
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller(controller); end",
"def helpers; end",
"def he... | [
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.6845591",
"0.66201514",
"0.66012555",
"0.66012555",
"0.66012555",
"0.64932394",
"0.64536875",
"0.6448602",
"0.6448602",
"0.64236474",
"0.64236474",
"0.63365... | 0.0 | -1 |
Notifies the list views that the data of the items was changed. | def update(range)
@access.update(range.min, range.max)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_will_change!\n collection_will_change!\n forward \"#{@key}_will_change!\"\n end",
"def updated(item)\n end",
"def onUpdated(item)\n @object.updated(import(item))\n end",
"def send_update\n changed\n notify_observers(self)\n end",
"def ListView_Update(hwndLV, ... | [
"0.6692425",
"0.66340446",
"0.63151324",
"0.629158",
"0.6282531",
"0.6216052",
"0.61427224",
"0.6141119",
"0.6085343",
"0.60210717",
"0.60184157",
"0.6004187",
"0.5965883",
"0.5943275",
"0.5924924",
"0.58768564",
"0.58768564",
"0.5852558",
"0.58254325",
"0.5814913",
"0.580968... | 0.0 | -1 |
Notifies the list views that items are about to be and were moved. | def moving(range, destination)
return if range.count == 0
@access.begin_move(range.min, range.max, destination)
ret = yield
@access.end_move
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_lists_if_role_changed\n if self.role_changed?\n new_role, self.role = self.role, self.role_was\n decrement_positions_on_lower_items if in_list?\n self.position = nil\n self.role = new_role\n add_to_list_bottom\n end\n end",
"def touch_moved(touch); end",
"def notify(s... | [
"0.60326296",
"0.5697715",
"0.5688385",
"0.55740714",
"0.55192304",
"0.5511923",
"0.54903954",
"0.5489858",
"0.54467714",
"0.5446743",
"0.54461825",
"0.5426799",
"0.539678",
"0.53930724",
"0.53756374",
"0.5359235",
"0.53258085",
"0.5319867",
"0.53123057",
"0.5294374",
"0.5293... | 0.0 | -1 |
Notifies the list views that items are about to be and were inserted. | def inserting(range, &block)
return if range.count == 0
@access.begin_insert(range.min, range.max)
ret = yield
@access.end_insert
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(item)\n @info << item\n changed\n notify_observers(self, :insert, item)\n self\n end",
"def ListView_InsertItem(hwnd, pitem) send_listview_message(hwnd, :INSERTITEM, lparam: pitem) end",
"def add_to_list\n\n # Keep a copy of position to set after the change detail is saved, \n # b... | [
"0.66504675",
"0.6070478",
"0.58258194",
"0.570584",
"0.55595505",
"0.55570686",
"0.5524886",
"0.54732764",
"0.54382086",
"0.5407919",
"0.54037195",
"0.54011273",
"0.53685105",
"0.5368274",
"0.5360224",
"0.53496796",
"0.5348266",
"0.5344416",
"0.5291684",
"0.527096",
"0.52573... | 0.0 | -1 |
Notifies the list views that items are about to be and were removed. | def removing(range, &block)
return if range.count == 0
@access.begin_remove(range.min, range.max)
ret = yield
@access.end_remove
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onRemoved(links)\n @set -= links\n end",
"def destroy\n\t\tconditions = ['listitems.user_id = ? AND listitems.title = ?',\n\t\t\tcurrent_user.id, params[:id]]\n\t\titem_count = Listitem.count(:conditions=>conditions)\n\t\tif item_count > 0\n\t\t\tListitem.delete_all(conditions)\n\t\t\tflash[:notice] = \"... | [
"0.6442221",
"0.64408123",
"0.64032876",
"0.6276328",
"0.6139893",
"0.6092839",
"0.60495305",
"0.60441804",
"0.60344166",
"0.60298455",
"0.60116446",
"0.59791344",
"0.596402",
"0.5957187",
"0.59447867",
"0.59287226",
"0.5927448",
"0.5911567",
"0.5898405",
"0.5890038",
"0.5855... | 0.0 | -1 |
Return an instance of PlistBuddy. | def pbuddy
@pbuddy ||= RunLoop::PlistBuddy.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plist_buddy\n '/usr/libexec/PlistBuddy'\n end",
"def show\n @buddy_list = current_user.buddy_list\n end",
"def set_buddy\n @buddy = Buddy.find(params[:id])\n end",
"def add1\n bp = bpn\n bp.add_list_item('Apollo13',actors,hanks)\nend",
"def create\n @buddy = Buddy.new(params[:bud... | [
"0.5949046",
"0.54233456",
"0.51353884",
"0.4760107",
"0.46905518",
"0.46317205",
"0.46123344",
"0.45994514",
"0.4597172",
"0.45855978",
"0.4543436",
"0.45032543",
"0.44756532",
"0.44717765",
"0.4458862",
"0.4458862",
"0.44487226",
"0.4432457",
"0.44182387",
"0.44166481",
"0.... | 0.8045256 | 0 |
Is the simulator for the current version of Xcode running? | def sim_is_running?
not sim_pid.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end",
"def is_simulator? uuid\n # Check if UUID is from a device or a simulator\n # Getting all the simulator's UUID\n uuids = `xcrun simctl list`\n return true if uuids.include? uuid\n return false\nend",
"def simulator?\... | [
"0.75366676",
"0.7353891",
"0.72129506",
"0.6991004",
"0.69042057",
"0.68885547",
"0.6866185",
"0.68157256",
"0.68120986",
"0.6777595",
"0.66876507",
"0.6671984",
"0.66689765",
"0.66617113",
"0.6646892",
"0.6606136",
"0.6589083",
"0.65531343",
"0.6511876",
"0.65103096",
"0.65... | 0.6663985 | 13 |
If it is running, quit the simulator for the current version of Xcode. | def quit_sim(opts={})
if sim_is_running?
default_opts = {:post_quit_wait => 1.0 }
merged_opts = default_opts.merge(opts)
`echo 'application "#{sim_name}" quit' | xcrun osascript`
sleep(merged_opts[:post_quit_wait]) if merged_opts[:post_quit_wait]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill\n if booted\n self.shutdown\n end\n\t\t\t\t\t\t\t\t\t\n %x[killall \"iOS Simulator\" 2>/dev/null]\n\t\t\tsleep 2\n end",
"def quit\n Gamework::App.quit\n end",
"def quit\n exit(1)\n end",
"def shutdown_booted_simulators\n\n # Closing all Simulators runni... | [
"0.7136024",
"0.63057476",
"0.6268967",
"0.62220806",
"0.6175569",
"0.6105849",
"0.6036814",
"0.60317945",
"0.5969988",
"0.5898689",
"0.5812626",
"0.57899415",
"0.5759068",
"0.57447827",
"0.5700647",
"0.56984144",
"0.56798553",
"0.56596965",
"0.5624682",
"0.5615822",
"0.56158... | 0.6687406 | 1 |
If it is not already running, launch the simulator for the current version of Xcode. Launches the simulator in the background so it does not steal focus. | def launch_sim(opts={})
unless sim_is_running?
default_opts = {:post_launch_wait => 2.0}
merged_opts = default_opts.merge(opts)
`xcrun open -g -a "#{sim_app_path}"`
sleep(merged_opts[:post_launch_wait]) if merged_opts[:post_launch_wait]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch_simulator(options={})\n merged_options = {\n :wait_for_stable => true\n }.merge(options)\n\n if !simulator_requires_relaunch?\n RunLoop.log_debug(\"Simulator is running and does not require a relaunch.\")\n return\n end\n\n RunLoop::CoreSimulator.quit_simulator\n RunLoop... | [
"0.775095",
"0.7276611",
"0.67841536",
"0.6781089",
"0.67802864",
"0.6698784",
"0.66060317",
"0.6439615",
"0.616472",
"0.6073634",
"0.6071769",
"0.59094733",
"0.5827573",
"0.5734003",
"0.5667446",
"0.5666772",
"0.54773015",
"0.54759777",
"0.5457963",
"0.544505",
"0.5404582",
... | 0.689802 | 2 |
Relaunch the simulator for the current version of Xcode. If that simulator is already running, it is quit. | def relaunch_sim(opts={})
default_opts = {:post_quit_wait => 1.0,
:post_launch_wait => 2.0}
merged_opts = default_opts.merge(opts)
quit_sim(merged_opts)
launch_sim(merged_opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relaunch\n if ENV['NO_LAUNCH'].nil?\n Calabash::Cucumber::SimulatorHelper.relaunch(app_path,ENV['SDK_VERSION'],ENV['DEVICE'] || 'iphone')\n end\nend",
"def kill\n if booted\n self.shutdown\n end\n\t\t\t\t\t\t\t\t\t\n %x[killall \"iOS Simulator\" 2>/dev/null]\n\t\t\tsleep 2\n end... | [
"0.6896068",
"0.6701985",
"0.64534444",
"0.6220858",
"0.60751486",
"0.57641846",
"0.5737419",
"0.5579108",
"0.5573153",
"0.55417025",
"0.55146414",
"0.5478392",
"0.54599804",
"0.5458356",
"0.5381588",
"0.5366824",
"0.5145447",
"0.49024466",
"0.48794827",
"0.48668107",
"0.4850... | 0.60507333 | 5 |
Resets the simulator content and settings. In Xcode [64] and relaunching the iOS Simulator which will recreate the Library directory and the latest SDK directory. On Xcode 6, it uses the `simctl erase ` command line tool. | def reset_sim_content_and_settings(opts={})
default_opts = {:post_quit_wait => 1.0,
:post_launch_wait => 3.0,
:sim_udid => nil}
merged_opts = default_opts.merge(opts)
quit_sim(merged_opts)
# WARNING - DO NOT TRY TO DELETE Developer/CoreSimulator/Devices!
# Very bad things will happen. Unlike Xcode < 6, the re-launching the
# simulator will _not_ recreate the SDK (aka Devices) directories.
if xcode_version_gte_6?
simctl_reset(merged_opts[:sim_udid])
else
sim_lib_path = File.join(sim_app_support_dir, 'Library')
FileUtils.rm_rf(sim_lib_path)
existing_sim_sdk_or_device_data_dirs.each do |dir|
FileUtils.rm_rf(dir)
end
launch_sim(merged_opts)
# This is tricky because we need to wait for the simulator to recreate
# the directories. Specifically, we need the Accessibility plist to be
# exist so subsequent calabash launches will be able to enable
# accessibility.
#
# The directories take ~3.0 - ~5.0 to create.
counter = 0
loop do
break if counter == 80
dirs = existing_sim_sdk_or_device_data_dirs
if dirs.count == 0
sleep(0.2)
else
break if dirs.all? { |dir|
plist = File.expand_path("#{dir}/Library/Preferences/com.apple.Accessibility.plist")
File.exist?(plist)
}
sleep(0.2)
end
counter = counter + 1
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_app_sandbox\n return true if !app_is_installed?\n\n RunLoop::CoreSimulator.quit_simulator\n RunLoop::CoreSimulator.wait_for_simulator_state(device, \"Shutdown\")\n\n reset_app_sandbox_internal\n end",
"def reset\n reset_config\n reset_driver\n end",
"def resetSimulator deviceID\n ... | [
"0.6638461",
"0.6372765",
"0.6362255",
"0.61680675",
"0.61035335",
"0.60946995",
"0.60299814",
"0.6012039",
"0.59952176",
"0.5960785",
"0.59386146",
"0.58479995",
"0.5844048",
"0.5833059",
"0.58119804",
"0.5789784",
"0.578112",
"0.5765553",
"0.57635844",
"0.57578737",
"0.5697... | 0.757543 | 0 |
TODO extract to FileSpecUtils | def mock_archive_upload(archive_path, type)
return ActionDispatch::Http::UploadedFile.new(:tempfile => File.new(Rails.root + archive_path , :type => type, :filename => File.basename(File.new(Rails.root + archive_path))))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_utils; end",
"def specfile\n Dir[\"#{@path}/[Ss]pecfile\"].first\n end",
"def spec_file(filename)\n File.open('spec/files/'+filename) { |f| f.read }\n end",
"def load_specification(file_name); end",
"def for(file_or_dir); end",
"def spec_for(file)\n base = File.basename(file)\n ext... | [
"0.6671504",
"0.6365106",
"0.62806785",
"0.6214339",
"0.61970794",
"0.61750823",
"0.6113739",
"0.60700923",
"0.60431165",
"0.60431165",
"0.6029333",
"0.6029333",
"0.6029333",
"0.6029333",
"0.6029333",
"0.6029333",
"0.6024887",
"0.5993425",
"0.5986114",
"0.5975602",
"0.5975602... | 0.0 | -1 |
Push user uploaded video file to kaltura server If successful set upload token with the object | def process_uploaded_video_file
if @video_file.present?
video_file_stream = if @video_file.respond_to?(:path, true)
File.open(@video_file.path)
else
@video_file
end
@uploaded_video_token = local_or_global_kaltura_client.
media_service.upload(video_file_stream)
raise ActsAsKaltura::Video::NoUploadedTokenFound if @uploaded_video_token.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(video, user)\r\n self.connect(user) unless user.token?\r\n uri = URI(HOST + 'feeds/api/users/default/uploads')\r\n post = Net::HTTP::Post.new uri.path\r\n post.body_stream, post.content_type = Multipart::Post.prepare_query(\"atom\" => video.atom, \"Video\" => video.file)\r\n pos... | [
"0.7196231",
"0.67141986",
"0.6487689",
"0.638707",
"0.6356648",
"0.633518",
"0.6322194",
"0.62731874",
"0.6269766",
"0.62677324",
"0.6247384",
"0.6242639",
"0.62298065",
"0.6219208",
"0.6219208",
"0.6215505",
"0.62026036",
"0.6200874",
"0.6171058",
"0.61517245",
"0.6123707",... | 0.74731743 | 0 |
Create kaltura video entry based on current video data if successful set kaltura id | def create_kaltura_video_entry
if @video_file.present?
# There must have uploaded token otherwise this should be invoked
raise NoUploadedTokenFound if @uploaded_video_token.nil?
# Covert host model as kaltura entry
entry = as_kaltura_entry
# Request kaltura service to store video entry for the
# uploaded video file
stored_entry = add_kaltuar_video_file(entry)
# Nil return should throw exception
raise KalturaVideoAddFailure if stored_entry.nil?
# Set kaltura_key from stored kaltura entry
self.kaltura_key = stored_entry.id.to_s
self.kaltura_syncd_at = Time.now
self.class.run_kaltura_after_save_callbacks self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_kaltura_video_entry\n if kaltura_key.present?\n entry = as_kaltura_entry\n update_kaltura_entry(entry)\n\n if @video_file.nil?\n entry.id = kaltura_key\n add_kaltuar_video_file(entry)\n end\n\n self.class.run_kaltura_after_save_callbacks self\n ... | [
"0.7755572",
"0.647937",
"0.60817695",
"0.6076675",
"0.60597146",
"0.6059479",
"0.60591215",
"0.605279",
"0.60499483",
"0.596863",
"0.5965039",
"0.59213346",
"0.59161747",
"0.5892259",
"0.588279",
"0.5875454",
"0.58576554",
"0.5836281",
"0.5827427",
"0.5827427",
"0.5827427",
... | 0.8067648 | 0 |
Update kaltura existing video entry If successful update kaltura_syncd_at | def update_kaltura_video_entry
if kaltura_key.present?
entry = as_kaltura_entry
update_kaltura_entry(entry)
if @video_file.nil?
entry.id = kaltura_key
add_kaltuar_video_file(entry)
end
self.class.run_kaltura_after_save_callbacks self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_kaltura_video_entry\n if @video_file.present?\n # There must have uploaded token otherwise this should be invoked\n raise NoUploadedTokenFound if @uploaded_video_token.nil?\n\n # Covert host model as kaltura entry\n entry = as_kaltura_entry\n\n # Request ka... | [
"0.6363763",
"0.613232",
"0.59090894",
"0.57936454",
"0.57817256",
"0.5777284",
"0.5558585",
"0.555655",
"0.55384856",
"0.55270195",
"0.550379",
"0.5502703",
"0.54967654",
"0.54799277",
"0.54788685",
"0.54635257",
"0.54606605",
"0.5457378",
"0.54313517",
"0.54239774",
"0.5423... | 0.82566136 | 0 |
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement. | def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name
"Write your SQL query Here"
"SELECT projects.title, SUM(amount) FROM projects
INNER JOIN pledges ON project_id = projects.id
GROUP BY title;"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'musi... | [
"0.9197295",
"0.7068433",
"0.69895536",
"0.66510636",
"0.66222274",
"0.65154123",
"0.6486208",
"0.63220215",
"0.60590106",
"0.594347",
"0.5939745",
"0.59020203",
"0.5880479",
"0.58721614",
"0.5855161",
"0.58522254",
"0.5841816",
"0.58206713",
"0.5783681",
"0.5783355",
"0.5703... | 0.59376645 | 11 |
Initialize with an array of risc MethodCompilers | def initialize(compilers = [])
@method_compilers = nil
compilers.each{|c| add_compiler(c)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compilers\n @compilers ||= []\n end",
"def translate_method( method_compiler , translator)\n all = []\n all << translate_cpu( method_compiler , translator )\n method_compiler.block_compilers.each do |block_compiler|\n all << translate_cpu(block_compiler , translator)\n ... | [
"0.61655724",
"0.59756494",
"0.58533525",
"0.5593299",
"0.558626",
"0.54047763",
"0.5379128",
"0.5331401",
"0.5330752",
"0.5317435",
"0.53027046",
"0.52809674",
"0.5241568",
"0.52234",
"0.52196765",
"0.5214572",
"0.516941",
"0.51666486",
"0.5158008",
"0.51265323",
"0.51184684... | 0.7054284 | 0 |
collects constants from all compilers into one array | def constants
all = []
method_compilers.each_compiler{|comp| all += comp.constants }
all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constants\n @method_compilers.inject([]){|sum ,comp| sum + comp.constants }\n end",
"def constants\n\t\tselect {|x| x.class == Constant }\n\tend",
"def constants\n @constants.uniq\n end",
"def list\n @@list ||= constants.inject({}){|a, c| a.merge! c => const_get(c)}\n end",
"def constan... | [
"0.74117494",
"0.63718176",
"0.6363881",
"0.63477015",
"0.6299236",
"0.6287683",
"0.6142359",
"0.6136934",
"0.6136934",
"0.6058291",
"0.58861184",
"0.5862406",
"0.58104587",
"0.5751321",
"0.57177883",
"0.56425387",
"0.56330794",
"0.56136644",
"0.55752975",
"0.5568159",
"0.556... | 0.7824646 | 0 |
Translate code to whatever cpu is specified. Currently only :arm and :interpret Translating means translating the initial jump and then translating all methods | def translate( platform_sym )
platform_sym = platform_sym.to_s.capitalize
platform = Platform.for(platform_sym)
assemblers = []
@method_compilers.each_compiler do |compiler|
compiler.translate_method( platform , assemblers)
end
Risc::Linker.new(platform , assemblers , constants)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_cpu(compiler , translator)\n risc = compiler.risc_instructions\n cpu_instructions = risc.to_cpu(translator)\n nekst = risc.next\n while(nekst)\n cpu = nekst.to_cpu(translator) # returning nil means no replace\n cpu_instructions << cpu if cpu\n nekst = nekst.ne... | [
"0.79277855",
"0.6221652",
"0.6135704",
"0.6028589",
"0.59688336",
"0.5874534",
"0.5775907",
"0.5600246",
"0.5575306",
"0.5536132",
"0.5536132",
"0.5536132",
"0.5536132",
"0.5536132",
"0.5536132",
"0.5536132",
"0.5536132",
"0.55322665",
"0.55033755",
"0.5475954",
"0.5430084",... | 0.65990907 | 1 |
Eval and parse http response | def parse_response(response)
return response unless response.respond_to?(:body)
JSON.parse(response.body, symbolize_names: true)
rescue StandardError => e
puts "Error parsing response from #{api_path}"
handle_error(e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_remote_response\n \"eval(request.responseText)\"\n end",
"def execute\n subs_hash = VariableSubstitutor.substitute_variables(response)\n content = generate_text(response)\n VariableEvaluator.evaluate_obj(content, subs_hash)\n end",
"def eval_response(response)\n return (response =... | [
"0.75874805",
"0.6991076",
"0.66550374",
"0.63691807",
"0.6250269",
"0.6161603",
"0.6113981",
"0.60981405",
"0.6082187",
"0.60728884",
"0.6040737",
"0.60263234",
"0.60157263",
"0.5941141",
"0.59007204",
"0.58487505",
"0.5802857",
"0.5794254",
"0.5793974",
"0.5789576",
"0.5789... | 0.0 | -1 |
GET /user_portraits GET /user_portraits.json | def index
@user_portraits = UserPortrait.find_by_sql ["SELECT up.id, up.user_id, up.portrait_id, up.status, up.created_at, up.updated_at, u.username, p.portrait FROM user_portraits up, users u, portraits p WHERE up.user_id = u.id AND up.portrait_id = p.id"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @user_portraits = UserPortrait.find_by_sql [\"SELECT up.id, up.user_id, up.portrait_id, up.status,up.created_at, up.updated_at, u.username, p.portrait FROM user_portraits up, users u, portraits p WHERE up.user_id = u.id AND up.portrait_id = p.id AND up.id = ?\", params[:id]]\n end",
"def show\n ... | [
"0.66232926",
"0.6532282",
"0.62715745",
"0.6230704",
"0.6189075",
"0.61881995",
"0.6174555",
"0.61570656",
"0.61518174",
"0.6097412",
"0.6047632",
"0.6038877",
"0.6005493",
"0.59790766",
"0.5972805",
"0.59622574",
"0.59549886",
"0.5939306",
"0.5938286",
"0.5936552",
"0.59359... | 0.68204397 | 0 |
GET /user_portraits/1 GET /user_portraits/1.json | def show
@user_portraits = UserPortrait.find_by_sql ["SELECT up.id, up.user_id, up.portrait_id, up.status,up.created_at, up.updated_at, u.username, p.portrait FROM user_portraits up, users u, portraits p WHERE up.user_id = u.id AND up.portrait_id = p.id AND up.id = ?", params[:id]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user_portraits = UserPortrait.find_by_sql [\"SELECT up.id, up.user_id, up.portrait_id, up.status, up.created_at, up.updated_at, u.username, p.portrait FROM user_portraits up, users u, portraits p WHERE up.user_id = u.id AND up.portrait_id = p.id\"]\n end",
"def show\n @user = User.find(params... | [
"0.6726003",
"0.6661004",
"0.6386593",
"0.6340047",
"0.6324577",
"0.62880677",
"0.62659955",
"0.61804783",
"0.6164414",
"0.61576873",
"0.6153037",
"0.61508197",
"0.6150223",
"0.6148064",
"0.6144063",
"0.6142794",
"0.61385256",
"0.6137815",
"0.6134521",
"0.61337686",
"0.611990... | 0.66677076 | 1 |
POST /user_portraits POST /user_portraits.json | def create
@user_portrait = UserPortrait.new(user_portrait_params)
respond_to do |format|
if @user_portrait.save
format.html { redirect_to @user_portrait, notice: 'User portrait was successfully created.' }
format.json { render :show, status: :created, location: @user_portrait }
else
format.html { render :new }
format.json { render json: @user_portrait.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user = User.new(user_params.except(:preferences))\n types = user_params[:preferences].split(\",\")\n password = \"TPSW_servidor\"\n @user.password = AESCrypt.encrypt(@user.password, password)\n #logger.info(@user)\n if @user.save\n \ttypes.each { |type|\n \t\tpref = Preference... | [
"0.60966843",
"0.6068543",
"0.5953493",
"0.58482116",
"0.582263",
"0.58208936",
"0.5792048",
"0.57850176",
"0.5743615",
"0.57396185",
"0.57350755",
"0.57325244",
"0.5730578",
"0.5722449",
"0.57193434",
"0.57069856",
"0.57064855",
"0.5696744",
"0.5694619",
"0.56905323",
"0.568... | 0.62863475 | 0 |
PATCH/PUT /user_portraits/1 PATCH/PUT /user_portraits/1.json | def update
respond_to do |format|
if @user_portrait.update(user_portrait_params)
format.html { redirect_to @user_portrait, notice: 'User portrait was successfully updated.' }
format.json { render :show, status: :ok, location: @user_portrait }
else
format.html { render :edit }
format.json { render json: @user_portrait.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to user_path(@user), notice: 'Pet was successfully updated.' }\n format.json { render json: @user, status: :ok }\n... | [
"0.653663",
"0.64309597",
"0.6345802",
"0.63232625",
"0.6310646",
"0.628896",
"0.627596",
"0.6252035",
"0.6249966",
"0.62463444",
"0.62463444",
"0.6245666",
"0.62402976",
"0.6233267",
"0.6231943",
"0.6224017",
"0.62146884",
"0.6198075",
"0.61814785",
"0.6179892",
"0.6170763",... | 0.6183302 | 18 |
DELETE /user_portraits/1 DELETE /user_portraits/1.json | def destroy
@user_portrait.destroy
respond_to do |format|
format.html { redirect_to user_portraits_url, notice: 'User portrait was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no... | [
"0.7217091",
"0.71583205",
"0.71399343",
"0.7135815",
"0.7135815",
"0.70677364",
"0.70453405",
"0.7015086",
"0.701377",
"0.70117664",
"0.70026517",
"0.6992968",
"0.69800186",
"0.6963931",
"0.6960105",
"0.6954501",
"0.6946389",
"0.6934509",
"0.693202",
"0.6931104",
"0.6923124"... | 0.73408914 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_user_portrait
@user_portrait = UserPortrait.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_portrait_params
params.permit(:user_id, :portrait_id, :status)
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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
This is the forum you want your "Suggestions" imported into | def verbose(string_to_output)
puts string_to_output if $verbose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findorsuggest()\n \n end",
"def suggest\n end",
"def help\n [\n [\"what are (people|is everyone) saying about <subject>\", \"search twitter for tweets on <subject>\"],\n [\"what's the word on <subject>\", \"search twitter for tweets on <subject>\"],\n ]\n end",
"def index\n @blog... | [
"0.62972313",
"0.62292886",
"0.59297603",
"0.58266884",
"0.573527",
"0.57175654",
"0.5712868",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56456125",
"0.56384057",
"0.56327724",
... | 0.0 | -1 |
Translate a set of Level 14 to freshdesk priority ids (1 being low) | def convert_rt_priority_to_freshdesk (rt_priority)
return 1 if rt_priority.to_i == 4
return 2 if rt_priority.to_i == 3
return 3 if rt_priority.to_i == 2
return 4 if rt_priority.to_i == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def priorities id\n return legal_values_for 'priority', id\n end",
"def get_priority(id)\n case id.to_i\n when 4\n return 'Critical'\n when 3\n return 'Low'\n when 2\n return 'Medium'\n when 1\n return 'High'\n else\n return 'Unknown'\n end\n end",
"def pr... | [
"0.6099174",
"0.58313054",
"0.5753318",
"0.57410294",
"0.55406284",
"0.55327713",
"0.5502176",
"0.5339407",
"0.52549267",
"0.52411467",
"0.5218136",
"0.5214281",
"0.5201361",
"0.5189011",
"0.5168859",
"0.5149406",
"0.51401055",
"0.51186377",
"0.5104847",
"0.5091163",
"0.50542... | 0.6571799 | 0 |
GET /users/:user_id/character/new Get the given user, and build it a character for it. | def new
user = User.find(params[:user_id])
@character = user.characters.build
authorize @character
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user = User.find(params[:user_id])\n @character = Character.new\n end",
"def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def create\n @character = @user.build... | [
"0.8228032",
"0.7686038",
"0.7553642",
"0.75029325",
"0.73825806",
"0.7279139",
"0.71190715",
"0.6980596",
"0.6918659",
"0.6855233",
"0.6794184",
"0.6779033",
"0.676488",
"0.6744055",
"0.6715344",
"0.66880566",
"0.66678923",
"0.66678923",
"0.65778697",
"0.6505417",
"0.650371"... | 0.7464589 | 4 |
POST /users/:user_id/character Creates a new Character with the passed in parameters. Redisplays the new page when there are errors. | def create
user = User.find(params[:user_id])
@character = user.characters.build(character_params)
authorize @character
# First character should be the main.
@character.main = (user.characters.count == 0)
if @character.save
redirect_to user
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @character = current_user.characters.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: I18n.translate(\"success\", scope: %i[characters new]) }\n format.json { render :show, status: :created, location: @charac... | [
"0.82591426",
"0.81638896",
"0.80350214",
"0.8001488",
"0.79526865",
"0.79526865",
"0.785414",
"0.7782211",
"0.77796257",
"0.7755326",
"0.7747817",
"0.7737858",
"0.7699695",
"0.7690159",
"0.7651587",
"0.76089346",
"0.7544241",
"0.7374269",
"0.7353582",
"0.7296941",
"0.7248630... | 0.7068836 | 30 |
POST /users/:user_id/character/:id/promote Makes the given character the "main" for it's user and sets all the other characters to "not main". | def promote
@character.user.main.update_attribute(:main, false)
@character.update_attribute(:main, true)
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promote\n user = User.find(params[:id])\n\n return unless current_user.user_role.can_promote_demote\n\n if user.user_role.name == 'User'\n user.user_role = UserRole.find_by(name: 'Officer')\n user.save\n redirect_to user_path(user)\n return\n end\n\n return unless user.user_r... | [
"0.61248523",
"0.5718577",
"0.5709135",
"0.5665539",
"0.55550385",
"0.54886925",
"0.5418397",
"0.52858406",
"0.5271742",
"0.5256851",
"0.525108",
"0.5207228",
"0.513388",
"0.50691324",
"0.50428915",
"0.5033307",
"0.5028764",
"0.50179213",
"0.5016912",
"0.5014516",
"0.5003018"... | 0.757508 | 0 |
DELETE /users/:user_id/character/:id Deletes the character. | def destroy
begin
@character.destroy
rescue Character::DestoryError => e
redirect_to :back, alert: e.message
return
end
redirect_to user_path(@character.user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character = current_user.characters.find(params[:id])\n @... | [
"0.8231452",
"0.80141723",
"0.79402614",
"0.7885143",
"0.78148407",
"0.7654058",
"0.7547767",
"0.7522538",
"0.75104135",
"0.75007856",
"0.75007856",
"0.74126476",
"0.7378937",
"0.73718524",
"0.7344147",
"0.72864443",
"0.72864443",
"0.72864443",
"0.72864443",
"0.72864443",
"0.... | 0.7166296 | 25 |
GET /roster Provides the users that are part of the core, and applicants. | def roster
@characters = policy_scope(Character)
.includes(user: :rank)
.where(main: true)
authorize @characters
# Get only the characters over Trial rank and shown.
@characters = @characters.select do |character|
character.user.shown? && character.user.rank.try(:>=, 'Trial')
end
# Group and sort the characters.
@classes = @characters.group_by(&:klass).each do |_klass, characters|
characters.sort! { |a, b| b.user.rank <=> a.user.rank }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_roster\n client.roster\n end",
"def fetch_roster\n roster = JSON.parse(RestClient.get(get_url))\n\n roster[\"teams\"].\n each do |roster_hash|\n roster_hash[\"roster\"][\"roster\"].\n each do |player|\n player_name = /(?<first_name>[^\\s]+)\\s(?<last_name>[^\\... | [
"0.7122853",
"0.67226577",
"0.67030936",
"0.64292294",
"0.64208794",
"0.63060755",
"0.63060755",
"0.6304405",
"0.6304405",
"0.62903744",
"0.6233597",
"0.6159032",
"0.6141672",
"0.6141672",
"0.6141672",
"0.60643226",
"0.60196674",
"0.593963",
"0.59143996",
"0.5896947",
"0.5871... | 0.0 | -1 |
character_params: > Hash Permits the character fields for assignment. | def character_params
permit = policy(@character || Character).permitted_attributes
params.require(:character).permit(*permit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def character_params\n params[:character].permit(:name, :game_class, :game_role, :game_tag, :game_alt_role, :armory_addr)\n end",
"def character_params\n params.require(:character).permit(:character_name, :player_name, :age, :gender, :eyes, :height, :hair, :weight, :gear, :description, :history, :cr... | [
"0.76103175",
"0.7417749",
"0.74140656",
"0.73703057",
"0.7364263",
"0.7350343",
"0.73170125",
"0.7304244",
"0.72582036",
"0.72552466",
"0.7218252",
"0.7184354",
"0.7183996",
"0.71728724",
"0.71727735",
"0.7171416",
"0.7164926",
"0.7154677",
"0.71334034",
"0.7127661",
"0.7121... | 0.7468841 | 1 |
Add a Folder for the current folder Params: +name+:: name of folder to be added | def add_folder name
elem = ElemFolder.new(name)
add_element(elem)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end",
"def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"... | [
"0.7740278",
"0.7740278",
"0.76704735",
"0.7280327",
"0.71587616",
"0.7085225",
"0.7075618",
"0.70697266",
"0.6842365",
"0.6830296",
"0.67800593",
"0.67649883",
"0.6700125",
"0.6670615",
"0.66006",
"0.65650284",
"0.6534593",
"0.6488611",
"0.63358396",
"0.6333733",
"0.6244556"... | 0.82934535 | 0 |
Add an Image for this folder Params: +name+:: name of image to be added +data+:: data file name encoded using base 64 | def add_image(name, data)
elem = ElemImage.new(name, data)
add_element(elem)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_image(name, path)\n @image_manager.add_existing_image(name, path)\n end",
"def add(image_name, type)\n image = Image.read(@folder+\"/\"+image_name)[0]\n # @width ||= image.columns\n # @height ||= image.rows\n add_type(image,type)\n @images << image\n end",
"def createIcon(data, icon... | [
"0.64227504",
"0.63109964",
"0.6143983",
"0.6098319",
"0.6084015",
"0.6067321",
"0.60552454",
"0.6002126",
"0.58958125",
"0.5850425",
"0.5779448",
"0.57618487",
"0.57561904",
"0.5747752",
"0.5657242",
"0.56231314",
"0.5613889",
"0.55453867",
"0.55277896",
"0.5507104",
"0.5505... | 0.7275797 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.