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 |
|---|---|---|---|---|---|---|
Exception handler called when the performance of an action raises an exception. | def rescue_action(exception)
log_error(exception) unless logger.nil?
if consider_all_requests_local || local_request?
rescue_action_locally(exception)
else
rescue_action_in_public(exception)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def exception_handler; end",
"def exception_handler(ex)\n \nend",
"def rescue_action(e); raise e; end",
"def process_action(*args)\n super\n rescue ... | [
"0.70532775",
"0.70532775",
"0.70532775",
"0.70532775",
"0.7029266",
"0.69289756",
"0.6922621",
"0.6841352",
"0.6635382",
"0.6467078",
"0.63432395",
"0.6294149",
"0.6284292",
"0.61866593",
"0.61778235",
"0.6122075",
"0.61210626",
"0.6094156",
"0.6070316",
"0.60647213",
"0.605... | 0.6007206 | 23 |
Overwrite to implement custom logging of errors. By default logs as fatal. | def log_error(exception) #:doc:
if ActionView::TemplateError === exception
logger.fatal(exception.to_s)
else
logger.fatal(
"\n\n#{exception.class} (#{exception.message}):\n " +
clean_backtrace(exception).join("\n ") +
"\n\n"
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fatal(msg); @logger.fatal(msg); end",
"def error(msg); @logger.error(msg); end",
"def fatal(message)\n log(4, message)\n end",
"def fatal(*args)\n log(*args)\n fail_now\n end",
"def fatal(msg)\n logger.fatal msg\n end",
"def fatal(msg) log(FATAL, \"FATAL \" << format(msg)... | [
"0.73099035",
"0.6945621",
"0.67913467",
"0.6784043",
"0.67269146",
"0.6723689",
"0.66577005",
"0.6656997",
"0.66544837",
"0.65693283",
"0.65693283",
"0.65693283",
"0.6563614",
"0.65523416",
"0.6542061",
"0.65316445",
"0.6519924",
"0.65118873",
"0.65096015",
"0.6504362",
"0.6... | 0.5834101 | 86 |
Overwrite to implement public exception handling (for requests answering false to local_request?). | def rescue_action_in_public(exception) #:doc:
render_text "<html><body><h1>Application error (Rails)</h1></body></html>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_request_error(exception)\n end",
"def serve_exception(_exception); end",
"def abort_on_exception(*) end",
"def abort_on_exception=(*) end",
"def wrapped_exception; end",
"def exception_handler; end",
"def is_exception?; end",
"def server_error?; end",
"def respond_bad_request; make_resp... | [
"0.71346956",
"0.6864399",
"0.68486553",
"0.67631716",
"0.6696974",
"0.6639288",
"0.65948355",
"0.6588481",
"0.64793456",
"0.64716864",
"0.64696455",
"0.6410618",
"0.63530475",
"0.6326964",
"0.630591",
"0.62972033",
"0.6293544",
"0.62822443",
"0.62674904",
"0.6267001",
"0.624... | 0.0 | -1 |
Overwrite to expand the meaning of a local request in order to show local rescues on other occurances than the remote IP being 127.0.0.1. For example, this could include the IP of the developer machine when debugging remotely. | def local_request? #:doc:
@request.remote_addr == "127.0.0.1"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_request? #:doc:\n request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST\n end",
"def local_request? #:doc:\n request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST\n end",
"def local_request?()\n return true if %w( development test ).include?(Rails.... | [
"0.64021605",
"0.64021605",
"0.63067764",
"0.63067764",
"0.62527925",
"0.6127323",
"0.5992975",
"0.5992975",
"0.59674674",
"0.5888512",
"0.58279514",
"0.580215",
"0.5795832",
"0.57882535",
"0.57882535",
"0.5769815",
"0.5719964",
"0.570767",
"0.5694553",
"0.5659948",
"0.565606... | 0.6258805 | 5 |
Renders a detailed diagnostics screen on action exceptions. | def rescue_action_locally(exception)
@exception = exception
@rescues_path = File.dirname(__FILE__) + "/templates/rescues/"
add_variables_to_assigns
@contents = @template.render_file(template_path_for_local_rescue(exception), false)
@headers["Content-Type"] = "text/html"
render_file(rescues_path("layout"), "500 Internal Error")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rescue_action(exception)\n @message = exception.message\n @backtrace = exception.backtrace.join(\"\\n\") unless exception.nil?\n logger.info @message\n logger.info @backtrace\n render :file => \"#{RAILS_ROOT}/app/views/errors/error.rhtml\", :layout=> false, :status => 404\n end",
"def show_de... | [
"0.7090987",
"0.6866481",
"0.6565763",
"0.6374556",
"0.6367066",
"0.6263703",
"0.62625855",
"0.62474465",
"0.6246485",
"0.6245408",
"0.62429893",
"0.61952895",
"0.60968935",
"0.60960615",
"0.60771024",
"0.60467863",
"0.5985887",
"0.5984449",
"0.5941006",
"0.5936079",
"0.59194... | 0.6063134 | 15 |
strong parameters /safe guard from mass assignment | def address_params
params[:address].permit(:user_id, :street, :city, :pin, :title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_attributes=(attrs, user=User.current)\n return unless attrs.is_a?(Hash)\n\n attrs = attrs.dup\n attrs = delete_unsafe_attributes(attrs, user)\n \n return if attrs.empty?\n\n # mass-assignment security bypass\n assign_attributes attrs, :without_protection => true\n end",
"def saniti... | [
"0.6650437",
"0.6547737",
"0.6547737",
"0.6437754",
"0.6396407",
"0.63740087",
"0.635594",
"0.635594",
"0.63110334",
"0.6277052",
"0.6267508",
"0.62641597",
"0.6257784",
"0.6255771",
"0.6239609",
"0.6227382",
"0.622628",
"0.6160975",
"0.615994",
"0.6145809",
"0.61449534",
"... | 0.0 | -1 |
Public: Grabs the next frame and prepares it for detection. The process is as follows: Grab a frame from the capture source Calculate the delta mask by subtracting the background Run a threshold on the background to eliminate shadows Erode and dilate the delta image as a second step to remove shadows. | def with_cycle(cycle_number = nil)
@frame = nil
# Loop until we get a (perspective corrected) frame from the map.
while !@frame do
@camera.set(CAMERA_OPTIONS) if @live
@frame = @map.frame
end
# We only count processing times as soon as we get the map. Seen as
# this is a really fast operation (and most of the time is spent on
# background subtration).
cycle_start = Time.now
next_cycle!
Log4r::NDC.push("##{ @cycle }") if cycle_number
@delta = @bg_subtractor.subtract(@frame, LEARNING_RATE)
# Resize the frames
[@frame, @delta].map do |img|
img.resize!(Size.new(Map::A0_HEIGHT, Map::A0_WIDTH))
end
# Turn all pixels until 128.0 to 0.0.
@delta.threshold! 128.0, 255.0
# Contract shapes.
@delta.erode!(EROSION_AMOUNT)
# Save stuff
if @debug
@frame.write "#{ Theia.tmp_path }/#{ "%04i" % @cycle }-frame.png"
@delta.write "#{ Theia.tmp_path }/#{ "%04i" % @cycle }-delta.png"
end
yield @frame, @delta
cycle_finish = Time.now
msecs = (cycle_finish - cycle_start)
# After measuring how long it took to process the frame, add it to
# processing times, make sure we only account for the last 10
# measurements, average them out and divide them by 1 (sec). This
# gives us the FPS.
@processing_times << msecs
@processing_times.shift if @processing_times.length > 10
@fps = 1.0 / @processing_times.mean
ensure
Log4r::NDC.pop if cycle_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take\n check\n `adb pull /dev/graphics/fb0 fb0`\n `dd bs=1920 count=800 if=fb0 of=fb0b`\n `ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 480x800 -i fb0 -f image2 -vcodec png #{@destination_folder}/#{@prefix}#{@no}.png`\n `rm fb0b`\n end",
"def frame\n @cap... | [
"0.5764144",
"0.5697106",
"0.5686045",
"0.54953426",
"0.54810065",
"0.54605556",
"0.53902674",
"0.5385765",
"0.5211709",
"0.51832473",
"0.51578534",
"0.51454633",
"0.50896716",
"0.50258684",
"0.50167793",
"0.50079465",
"0.497904",
"0.49656343",
"0.49429202",
"0.4921613",
"0.4... | 0.5507612 | 3 |
Public: Iterates through contours and yields them. | def with_each_contour
contours.each do |contour|
# Generate a MASK based on the current contour, and erode it so
# that we can get rid of some of the shadow around the piece.
# The whole map is black and the piece is white.
yield contour, grab_color_from_contour(contour)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contour( *args )\n return bezier.contour\n end",
"def get_contour_points_adv()\r\n result = []\r\n idx = 0\r\n result[idx] = Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n# puts \" outer #{result[idx].length} #{result[idx]} \"\r\n @active_face.loop... | [
"0.60089713",
"0.5678124",
"0.559642",
"0.549338",
"0.52676505",
"0.5193994",
"0.5161028",
"0.5131451",
"0.50493115",
"0.5042759",
"0.50266737",
"0.4899071",
"0.48570544",
"0.48410073",
"0.4837293",
"0.48018655",
"0.4788069",
"0.47867218",
"0.47665426",
"0.47369778",
"0.47241... | 0.7435681 | 0 |
Ask user for input Save vowels and consonants so that you can change to the next letter Swap first and last name by asking for each part of name and then adding it starting with last + first Make the translated code go into a new array Add a hash at the end to store the names | def alias_creator(nickname)
vowels="aeiou"
consonants="bcdfghjklmnpqrstvwxyz"
#consonants exclude all vowels
nickname_split=nickname.split("")
new_nickname=[]
#The translated nickname will be saved in the new_nickname arrawy
nickname_split.map! do |x|
if vowels.include?(x)
new_nickname << vowels[vowels.index(x)+1]
elsif consonants.include?(x)
new_nickname << consonants[consonants.index(x)+1]
elsif x == " "
new_nickname << " "
end
end
new_nickname.join("").split.map {|x| x.capitalize}.join(" ")
#We are doing this so that we capitalize the first letter of both words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namecoder\n valid_input = false\n until valid_input\n secret_name_database = []\n \n puts \"Whats your first name?\"\n fname = gets.chomp.downcase.split('')\n puts \"What's your last name?\"\n lname = gets.chomp.downcase.split('')\n original_name = [fname,\" \", lname].join\n fullna... | [
"0.79662883",
"0.7713442",
"0.7711268",
"0.7619452",
"0.7580007",
"0.7563903",
"0.7547847",
"0.7466393",
"0.74379456",
"0.7319693",
"0.72768354",
"0.72687477",
"0.72406626",
"0.72405505",
"0.72147334",
"0.72056395",
"0.71974885",
"0.7190954",
"0.71695256",
"0.7083699",
"0.706... | 0.7218378 | 14 |
=begin Savings Related =end | def update_total_savings_account
incoming = member.savings_entries.where(
:savings_status => SAVINGS_STATUS[:savings_account],
:direction => FUND_DIRECTION[:incoming]
).sum("amount")
outgoing = member.savings_entries.where(
:savings_status => SAVINGS_STATUS[:savings_account],
).sum("amount")
self.total_savings_account = incoming - outgoing
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def savings(inc_vat:)\n price_calculator.savings(inc_vat: inc_vat)\n end",
"def stock_market; end",
"def savings\n read_attribute(:price) - read_attribute(:sale_price)\n end",
"def annualized_portfolio_amount_needed\n savings_portion_needed * 12.0\n end",
"def book_sales(period='enddate', basis... | [
"0.6275364",
"0.5767553",
"0.5746997",
"0.5744801",
"0.56642556",
"0.5645332",
"0.5603326",
"0.5585042",
"0.5562884",
"0.5536648",
"0.5533023",
"0.55208504",
"0.5501514",
"0.547009",
"0.54682106",
"0.54283625",
"0.54234743",
"0.54034615",
"0.5385218",
"0.538247",
"0.5351512",... | 0.51045537 | 43 |
metodo que crea los frames | def matrix
10.times do |round|
@score_table.push([])
rolls
if round == 9 && @suma == 10
if @suma == 10
@roll_three = rand(0..10)
@score += @roll_three
llenado(4, round)
end
else
llenado(3, round)
end
end
bonus = Score.new(@score_table)
bonus.bonus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end",
"def build_frames\n prev_frame = nil\n 10.times.map do |frame_number|\n prev_frame ... | [
"0.7582912",
"0.7371906",
"0.7366729",
"0.7116567",
"0.6987366",
"0.6696666",
"0.6456462",
"0.6291647",
"0.6282093",
"0.62450194",
"0.6211275",
"0.61752737",
"0.61316735",
"0.6096042",
"0.6093267",
"0.60881716",
"0.60881716",
"0.6063691",
"0.60539216",
"0.6007254",
"0.5991986... | 0.0 | -1 |
metodo que llena los frames | def llenado(numero, round)
numero.times do |columns|
@score_table[round][columns] = tiros(columns)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frames; end",
"def frames\n _nudge[3]\n end",
"def frame=(pos); end",
"def frame; end",
"def frames; motion.frames; end",
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = ... | [
"0.8589545",
"0.73132855",
"0.72158456",
"0.71395475",
"0.7058525",
"0.7052266",
"0.6854691",
"0.6780105",
"0.6776601",
"0.67535096",
"0.6684968",
"0.66157055",
"0.6610187",
"0.65869415",
"0.65182",
"0.6484023",
"0.6372667",
"0.6341841",
"0.6341841",
"0.62912405",
"0.6271168"... | 0.0 | -1 |
Metodo que muestra los frames | def show
10.times do |round|
@cadena = ''
if round == 9
show_auxiliar(4, round, @cadena)
else
show_auxiliar(3, round, @cadena)
end
puts "#{@cadena}\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frames; end",
"def frame; end",
"def frame=(pos); end",
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end",
"def c_frame?; end",
"def... | [
"0.85845155",
"0.7584838",
"0.73254853",
"0.7113471",
"0.6955063",
"0.6818274",
"0.6782232",
"0.6754397",
"0.67473024",
"0.66151756",
"0.6511677",
"0.6446934",
"0.6441692",
"0.64107955",
"0.63725597",
"0.6370485",
"0.6357772",
"0.6311363",
"0.6309925",
"0.6305402",
"0.6303264... | 0.0 | -1 |
Metodo switch para rellenar la matriz | def tiros(columns)
case columns
when 0
@roll_one
when 1
@roll_two
when 2
@score
else
@roll_three
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix\n end",
"def principal\n op=0\n while (op!=5)\n op= menu1\n case op\n when 1\n\tputs \"CREAR MATRICES\"\n\tputs \"Introduce la dimension de las matriz 1: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1\... | [
"0.6669849",
"0.64438766",
"0.63313633",
"0.62931114",
"0.6205714",
"0.6169655",
"0.6119537",
"0.61051834",
"0.6076336",
"0.6004007",
"0.5978644",
"0.596345",
"0.5926436",
"0.5923426",
"0.589799",
"0.58484995",
"0.5779267",
"0.57717454",
"0.5753438",
"0.5746196",
"0.57262516"... | 0.0 | -1 |
GET /nature_financings GET /nature_financings.json | def index
@nature_financings = NatureFinancing.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n form... | [
"0.66428757",
"0.62522465",
"0.6037751",
"0.6009311",
"0.5964351",
"0.5962566",
"0.59222186",
"0.5899061",
"0.58915544",
"0.58852136",
"0.58818626",
"0.58692473",
"0.58586335",
"0.584415",
"0.58214456",
"0.5809563",
"0.5794413",
"0.578763",
"0.578101",
"0.5777905",
"0.5756194... | 0.7403564 | 0 |
GET /nature_financings/1 GET /nature_financings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @nature_financings = NatureFinancing.all\n end",
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def show\n... | [
"0.72915167",
"0.68248355",
"0.6327514",
"0.6265682",
"0.62127054",
"0.60246485",
"0.6022422",
"0.6012324",
"0.6007121",
"0.59941745",
"0.5985369",
"0.5964428",
"0.5923561",
"0.5890361",
"0.5886626",
"0.5885426",
"0.58840656",
"0.58838266",
"0.5881547",
"0.58787084",
"0.58772... | 0.0 | -1 |
POST /nature_financings POST /nature_financings.json | def create
@nature_financing = NatureFinancing.new(nature_financing_params)
@nature_financing.institute = current_institute
respond_to do |format|
if @nature_financing.save
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }
format.json { render :show, status: :created, location: @nature_financing }
else
format.html { render :new }
format.json { render json: @nature_financing.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nature_financing_params\n params.require(:nature_financing).permit(:title, :description, :institute_id)\n end",
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to... | [
"0.6604814",
"0.6420883",
"0.638493",
"0.6008372",
"0.59575504",
"0.592031",
"0.5761156",
"0.57413477",
"0.56809795",
"0.56630325",
"0.563797",
"0.5607012",
"0.5606789",
"0.56050414",
"0.5593278",
"0.5548935",
"0.55449504",
"0.55356085",
"0.55339384",
"0.55339384",
"0.5530416... | 0.6804349 | 0 |
PATCH/PUT /nature_financings/1 PATCH/PUT /nature_financings/1.json | def update
respond_to do |format|
if @nature_financing.update(nature_financing_params)
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }
format.json { render :show, status: :ok, location: @nature_financing }
else
format.html { render :edit }
format.json { render json: @nature_financing.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n ... | [
"0.68497854",
"0.6820507",
"0.61943775",
"0.61264604",
"0.6111212",
"0.6064038",
"0.60610753",
"0.60450727",
"0.60300046",
"0.60036325",
"0.5999813",
"0.5993303",
"0.5987237",
"0.5986764",
"0.5986676",
"0.59830415",
"0.59792536",
"0.5975104",
"0.5968804",
"0.59637606",
"0.596... | 0.7074337 | 0 |
DELETE /nature_financings/1 DELETE /nature_financings/1.json | def destroy
@nature_financing.destroy
respond_to do |format|
format.html { redirect_to nature_financings_url, notice: 'Nature financing was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @socio_doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to socio_doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foiltype = ... | [
"0.6873725",
"0.6706721",
"0.67030793",
"0.6683761",
"0.6608549",
"0.65908784",
"0.65865266",
"0.6575249",
"0.65596765",
"0.6547893",
"0.6520962",
"0.65199906",
"0.6508244",
"0.6507091",
"0.6505291",
"0.6505291",
"0.65048474",
"0.6492816",
"0.6486912",
"0.64862823",
"0.648151... | 0.7301639 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_nature_financing
begin
@nature_financing = current_institute.nature_financings.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to nature_financings_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def nature_financing_params
params.require(:nature_financing).permit(:title, :description, :institute_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
GET /inventory_snapshot_contents GET /inventory_snapshot_contents.json | def index
@inventory_snapshot_contents = InventorySnapshotContent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.f... | [
"0.68496674",
"0.6571057",
"0.65362597",
"0.6531449",
"0.6490074",
"0.6254804",
"0.6193462",
"0.61878216",
"0.61849135",
"0.60949624",
"0.6060234",
"0.60109794",
"0.6005607",
"0.60007113",
"0.59459823",
"0.5931839",
"0.58714306",
"0.5845803",
"0.58300704",
"0.5812881",
"0.578... | 0.76583564 | 0 |
GET /inventory_snapshot_contents/1 GET /inventory_snapshot_contents/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def set_inv... | [
"0.76774454",
"0.6707781",
"0.6662215",
"0.6516531",
"0.6456946",
"0.63349783",
"0.6293955",
"0.6239831",
"0.60875183",
"0.6057676",
"0.6033851",
"0.6019267",
"0.60180235",
"0.60124",
"0.59836453",
"0.5956271",
"0.58814824",
"0.5877155",
"0.5863907",
"0.58595973",
"0.5850956"... | 0.0 | -1 |
POST /inventory_snapshot_contents POST /inventory_snapshot_contents.json | def create
@inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)
respond_to do |format|
if @inventory_snapshot_content.save
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }
format.json { render :show, status: :created, location: @inventory_snapshot_content }
else
format.html { render :new }
format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def inventory_snapshot_content_params\n params.require(:inventory_snapshot_content).permit(:in... | [
"0.7063605",
"0.6874044",
"0.65961987",
"0.65095544",
"0.623067",
"0.6076004",
"0.5891567",
"0.5864759",
"0.58224505",
"0.57561773",
"0.5733231",
"0.5695487",
"0.5695487",
"0.5670691",
"0.5603551",
"0.5540606",
"0.549805",
"0.5497956",
"0.5493898",
"0.54928637",
"0.54853433",... | 0.69451535 | 1 |
PATCH/PUT /inventory_snapshot_contents/1 PATCH/PUT /inventory_snapshot_contents/1.json | def update
respond_to do |format|
if @inventory_snapshot_content.update(inventory_snapshot_content_params)
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_snapshot_content }
else
format.html { render :edit }
format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n flash[:notice] = 'Snapshot was successfully updated.'\n format.html { redi... | [
"0.63918066",
"0.6122518",
"0.61052436",
"0.60411817",
"0.5987605",
"0.59689766",
"0.5941832",
"0.5919314",
"0.59164494",
"0.5915763",
"0.58930266",
"0.5860993",
"0.5847519",
"0.5847519",
"0.5847519",
"0.58218503",
"0.58218503",
"0.58209634",
"0.581484",
"0.5792977",
"0.57495... | 0.72562665 | 0 |
DELETE /inventory_snapshot_contents/1 DELETE /inventory_snapshot_contents/1.json | def destroy
@inventory_snapshot_content.destroy
respond_to do |format|
format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_snapshot(snapshot_id)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end... | [
"0.71034294",
"0.6989312",
"0.698219",
"0.6873329",
"0.6862213",
"0.67356247",
"0.67318803",
"0.67318803",
"0.66691077",
"0.66383034",
"0.6449294",
"0.64359504",
"0.64261997",
"0.6413788",
"0.6397142",
"0.63857067",
"0.63417417",
"0.63295454",
"0.632338",
"0.6293428",
"0.6273... | 0.74888015 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_inventory_snapshot_content
@inventory_snapshot_content = InventorySnapshotContent.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def inventory_snapshot_content_params
params.require(:inventory_snapshot_content).permit(:inventory_snapshot_id, :rfid_hardware_id, :trackable_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
before_action :configure_account_update_params, only: [:update] GET /resource/sign_up | def new
@user = User.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_account_update_params\n devise_parameter_sanitizer.permit(\n :account_update, keys: authentication_params(type: :sign_up)\n )\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:password, :password_confirmation, :first_name, :las... | [
"0.7499267",
"0.71698177",
"0.7040482",
"0.7001558",
"0.69494694",
"0.6947952",
"0.6911424",
"0.6848661",
"0.6848325",
"0.6831332",
"0.68107826",
"0.6782843",
"0.67642134",
"0.6758337",
"0.6755052",
"0.67527187",
"0.6745702",
"0.6733424",
"0.6731361",
"0.6719885",
"0.67175007... | 0.0 | -1 |
GET /resource/edit def edit super end PUT /resource | def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
resource_updated = update_resource(resource, account_update_params)
yield resource if block_given?
if resource_updated
if is_flashing_format?
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
:update_needs_confirmation : :updated
set_flash_message :notice, flash_key
end
sign_in resource_name, resource, bypass: true
respond_with resource, location: after_update_path_for(resource)
else
clean_up_passwords resource
respond_with resource
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n respond_with(resource)\n end",
"def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end",
"def edit\... | [
"0.84682256",
"0.79906833",
"0.784054",
"0.76603776",
"0.7518685",
"0.7514583",
"0.7485632",
"0.7473292",
"0.73174673",
"0.73140186",
"0.73098606",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759"... | 0.0 | -1 |
If you have extra params to permit, append them to the sanitizer. | def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:role, :first_name, :last_name, :company_name, :postal_code, :city, :province, :gender, :birth_date])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6... | 0.0 | -1 |
If you have extra params to permit, append them to the sanitizer. | def configure_account_update_params
devise_parameter_sanitizer.permit(:account_update, keys: [:role])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6... | 0.0 | -1 |
Raises an error depending on the mode | def raise_error_with(message, **arguments)
message = message.call(**arguments) if message.is_a?(Proc)
raise self.class.argument_error_class, message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_mode; end",
"def error_mode=(_arg0); end",
"def error?; @level <= ERROR; end",
"def error?; @level <= ERROR; end",
"def mode\n raise \"Not implemented\"\n end",
"def error?; end",
"def error?; end",
"def error?; end",
"def error?()\n #This is a stub, used for indexing\n ... | [
"0.7741705",
"0.76432985",
"0.6749671",
"0.6749671",
"0.65676486",
"0.6463306",
"0.6463306",
"0.6463306",
"0.6212837",
"0.61819977",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.6096074",
"0.60069615",
"0.59988827",
"0.5... | 0.0 | -1 |
GET /trips GET /trips.json | def index
@trips = Trip.all
@now = Date.today
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @t... | [
"0.819985",
"0.8043565",
"0.7999928",
"0.7999928",
"0.7953077",
"0.79234964",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.74755937",
"0.7470587",
"0.74533826",
"0.7362053",
"0.73253477",
"0.73083544",
"0.72763485",
"0.72763485... | 0.6161163 | 66 |
GET /trips/1 GET /trips/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all... | [
"0.7947563",
"0.77819043",
"0.77819043",
"0.77373976",
"0.77221835",
"0.76180017",
"0.74432886",
"0.73136485",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.7163972",
"0.71326137",
"0.70854133",
"0.7082617",
"0.70766836",
"0.7049975",
... | 0.0 | -1 |
POST /trips POST /trips.json | def create
@trip = Trip.new(trip_params)
@trip.user = @current_user
@trip.users.append(current_user)
respond_to do |format|
if @trip.save
format.html { redirect_to @trip, notice: 'Trip was successfully created.' }
format.json { render json: {message: 'Utworzono tripa.', admin_id: @trip.user_id}, status: :ok }
else
format.html { render :new }
format.json {
render json:
{errors: @trip.errors}, status: :unprocessable_entity
}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n ... | [
"0.7208045",
"0.70307076",
"0.6864295",
"0.68321437",
"0.6772133",
"0.6772133",
"0.6692161",
"0.66867685",
"0.664916",
"0.6610407",
"0.6559959",
"0.6522311",
"0.6514665",
"0.6384032",
"0.63697636",
"0.6347624",
"0.6323213",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
... | 0.56690204 | 85 |
PATCH/PUT /trips/1 PATCH/PUT /trips/1.json | def update
respond_to do |format|
if @trip.update(trip_params)
format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }
format.json { render :show, status: :ok, location: @trip }
else
format.html { render :edit }
format.json { render json: @trip.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.6753636",
"0.67453563",
"0.6706192",
"0.6706192",
"0.67016983",
"0.6695184",
"0.65354353",
"0.6473278",
"0.6462758",
"0.6444298",
"0.6444298",
"0.6427983",
"0.64206475",
"0.6391811",
"0.6363443",
"0.63565403",
"0.63495326",
"0.63475513",
"0.63218755",
"0.62844306",
"0.6271... | 0.6330609 | 23 |
DELETE /trips/1 DELETE /trips/1.json | def destroy
@trip = Trip.find(params[:trip])
if current_user.trips.include?(@trip)
@trip.destroy
render json: {message: "usunięto tripa"}
else
@trip.errors.add(:permissions, 'brak uprawnień')
render json: { errors: @trip.errors }, status: :unauthorized
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @trip = Trips.find_trip( params[ :id ])\n end",
"def destroy\n @trip = Trip.find(par... | [
"0.74131525",
"0.7404101",
"0.73837495",
"0.73837495",
"0.7373286",
"0.7373286",
"0.7373286",
"0.7302994",
"0.7280395",
"0.72525823",
"0.72525823",
"0.72525823",
"0.7190258",
"0.7190258",
"0.7190258",
"0.7182205",
"0.71414",
"0.7120381",
"0.70009905",
"0.6918324",
"0.69046646... | 0.6732516 | 34 |
Use callbacks to share common setup or constraints between actions. | def set_trip
@trip = Trip.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def trip_params
params.require(:trip).permit(:name, :start_date, :end_date, :town_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Take a file, get all the lines until matching termination_pattern. We are searching for // in particular, which are the termination characters for the cds. TODO: make the method general for any String object, and not for file objects. | def get_sequence(file, termination_pattern, keep_last = nil)
assert(file.class == File, "#{file} is not a valid File object.")
assert(termination_pattern.class == Regexp, "#{termination_pattern} is not a valid Regexp object.")
out = ""
line = file.gets
# Continue reading file lines until file ends or
# line match termination_pattern
while (!file.eof? && !line.match(termination_pattern)) do
out += line
line = file.gets # read next line
end
if keep_last
out += line
end
if (!line.match(termination_pattern))
abort("Error: Cannot find termination pattern.")
end
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def get_lines raw_file\n lines = raw_file.split(\"\\n\").compact\n lines = lines.un... | [
"0.6186355",
"0.6186355",
"0.5688657",
"0.5572266",
"0.5494056",
"0.54769635",
"0.5469907",
"0.54392624",
"0.5434705",
"0.53960973",
"0.53926474",
"0.53635836",
"0.5352465",
"0.53516716",
"0.5276789",
"0.52446127",
"0.5197745",
"0.51373065",
"0.51366985",
"0.5135233",
"0.5125... | 0.6285695 | 0 |
group sequence in 80 characters lines long the 80th character is '\n' TODO: try to pass sequence by reference (think 'yeld' statement is involved) | def group_sequence (sequence, length)
temp_sequence = ""
index = 0; cont = 0
while sequence[index] != nil do
temp_sequence += sequence[index]
index += 1
if cont < length - 1
cont += 1
else
temp_sequence += "\n"
cont = 0
end
end
temp_sequence
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string2seq seq\n numN = (seq.length-1) / 60\n for i in 1..numN\n index = i*61 - 1\n seq.insert(index,\"\\n\")\n end\n return seq \nend",
"def sequence_lined(char_per_line)\n counter = char_per_line\n sequence_lined = \"\"\n sequence.each_char { |ch|\n sequence_lined.concat(ch)\n ... | [
"0.70442134",
"0.6604634",
"0.6344033",
"0.6255229",
"0.6180489",
"0.60526514",
"0.5995365",
"0.59914327",
"0.5963045",
"0.5961926",
"0.59178966",
"0.58994865",
"0.5895896",
"0.58919954",
"0.5863008",
"0.58487666",
"0.58373606",
"0.58156574",
"0.580436",
"0.57835954",
"0.5719... | 0.75298303 | 0 |
Given a complete CDS sequence (trimmed and concatenated), calculates sequence codons distribution | def frequency_distribution (sequence, length_pattern)
assert(length_pattern > 0, "The pattern length must be grater than 0")
frequency = Hash.new
index = 0
while index < sequence.length do
codon = sequence[index .. index + length_pattern - 1]
frequency[codon] == nil ? frequency[codon] = 1 : frequency[codon] += 1
index += length_pattern
end
frequency
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cds_seq\n cds_length = self.coding_region_cdna_end - self.coding_region_cdna_start + 1\n \n return self.seq[(self.coding_region_cdna_start - 1), cds_length]\n end",
"def gcThree #average gc 3 values for seqs\n freqs = Array.new\n self.codons.each{ | eachRow |\n gcCount... | [
"0.59478086",
"0.55945766",
"0.55867183",
"0.5581686",
"0.55613106",
"0.5481199",
"0.5469836",
"0.53891253",
"0.53622663",
"0.5349391",
"0.5330358",
"0.5327501",
"0.53221565",
"0.5314202",
"0.5310147",
"0.530708",
"0.52785164",
"0.5266239",
"0.5258946",
"0.5217964",
"0.518615... | 0.55862707 | 3 |
Send the user an email saying the bulk observation import encountered an error. | def bulk_observation_error( user, filename, error_details )
@user = user
@message = error_details[:reason]
@errors = error_details[:errors]
@field_options = error_details[:field_options]
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:were_sorry_but_your_bulk_import_of_filename_has_failed,
{ filename: filename }
]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startup_import_failed(user)\n @user = user\n mail(:to => user.email, :subject => _('Startup import failed on %s.') % [\n Doers::Config.app_name])\n end",
"def bulk_observation_success( user, filename )\n @user = user\n @filename = filename\n mail_with_defaults(\n to: \"#{user.name} ... | [
"0.7121073",
"0.7028098",
"0.688409",
"0.672163",
"0.66173947",
"0.64790744",
"0.64095193",
"0.6355795",
"0.63334626",
"0.6326061",
"0.62635976",
"0.62318677",
"0.6212769",
"0.6197572",
"0.61504775",
"0.6117635",
"0.61053604",
"0.6094399",
"0.6081655",
"0.6038021",
"0.6022153... | 0.8026312 | 0 |
Send the user an email saying the bulk observation import was successful. | def bulk_observation_success( user, filename )
@user = user
@filename = filename
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:bulk_import_of_filename_is_complete,
{ filename: filename }
]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end",
"def bulk_observation_error( user, filename, error_... | [
"0.6828059",
"0.6817229",
"0.65598416",
"0.6248235",
"0.613114",
"0.60800695",
"0.59730613",
"0.59607154",
"0.5936173",
"0.59326285",
"0.58989424",
"0.5888067",
"0.58783627",
"0.58548117",
"0.5841181",
"0.58194315",
"0.581422",
"0.58033085",
"0.5798732",
"0.57891613",
"0.5767... | 0.8169935 | 0 |
Usage: Google::Reader::Label.new('friends') Google::Reader::Label.new('friends', false) Google::Reader::Label.new('friends', false, 3) | def initialize(name, shared=false, count=0)
self.name = name
self.shared = shared
self.count = count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_label label\n @labels[label] = true\n\n label\nend",
"def label; end",
"def label; end",
"def labels\n all.select { |c| c.google_id =~ /^user/ }.collect { |c| Label.new(c.google_id, nil, c.count) }\n end",
"def label(lname)\n $labels[lname] = $iptr\nend",
"def create_label(node... | [
"0.6032051",
"0.5854021",
"0.5854021",
"0.5767846",
"0.56982565",
"0.5677998",
"0.5655394",
"0.5633246",
"0.5605168",
"0.55450964",
"0.5473122",
"0.54662097",
"0.54630727",
"0.54626113",
"0.54202855",
"0.5412316",
"0.5397839",
"0.5357275",
"0.53293896",
"0.53003687",
"0.52870... | 0.0 | -1 |
Returns name; converts broadcast label to shared to be consistent with google | def name
@name == 'broadcast' ? 'shared' : @name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_name\n @normalized_name ||= if self.name.start_with?(ClientConstants::GLOBAL_PLAYLIST_PREFIX)\n self.name[2..-1]\n else\n self.name\n end\n end",
"def human_name\n \"reverse UDP\"\n end",
"def label_name(product)\n return product.label_override unless product.label_o... | [
"0.5969148",
"0.59362423",
"0.59199756",
"0.57583636",
"0.5734359",
"0.5624824",
"0.5557625",
"0.5550942",
"0.55457973",
"0.55219597",
"0.55169463",
"0.55048835",
"0.5504671",
"0.54974896",
"0.54896873",
"0.54806745",
"0.5469429",
"0.54642653",
"0.5458646",
"0.54083604",
"0.5... | 0.7227313 | 0 |
Usage: Google::Reader::Label.new('friends').entries Google::Reader::Label.new('friends').entries(:all, :n => 25) Google::Reader::Label.new('friends').entries(:unread) Google::Reader::Label.new('friends').entries(:unread, :n => 25) To use with continuations: unread = Google::Reader::Label.new('friends').entries(:unread) next_unread = Google::Reader::Label.new('friends').entries(:unread, :c => unread.continuation) The examples above would grab the first 15 unread entries and then using google reader's continuations, the next 15 unread after the first 15. | def entries(which=nil, o={})
options = {:n => 15,}.merge(o)
query_str = valid_keys_to_query_string(o)
url = case which.to_s
when 'unread'
sprintf(LABEL_URL, @name) + "?xt=#{State::READ}&#{query_str}"
else
sprintf(LABEL_URL, @name)
end
self.class.get_entries(url, :continuation => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entries(limit = nil)\n limit ||= -1\n prepare_entries(LiveJournal::Request::GetFriendsPage.new(@user, :recent => limit, :strict => false).run)\n rescue exception_block\n end",
"def get_next_entry; end",
"def initial_unread_entries\n update unread_entries: feed.entries.count\n end",
... | [
"0.54353607",
"0.53896016",
"0.5341011",
"0.5337799",
"0.5326041",
"0.51987106",
"0.5083683",
"0.5060455",
"0.5052474",
"0.5021779",
"0.5020245",
"0.49735343",
"0.4968922",
"0.4966228",
"0.49256212",
"0.49205467",
"0.49009368",
"0.48384634",
"0.48378083",
"0.4820481",
"0.4819... | 0.6037697 | 0 |
Converts a hash to a query string but only keys that are valid | def valid_keys_to_query_string(o)
str = ''
o.each { |k,v| str << "#{k}=#{v}&" if VALID_KEYS.include?(k) }
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_to_query_string(hash)\n hash.delete \"password\"\n hash.delete \"password_confirmation\"\n hash.collect {|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end",
"def hash_to_query_string(hash)\n hash.delete \"password\"\n hash.delete \"password_confirmation\"\n hash.collect {|k,v| \"#{k}=#{v}\"}.joi... | [
"0.7981429",
"0.7981429",
"0.79270375",
"0.77264994",
"0.7410117",
"0.73919785",
"0.7303997",
"0.7223133",
"0.7199999",
"0.7146574",
"0.7029694",
"0.6998005",
"0.6940396",
"0.66855156",
"0.6548372",
"0.65437925",
"0.6480525",
"0.6457247",
"0.6440795",
"0.63848615",
"0.6346777... | 0.73448867 | 6 |
before_filter :authenticate_user! prepend_before_filter :authenticate_user! | def index
# current_user.cdg_id
@@users = SoapConnection::ChoferUsers.users( (1 rescue 1) ).compact rescue []
@users = @@users
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_filter\n if current_user\n true\n end\n end",
"def login_required\n authenticate_user! \n end",
"def authenticate_user!\n redirect_to '/login' unless current_user\n end",
"def authenticate\n redirect_to :login unless user_signed_in?\n end",
"def before_filter; end",
... | [
"0.72244203",
"0.7221027",
"0.7173562",
"0.71080893",
"0.70743805",
"0.7024973",
"0.70062715",
"0.7003767",
"0.69978774",
"0.6995932",
"0.6945002",
"0.6909033",
"0.6888564",
"0.68350834",
"0.68184316",
"0.68169814",
"0.67796487",
"0.67745125",
"0.67631346",
"0.67573726",
"0.6... | 0.0 | -1 |
GET /multi_boards/1 GET /multi_boards/1.json | def show
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @multi_board }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html ... | [
"0.717086",
"0.71656495",
"0.71656495",
"0.7125509",
"0.70815754",
"0.6953657",
"0.68549836",
"0.67742854",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.67567176",
"0.67567176",
"0.6660346",
"0.6653679",
"0.66397345",
"0.662427... | 0.77802366 | 0 |
GET /multi_boards/new GET /multi_boards/new.json | def new
@multi_board = MultiBoard.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @multi_board }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board... | [
"0.765537",
"0.73813117",
"0.7373626",
"0.7373626",
"0.7373626",
"0.7358786",
"0.73242414",
"0.72853667",
"0.71558535",
"0.68685913",
"0.67852145",
"0.67022324",
"0.66908336",
"0.6659409",
"0.6654111",
"0.662626",
"0.6616006",
"0.6602182",
"0.6602182",
"0.65454155",
"0.652276... | 0.8042196 | 0 |
POST /multi_boards POST /multi_boards.json | def create
@multi_board = MultiBoard.new(params[:multi_board])
respond_to do |format|
if @multi_board.save
format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }
format.json { render json: @multi_board, status: :created, location: @multi_board }
else
format.html { render action: "new" }
format.json { render json: @multi_board.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def create\n # render json: params\n render json: UserBoards.create(params[\"user_board\"])\n end",
"def create\n\n #figure ou... | [
"0.65558285",
"0.6052207",
"0.6017639",
"0.5955247",
"0.5944999",
"0.589071",
"0.5879683",
"0.58716166",
"0.5822776",
"0.58199686",
"0.58197665",
"0.5805861",
"0.5805861",
"0.5792975",
"0.5789303",
"0.5780078",
"0.5767066",
"0.57580215",
"0.5733862",
"0.57283384",
"0.5728132"... | 0.72645885 | 0 |
PUT /multi_boards/1 PUT /multi_boards/1.json | def update
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
if @multi_board.update_attributes(params[:multi_board])
format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @multi_board.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user = User.find(params[:user_id])\n @board = @user.boards.find(params[:id])\n @board.update_column(:content, params[:board].as_json)\n respond_to do |format|\n format.json { render json: @board }\n end\n end",
"def update\n render json: UserBoards.update(params[\"id\"], par... | [
"0.63786983",
"0.6290787",
"0.6277463",
"0.61961484",
"0.61092675",
"0.6101314",
"0.609912",
"0.60944223",
"0.60743004",
"0.60743004",
"0.607125",
"0.5998887",
"0.5965327",
"0.5960679",
"0.59169346",
"0.5907754",
"0.5899616",
"0.5879339",
"0.587101",
"0.5866627",
"0.5866627",... | 0.738697 | 0 |
DELETE /multi_boards/1 DELETE /multi_boards/1.json | def destroy
@multi_board = MultiBoard.find(params[:id])
@multi_board.destroy
respond_to do |format|
format.html { redirect_to multi_boards_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_boards_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @board.des... | [
"0.7401453",
"0.73394424",
"0.7290816",
"0.7290816",
"0.7290816",
"0.72545016",
"0.72545016",
"0.7245085",
"0.721105",
"0.71041125",
"0.7101037",
"0.7099692",
"0.70849425",
"0.70300865",
"0.70039123",
"0.69742435",
"0.69690216",
"0.69690216",
"0.69690216",
"0.69690216",
"0.69... | 0.8229748 | 0 |
Zellen als Zeilen aufrufen | def rows
cells_ordered = cells.order(:y => :desc)
(0..height).map { |row_id| cells.where(y: row_id) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zuruecksetzen()\n end",
"def unsichtbar_machen()\n @fuss.unsichtbar_machen()\n @stiel.unsichtbar_machen()\n @schirm.unsichtbar_machen()\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n ... | [
"0.6275166",
"0.5999008",
"0.5922941",
"0.58124447",
"0.5674678",
"0.56488335",
"0.5548447",
"0.5519281",
"0.54978114",
"0.54978114",
"0.54978114",
"0.54978114",
"0.54675776",
"0.54675776",
"0.54675776",
"0.54675776",
"0.54675776",
"0.54675776",
"0.5404478",
"0.53855246",
"0.... | 0.0 | -1 |
Baut das Spielfeld neu auf | def build_field
return unless random_build
(0..height).each do |row_id|
build_row(row_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schubert; end",
"def zuruecksetzen()\n end",
"def suivre; end",
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def refutal()\n end",
"def terpene; end",
"def schumann; end",
"def verdi; end",
"def placebo?; fals... | [
"0.7522723",
"0.7405135",
"0.7240292",
"0.70891947",
"0.68321526",
"0.68321526",
"0.68321526",
"0.68321526",
"0.6577367",
"0.6471559",
"0.64487016",
"0.6403181",
"0.6259375",
"0.62580353",
"0.623741",
"0.6232886",
"0.62283695",
"0.62240726",
"0.6213474",
"0.60875255",
"0.6059... | 0.0 | -1 |
Initieren der Zellen beim Erstellen | def build_row(row_id)
(0..width).each do |col_id|
cells.create(y: row_id, x: col_id, random_alive: true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def init\n end",
"def init\n end",
"def init\n end",
"def at_init\n\n\t\tend",
"def initialize\n init\n end",
"def initialize\n\t\t\n\tend",
"def init\n\n end",
"def initialize\n \n end",
"def in... | [
"0.8108058",
"0.8108058",
"0.8108058",
"0.8108058",
"0.8010954",
"0.8010954",
"0.8010954",
"0.7883829",
"0.7875984",
"0.7782124",
"0.777664",
"0.7717486",
"0.7697641",
"0.7611498",
"0.7565829",
"0.7565829",
"0.7550641",
"0.752312",
"0.75176054",
"0.75176054",
"0.75051475",
... | 0.0 | -1 |
starting value ending value step value output: nil rules/constraints: test input/output algorithm/data structure: | def step(value, end_value, step)
loop do
yield(value)
break if value + step > end_value
value += step
end
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def est\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n begin\n # at line 42:11: ( dclr | asign | comp | prt | red )\n # at line 42:11: ( dclr | asign | comp | prt | red )\n alt_4 = 5\n case look_4 = @input.peek( 1 )\n ... | [
"0.5693527",
"0.5612068",
"0.5602636",
"0.5546726",
"0.55125064",
"0.5491885",
"0.5484975",
"0.5476097",
"0.5472598",
"0.54617155",
"0.54609925",
"0.5454319",
"0.5422423",
"0.5390473",
"0.53625304",
"0.5347475",
"0.53046364",
"0.53046364",
"0.53046364",
"0.53046364",
"0.52849... | 0.0 | -1 |
Retrieve the client vpn config for current user Returns the client vpn config for the currently loggedin user. | def find_current_user_vpn_config(code, opts = {})
data, _status_code, _headers = find_current_user_vpn_config_with_http_info(code, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_config\n config[client_name]\n end",
"def vpn_configuration_id\n return @vpn_configuration_id\n end",
"def client_id\n ENV['VIPPS_CLIENT_ID']\n end",
"def get_current_user_options\n response = get_current_user_meta('options')\n ... | [
"0.6358495",
"0.573225",
"0.5680149",
"0.5658015",
"0.5591358",
"0.5542105",
"0.5481544",
"0.54781246",
"0.5419859",
"0.53983325",
"0.5335912",
"0.53180736",
"0.53159946",
"0.528733",
"0.52699834",
"0.52698797",
"0.5264542",
"0.5219623",
"0.520557",
"0.5197233",
"0.5182343",
... | 0.65783453 | 0 |
Retrieve the client vpn config for current user Returns the client vpn config for the currently loggedin user. | def find_current_user_vpn_config_with_http_info(code, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.find_current_user_vpn_config ...'
end
# verify the required parameter 'code' is set
if @api_client.config.client_side_validation && code.nil?
fail ArgumentError, "Missing the required parameter 'code' when calling VPNApi.find_current_user_vpn_config"
end
# verify enum value
allowable_values = ["ewr1", "scj1", "arm1", "nrt1"]
if @api_client.config.client_side_validation && !allowable_values.include?(code)
fail ArgumentError, "invalid value for \"code\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'code'] = code
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'VPNConfig'
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.find_current_user_vpn_config",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#find_current_user_vpn_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_current_user_vpn_config(code, opts = {})\n data, _status_code, _headers = find_current_user_vpn_config_with_http_info(code, opts)\n data\n end",
"def selected_config\n config[client_name]\n end",
"def vpn_configuration_id\n return @vpn_configuration_id\n ... | [
"0.6579705",
"0.63586915",
"0.573316",
"0.5678917",
"0.56588316",
"0.5591889",
"0.55420953",
"0.54815334",
"0.54779655",
"0.541976",
"0.53990734",
"0.5336294",
"0.5319451",
"0.53161216",
"0.5288751",
"0.5269949",
"0.5264615",
"0.522074",
"0.52051604",
"0.51969177",
"0.5183194... | 0.52711064 | 15 |
Turn off vpn for the current user Turns off vpn for the currently loggedin user. | def turn_off_current_user_vpn(opts = {})
turn_off_current_user_vpn_with_http_info(opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:q... | [
"0.6947038",
"0.6082682",
"0.599128",
"0.5936998",
"0.5935822",
"0.59238344",
"0.5907025",
"0.58545583",
"0.584242",
"0.5832911",
"0.5825407",
"0.57688993",
"0.5741067",
"0.57284874",
"0.57183874",
"0.57183874",
"0.5712141",
"0.5710035",
"0.568161",
"0.565093",
"0.56494325",
... | 0.80374235 | 0 |
Turn off vpn for the current user Turns off vpn for the currently loggedin user. | def turn_off_current_user_vpn_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.turn_off_current_user_vpn",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#turn_off_current_user_vpn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off_current_user_vpn(opts = {})\n turn_off_current_user_vpn_with_http_info(opts)\n nil\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactivate_user(user_id)\n post... | [
"0.80374235",
"0.6082682",
"0.599128",
"0.5936998",
"0.5935822",
"0.59238344",
"0.5907025",
"0.58545583",
"0.584242",
"0.5832911",
"0.5825407",
"0.57688993",
"0.5741067",
"0.57284874",
"0.57183874",
"0.57183874",
"0.5712141",
"0.5710035",
"0.568161",
"0.565093",
"0.56494325",... | 0.6947038 | 1 |
Turn on vpn for the current user Turns on vpn for the currently loggedin user. | def turn_on_current_user_vpn(opts = {})
turn_on_current_user_vpn_with_http_info(opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def turn_on_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_on_current_user_vpn ...'\n end\n # resource path\n local_v... | [
"0.6372449",
"0.593669",
"0.573794",
"0.55957085",
"0.55560887",
"0.55357134",
"0.55208737",
"0.55129844",
"0.5454473",
"0.54213685",
"0.5414204",
"0.5395543",
"0.538463",
"0.5373731",
"0.53193337",
"0.53193337",
"0.53193337",
"0.5308838",
"0.52956516",
"0.5282667",
"0.525830... | 0.71412027 | 0 |
Turn on vpn for the current user Turns on vpn for the currently loggedin user. | def turn_on_current_user_vpn_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.turn_on_current_user_vpn ...'
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.turn_on_current_user_vpn",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#turn_on_current_user_vpn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end",
"def activate_user(user_id)... | [
"0.71401227",
"0.6372117",
"0.5737986",
"0.55936664",
"0.5555818",
"0.5535226",
"0.5520048",
"0.5512347",
"0.5454351",
"0.54221505",
"0.5414128",
"0.53955466",
"0.5384912",
"0.5373507",
"0.5319554",
"0.5319554",
"0.5319554",
"0.5309335",
"0.5292948",
"0.5282744",
"0.5257364",... | 0.5937526 | 2 |
Resets state of line inspection. | def reset
@block_type = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @p = 0\n @line = 1\n @char_position_in_line = 0\n @mark_depth = 0\n end",
"def reset()\n raise NotImplementedError\n @lineno = 1\n\t\t@line_offset = 0\n @token_pos = 0\n end",
"def reset\n @line_no, @last_lexeme = 0, [\"\\n\"]\n super\n end",
"def res... | [
"0.699162",
"0.67800814",
"0.6779406",
"0.67112875",
"0.67058814",
"0.6602612",
"0.64711004",
"0.6467084",
"0.6465414",
"0.64157337",
"0.63423526",
"0.6337497",
"0.63093483",
"0.6307712",
"0.6302177",
"0.6296336",
"0.62727237",
"0.6235075",
"0.62163764",
"0.6158546",
"0.61585... | 0.0 | -1 |
Returns the handler's current type. | def current_type
@block_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_type\n @type\n end",
"def current_handler\n @current_handler || @default_handler\n end",
"def type; Common.type(@handle); end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n ... | [
"0.7365137",
"0.7020336",
"0.6899231",
"0.68119264",
"0.68119264",
"0.68119264",
"0.67949414",
"0.67746633",
"0.67746633",
"0.67746633",
"0.6773439",
"0.6723491",
"0.6718016",
"0.66653603",
"0.66577977",
"0.6641242",
"0.6638806",
"0.6631179",
"0.6631179",
"0.66249025",
"0.661... | 0.63673043 | 57 |
Useful for pipeline chains in the form `blockmacroblock`. This checks if the current block handler/type is equivalent to the block that's being pipelined. | def equal?(handler, type)
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block?\n !!block\n end",
"def is_block?\n get_metadata(:for_block)\n end",
"def block_is_type?(block)\n is_type? || (block && eval('defined?(__in_erb_template)', block.binding))\n end",
"def block_is_haml?(block)\n eval('_hamlout', block.binding)\n tr... | [
"0.6830338",
"0.6803576",
"0.6703911",
"0.6393082",
"0.6378061",
"0.63617224",
"0.63480777",
"0.6319698",
"0.6313633",
"0.622716",
"0.61516833",
"0.6140495",
"0.6138688",
"0.6066277",
"0.6015716",
"0.6008356",
"0.6000517",
"0.5985821",
"0.5980963",
"0.59389806",
"0.591415",
... | 0.0 | -1 |
Sets the default parameters for a block type. | def set_block_params(name, params)
params = {} if !params.is_a?(Hash)
@vars[:block_params][name] = params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_block_type\n @block_type = BlockType.find(params[:id])\n end",
"def set_block_typ\n @block_type = BlockType.find(params[:id])\n end",
"def block_type_params\n params.require(:block_type).permit(:name)\n end",
"def default\n @type = :default\n end",
"def block... | [
"0.6814038",
"0.6716204",
"0.6655171",
"0.64248866",
"0.6312512",
"0.6199047",
"0.6159597",
"0.6049608",
"0.60355854",
"0.6024647",
"0.6003059",
"0.60009146",
"0.60008955",
"0.5960026",
"0.59460604",
"0.5945341",
"0.5945341",
"0.5945148",
"0.5943789",
"0.594148",
"0.5936704",... | 0.6247218 | 5 |
Define breakfast, lunch and dinner methods that return the meal choice passed into them. If nothing is passed in, it shoud default to the foods on the readme (frosted flake, grilled cheese, salmon) | def meal(breakfast = "frosted flakes", lunch = "grilled cheese", dinner = "salmon")
puts "Morning is the best time for #{breakfast}!"
puts "Noon is the best time for #{lunch}!"
puts "Evening is the best time for #{dinner}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meal_choice( food = \"meat\") \n return food\nend",
"def meal_choice(food_type = \"meat\")\n food_type\nend",
"def meal_choice(choice = \"meat\")\n return choice\nend",
"def meal_choice(choice = \"meat\")\n return choice #meal choice that was passed into it \nend",
"def meal_choice(vegan = \"meat... | [
"0.7704664",
"0.74114716",
"0.73323464",
"0.7279166",
"0.7224172",
"0.71477914",
"0.707415",
"0.7061001",
"0.70384383",
"0.7017799",
"0.7001092",
"0.69718695",
"0.6878549",
"0.68420815",
"0.6826327",
"0.680343",
"0.6801603",
"0.67776394",
"0.6737181",
"0.6737181",
"0.6737181"... | 0.7449021 | 1 |
When modifying the context, also update GraphqlControllercontext if needed so that we have similar context when executing queries, mutations, and subscriptions Objects added to the context may also need to be reloaded in `Subscriptions::BaseSubscription` so that they are not stale | def context
# is_sessionless_user is always false because we only support cookie auth in ActionCable
{ channel: self, current_user: current_user, is_sessionless_user: false }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n init\n @context\n end",
"def context\n unless @instance_context\n @instance_context = UserDefinedMessageSubscriptionContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])\n end\n ... | [
"0.6208964",
"0.61923033",
"0.60022753",
"0.58857155",
"0.5856376",
"0.5847113",
"0.5847113",
"0.5842006",
"0.58317757",
"0.58150333",
"0.58085984",
"0.57728934",
"0.5766288",
"0.5725633",
"0.57165337",
"0.57136184",
"0.5697591",
"0.5697591",
"0.56969374",
"0.56852114",
"0.56... | 0.0 | -1 |
=begin Dado un alfabeto, hace un corrimiento de n lugares regresando el alfabeto recorrido y ciclico =end | def recorre(alfabeto, corrimiento)
i = 0
while i < corrimiento
c = alfabeto[i]
alfabeto << c
i= i+1
end
alfabeto.slice!(0...i)
return alfabeto
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activar()\n\n i=0\n\n print \"Inicio planta\\n\"\n\n cantidadCervezas = 0\n while(i < @ciclos)\n\n i+=1;\n print \"---------->Ciclo numero\",i,\"<---------------\\n\"\n\n #Inicio de procesamiento\n @silosCebada.producir(@almacen)\n @silosCebada.imprimir()\n @molino.pro... | [
"0.67087585",
"0.66166407",
"0.65287495",
"0.6429256",
"0.6249654",
"0.6235706",
"0.6201119",
"0.61923677",
"0.6153229",
"0.61350083",
"0.61311436",
"0.61049783",
"0.6093661",
"0.60761464",
"0.6058017",
"0.60579515",
"0.6051392",
"0.60140836",
"0.60090864",
"0.5994895",
"0.59... | 0.0 | -1 |
=begin dada una palabra clave(llave) construlle una tabla tipo vigenere polialfabetica. =end | def crea_tabla(llave)
renglon = Array.new
tam = llave.length
tam.times do |i|
tmp = "" << llave[i]
if ALFABETO.include? tmp
renglon.push(tmp)
ALFABETO.delete! tmp
end
end
ALFABETO.chars{|c| renglon.push(c)}
tabla = Array.new
tabla.push(renglon.to_s)
for i in (1...26)
aux = recorre(renglon.to_s, i)
tabla.push(aux)
end#for
return tabla
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publicaEnPantalla(tabla,resultados)\n\t\tentrada=0\n\t\ti=0\n\t\trenglonesDeResultado=[]\n\t\twhile resultados.length > entrada\n\t\t\tif (resultados[entrada].to_s==tabla.getItemText(i,4).to_s)\n\t\t\t\tentrada=1+entrada\n\t\t\t\trenglonesDeResultado.push(i)\n\t\t\t\ti=0\n\t\t\telse\n\t\t\t\ti=1+i\n\t\t\tend\... | [
"0.61291707",
"0.5964928",
"0.58517224",
"0.569821",
"0.559974",
"0.55498147",
"0.55345196",
"0.55345196",
"0.55345196",
"0.55345196",
"0.54677457",
"0.54645467",
"0.5439441",
"0.5423002",
"0.540165",
"0.53390056",
"0.5324846",
"0.531647",
"0.52941746",
"0.52847576",
"0.52779... | 0.6340806 | 0 |
List all unsubscribes for the domain | def list(options={})
Mailgun.submit(:get, unsubscribe_url, options)["items"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribed\n\tend",
"def unsubscribed; end",
"def unsubscribed\n @attributes[:unsubscribed]\n end",
"def unsubscribe_all\n send_action('unsubscribe_all')\n end",
... | [
"0.861392",
"0.7337089",
"0.7337089",
"0.720435",
"0.7147215",
"0.7093557",
"0.700932",
"0.69384354",
"0.69024134",
"0.68970585",
"0.68882036",
"0.68441564",
"0.6813133",
"0.6778833",
"0.676144",
"0.6633737",
"0.651101",
"0.65095407",
"0.64840287",
"0.63847935",
"0.63548714",... | 0.6490696 | 18 |
Helper method to generate the proper url for Mailgun unsubscribe API calls | def unsubscribe_url(address=nil)
"#{@mailgun.base_url}/#{@domain}/unsubscribes#{'/' + address if address}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribe_url\n nil\n end",
"def unsubscribe_url(id:, email:)\n token =\n Base64.encode64(\"#{id}:#{email}\")\n\n \"#{connection.url_prefix}unsubscribe?token=#{token}\"\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n en... | [
"0.7956396",
"0.7790017",
"0.66825646",
"0.66825646",
"0.6421595",
"0.64120543",
"0.6399402",
"0.62976885",
"0.6285101",
"0.62684",
"0.62666005",
"0.6224547",
"0.61930853",
"0.61874294",
"0.61724144",
"0.6149331",
"0.61451983",
"0.61103004",
"0.6095919",
"0.6062818",
"0.60594... | 0.82254606 | 0 |
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list whose elements may also be integers or other lists. Example 1: Given the list [[1,1],2,[1,1]], return 10. (four 1's at depth 2, one 2 at depth 1) | def sum_depth ( x, weight = 1 )
sum = 0
x = [ x ] if x.is_a? Integer
x.each do | n |
if n.is_a? Array
sum += sum_depth( n, weight + 1 )
else
sum += n * weight
end
end
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_nested_collection\n nested_numbers = [[1,2,3], [5,6,7,5], [9,10,13,6], [1]]\nend",
"def list_depth(list, depth = 0)\n return depth if !list.is_a?(Array)\n list.empty? ? depth + 1 : list.map { |l| list_depth(l, depth + 1) }.max\n end",
"def two_d_sum(arr)\n\ttotal = 0\n\n\t# 1st Leve... | [
"0.7259541",
"0.6403564",
"0.6190413",
"0.61393106",
"0.61237186",
"0.6052727",
"0.60513127",
"0.6027382",
"0.59915495",
"0.5952943",
"0.5952943",
"0.584366",
"0.58356076",
"0.5814014",
"0.5787257",
"0.57775086",
"0.5742661",
"0.5713105",
"0.57107484",
"0.57060844",
"0.569219... | 0.8158782 | 0 |
This would save the user object with entered params in the DB | def create
@user = User.new(username: params[:username], email: params[:email], password: params[:password])
if @user.save
render json: {status: 'SUCCESS', message: 'Account successfully created', accessToken: @user.access_token}.to_json
else
render json: {errors: ["Sign up failed!"], status: 422}.to_json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_obj params\r\n paramsh = {\r\n :user_id => params[:user_id],\r\n :name => params[:name], \r\n :subject => params[:subject],\r\n :tenant_uid => params[:tenant_uids]\r\n }\r\n update_attributes(paramsh)\r\n save!\r\n end",
"def save_user( args )\n user_id = args... | [
"0.760077",
"0.7200834",
"0.7035687",
"0.7007495",
"0.68859005",
"0.68464035",
"0.68027",
"0.67970026",
"0.67680115",
"0.67669207",
"0.6752035",
"0.6732302",
"0.6708863",
"0.67057824",
"0.6704783",
"0.6704783",
"0.659785",
"0.6595161",
"0.65949905",
"0.65863216",
"0.65788954"... | 0.0 | -1 |
This updates user params | def update
if @user.update(username: params[:username], email: params[:email], password: params[:password])
render json: {status: 'SUCCESS', message: 'Account successfully updated', accessToken: @user.access_token}.to_json
else
render json: { errors: ['Update unsuccessful!'], status: 422 }.to_json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_params_upd\n params.require(:user).permit(:name, :date_of_birth, :bio, :has_muggle_relatives, :password,\n :password_confirmation)\n end",
"def modify_user_params(attrs)\n attrs\n end",
"def update\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\... | [
"0.7841783",
"0.7787112",
"0.7510326",
"0.74635",
"0.7458976",
"0.7456601",
"0.73789066",
"0.7376452",
"0.7363599",
"0.7357148",
"0.73554677",
"0.73341537",
"0.73073184",
"0.730612",
"0.727584",
"0.72503674",
"0.7236379",
"0.7235486",
"0.7191905",
"0.71840703",
"0.718202",
... | 0.0 | -1 |
Checks if the user is the author of a reply | def reply_author(reply)
logged_in? && current_user.id == reply.user_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply_author(reply)\n user_signed_in? && current_user.id == reply.user_id\n end",
"def answered_by?(user)\n replies.exists?(:user_id => user)\n end",
"def author?(user)\n user && author.id == user.id\n end",
"def author?(user)\n self.user == user\n end",
"def is_author?\n Response.jo... | [
"0.84007716",
"0.75702244",
"0.7307788",
"0.7227496",
"0.71521413",
"0.7040628",
"0.6997446",
"0.6984886",
"0.6984886",
"0.6929768",
"0.6856324",
"0.6832867",
"0.6771362",
"0.67612094",
"0.674855",
"0.67419815",
"0.66817474",
"0.6679152",
"0.66348916",
"0.66151196",
"0.661090... | 0.8284275 | 1 |
Add an SGE user | def add
Tempfile.open do |tmpfile|
tmpfile.puts render(Templates::User::ERB)
tmpfile.flush
system("qconf -Auser #{tmpfile.path}")
sleep 5
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user(name)\n\t@users << {:name => name}\n end",
"def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n... | [
"0.7603849",
"0.751478",
"0.72711176",
"0.72103393",
"0.7151666",
"0.70998955",
"0.70451564",
"0.7040385",
"0.7026924",
"0.70248336",
"0.69597894",
"0.6925",
"0.69011736",
"0.6880364",
"0.6874549",
"0.68716866",
"0.68665946",
"0.6850294",
"0.68425024",
"0.6792965",
"0.6786671... | 0.0 | -1 |
Remove an SGE user | def remove
system("qconf -duser #{name}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_user\n query_api \"/rest/user\", nil, \"DELETE\"\n end",
"def remove_user\n create_user.tap do |r|\n r.action(:remove)\n end\n end",
"def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end",
"def remove_user(user)\n self.users.destroy(user)... | [
"0.7692844",
"0.76537216",
"0.7575168",
"0.73951584",
"0.73552257",
"0.73220086",
"0.72247833",
"0.72247833",
"0.7114189",
"0.71008396",
"0.7027343",
"0.6995356",
"0.69880724",
"0.69820684",
"0.696862",
"0.6931495",
"0.6920463",
"0.69049597",
"0.68771243",
"0.68620926",
"0.68... | 0.0 | -1 |
GET /tipo_venta GET /tipo_venta.json | def index
@tipo_venta = TipoVentum.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_t... | [
"0.6942735",
"0.6925548",
"0.6880988",
"0.6825113",
"0.67987573",
"0.67135465",
"0.66853625",
"0.6684955",
"0.6644784",
"0.6624199",
"0.66174984",
"0.6594518",
"0.65875727",
"0.65875727",
"0.65865386",
"0.6560805",
"0.65582186",
"0.6553839",
"0.65499914",
"0.65404946",
"0.652... | 0.67536235 | 5 |
GET /tipo_venta/1 GET /tipo_venta/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.e... | [
"0.70174927",
"0.6898491",
"0.6890585",
"0.6844534",
"0.68257654",
"0.6825207",
"0.67990077",
"0.6754393",
"0.67279553",
"0.6721315",
"0.6688154",
"0.6686874",
"0.6658056",
"0.66360027",
"0.6633383",
"0.6633383",
"0.66331726",
"0.66279227",
"0.6605922",
"0.6605021",
"0.659895... | 0.0 | -1 |
POST /tipo_venta POST /tipo_venta.json | def create
@tipo_ventum = TipoVentum.new(tipo_ventum_params)
respond_to do |format|
if @tipo_ventum.save
format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully created.' }
format.json { render :show, status: :created, location: @tipo_ventum }
else
format.html { render :new }
format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @servico_evento = Servico::Evento.new(servico_evento_params)\n\n respond_to do |format|\n if @servico_evento.save\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servi... | [
"0.6867",
"0.6817968",
"0.68127877",
"0.67253333",
"0.66842735",
"0.66657007",
"0.6665518",
"0.6631251",
"0.6573862",
"0.65716714",
"0.65370315",
"0.65320987",
"0.6525978",
"0.65173113",
"0.64755213",
"0.6468274",
"0.64443547",
"0.6443177",
"0.64382386",
"0.64375365",
"0.6435... | 0.6920562 | 0 |
PATCH/PUT /tipo_venta/1 PATCH/PUT /tipo_venta/1.json | def update
respond_to do |format|
if @tipo_ventum.update(tipo_ventum_params)
format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully updated.' }
format.json { render :show, status: :ok, location: @tipo_ventum }
else
format.html { render :edit }
format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\... | [
"0.6921154",
"0.6763069",
"0.6710749",
"0.66690814",
"0.6646843",
"0.66117394",
"0.6593076",
"0.65821415",
"0.65633976",
"0.65546733",
"0.65273225",
"0.65213495",
"0.6511184",
"0.64955443",
"0.6490847",
"0.646394",
"0.6463841",
"0.6455664",
"0.64451206",
"0.64234304",
"0.6418... | 0.66976964 | 3 |
DELETE /tipo_venta/1 DELETE /tipo_venta/1.json | def destroy
@tipo_ventum.destroy
respond_to do |format|
format.html { redirect_to tipo_venta_url, notice: 'Tipo ventum was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapr... | [
"0.73050547",
"0.7288937",
"0.72860026",
"0.7260907",
"0.72545373",
"0.72513586",
"0.72424674",
"0.7212556",
"0.72034216",
"0.7199657",
"0.7173166",
"0.715502",
"0.7154095",
"0.71462303",
"0.71372104",
"0.71292514",
"0.712569",
"0.712216",
"0.7115263",
"0.71151876",
"0.710945... | 0.7411644 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tipo_ventum
@tipo_ventum = TipoVentum.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def tipo_ventum_params
params.require(:tipo_ventum).permit(:tipoVenta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
I worked on this challenge with Jessie Richardson I spent [2.5] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? an array of any size greater than or equal to zero What is the output? (i.e. What should the code return?) for pad!: output = if array length is greater than or equal to the minimum size, then the original array is outputted. If array is less than the minimum size, then the output will be an array with all of the contents of the original array plus padding to make the array longer. for pad: output = Same as above but a new array will be outputted and original array still exists. What are the steps needed to solve the problem? PSEUDOCODE FOR "pad!": 1) define a method called pad! 2) IF minimum size is less than or equal to the length of "array", return "array" 3) If minimum size is greater than the length of "array", "array" needs to be padded with x number of elements (where x = min_size array length) whose value is equal to "value" (nil). PSEUDOCODE FOR "pad" : 1) define a method called "pad" 2) IF minimum size is less than or equal to the length of "array", return "array" 3) If minimum size is greater than the length of "array", a copy of "array" is created and then padded with x number of elements ( where x = min_size array length) whose value is equal to "value" (nil). EXAMPLE: array = [1,2,3,4], min_size = 6 1. Initial Solution | def pad!(array, min_size, value = nil) #destructive
if min_size <= array.length
return array
else
until array.length == min_size
array << value
end
array
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array <<... | [
"0.8601387",
"0.8491136",
"0.84425193",
"0.84000564",
"0.83731455",
"0.8342784",
"0.8309159",
"0.83052385",
"0.83029413",
"0.82975966",
"0.8293706",
"0.82908595",
"0.82867765",
"0.82847285",
"0.8284431",
"0.82768124",
"0.8273952",
"0.82601684",
"0.825275",
"0.8251968",
"0.824... | 0.8189274 | 32 |
Fetches number of followers and number of lists | def twitter_stats
# would be nice to use the twitter gem here, but twitter
# doesn't expose list counts on user info.
doc = Nokogiri::HTML(open("http://twitter.com/#@twitter"))
followers = doc.css("#follower_count").first.content.to_i
lists = doc.css("#lists_count").first.content.to_i
"followers: #{followers}; lists #{lists}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_followers\n return_list_of_followers.size\n end",
"def number_of_followees\n return_list_of_followed_users.size\n end",
"def followers_count\n follow_count_for_a(:follower)\n end",
"def num_followers\n follower_ids = Following.where(:followed_id => self.id).pluck(:followe... | [
"0.8433614",
"0.8087633",
"0.7930892",
"0.77348393",
"0.7483281",
"0.74686164",
"0.74124014",
"0.7402562",
"0.7387989",
"0.7377384",
"0.73005885",
"0.72520506",
"0.71130013",
"0.70904374",
"0.7036449",
"0.6996078",
"0.69950974",
"0.6938961",
"0.6932235",
"0.69162554",
"0.6895... | 0.6583598 | 41 |
TODO: implement the same functionality without method_missing | def method_missing(*attributes)
if (attributes[0][/_safe$/])
html_safe_string = send(attributes[0].to_s.gsub(/_safe$/,"").intern).html_safe
CGI::unescapeElement( CGI::escapeHTML(html_safe_string), "BR" )
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def method_missing(code, *args, &blk); end",
"def method_missing(code, *args, &blk); end",
"def method_missing(method, *args, &blk); end",
"def method_missing(method, *args, &block); end",
"def method_missing(method_name, *args); end",
"def method_missing(method_name, *args); end",
... | [
"0.6878782",
"0.66829175",
"0.66829175",
"0.65917856",
"0.64612764",
"0.64221305",
"0.64221305",
"0.6388353",
"0.636361",
"0.6336306",
"0.62625515",
"0.62147874",
"0.62147874",
"0.6214437",
"0.61579806",
"0.61579806",
"0.61579806",
"0.6133621",
"0.6133621",
"0.6129515",
"0.61... | 0.0 | -1 |
Checks if other period is inside this period. This means that both starts_at and ends_at of other period have to be included in this period. | def include?(other_period)
inside?(other_period.starts_at) && inside?(other_period.ends_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def ove... | [
"0.84127146",
"0.79092336",
"0.775272",
"0.7748917",
"0.7659067",
"0.7430443",
"0.70193183",
"0.69477475",
"0.6879989",
"0.68794787",
"0.68765366",
"0.68664837",
"0.68364984",
"0.6810467",
"0.68038625",
"0.6779065",
"0.6754526",
"0.6729548",
"0.6729548",
"0.6723803",
"0.67060... | 0.8659968 | 0 |
Checks if other period overlaps with this period. Returns true when either other_period.starts_at or other_period.ends_at is included this period. | def cover?(other_period)
inside?(other_period.starts_at) || inside?(other_period.ends_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def overlaps?(other)\n\t\... | [
"0.81052905",
"0.81040674",
"0.8060988",
"0.80536056",
"0.7708344",
"0.7657693",
"0.75019264",
"0.7323826",
"0.707367",
"0.70308346",
"0.7016181",
"0.7016181",
"0.70065284",
"0.6978261",
"0.69742537",
"0.6895147",
"0.6872097",
"0.6872097",
"0.6854419",
"0.67827016",
"0.678124... | 0.7849455 | 4 |
We can't serialize the explainer, so clear it before we transmit | def prepare_to_send
statement.explainer = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n\t\tself.raw = ''\n\t\tself.hdr_length_left = 8\n\t\tself.payload_length_left = 0\n\tend",
"def clear_body; end",
"def clear\n @raw.clear\n self\n end",
"def reset\n @id = nil\n @strands = []\n @suggested_topic = nil\n end",
"def clear() end",
"def clear() end",
... | [
"0.5777639",
"0.5725918",
"0.5681908",
"0.56193465",
"0.54777956",
"0.54777956",
"0.5457249",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.54160935",
"0.5398351",
"0.53931236",
"0.537337",
"0.5359569",
"0.53531617",
"0.53531617... | 0.6434746 | 0 |
I thinks this action should be a POST | def update_employee_leave_reset_all
EmployeeLeave.reset_all
notice = t('leave_count_reset_sucessfull')
render :update do |page|
page.replace_html "main-reset-box", :text => "<p class='flash-msg'>#{notice}</p>"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def POST; end",
"def post\r\n end",
"def post; end",
"def post(action, **args); end",
"def post\n end",
"def post_data; end",
"def post_request(object)\n end",
"def submit; end",
"def post\n raise NotImplementedError\n end",
"def api_post(action, data)\n api_request(action, dat... | [
"0.83094245",
"0.79514235",
"0.78566706",
"0.7554529",
"0.75429296",
"0.7153567",
"0.68442225",
"0.67842406",
"0.67479104",
"0.6721777",
"0.6695921",
"0.66037005",
"0.6600933",
"0.6589217",
"0.6576679",
"0.64968795",
"0.647774",
"0.6469792",
"0.6452513",
"0.64426273",
"0.6442... | 0.0 | -1 |
`Paginatedlast_page(count)` Compute the maximum page number which could be meaningfully displayed. | def last_page(count)
(count / PER_PAGE.to_f).ceil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_page_number\n number_of_pages\n end",
"def bound_last(last, count)\n if last > last_page(count) then last_page(count) else last end\n end",
"def last_page\n (max_matches.to_f / per_page).ceil\n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hin... | [
"0.77618897",
"0.7652974",
"0.7541254",
"0.7479644",
"0.74753183",
"0.7469814",
"0.73419493",
"0.73419493",
"0.7279868",
"0.7231671",
"0.71892387",
"0.7136886",
"0.7101307",
"0.7081131",
"0.7075225",
"0.6987154",
"0.6924625",
"0.6673539",
"0.6664465",
"0.6664465",
"0.66098636... | 0.8702603 | 0 |
`Paginatedpage(req)` Retrieve the current page out of the `req` instance. | def page(req)
req.params.fetch('page', default='1').to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page\n @request.params[:page] ? @request.params[:page].to_i : 1\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def current_page\n unless @page\n @page = params[:page].to_i\n @page = 1 unless @page\n @page = 1 if @page < 1\n end\n return @page\n end",
"def c... | [
"0.7167881",
"0.7017142",
"0.6912711",
"0.6870681",
"0.68435025",
"0.6779926",
"0.67683566",
"0.67608017",
"0.66719925",
"0.6671466",
"0.6610503",
"0.6595616",
"0.65521616",
"0.65460056",
"0.6499224",
"0.6487493",
"0.6485147",
"0.64834034",
"0.648218",
"0.64777994",
"0.64458"... | 0.79003173 | 0 |
`Paginatedpage_nums(req, count)` Compute the range of page numbers to display based on the current `req` and the total `count` of items contained in the paginated collection. | def page_nums(req, count)
first = page(req) - SPREAD
last = bound_first(first) + (SPREAD * 2)
first = bound_last(last, count) - (SPREAD * 2) if bound_last(last, count) == last_page(count)
bound_first(first)..bound_last(last, count)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end",
"def page_count\n if item_count % @items_per_page == 0\n ... | [
"0.68033",
"0.6742234",
"0.67151403",
"0.6706579",
"0.6575172",
"0.6540593",
"0.65268904",
"0.65163493",
"0.6479631",
"0.64606625",
"0.6439652",
"0.6423903",
"0.6397344",
"0.6397344",
"0.6354994",
"0.6351529",
"0.6339063",
"0.6337159",
"0.63135064",
"0.629884",
"0.6276227",
... | 0.8142675 | 0 |
`Paginatedbound_first(first)` Private method to calculate the first page based on the current value of `first` to display taking into account the lower display bound or minimum page number (1). | def bound_first(first)
if first < 1 then 1 else first end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_page\n return nil if total_pages < 1\n return 1\n end",
"def first_in_page\n ((current_page - 1) * per_page) + 1\n end",
"def first_page_number\n 1\n end",
"def first_page\n previous_page? ? updated_collection(from: from, page: { number: 1 }) : self\n ... | [
"0.7377282",
"0.7195114",
"0.6836876",
"0.66712075",
"0.6499926",
"0.6460395",
"0.63195884",
"0.62161016",
"0.6181618",
"0.6150422",
"0.6137931",
"0.6100401",
"0.59770656",
"0.597066",
"0.59535486",
"0.59534216",
"0.5894904",
"0.5894904",
"0.5894904",
"0.5894904",
"0.5867713"... | 0.7515672 | 0 |
`Paginatedbound_last(last, count)` Private method to calculate the last page number to display accounting for the maximum page number display bound represented by `last_page`. Returns a value less than or equal to `last_page` based on the current value of `last` and the total `count` of items in the collection. | def bound_last(last, count)
if last > last_page(count) then last_page(count) else last end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_page(count)\n (count / PER_PAGE.to_f).ceil\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def ... | [
"0.77432275",
"0.754022",
"0.754022",
"0.73383677",
"0.72729415",
"0.7152181",
"0.70715684",
"0.7006435",
"0.69542134",
"0.6946921",
"0.6859196",
"0.6797491",
"0.67929506",
"0.6724094",
"0.66747844",
"0.6551067",
"0.6513334",
"0.6513334",
"0.6503359",
"0.6484546",
"0.6471332"... | 0.84732765 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.