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 |
|---|---|---|---|---|---|---|
POST /bugreports POST /bugreports.json | def create
@bugreport = Bugreport.new(bugreport_params)
@bugreport.reporter = current_user
respond_to do |format|
if @bugreport.save
format.html { redirect_to root_url, notice: 'Bugreport was successfully created.' }
format.json { render action: 'show', status: :created, location: @bugreport }
else
format.html { render action: 'new' }
format.json { render json: @bugreport.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bug = Bug.new(bug_params)\n @bug.project_id = session[:project_id]\n @bug.user_id = current_user.id\n @bug.clean_summary\n @bug.clean_description\n @bug.status = 0 #New\n @bug.resolution = 0 #Open\n\n respond_to do |format|\n if @bug.save\n BugHistoric.create(bug_i... | [
"0.6781488",
"0.65825206",
"0.6582034",
"0.6582034",
"0.64818656",
"0.64270556",
"0.6361853",
"0.63279647",
"0.6293628",
"0.62586296",
"0.62543607",
"0.6249598",
"0.6227144",
"0.62130576",
"0.6190422",
"0.6161469",
"0.6136166",
"0.6122411",
"0.611669",
"0.61154073",
"0.594975... | 0.69298863 | 0 |
PATCH/PUT /bugreports/1 PATCH/PUT /bugreports/1.json | def update
respond_to do |format|
if @bugreport.update(bugreport_params)
format.html { redirect_to @bugreport, notice: 'Bugreport was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @bugreport.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @bug.update(bug_params)\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.MODIFIED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @... | [
"0.7086432",
"0.6667938",
"0.66447854",
"0.6626886",
"0.66071826",
"0.66071826",
"0.65955746",
"0.6494753",
"0.6492648",
"0.6436245",
"0.62485963",
"0.6247278",
"0.62275034",
"0.6176275",
"0.6114004",
"0.60641396",
"0.6059335",
"0.6047012",
"0.6046641",
"0.6044141",
"0.603974... | 0.70894927 | 0 |
DELETE /bugreports/1 DELETE /bugreports/1.json | def destroy
@bugreport.destroy
respond_to do |format|
format.html { redirect_to bugreports_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @client_bug.destroy\n respond_to do |format|\n format.html { redirect_to client_bugs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bug.destroy\n respond_to do |format|\n ... | [
"0.71863943",
"0.7172071",
"0.7099058",
"0.70983267",
"0.7091251",
"0.70906377",
"0.70906377",
"0.70906377",
"0.7082701",
"0.70794785",
"0.7059974",
"0.7059974",
"0.70548797",
"0.70184135",
"0.70184135",
"0.70184135",
"0.70184135",
"0.6989349",
"0.6981774",
"0.69305503",
"0.6... | 0.7836252 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bugreport
@bugreport = Bugreport.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 bugreport_params
params.require(:bugreport).permit(:subject, :description, :userid, :employeeid)
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 |
2. Metoda display_details() afiseaza numele si prenumele | def display_details()
puts "Numele persoanei: #@nume"
puts "Prenumele persoanei: #@prenume"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_details\n return @selected.details\n end",
"def details\n end",
"def details\n\n end",
"def info_page_will_display_details\n if info_page_can_display_details && link.details_text_markup.to_s != ''\n true\n end\n end",
"def details; end",
"def show_details\n @selected.de... | [
"0.7489983",
"0.74136686",
"0.7353853",
"0.7159857",
"0.7116823",
"0.7020158",
"0.7009326",
"0.697416",
"0.6950837",
"0.6901627",
"0.68921447",
"0.6859523",
"0.68557215",
"0.68552256",
"0.67985594",
"0.67267156",
"0.6706501",
"0.67044353",
"0.6667234",
"0.66666734",
"0.666161... | 0.7535434 | 1 |
DELETE LIST NOT WORKING | def destroy
@list = current_user.lists.find(list_params)
@list.destroy
flash[:success] = "List deleted"
redirect_to current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove list\n list_action list, \"remove\"\n end",
"def delete_list(id)\n query(\"DELETE FROM todos WHERE list_id = $1\", id)\n query(\"DELETE FROM lists WHERE id = $1\", id)\n end",
"def delete_list(list)\n @lists[list.title].delete(list.title)\n end",
"def delete_list(params={}... | [
"0.77334905",
"0.76464516",
"0.75257987",
"0.74470896",
"0.726799",
"0.7262673",
"0.7243866",
"0.7214567",
"0.7209067",
"0.7171147",
"0.7165363",
"0.71645653",
"0.7159874",
"0.7130478",
"0.7130099",
"0.7126456",
"0.71031576",
"0.7101522",
"0.7094816",
"0.7075567",
"0.707212",... | 0.6701252 | 91 |
Initilizes an instance of the class with default settings Loads defaults from Yolo::Config::Settings | def initialize
self.server = Yolo::Config::Settings.instance.mail_host
self.from = Yolo::Config::Settings.instance.mail_from
self.port = Yolo::Config::Settings.instance.mail_port
self.account = Yolo::Config::Settings.instance.mail_account
self.password = Yolo::Config::Settings.instance.mail_password
@error_formatter = Yolo::Formatters::ErrorFormatter.new
@progress_formatter = Yolo::Formatters::ProgressFormatter.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(settings = {})\n settings = self.class.defaults.merge(settings)\n settings.each do |key, value|\n set key, value\n end\n end",
"def initialize settings\n self.settings = settings\n end",
"def initialize\n @main = {}\n @config_directory = File.expa... | [
"0.70534503",
"0.69655895",
"0.6902988",
"0.6889849",
"0.68412465",
"0.6831291",
"0.6831291",
"0.682119",
"0.68199843",
"0.6772664",
"0.67419064",
"0.6729439",
"0.672668",
"0.6719839",
"0.67121196",
"0.66933143",
"0.6688689",
"0.6677705",
"0.6656091",
"0.6614732",
"0.66145307... | 0.0 | -1 |
Sends a nofification email using SMTP | def send(opts={})
opts[:server] ||= self.server
opts[:from] ||= self.from
opts[:subject] ||= "New Build!"
opts[:title] ||= "New Build!"
opts[:body] ||= body(opts)
opts[:password] ||= self.password
opts[:account] ||= self.account
opts[:port] ||= self.port
opts[:to] ||= self.to
msg = opts[:body]
if opts[:account] and opts[:password] and opts[:port] and opts[:to]
@progress_formatter.sending_email
smtp = Net::SMTP.new opts[:server], opts[:port]
smtp.enable_starttls
smtp.start(opts[:server], opts[:account], opts[:password], :login) do
smtp.send_message(msg, opts[:from], opts[:to])
@progress_formatter.email_sent(opts[:to])
end
elsif opts[:server] and opts[:to]
@progress_formatter.sending_email
Net::SMTP.start(opts[:server]) do |smtp|
smtp.send_message(msg, opts[:from], opts[:to])
@progress_formatter.email_sent(opts[:to])
end
else
@error_formatter.missing_email_details
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendemail(subject,content,to=nil) \n from = \"saq@xj.cninfo.net\" \n to = [\"saq@xj.cninfo.net\"] if to.nil? \n sendmessage = \"Subject: \"+subject +\"\\n\\n\"+content \n smtp = Net::SMTP.start(\"mail.xj.cninfo.net\",25,\"mail.xj.cninfo.net\",'saq','wei720503',:login) \n smtp.send_mess... | [
"0.6757125",
"0.67063755",
"0.6697372",
"0.66802394",
"0.66523594",
"0.66007894",
"0.65977967",
"0.6530458",
"0.6492388",
"0.6479715",
"0.64768785",
"0.64660764",
"0.6410577",
"0.64089113",
"0.64043003",
"0.6332624",
"0.6327602",
"0.6315676",
"0.6314604",
"0.63089246",
"0.630... | 0.0 | -1 |
The body of them notification email, this method should be overwritten in subclasses to provide custom content | def body(opts)
""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customized_message_body\n return @customized_message_body\n end",
"def message_body\n message_body = \"#{author.name} desea participar al evento '#{event.name}'.\"\n message_body += \"<br><br>\"\n message_body += \"Si deseas que participe en el evento pulsa en el sigu... | [
"0.77182907",
"0.73216015",
"0.7242683",
"0.71353215",
"0.7131467",
"0.7082127",
"0.7069802",
"0.7051678",
"0.69970715",
"0.69641256",
"0.69598466",
"0.6952719",
"0.693243",
"0.6839397",
"0.68000025",
"0.67972386",
"0.67860496",
"0.6752864",
"0.6747737",
"0.6723083",
"0.66454... | 0.0 | -1 |
Takes a host to and initializes `task` attribute as an empty array. | def initialize(host=nil)
@host = host
@tasks = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize # Initialize method that is similar to a Constructor in Java\n @all_tasks = [] # Method includes an array that stores all tasks\n end",
"def tasksOnHost(filter, host)\n java_import 'java.net.URL'\n java_import 'java.net.SocketException'\n java_import 'java.io.InputStreamReader'\... | [
"0.67093545",
"0.6549487",
"0.63946384",
"0.63946384",
"0.62502074",
"0.62445647",
"0.6239553",
"0.6239553",
"0.6239553",
"0.61795175",
"0.6177458",
"0.61316544",
"0.6126421",
"0.60572904",
"0.60484326",
"0.60366523",
"0.6012856",
"0.59558856",
"0.5936936",
"0.59276474",
"0.5... | 0.804462 | 0 |
has_many :reverse_relationships, foreign_key: "followed_id", class_name: "Relationship", dependent: :destroy has_many :followers, through: :reverse_relationships, source: :follower | def followers
rels = Relationship.where(followed_id: self.id)
followers = []
rels.each do |rel|
followers << User.find(rel.follower_id)
end
followers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def followers\n Follow.where(\"following_id = ?\", self.id)\n end",
"def followers\n Following.where(:followed_id => self).includes(:follower).map(&:follower)\n end",
"def follow(other)\n active_relationships.create(followed_id: other.id)\nend",
"def followed\n Following.where(:follower_id => self... | [
"0.68456525",
"0.68006134",
"0.6770891",
"0.66944593",
"0.66756195",
"0.66528517",
"0.6610943",
"0.6567458",
"0.65321505",
"0.6499715",
"0.64873135",
"0.6482333",
"0.6481215",
"0.6481215",
"0.6481215",
"0.6481215",
"0.6481215",
"0.6481215",
"0.6481215",
"0.6481215",
"0.648121... | 0.65514994 | 8 |
Helper method for bottomup implementation | def knapsack_table(weights, values, capacity)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_to_bottom\n ... | [
"0.70185775",
"0.6855966",
"0.6792547",
"0.66875625",
"0.66756815",
"0.6672704",
"0.66373646",
"0.663226",
"0.6596407",
"0.6587347",
"0.6516622",
"0.65097195",
"0.6507161",
"0.64792657",
"0.6440934",
"0.6431597",
"0.6431418",
"0.63186693",
"0.6293141",
"0.62752163",
"0.626493... | 0.0 | -1 |
This method will be called by the Logging framework when it first initializes. Here we require the redis appender code. | def initialize_redis
require File.expand_path('../appenders/redis', __dir__)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init\n Logging.logger.root.level = :debug\n Logging.logger.root.add_appenders(\n Logging.appenders.stdout(\n :backtrace => false,\n :level => @config[:verbose] ? :debug : :info,\n :layout => Logging.layouts.pattern(:pattern => STDOUT_PATTERN)\n )... | [
"0.6999989",
"0.6786388",
"0.6674792",
"0.65466744",
"0.64838135",
"0.64409333",
"0.6401675",
"0.63844216",
"0.6337871",
"0.63170874",
"0.63118863",
"0.6310815",
"0.6283471",
"0.6278116",
"0.6253453",
"0.625073",
"0.6247212",
"0.62417215",
"0.62314206",
"0.62251663",
"0.62147... | 0.69176537 | 1 |
Now actually do some update work! | def update
# Compute the passage of time.
@new = Gosu.milliseconds
@old ||= @new
delta = @new - @old
@old = @new
#Update for gravity.
@vy += @gravity
# Compute the drag
@vx *= @drag
@vy *= @drag
# Compute the new proposed position.
@x += @vx * delta
@y += @vy * delta
# Compute the boundary limits.
top = @y
bottom = @y + @ball.height
left = @x
right = @x + @ball.width
# Check for collision with the left and right walls.
if left < 0
@vx *= -1
@x = -left
elsif right > self.width
@vx *= -1
@x -= 2 * (right-self.width)
end
# Check for collision with the top and bottom walls.
if top < 0
@vy *= -1
@y = -top
elsif bottom > self.height
@vy *= -1
@y -= 2 * (bottom-self.height)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update() end",
"def update ; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update\n \n end",
"def update\n \n end",
"def update\r\n end",
"def update\r\n ... | [
"0.83104473",
"0.8299709",
"0.80469996",
"0.80469996",
"0.80469996",
"0.80469996",
"0.80469996",
"0.80469996",
"0.80469996",
"0.80469996",
"0.77649814",
"0.77207905",
"0.76989233",
"0.7693573",
"0.7693573",
"0.7693573",
"0.7693573",
"0.7654609",
"0.7621498",
"0.7620195",
"0.7... | 0.0 | -1 |
allows for account creation from twitter & fb allows saves w/o password | def password_required?
(!persisted? && user_tokens.empty?) || password.present? || password_confirmation.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_... | [
"0.7049782",
"0.7043915",
"0.7043642",
"0.6796453",
"0.6773182",
"0.6628377",
"0.6529823",
"0.65026855",
"0.6500722",
"0.6485491",
"0.64768547",
"0.6454969",
"0.6442903",
"0.64350176",
"0.64256823",
"0.63911283",
"0.63585657",
"0.63476455",
"0.63430136",
"0.6328729",
"0.63131... | 0.0 | -1 |
allows for account creation from twitter | def email_required?
user_tokens.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_... | [
"0.78831327",
"0.7386175",
"0.73367363",
"0.7259663",
"0.7202203",
"0.7105719",
"0.7078297",
"0.70148623",
"0.6986618",
"0.6943751",
"0.6937294",
"0.6928746",
"0.6903761",
"0.6841695",
"0.67827666",
"0.6736823",
"0.67244667",
"0.66916084",
"0.6687735",
"0.66702646",
"0.664700... | 0.0 | -1 |
method to return all projects I've created | def my_projects
# Look at all the project
# see which project's creator is equal to self
Project.all.select do |project|
project.creator == self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projects\n request(method: 'getAllProjects')\n end",
"def all\n @projects\n end",
"def all\n @projects\n end",
"def projects\n PivotalTracker::Project.all\n end",
"def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].... | [
"0.8165575",
"0.80652684",
"0.80652684",
"0.8020134",
"0.79446006",
"0.7902813",
"0.7845735",
"0.7725574",
"0.7704576",
"0.76845634",
"0.76776683",
"0.7623777",
"0.76021594",
"0.75589955",
"0.75243956",
"0.7522458",
"0.74845994",
"0.7474656",
"0.74732447",
"0.7467479",
"0.744... | 0.7389421 | 22 |
method to return all pledges I've made | def pledges
# Look through all pledges
# only keep the ones where pledge.user == self
Pledge.all.select do |pledge|
pledge.user == self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pledges\n Pledge.all.filter do |pledge|\n pledge.project == self\n end\n end",
"def pledges\n Pledge.all.select do |pledge|\n pledge.project == self\n end\n end",
"def pledges\n Pledge.all.select {|pledge| pledge.backer == self}\n end",
"d... | [
"0.67649865",
"0.66099674",
"0.65735185",
"0.65679365",
"0.6401878",
"0.62514627",
"0.6244485",
"0.62377506",
"0.6148643",
"0.6122165",
"0.6099414",
"0.60121197",
"0.59721273",
"0.59703964",
"0.5959682",
"0.5957612",
"0.59520423",
"0.5942205",
"0.5906756",
"0.585479",
"0.5837... | 0.63860524 | 5 |
method to return all projects I've donated to | def backed_projects
pledges.map { |pledge| pledge.project }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projects\n PivotalTracker::Project.all\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def projects\n @projects\n end",
"def projects\n my_proj = self.my_projects\n my_memb = self.collaborations\n my_proj + my_memb\n end",
"def projects\n @projects ||... | [
"0.72560596",
"0.698906",
"0.6930253",
"0.69187087",
"0.6888471",
"0.68667555",
"0.6848498",
"0.6841324",
"0.6821687",
"0.6813384",
"0.68098927",
"0.67724717",
"0.6756995",
"0.6735186",
"0.6732345",
"0.67211485",
"0.6719598",
"0.6685721",
"0.66738856",
"0.66629225",
"0.664528... | 0.6811322 | 10 |
helper method for self.highest_pledge to abstract away the process to get highest pledge amount | def highest_pledge_amount
pledges.reduce(0) do |highest_pledge_amount, pledge|
highest_pledge_amount = pledge.amount > highest_pledge_amount ? pledge.amount : highest_pledge_amount
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def biggest_investment()\n funding_rounds = self.funding_rounds.select {|funding| funding.amount}\n amount = 0\n\n funding_rounds.select do |funding|\n\n if funding.amount >= amount\n amount = funding.amount\n funding\n end\n \n... | [
"0.7359576",
"0.69808304",
"0.69797075",
"0.6851441",
"0.6802575",
"0.6708251",
"0.6638615",
"0.66277385",
"0.6613474",
"0.65981984",
"0.6587211",
"0.6574272",
"0.6553286",
"0.65527064",
"0.650865",
"0.647831",
"0.6453326",
"0.6432564",
"0.64111716",
"0.64097774",
"0.63974833... | 0.85352814 | 0 |
Retrieve a single page of BrandedCallInstance records from the API. Request is executed immediately. | def create(from: nil, to: nil, reason: nil, call_sid: :unset)
data = Twilio::Values.of({'From' => from, 'To' => to, 'Reason' => reason, 'CallSid' => call_sid, })
payload = @version.create(
'POST',
@uri,
data: data
)
BrandedCallInstance.new(@version, payload, )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/calls\"))[0].map do |item|\n Call.new(item, @client)\n end\n end",
"def get_instance(payload)\n BrandedCallInstance.new(@version, payload, )\n end",
"def index\n @calls = Call... | [
"0.6424597",
"0.6114552",
"0.60889083",
"0.60889083",
"0.60889083",
"0.60889083",
"0.5947036",
"0.59110135",
"0.58842075",
"0.58420473",
"0.57310975",
"0.57124007",
"0.57086104",
"0.5704613",
"0.56901115",
"0.5628698",
"0.5624566",
"0.5603134",
"0.5586479",
"0.55590826",
"0.5... | 0.0 | -1 |
Provide a user friendly representation | def to_s
'#<Twilio.Preview.TrustedComms.BrandedCallList>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Build an instance of BrandedCallInstance | def get_instance(payload)
BrandedCallInstance.new(@version, payload, )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(from: nil, to: nil, reason: nil, call_sid: :unset)\n data = Twilio::Values.of({'From' => from, 'To' => to, 'Reason' => reason, 'CallSid' => call_sid, })\n\n payload = @version.create(\n 'POST',\n @uri,\n data: data\n )\n\n ... | [
"0.63680667",
"0.6322264",
"0.62932366",
"0.6178401",
"0.59782547",
"0.59414494",
"0.59082586",
"0.58589464",
"0.5767151",
"0.57323474",
"0.56939757",
"0.56818175",
"0.56554455",
"0.5654454",
"0.5649689",
"0.5603783",
"0.5573472",
"0.5534251",
"0.5508815",
"0.5501636",
"0.547... | 0.76183873 | 0 |
Provide a user friendly representation | def to_s
'<Twilio.Preview.TrustedComms.BrandedCallPage>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Provide a user friendly representation | def to_s
"<Twilio.Preview.TrustedComms.BrandedCallInstance>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
Provide a detailed, user friendly representation | def inspect
"<Twilio.Preview.TrustedComms.BrandedCallInstance>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for mor... | [
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64... | 0.0 | -1 |
GET /arguments GET /arguments.json | def index
controversial
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments(model)\n\n # This calls resources/resource.rb with calls\n # resources/subfolder/subresource.rb which in turn loads a json\n # from resources/data/arguments.json\n return make_arguments()\n\n return args\n end",
"def request(args = {})\n response = @client.get(args[:url],\n ... | [
"0.6873437",
"0.6626993",
"0.6456136",
"0.63833046",
"0.6369182",
"0.6336311",
"0.62287295",
"0.6213961",
"0.605684",
"0.6048007",
"0.6018319",
"0.60069495",
"0.59771633",
"0.5976822",
"0.5964933",
"0.5932559",
"0.5868591",
"0.58463955",
"0.58339417",
"0.58195823",
"0.5807385... | 0.0 | -1 |
GET /arguments/1 GET /arguments/1.json | def show
@is_doubt = !params[:doubt].nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments(model)\n\n # This calls resources/resource.rb with calls\n # resources/subfolder/subresource.rb which in turn loads a json\n # from resources/data/arguments.json\n return make_arguments()\n\n return args\n end",
"def cmd_get argv\n setup argv\n e = @hash['element']\n respon... | [
"0.65474063",
"0.6496125",
"0.63066643",
"0.627296",
"0.62493974",
"0.6181034",
"0.61613244",
"0.61021316",
"0.59450805",
"0.5935237",
"0.5902936",
"0.58880544",
"0.58427536",
"0.58378506",
"0.5804958",
"0.5780718",
"0.57761467",
"0.57658726",
"0.5742781",
"0.5722882",
"0.570... | 0.0 | -1 |
POST /arguments POST /arguments.json | def create
@argument = Argument.new(argument_params.permit(:statement))
respond_to do |format|
if @argument.save
format.html { redirect_to @argument, notice: 'Argument was successfully created.' }
format.json { render :show, status: :created, location: @argument }
else
format.html { render :new }
format.json { render json: @argument.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, arguments = {})\n perform_request { connection.post(path, arguments).body }\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def post(*a... | [
"0.6495836",
"0.64543873",
"0.6440452",
"0.63580114",
"0.62395155",
"0.61328435",
"0.61103266",
"0.60280323",
"0.601466",
"0.60119164",
"0.60003245",
"0.5979707",
"0.59660214",
"0.5940366",
"0.5915267",
"0.58772194",
"0.5876523",
"0.5847612",
"0.5791875",
"0.5786974",
"0.5761... | 0.6006579 | 10 |
PATCH/PUT /arguments/1 PATCH/PUT /arguments/1.json | def update
respond_to do |format|
if @argument.update(argument_params)
format.html { redirect_to @argument, notice: 'Argument was successfully updated.' }
format.json { render :show, status: :ok, location: @argument }
else
format.html { render :edit }
format.json { render json: @argument.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(path, **args); end",
"def cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @reso... | [
"0.6496346",
"0.6487871",
"0.6477869",
"0.64733905",
"0.64583373",
"0.6392508",
"0.6350201",
"0.6350201",
"0.6350201",
"0.6350201",
"0.6350201",
"0.6350201",
"0.6326692",
"0.6290549",
"0.62776536",
"0.6274179",
"0.6263639",
"0.6261728",
"0.6261728",
"0.6261728",
"0.6261728",
... | 0.639729 | 5 |
DELETE /arguments/1 DELETE /arguments/1.json | def destroy
@argument.destroy
respond_to do |format|
format.html { redirect_to arguments_url, notice: 'Argument was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @argument = Argument.find(params[:id])\n... | [
"0.75688696",
"0.72847176",
"0.71873206",
"0.7144435",
"0.70105094",
"0.6998808",
"0.69948167",
"0.68987846",
"0.6848293",
"0.68137556",
"0.6784354",
"0.67412",
"0.6682015",
"0.6670422",
"0.65815276",
"0.6571792",
"0.6547695",
"0.64841104",
"0.6479914",
"0.6474277",
"0.641051... | 0.7184689 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_argument
@argument = Argument.friendly.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 argument_params
params[:argument]
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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
check if the left child of is greater than parent | def left_child_greater?(array, index)
array[left_child(index)] && (left_child(index) > array[index])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end",
"def child? \n parent_id = self[parent_col_name]\n ... | [
"0.7636001",
"0.7636001",
"0.7587314",
"0.7325978",
"0.6972412",
"0.69609654",
"0.6895651",
"0.68921894",
"0.68921894",
"0.68766135",
"0.67620105",
"0.6760237",
"0.6756421",
"0.669682",
"0.6637197",
"0.6598437",
"0.65784174",
"0.65537393",
"0.65490246",
"0.65108603",
"0.65002... | 0.7770504 | 0 |
we check if the right node leaf exists and if it is greater than its parent | def right_child_greater?(array, index)
@array[right_child(index)] && (@array[right_child(index)] > @array[index])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end",
"def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) ... | [
"0.7106007",
"0.7106007",
"0.7078304",
"0.68334454",
"0.68334454",
"0.6781583",
"0.67164516",
"0.6708795",
"0.6668383",
"0.6658609",
"0.66499496",
"0.6610278",
"0.6609255",
"0.6608141",
"0.6499517",
"0.6498077",
"0.6491035",
"0.6475779",
"0.64477485",
"0.6440606",
"0.6407559"... | 0.6367223 | 24 |
instance method that handles one specific activity | def instance_to_json
{
id: self.id,
title: self.title,
description: self.description,
creator: self.creator.name
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity\n end",
"def intent_send\n\tbegin\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '1'\n\t\t\t\tparams_constructor(Rho::Intent::START_ACTIVITY, \"\", \"ACTION_MAIN\", \"\", \"com.smap.targetapp\", \"\", \"\", \"\", \"\")\n\t\t\twhen '3'\n\t\t\t\tparams_constructor(Rho::Intent::START_AC... | [
"0.7108112",
"0.5848159",
"0.57066506",
"0.56031746",
"0.5583077",
"0.5571177",
"0.55626744",
"0.55465144",
"0.5535637",
"0.5502883",
"0.5486768",
"0.54577106",
"0.54499793",
"0.5428943",
"0.5428943",
"0.5428943",
"0.5428943",
"0.5428943",
"0.5428943",
"0.5428943",
"0.5428943... | 0.0 | -1 |
Below Sets params for upload. | def set_upload
@upload = LibraryUpload.friendly.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file_params\n puts params\n params\n end",
"def upload_params\n params[:upload]\n end",
"def upload_params\n params[:upload]\n end",
"def upload_params\n params.require(:upload).permit(:title, :upload, :user_id)\n end",
"def upload_params\n params.requir... | [
"0.7827048",
"0.7441134",
"0.7441134",
"0.7262384",
"0.7259706",
"0.724039",
"0.723374",
"0.7232394",
"0.7180241",
"0.6993453",
"0.69169587",
"0.69152635",
"0.690842",
"0.6895063",
"0.68622875",
"0.68599737",
"0.68510735",
"0.6847559",
"0.6838511",
"0.68078375",
"0.67894286",... | 0.0 | -1 |
Below Sets params for admin library id from inherited AdminLibraries class. | def set_library
@library = AdminLibrary.friendly.find(params[:admin_library_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_library\n @library = AdminLibrary.friendly.find(params[:id]) \n end",
"def set_library\n @library = Library.find_by(id: params[:id])\n end",
"def set_library\n #for getting one library\n @library = Library.find_by_red_id(params[:id])\n end",
"def set_library\n @libra... | [
"0.66456765",
"0.6317812",
"0.6300191",
"0.625822",
"0.61746913",
"0.59464914",
"0.58952403",
"0.57715607",
"0.56993145",
"0.5645499",
"0.56342816",
"0.55929744",
"0.5572139",
"0.55279535",
"0.5471647",
"0.5395107",
"0.53885126",
"0.53854704",
"0.5384356",
"0.53722453",
"0.53... | 0.70998466 | 0 |
Below Provides params for new library upload record. | def upload_params
params.require(:library_upload).permit(:title, :description, :tags, :image, :file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def library_params\n params.require(:library).permit(:red_id, :purchased_on, :user_id, :description, :library_data)\n end",
"def library_params\n params.require(:library).permit(:name, :cover, :cover_cache, :remove_cover, :desc, :file, :file_cache, :remove_file, :crop_x, :crop_y, :crop_w, :crop_h, :... | [
"0.7122363",
"0.71116245",
"0.6918736",
"0.6917665",
"0.6913336",
"0.6913336",
"0.686343",
"0.6735816",
"0.6684364",
"0.66784006",
"0.6670489",
"0.66634995",
"0.6642525",
"0.6630823",
"0.66180724",
"0.66176736",
"0.6602055",
"0.65902513",
"0.6558071",
"0.655783",
"0.65406513"... | 0.7591383 | 0 |
this allows me use all the methods in the sessions helper in all my controllers | def user_id
@logged_in_user = User.find_by(id: params[:id])
@user_id = @logged_in_user.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session\n end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def expose_session_to_models\n $_SESSION = session\n end",
"def set_session\n \n end",
"def session\n @controller.session\n end",
"def session() request.session end",
"def session... | [
"0.7659427",
"0.7556875",
"0.7556875",
"0.7556875",
"0.7556875",
"0.72970706",
"0.7202967",
"0.7134648",
"0.70918244",
"0.7068453",
"0.7000629",
"0.7000629",
"0.7000629",
"0.68935806",
"0.6826938",
"0.67051023",
"0.6651854",
"0.6599791",
"0.6572714",
"0.6522088",
"0.6511973",... | 0.0 | -1 |
digits, return a sorted array of all the unique numbers that can be formed with those digits. | def number_shuffle(number)
no_of_combinations = number.to_s.size == 3 ? 6 : 24
digits = number.to_s.split(//)
combinations = []
combinations << digits.shuffle.join.to_i while
combinations.uniq.size!=no_of_combinations
combinations.uniq.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unused_digits *integer_array\n remaining_nums = Array(0..9) - integer_array.flatten.join.scan(/\\d/).sort.map(&:to_i)\n remaining_nums.join.to_s\nend",
"def unused_digits(*num)\n digits = (0..9)\n arr = *num.join.split('')\n \n unused_digits = digits.select do |num|\n !arr.include?(num.to_s)\n en... | [
"0.6878238",
"0.6535237",
"0.646715",
"0.6439634",
"0.63603866",
"0.6308074",
"0.6305041",
"0.62460005",
"0.6222417",
"0.6211685",
"0.62086",
"0.62052",
"0.61830163",
"0.6182554",
"0.6094582",
"0.6073112",
"0.6063015",
"0.6062575",
"0.6060726",
"0.60525095",
"0.6029725",
"0... | 0.5711654 | 69 |
Counts the number of quote characters in a line, excluding escaped quotes. | def count_quote_chars(line, quote_char)
return 0 if line.nil? || quote_char.nil?
count = 0
previous_char = ''
line.each_char do |char|
count += 1 if char == quote_char && previous_char != '\\'
previous_char = char
end
count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_quote_markers(line)\n\n marker = \">> \"\n count = 0\n\n loop do\n break unless line.starts_with?(marker)\n\n line = line.sub(marker, '')\n count = count + 1\n end\n\n [line, count]\n end",
"def count_characters(all_lines_from_file)\n all_lines_from_file.gsub(/\\n+/,\"\... | [
"0.637429",
"0.63518494",
"0.63001055",
"0.62423486",
"0.62383735",
"0.6237805",
"0.6217741",
"0.61562014",
"0.6153911",
"0.59262764",
"0.59262764",
"0.5924019",
"0.57923114",
"0.57564396",
"0.57545006",
"0.5729501",
"0.57252765",
"0.5714425",
"0.56468415",
"0.5607265",
"0.56... | 0.87860364 | 0 |
NOTE: this is not called when "parse" methods are tested by themselves | def default_options
{
acceleration: true,
auto_row_sep_chars: 500,
chunk_size: nil,
col_sep: :auto, # was: ',',
comment_regexp: nil, # was: /\A#/,
convert_values_to_numeric: true,
downcase_header: true,
duplicate_header_suffix: nil,
file_encoding: 'utf-8',
force_simple_split: false,
force_utf8: false,
headers_in_file: true,
invalid_byte_sequence: '',
keep_original_headers: false,
key_mapping: nil,
quote_char: '"',
remove_empty_hashes: true,
remove_empty_values: true,
remove_unmapped_keys: false,
remove_values_matching: nil,
remove_zero_values: false,
required_headers: nil,
required_keys: nil,
row_sep: :auto, # was: $/,
silence_missing_keys: false,
skip_lines: nil,
strings_as_keys: false,
strip_chars_from_headers: nil,
strip_whitespace: true,
user_provided_headers: nil,
value_converters: nil,
verbose: false,
with_line_numbers: false,
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse; end",
"def parse; end",
"def parse; end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parse\n raise \"absctract method called\"\n end",
"def parse\n end",
"def parsed; end",
"def parsed; end",
"def parse\n raise NotImplementedE... | [
"0.80481535",
"0.80481535",
"0.80481535",
"0.7903929",
"0.7823365",
"0.78050226",
"0.7788776",
"0.7788776",
"0.7537192",
"0.7443186",
"0.7382194",
"0.737043",
"0.737043",
"0.737043",
"0.737043",
"0.73511493",
"0.7322105",
"0.7306407",
"0.7121635",
"0.7088825",
"0.7088825",
... | 0.0 | -1 |
Thin wrapper around Cextension | def parse(line, options, header_size = nil)
# puts "SmarterCSV.parse OPTIONS: #{options[:acceleration]}" if options[:verbose]
if options[:acceleration] && has_acceleration?
# :nocov:
has_quotes = line =~ /#{options[:quote_char]}/
elements = parse_csv_line_c(line, options[:col_sep], options[:quote_char], header_size)
elements.map!{|x| cleanup_quotes(x, options[:quote_char])} if has_quotes
return [elements, elements.size]
# :nocov:
else
# puts "WARNING: SmarterCSV is using un-accelerated parsing of lines. Check options[:acceleration]"
return parse_csv_line_ruby(line, options, header_size)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension; end",
"def extension; end",
"def extension; end",
"def extension; end",
"def setup_c_extension(extension_name, gem_spec = nil)\n # use the DLEXT for the true extension name\n ext_name = \"#{extension_name}.#{RbConfig::CONFIG['DLEXT']}\"\n\n # we need lib\n directory 'lib'\n\n # verify i... | [
"0.6745022",
"0.6745022",
"0.6745022",
"0.6745022",
"0.66879165",
"0.65144515",
"0.65144515",
"0.63401794",
"0.62707967",
"0.6109123",
"0.6109123",
"0.60617757",
"0.6042484",
"0.6015097",
"0.6014227",
"0.5932692",
"0.59141135",
"0.5900682",
"0.5900682",
"0.5900682",
"0.586342... | 0.0 | -1 |
Ruby equivalent of the Cextension for parse_line parses a single line: either a CSV header and body line quoting rules compared to RFC4180 are somewhat relaxed we are not assuming that quotes inside a fields need to be doubled we are not assuming that all fields need to be quoted (0 is even) works with multichar col_sep if header_size is given, only up to header_size fields are parsed We use header_size for parsing the body lines to make sure we always match the number of headers in case there are trailing col_sep characters in line Our convention is that empty fields are returned as empty strings, not as nil. the purpose of the max_size parameter is to handle a corner case where CSV lines contain more fields than the header. In which case the remaining fields in the line are ignored | def parse_csv_line_ruby(line, options, header_size = nil)
return [] if line.nil?
line_size = line.size
col_sep = options[:col_sep]
col_sep_size = col_sep.size
quote = options[:quote_char]
quote_count = 0
elements = []
start = 0
i = 0
previous_char = ''
while i < line_size
if line[i...i+col_sep_size] == col_sep && quote_count.even?
break if !header_size.nil? && elements.size >= header_size
elements << cleanup_quotes(line[start...i], quote)
previous_char = line[i]
i += col_sep.size
start = i
else
quote_count += 1 if line[i] == quote && previous_char != '\\'
previous_char = line[i]
i += 1
end
end
elements << cleanup_quotes(line[start..-1], quote) if header_size.nil? || elements.size < header_size
[elements, elements.size]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(line, options, header_size = nil)\n # puts \"SmarterCSV.parse OPTIONS: #{options[:acceleration]}\" if options[:verbose]\n\n if options[:acceleration] && has_acceleration?\n # :nocov:\n has_quotes = line =~ /#{options[:quote_char]}/\n elements = parse_csv_line_c(line, option... | [
"0.6565621",
"0.64743674",
"0.585044",
"0.57938266",
"0.57859784",
"0.5755265",
"0.5731677",
"0.5705156",
"0.56596583",
"0.559933",
"0.5564447",
"0.54969245",
"0.5446638",
"0.5443309",
"0.5440782",
"0.54093933",
"0.53580254",
"0.53291667",
"0.53099924",
"0.52911675",
"0.52001... | 0.7201294 | 0 |
acts as a roadblock to limit processing when iterating over all k/v pairs of a CSVhash: | def only_or_except_limit_execution(options, option_name, key)
if options[option_name].is_a?(Hash)
if options[option_name].has_key?(:except)
return true if Array(options[option_name][:except]).include?(key)
elsif options[option_name].has_key?(:only)
return true unless Array(options[option_name][:only]).include?(key)
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _each\n delete_harmful!\n convert_eol_to_unix!\n transliterate_whole_file_to_utf8!\n skip_rows!\n\n Engine.new(local_copy.encoded_io, csv_options).each do |row|\n\n some_value_present = false\n\n if not headers\n\n # represent the row as an array\n array... | [
"0.6426166",
"0.626937",
"0.60738885",
"0.60609835",
"0.5896111",
"0.5876972",
"0.5785326",
"0.57699597",
"0.5707463",
"0.57027686",
"0.5668483",
"0.5625261",
"0.5621421",
"0.5566072",
"0.55597955",
"0.55592924",
"0.55536854",
"0.5538221",
"0.5513996",
"0.5513996",
"0.5490846... | 0.0 | -1 |
If file has headers, then guesses column separator from headers. Otherwise guesses column separator from contents. Raises exception if none is found. | def guess_column_separator(filehandle, options)
skip_lines(filehandle, options)
delimiters = [',', "\t", ';', ':', '|']
line = nil
has_header = options[:headers_in_file]
candidates = Hash.new(0)
count = has_header ? 1 : 5
count.times do
line = readline_with_counts(filehandle, options)
delimiters.each do |d|
candidates[d] += line.scan(d).count
end
rescue EOFError # short files
break
end
rewind(filehandle)
if candidates.values.max == 0
# if the header only contains
return ',' if line.chomp(options[:row_sep]) =~ /^\w+$/
raise SmarterCSV::NoColSepDetected
end
candidates.key(candidates.values.max)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inferred_separator\n SUPPORTED_SEPARATORS.each do |sep|\n return sep if data.scan(sep).length > 0\n end\n\n raise UnknownFormat.new(@path)\n end",
"def column_seperator\n self.data.strip.each.first.gsub(/[;,]/).first\n end",
"def column_headers(data)\n data.find { |line| line.split(' ... | [
"0.6036126",
"0.5901849",
"0.5612929",
"0.54666996",
"0.5438543",
"0.5357109",
"0.53222996",
"0.5294445",
"0.50595534",
"0.49793327",
"0.4963215",
"0.49334764",
"0.49233347",
"0.4920066",
"0.49138913",
"0.48828658",
"0.48672378",
"0.48038948",
"0.47681335",
"0.47544372",
"0.4... | 0.8163416 | 0 |
limitation: this currently reads the whole file in before making a decision | def guess_line_ending(filehandle, options)
counts = {"\n" => 0, "\r" => 0, "\r\n" => 0}
quoted_char = false
# count how many of the pre-defined line-endings we find
# ignoring those contained within quote characters
last_char = nil
lines = 0
filehandle.each_char do |c|
quoted_char = !quoted_char if c == options[:quote_char]
next if quoted_char
if last_char == "\r"
if c == "\n"
counts["\r\n"] += 1
else
counts["\r"] += 1 # \r are counted after they appeared
end
elsif c == "\n"
counts["\n"] += 1
end
last_char = c
lines += 1
break if options[:auto_row_sep_chars] && options[:auto_row_sep_chars] > 0 && lines >= options[:auto_row_sep_chars]
end
rewind(filehandle)
counts["\r"] += 1 if last_char == "\r"
# find the most frequent key/value pair:
k, _ = counts.max_by{|_, v| v}
return k
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(file)\n results = error_basic_inject(\"select CHAR_LENGTH(load_file(#{file.strip.chomp.mysqlhex}))\")\n if results.nil? or results == ''\n print_line(\"\")\n print_caution(\"Unable to determine size of #{file}....\")\n max = 1000\n else\n max = results.to_i\n end\n ... | [
"0.64510834",
"0.6363693",
"0.5981454",
"0.5981454",
"0.59514344",
"0.58437526",
"0.58272374",
"0.58261335",
"0.578718",
"0.5766728",
"0.5748342",
"0.5745426",
"0.573911",
"0.57380366",
"0.5734192",
"0.56975883",
"0.5693876",
"0.56885296",
"0.567609",
"0.56263334",
"0.5583944... | 0.0 | -1 |
GET /litigantes GET /litigantes.json | def index
@litigantes = Litigante.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render j... | [
"0.6840143",
"0.6735118",
"0.67135036",
"0.66299325",
"0.6515038",
"0.64215463",
"0.63972616",
"0.6362224",
"0.63478523",
"0.63315403",
"0.6283525",
"0.62643254",
"0.6225559",
"0.62150204",
"0.6206708",
"0.6193282",
"0.61909634",
"0.6187592",
"0.61722666",
"0.6141094",
"0.613... | 0.6933273 | 0 |
GET /litigantes/1 GET /litigantes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render j... | [
"0.71055126",
"0.7098314",
"0.7021023",
"0.68522185",
"0.67774117",
"0.67612505",
"0.66655535",
"0.6528839",
"0.65203226",
"0.64979935",
"0.6490209",
"0.64629066",
"0.64213794",
"0.6416448",
"0.6416448",
"0.6415562",
"0.64139843",
"0.64106244",
"0.63818747",
"0.63815",
"0.637... | 0.0 | -1 |
POST /litigantes POST /litigantes.json | def create
@litigante = Litigante.new(litigante_params)
respond_to do |format|
if @litigante.save
format.html { redirect_to @litigante, notice: 'Litigante was successfully created.' }
format.json { render :show, status: :created, location: @litigante }
else
format.html { render :new }
format.json { render json: @litigante.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @leito = Leito.new(params[:leito])\n\n respond_to do |format|\n if @leito.save\n format.html { redirect_to @leito, notice: 'Leito was successfully created.' }\n format.json { render json: @leito, status: :created, location: @leito }\n else\n format.html { render ac... | [
"0.6765753",
"0.6617363",
"0.64101124",
"0.63843805",
"0.6254881",
"0.6250767",
"0.6247321",
"0.62227625",
"0.6202175",
"0.61843634",
"0.6178186",
"0.6176066",
"0.61421204",
"0.6141438",
"0.6125902",
"0.6119125",
"0.6104647",
"0.6095952",
"0.60938144",
"0.6085084",
"0.6079238... | 0.6908584 | 0 |
PATCH/PUT /litigantes/1 PATCH/PUT /litigantes/1.json | def update
respond_to do |format|
if @litigante.update(litigante_params)
format.html { redirect_to @litigante, notice: 'Litigante was successfully updated.' }
format.json { render :show, status: :ok, location: @litigante }
else
format.html { render :edit }
format.json { render json: @litigante.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n if @lieu.update_attributes(params[:lieu])\n format.html { redirect_to @lieu, notice: 'L... | [
"0.67894596",
"0.667066",
"0.6593973",
"0.6529157",
"0.6450816",
"0.6448251",
"0.6413122",
"0.6404869",
"0.6365288",
"0.6345258",
"0.6335578",
"0.6335578",
"0.6323793",
"0.6323017",
"0.63147813",
"0.63147813",
"0.6313628",
"0.63045555",
"0.6301771",
"0.6301771",
"0.62926155",... | 0.6799611 | 0 |
DELETE /litigantes/1 DELETE /litigantes/1.json | def destroy
@litigante.destroy
respond_to do |format|
format.html { redirect_to litigantes_url, notice: 'Litigante was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @leito = Leito.find(params[:id])\n @leito.destroy\n\n respond_to do |format|\n format.html { redirect_to leitos_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\... | [
"0.7220753",
"0.7054459",
"0.69733346",
"0.6945899",
"0.69382465",
"0.6909284",
"0.6870737",
"0.6869344",
"0.6866321",
"0.68574893",
"0.6827508",
"0.68133086",
"0.6772821",
"0.6765886",
"0.67650384",
"0.6762594",
"0.6761315",
"0.67601734",
"0.67503726",
"0.674974",
"0.6743486... | 0.70145524 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_litigante
@litigante = Litigante.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 litigante_params
params.require(:litigante).permit(:case_id, :participante, :rut, :persona, :nombre)
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 |
Destroys the like tied to this user on this likeable model | def unliked_by(user)
self.send(self.class.like_label.tableize.to_sym).find_by_user_id(user.id).destroy rescue false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n like = Like.find(params[:id])\n if like.user == current_user\n Like.destroy(params[:id])\n end\n redirect_to root_url\n end",
"def destroy_like\n @like = Like.where(likeable_id: params[:comment_id], likeable_type: \"Comment\", user_id: current_user.id).first\n @like.destro... | [
"0.7908806",
"0.7688841",
"0.76653564",
"0.7583854",
"0.75662553",
"0.7433691",
"0.74025714",
"0.7395852",
"0.73752505",
"0.73436856",
"0.73384136",
"0.730955",
"0.72346383",
"0.72338724",
"0.7202475",
"0.71232116",
"0.70947874",
"0.7093496",
"0.70547974",
"0.7019187",
"0.695... | 0.7718917 | 1 |
matches `[PERCENTAGE] of [NUM]` and `[PERCENTAGE] (off|on) [NUM]` | def parse_percentage_expression
regex = /(?<percentage>-?[\d.]+)% (?<operator>(off?|on)) (?<expr>.*$)/
match = @expression.match(regex)
if match
operator = match.named_captures["operator"]
percentage = match.named_captures["percentage"]
expr = match.named_captures["expr"]
percentage_expr = "#{expr} * #{percentage.to_f/100}"
case operator
when 'of'
@expression = percentage_expr
when 'off'
@expression = "#{expr} - (#{percentage_expr})"
when 'on'
@expression = "#{expr} + (#{percentage_expr})"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = PERCENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 163:11: '%'\n match( 0x25 )\n\n \n @state.type = t... | [
"0.55788255",
"0.55465823",
"0.5396152",
"0.50461864",
"0.49546033",
"0.48955175",
"0.48949093",
"0.4863768",
"0.4861592",
"0.48227188",
"0.48227188",
"0.47872362",
"0.47347498",
"0.47109276",
"0.47109276",
"0.4707554",
"0.47000086",
"0.46835592",
"0.4656993",
"0.46562716",
"... | 0.67594284 | 0 |
reformat any mathmatical functions from lowercase to upper e.g. avg(1,2) > AVG(1,2) | def reformat_math_functions
funcs = %w(min max sum avg count round rounddown roundup sin cos tan)
regex = /\b(?<func>#{funcs}.join('|'))\((?<expr>[^()]+)\)/
match = @expression.match(regex)
if match
func = match.named_captures["func"]
expr = match.named_captures["expr"]
@expression = "#{func.upcase}(#{expr})"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_function_lower(scope, ast)\n scope, str = apply_ast(scope, ast.children.first)\n return scope, \"lower(#{str})\"\n end",
"def shout (maj)\n maj.upcase\nend",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def apply_function_upper(scope, ast)\... | [
"0.6066712",
"0.58529526",
"0.58274436",
"0.5823314",
"0.5795221",
"0.57646775",
"0.5761234",
"0.57603145",
"0.5735932",
"0.5728774",
"0.5704479",
"0.5695553",
"0.5692357",
"0.56736153",
"0.5672991",
"0.5668631",
"0.56610185",
"0.56388676",
"0.56373316",
"0.5620427",
"0.56000... | 0.74625003 | 0 |
comments resemble cstyle, singleline statements `//[...]` when commented out, the processed expression will be blank | def detect_comments
if @input =~ %r{^\s*[/]{2}}
@mode = :comment
@expression = ''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lex_comment line\n # do nothing\n end",
"def consume_comments; end",
"def single_line_comment\n # //\n if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2f\n @pos += 2\n pos0 = @pos\n while (code = @codes[@pos]) and !line_terminator?(code)\n @pos += 1\n en... | [
"0.7427642",
"0.7419718",
"0.72615504",
"0.7205587",
"0.7187588",
"0.7085778",
"0.70835793",
"0.69837433",
"0.6953066",
"0.6921879",
"0.6921879",
"0.6921879",
"0.6921879",
"0.69048876",
"0.6899584",
"0.6897714",
"0.6876154",
"0.68521494",
"0.6847973",
"0.6847973",
"0.6847973"... | 0.7622495 | 0 |
if input matches `[VAR] = [EXPRESSION]` extract variable name and expression | def process_variable_assignment
regex = %r{(?<name>\w+)( = )(?<expression>.*$)}
match = @input.match(regex)
if match
@name = match.named_captures["name"]
@expression = match.named_captures["expression"]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_exp(input, variable, expression); end",
"def expand_variables\n # self.tokens = self\n\n # var_regex = /^[\\w]+$/\n # var_regex = /([\\s\\b])[\\w]+([\\s\\b])/\n\n # expanded = []\n # self.tokens.each do |token|\n # expanded << expand_token(token)\n # end\n # @expression = expan... | [
"0.69910884",
"0.6536794",
"0.64713204",
"0.6470084",
"0.63306314",
"0.6091931",
"0.605322",
"0.5949441",
"0.593646",
"0.580148",
"0.5785296",
"0.5775926",
"0.5753371",
"0.5744721",
"0.57291156",
"0.56937635",
"0.56901443",
"0.5671195",
"0.56445926",
"0.56445926",
"0.56445926... | 0.7523549 | 0 |
currently variables are only expanded when surrounded by whitespace or ends of line | def expand_variables
# self.tokens = self
# var_regex = /^[\w]+$/
# var_regex = /([\s\b])[\w]+([\s\b])/
# expanded = []
# self.tokens.each do |token|
# expanded << expand_token(token)
# end
# @expression = expanded.join(' ')
@expression = self.tokens.map do |token|
expand_token(token)
end.join(' ')
# @expression = @expression.split(' ').map do |token|
# if !valid_var_name?(token)
# return token
# elsif is_var?(token)
# return get_var(token)
# else
# @mode = :invalid
# @errors << {message: "invalid variable name", info: token}
# return token
# end
# end.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_variables() end",
"def capture_variables(line)\n noncomment, _ = line.split(\"#\", 2)\n noncomment.scan(/ENV(?:\\[|\\.fetch\\()['\"]([^'\"]+)['\"]/).flatten\n end",
"def external_vars(opts={})\n if opts\n opts.each do |k,v|\n if v.include? \",\"\n if... | [
"0.6537794",
"0.63158387",
"0.6120582",
"0.610311",
"0.60432076",
"0.6039906",
"0.60265493",
"0.5985823",
"0.5981582",
"0.596007",
"0.596007",
"0.59542567",
"0.59515023",
"0.59330624",
"0.59330624",
"0.59330624",
"0.59330624",
"0.59330624",
"0.59330624",
"0.59330624",
"0.5933... | 0.69487417 | 0 |
remove leading and trailing whitespace from expression | def trim_whitespace
@expression.strip!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rstrip\r\n match = rewrite(/\\s+\\z/)\r\n match ? match[0] : ''\r\n end",
"def undent\n gsub /^.{#{slice(/^ +/).length}}/, ''\n end",
"def strip_whitespace!\n replace(self.strip_whitespace)\n end",
"def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end",
"def trim_whitespace;... | [
"0.7307711",
"0.7171218",
"0.70892143",
"0.7087",
"0.70736927",
"0.7025794",
"0.69583726",
"0.69527805",
"0.6921175",
"0.69098747",
"0.6826063",
"0.6826063",
"0.68033904",
"0.67857105",
"0.67702067",
"0.6761271",
"0.6749779",
"0.67470104",
"0.67125535",
"0.67108345",
"0.67066... | 0.8477355 | 0 |
if nonblank expression is invalid then mark mode as :invalid | def validate
# @expression && !@expression.blank?
if !@expression || @expression.blank?
return
elsif !Calculator.valid?(@expression)
@expression = nil
@mode = :invalid
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate!\n # Expression must be present.\n if expression.to_s.length == 0\n raise SkyDB::Query::ValidationError.new(\"Invalid expression for selection group: '#{expression.to_s}'\")\n end\n end",
"def match_regex\n if !self.value.blank? && self.regex\n errors.add(:... | [
"0.628122",
"0.62244105",
"0.62024724",
"0.62024724",
"0.61063355",
"0.60719776",
"0.6065709",
"0.6065709",
"0.6015074",
"0.5882369",
"0.57849026",
"0.57636803",
"0.57636803",
"0.57636803",
"0.57636803",
"0.57636803",
"0.57636803",
"0.5759746",
"0.5747975",
"0.574058",
"0.572... | 0.727553 | 0 |
def hellobug redirect_to '/user_traits' end | def privacy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def other_hello\n redirect_to(:controller => 'demo', :action => 'hello')\n end",
"def other_hello\n # redirect_to(:controller => 'demo', :action =>'index')\n redirect_to(:action => 'hello')\n end",
"def redirect?; end",
"def redirects; end",
"def redirect_ok; end",
"def redirect_ok; end",
"d... | [
"0.704424",
"0.6993151",
"0.6965169",
"0.6918002",
"0.6815349",
"0.6815349",
"0.668292",
"0.65834785",
"0.65522134",
"0.6501314",
"0.6496074",
"0.6490836",
"0.6490836",
"0.6481421",
"0.6445969",
"0.6441586",
"0.6415043",
"0.6412178",
"0.6403546",
"0.6400171",
"0.64000154",
... | 0.0 | -1 |
To prevent the render call from reentrancy we need to remember if we're in our own render path. Our rendering code calls 'render' to access the real view renderer so we need a way to fall back to it. | def in_progressive_render
@in_progressive_render = true
yield
@in_progressive_render = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_render_context\n self\n end",
"def sync_render_context\n self\n end",
"def render?\n true\n end",
"def cached_render\n if Global.file_cache\n cached_render_file\n else\n cached_render_memory\n end\n end",
"def render?\n true\n ... | [
"0.6574456",
"0.6574456",
"0.64954865",
"0.6488966",
"0.6478073",
"0.64642256",
"0.6463588",
"0.64134383",
"0.63959855",
"0.63636965",
"0.63609564",
"0.6316424",
"0.6316424",
"0.62934256",
"0.6286148",
"0.62748",
"0.6259806",
"0.62378365",
"0.6232748",
"0.62122214",
"0.620507... | 0.0 | -1 |
random number between 152 | def random
card = rand(1..52)
card.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_no\n rand(5000)\nend",
"def random_number\n rand(0..20)\n end",
"def gen_num\n rand(1..100)\nend",
"def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"def n_generator\n number = rand(10..30)\n end",
"def number_generator\n rand(1..20)\n end",
... | [
"0.77748",
"0.7553915",
"0.75041515",
"0.7427795",
"0.74111843",
"0.7367872",
"0.73326653",
"0.72957766",
"0.72800153",
"0.72745955",
"0.72745955",
"0.72114116",
"0.7194774",
"0.7187147",
"0.7185083",
"0.7156885",
"0.71304184",
"0.7102128",
"0.70645434",
"0.7037566",
"0.70365... | 0.7310965 | 8 |
GET /uploads GET /uploads.js | def index
# Optionally filter by election.
if @election
@uploads = policy_scope(Upload).where(election: @election).joins(:file_type).order(sort_column.to_s + ' ' + sort_direction.to_s).page(params[:page]).per(params[:limit])
else
@uploads = policy_scope(Upload).joins(:file_type).order(sort_column.to_s + ' ' + sort_direction.to_s).page(params[:page]).per(params[:limit])
end
authorize @uploads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @uploads = @user.uploads\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads }\n end\n end",
"def file_uploads; end",
"def index\n @upload = Upload.new # Allow file uploads on index page via jq_fu\n\n respond_to do |format|\n ... | [
"0.7486534",
"0.73832065",
"0.7076796",
"0.70105416",
"0.6757131",
"0.67211336",
"0.6681613",
"0.6681",
"0.6681",
"0.6681",
"0.6681",
"0.6681",
"0.6658865",
"0.66562563",
"0.6578515",
"0.6552561",
"0.6550858",
"0.6420163",
"0.6420163",
"0.64180577",
"0.63670146",
"0.6347575... | 0.5744372 | 79 |
Determines if the uploaded file should be committed to the blockchain and if so, commits it. | def commit_file
if @upload.public? && @upload.file_type.public? && @upload.address.blank? && (@upload.creating? || @upload.failed?)
BlockchainCommitJob.perform_later(@upload.id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_file\n\t\tlogger.info(\"[File Attribute #{sprintf('0x%08x', self.object_id)}] Committing file for #{@obj.class}(#{@obj.id}).#{attribute_name} ...\")\n\t\tif @file\n\t\t\tlogger.info(\"[File Attribute] Saving file #{local_file_name} ...\")\n\t\t\t@file.rewind if @file.respond_to?(:rewind)\n\t\t\tFile.mak... | [
"0.70447665",
"0.65341896",
"0.6500315",
"0.6240958",
"0.62225926",
"0.6187146",
"0.60833895",
"0.60467666",
"0.602827",
"0.5978281",
"0.5943722",
"0.5923486",
"0.5871943",
"0.5862198",
"0.58589554",
"0.5825412",
"0.5822279",
"0.57865465",
"0.5734036",
"0.5720119",
"0.5697462... | 0.7668371 | 0 |
Determines if the uploaded file can be retrieved from the blockchain and if so, retrieves it. | def retrieve_file
if @upload.public? && @upload.file_type.public? && @upload.address.present? && @upload.success?
BlockchainRetrieveJob.perform_later(@upload.id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_file(file)\n begin\n @ftp.getbinaryfile(file)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end",
"def fetchFile #:doc:\n \n begin\n @user = User.find_by_username(params[:username])\n @device = @user.devices.find_by_dev_... | [
"0.6731581",
"0.666982",
"0.65142936",
"0.6495629",
"0.62553185",
"0.61968386",
"0.61654264",
"0.6135881",
"0.6132813",
"0.60777885",
"0.5985837",
"0.5973886",
"0.59500945",
"0.5936127",
"0.5932834",
"0.59322786",
"0.59254086",
"0.59176177",
"0.58598405",
"0.58598405",
"0.583... | 0.75448596 | 0 |
Setup the parent resource. | def set_election
@election = nil
@election = Election.find(params[:filter]) if params[:filter]
@election = Election.find(params[:election_id]) if params[:election_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(resource)\n if @resource_config[:parent]\n raise DefinitionError, \"parent already declared in #{self}\"\n end\n @resource_config[:parent] = resource\n end",
"def parent=(resource)\n @parent = resource\n end",
"def set_parent_resource(resource = nil)\n ... | [
"0.7486468",
"0.7392739",
"0.73852366",
"0.69773346",
"0.6879572",
"0.6802472",
"0.6791323",
"0.67704844",
"0.67345697",
"0.67345697",
"0.67345697",
"0.67345697",
"0.67345697",
"0.67345697",
"0.67296046",
"0.67296046",
"0.67282623",
"0.6707594",
"0.66529775",
"0.6596481",
"0.... | 0.0 | -1 |
Never trust parameters from the scary Internet, only allow the white list through. | def upload_params
params.require(:upload).permit(:election_id, :file_type_id, :public, :file) # Not status, address or checksum.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def safe_params\n params.exce... | [
"0.6888801",
"0.6744586",
"0.66958785",
"0.6691486",
"0.6632683",
"0.66152805",
"0.6571971",
"0.6556105",
"0.6498985",
"0.6418654",
"0.641478",
"0.63825935",
"0.6380411",
"0.6351492",
"0.634005",
"0.6323299",
"0.62733626",
"0.6253789",
"0.62238204",
"0.6222662",
"0.6201494",
... | 0.0 | -1 |
=========================== solved by loris | def odds_and_evens(string, return_odds)
newString = String.new
puts newString
stringArray = string.split(//)
if return_odds == true
stringArray.each_with_index do |v, k|
if k % 2 != 0
newString << v
end
end
else
stringArray.each_with_index do |v, k|
if k % 2 == 0
newString << v
end
end
end
return newString
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def stderrs; end",
"def anchored; end",
"def berlioz; end",
"def rassoc(p0) end",
"def malts; end",
"def terpene; end",
"def suivre; end",
"def verdi; end",
"def trd; end",
"def schumann; end",
"def formation; end",
"def offen... | [
"0.6524386",
"0.6120349",
"0.5971137",
"0.5967669",
"0.5901956",
"0.5856847",
"0.5838328",
"0.58174294",
"0.5803969",
"0.5713613",
"0.56706893",
"0.5657227",
"0.5655819",
"0.5617566",
"0.5616523",
"0.560087",
"0.5492753",
"0.54742366",
"0.54742366",
"0.54742366",
"0.54742366"... | 0.0 | -1 |
GET /markets GET /markets.json | def index
@markets = Market.all
fill_markers
respond_to do |format|
format.html
format.csv { send_data @markets.to_csv }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markets\n get('/markets')['markets']\n end",
"def index\n @markets = Market.all\n end",
"def index\n @supermarkets = Supermarket.all\n respond_to do |format|\n format.json { render json: @supermarkets, status: :ok } \n end \n end",
"def planets\n data = JSON.parse(open(\"h... | [
"0.86405236",
"0.70124197",
"0.6991847",
"0.68668693",
"0.6417092",
"0.63555455",
"0.633128",
"0.63163906",
"0.63156444",
"0.6295922",
"0.6292435",
"0.6274393",
"0.6237423",
"0.62005645",
"0.6156033",
"0.6136192",
"0.61211365",
"0.6120647",
"0.6111573",
"0.6058865",
"0.605886... | 0.6068674 | 19 |
GET /markets/1 GET /markets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markets\n get('/markets')['markets']\n end",
"def index\n @markets = Market.all\n end",
"def index\n @supermarkets = Supermarket.all\n respond_to do |format|\n format.json { render json: @supermarkets, status: :ok } \n end \n end",
"def show\n @supermarket = Supermarket.fi... | [
"0.80650157",
"0.69190115",
"0.6814074",
"0.63388085",
"0.6314816",
"0.63018113",
"0.6116833",
"0.6085035",
"0.60797405",
"0.60685396",
"0.6040937",
"0.60169077",
"0.6007949",
"0.60025054",
"0.5981447",
"0.5974471",
"0.597257",
"0.5972565",
"0.59721947",
"0.5962268",
"0.59092... | 0.0 | -1 |
POST /markets POST /markets.json | def create
@market = Market.new(market_params)
respond_to do |format|
if @market.save
format.html { redirect_to root_url, notice: 'Activity was successfully created.' }
format.json { render action: 'show', status: :created, location: @market }
else
format.html { render action: 'new' }
format.json { render json: @market.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markets\n get('/markets')['markets']\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => edi... | [
"0.64508766",
"0.6220002",
"0.6071341",
"0.58297485",
"0.57596576",
"0.57408005",
"0.57232237",
"0.5694976",
"0.5672033",
"0.5672033",
"0.5575804",
"0.5575804",
"0.5563048",
"0.5526993",
"0.5511544",
"0.54852283",
"0.54690504",
"0.54624027",
"0.54268354",
"0.54225665",
"0.541... | 0.5719034 | 7 |
PATCH/PUT /markets/1 PATCH/PUT /markets/1.json | def update
respond_to do |format|
if @market.update(market_params)
format.html { redirect_to @market, notice: 'Market was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @market.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n respond_to do |format|\n if @market.update(market_params)... | [
"0.6689297",
"0.6285735",
"0.62254876",
"0.6205059",
"0.6087899",
"0.5969578",
"0.5943647",
"0.5923731",
"0.5918055",
"0.58609074",
"0.5856743",
"0.58487135",
"0.5837215",
"0.5828785",
"0.58192664",
"0.581824",
"0.5796044",
"0.5793048",
"0.5785845",
"0.5774626",
"0.57715815",... | 0.63627464 | 1 |
DELETE /markets/1 DELETE /markets/1.json | def destroy
@market.destroy
respond_to do |format|
format.html { redirect_to markets_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @market.destroy\n respond_to do |format|\n format.html { redirect_to markets_url, notice: 'Market was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @simulation_market = SimulationMarket.find(params[:id])\n @simulation_market.des... | [
"0.71753776",
"0.7122614",
"0.6966567",
"0.6872031",
"0.6830154",
"0.68011874",
"0.6796561",
"0.6779791",
"0.67787063",
"0.6742691",
"0.6737567",
"0.6702646",
"0.6678278",
"0.66740394",
"0.66698384",
"0.66698384",
"0.66698384",
"0.66572165",
"0.66490245",
"0.6637208",
"0.6630... | 0.7435892 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_market
@market = Market.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 market_params
params.require(:market).permit(:name, :website, :street, :city, :state, :zip, :latitude, :longitude, :description, :image, :rating)
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 |
finalResult = getHalfMinuteEpisodeInfo(' File.open("output.txt", "w") do |f| finalResult.each do |r| f.puts r.name.strip end end | def getHalfMinuteArticle(showURL,theYear,defaultDate)
page = Nokogiri::HTML(open(showURL))
showTitle = page.css('td#contentTd table td h3 strong.title').text.strip
showDescription = page.css('td#contentTd p').text.strip
episodeTable = page.css('td#contentTd table td a.hmenu')
episodeTitle = []
episodeURL = []
episodeDate = []
episodeMaster = []
episodeDesc = []
episodeTable.each do |t|
episodeURL.push('http://www.moneyradio.org/'+t['href'])
titleText = t.text.strip
#episodeDate.push(titleText.index(theYear))
if(titleText.index(theYear).nil?)
episodeDate.push(Date.strptime(defaultDate, '%m/%d/%Y'))
episodeTitle.push(t.text.strip)
#use this print out to debug
#puts t.text.strip
else
if titleText.index('1011/2007') # this is special case in 2007
episodeDate.push(Date.strptime(defaultDate, '%m/%d/%Y'))
episodeTitle.push(t.text.strip)
else
episodeDate.push(Date.strptime(titleText[0..(titleText.index(theYear)+theYear.length-1)], '%m/%d/%Y'))
episodeTitle.push(titleText[(titleText.index(theYear)+theYear.length)..titleText.length].to_s.strip)
end
#use this print out to debug
#puts t.text.strip
end
end
f = 0
#episodeURL = episodeURL[0..4]
episodeURL.each do |c|
articlePage = Nokogiri::HTML(open(c))
content = articlePage.css('td#contentTd p').text.strip
#puts content
episodeDesc.push(content)
puts f.to_s
puts episodeDate[f]
puts episodeTitle[f]
sleep(3)
f = f+1
end
#puts "title: "+episodeTitle.length.to_s + "content: "+episodeDesc.length.to_s
k = 0
episodeURL.each do |j|
episode = EpisodePage.new
episode.name = episodeTitle[k]
episode.date = episodeDate[k]
#episode.url = j
episode.desc = episodeDesc[k]
k = k + 1
episodeMaster.push(episode)
end
return episodeMaster
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeFile\n File.open(ARGV[1], \"w+\") do |f|\n $results.each{\n |result|\n f.puts(result)\n }\n end\nend",
"def save_to_file\n File.open(\"results/#{seq_name}\"+\".txt\", 'w') { |file|\n \n n=1\n \n @actions.each do |a|\n file.puts a.des... | [
"0.64996266",
"0.62931234",
"0.6069133",
"0.6062333",
"0.6050378",
"0.59020406",
"0.58799666",
"0.58142805",
"0.5789743",
"0.5752137",
"0.57201827",
"0.56929183",
"0.5680116",
"0.56533235",
"0.56233144",
"0.5618905",
"0.56125146",
"0.56022274",
"0.5541119",
"0.55317575",
"0.5... | 0.51890177 | 74 |
finalResult = getHalfMinuteArticle(' puts "final: " + finalResult.length.to_s | def getArticleWithHTML(showURL)
page = Nokogiri::HTML(open(showURL))
showTitle = page.css('td#contentTd table td h3 strong.title').text.strip
showDescription = page.css('td#contentTd p').text.strip
episodeTable = page.css('td#contentTd table td a.hmenu')
episodeTitle = []
episodeURL = []
episodeDate = []
episodeMaster = []
episodeDesc = []
episodeTable.each do |t|
episodeURL.push('http://www.moneyradio.org/'+t['href'])
titleText = t.text.strip
puts titleText
end
f = 0
#episodeURL = episodeURL[0..4]
episodeURL.each do |c|
articlePage = Nokogiri::HTML(open(c))
content = articlePage.css('td#contentTd p').text.strip
puts content
episodeDesc.push(content)
#puts f.to_s
#puts episodeTitle[f]
sleep(3)
f = f+1
end
#puts "title: "+episodeTitle.length.to_s + "content: "+episodeDesc.length.to_s
k = 0
episodeURL.each do |j|
episode = EpisodePage.new
episode.name = episodeTitle[k]
episode.date = ''
#episode.url = j
episode.desc = episodeDesc[k]
k = k + 1
episodeMaster.push(episode)
end
return episodeMaster
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combien_journaliste(journaliste)\n\tputs \"Reponse: \"\n\tputs \" Il y en a \"\n\tputs journaliste.length\n\tputs \" \"\n\nend",
"def prindex(output_string)\n print output_string\n output_string.length #returns this\nend",
"def get_length\n\t\tsynchronized do\n\t\t\t@vlc.puts \"get_length\"\n\t\t\t@vlc.... | [
"0.6628418",
"0.62732923",
"0.60890436",
"0.6028374",
"0.6028374",
"0.6028374",
"0.6028374",
"0.5999339",
"0.59858006",
"0.5938901",
"0.59271765",
"0.59271765",
"0.5881196",
"0.5837409",
"0.5837409",
"0.5837409",
"0.5837409",
"0.5837409",
"0.5837409",
"0.5837409",
"0.58361465... | 0.0 | -1 |
GET /movies GET /movies.json | def index
respond_with Movie.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies\n get('Movies')\n end",
"def pull_movies(options = {})\n response = HTTParty.get(build_url('movie', options), headers: HEADERS, debug_output: $stdout)\n JSON.parse(response.body)\n end",
"def index\n @movies = @category.movies.find(:all)\n\n respond_to do |format|\n f... | [
"0.8227555",
"0.7484902",
"0.74789107",
"0.74730414",
"0.74474025",
"0.7354044",
"0.7354044",
"0.7354044",
"0.7354044",
"0.7354044",
"0.7354044",
"0.73434794",
"0.7283256",
"0.7214987",
"0.7197649",
"0.7150194",
"0.7128301",
"0.703391",
"0.70069593",
"0.70027626",
"0.6960787"... | 0.69713336 | 20 |
GET /movies/1 GET /movies/1.json | def show
respond_with Movie.search(params[:id])
# respond_with movie: movie
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies\n get('Movies')\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.ht... | [
"0.7840408",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7417043",
"0.7337925",
"0.7307941",
"0.7254705",
"0.7145913",
"0.712192",
"0.7111538",
"0.70936346",
"0.7092198",
"0.70896614",
"0.70844346",
"0.7034522",
"0.6987229",
"0.69613814",
"0.6960965",
... | 0.67870307 | 30 |
DELETE /movies/1 DELETE /movies/1.json | def destroy
@movie.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.ht... | [
"0.75603294",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7552992",
"0.7529331",
"0.7491699",
"0.7491699",
"0.7491699",
"0.7491699",
"0.7437082",
"0.731825",
"0.72664374",
"0.72664374",
"0.72664374",
"0.7200594",
"0.71991533",
"0.71991533"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_movie
@movie = Movie.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def movie_params
params.require(:movie).permit(:title, :desc, :year)
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 |
Example: === class MyController < ApplicationController def index theme 'dark' end end === | def theme(name)
@current_theme = name
path = ThemePark.resolve_views_path(name)
prepend_view_path path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @themes = Theme.all\n end",
"def index\n @user=User.find(session[:user_id])\n @app = @user.apps.find(params[:app_id])\n ThemeColorsHelper.updateTheme @app.id\n @theme_colors = ThemeColor.where(\"app_id = '#{@app.id}'\")\n end",
"def set_theme\n # @theme = Theme.find(params[:id])... | [
"0.6704911",
"0.64578456",
"0.6457647",
"0.6420494",
"0.6404305",
"0.6404305",
"0.6404305",
"0.6401397",
"0.63236445",
"0.62932104",
"0.6274972",
"0.62701505",
"0.6233011",
"0.61959016",
"0.61286694",
"0.6106358",
"0.6090321",
"0.60799366",
"0.6056535",
"0.6056535",
"0.604514... | 0.5648856 | 53 |
Returns the base_path value. | def base_path
instance.options[:base_path]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_path(val=nil)\n if val\n @base_path = val\n else\n @base_path || default_base_path_name\n end\n end",
"def base_path\n @base_path || self.class.base_path\n end",
"def base_path path=nil\n if path\n @base_path = path\n end\n @bas... | [
"0.8596282",
"0.8317347",
"0.8245711",
"0.8209672",
"0.82091814",
"0.790009",
"0.77242315",
"0.7668497",
"0.7497538",
"0.74226797",
"0.742109",
"0.7391522",
"0.73889166",
"0.7380746",
"0.73708135",
"0.7271474",
"0.7167864",
"0.71206844",
"0.7109751",
"0.70852864",
"0.70742846... | 0.79422367 | 5 |
Returns the compression value. | def compression
instance.options[:compression]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compression\n unless defined?(@compression)\n @compression = :bzip2\n reset_computed_values\n end\n @compression\n end",
"def compression_codec\n cluster.config.compression_codec if compressed?\n end",
"def compression_level; end",
"def compress(value)\n Zlib::Deflate.def... | [
"0.74775016",
"0.7133638",
"0.7039516",
"0.6944209",
"0.6895531",
"0.6887365",
"0.6846899",
"0.67695725",
"0.6640865",
"0.66004616",
"0.65864617",
"0.6493128",
"0.6493128",
"0.6441703",
"0.6433299",
"0.6386159",
"0.6340291",
"0.6291131",
"0.6234644",
"0.6156641",
"0.6134908",... | 0.7026591 | 4 |
Returns the configuration singleton. Append configuration methods to access the configuration variable. | def configuration
instance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration\n Configuration::get\n end",
"def configuration\n Configuration::get\n end",
"def config\n @configuration ||= Configuration.new\n end",
"def config\n @configuration ||= Configuration.new\n end",
"def config\r\n Configuration\r\n ... | [
"0.82394314",
"0.82394314",
"0.799018",
"0.799018",
"0.79115945",
"0.79115945",
"0.79115945",
"0.79115945",
"0.79115945",
"0.79115945",
"0.78919566",
"0.78064716",
"0.7733344",
"0.7733344",
"0.7728442",
"0.7702278",
"0.7687167",
"0.7653952",
"0.7633891",
"0.7615704",
"0.76157... | 0.7520445 | 45 |
Returns the chosen colour mode. | def colour_mode
instance.options[:colour_mode]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_modes\n return @color_modes\n end",
"def colormode\n # TODO: Return a ColorMode object\n mode_value = @attributes.fetch('colormode', nil)\n ColorMode.new(mode_value)\n end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truec... | [
"0.74411714",
"0.7409013",
"0.7105346",
"0.7105346",
"0.7052336",
"0.6993235",
"0.68241763",
"0.6773737",
"0.66509247",
"0.66509247",
"0.6645449",
"0.6645449",
"0.66019326",
"0.65880203",
"0.65370166",
"0.6438889",
"0.6363784",
"0.6352362",
"0.6347746",
"0.633593",
"0.6274141... | 0.8042531 | 1 |
Returns whether debugging is enabled or disabled. Default is false; meaning only the top line of a backtrace from an exception is shown to the user of the client application. | def debug?
instance.options[:debug]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debugging?\n Options[:debug]\n end",
"def debug?\n false\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def debug_through?\r\n return false\r\n end",
"def debug?\n @@debug\n end",
"def debug_mode?\n @@debug_mode\n end",
"def ... | [
"0.74383974",
"0.7377318",
"0.725585",
"0.725585",
"0.7119016",
"0.7113887",
"0.7105518",
"0.70937675",
"0.705628",
"0.7026666",
"0.70124555",
"0.70080554",
"0.6969551",
"0.69695175",
"0.689556",
"0.6853887",
"0.68417865",
"0.68046445",
"0.6744632",
"0.6743809",
"0.6738521",
... | 0.68841505 | 16 |
Returns whether the DRb server is enabled or disabled. Default is false. | def drb?
instance.options[:drb]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled?\n !host.nil?\n end",
"def enabled?\n\n return @enabled\n\n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n !!configuration.enabled\n end",
"def enabled?\n return enabled\n end",
"d... | [
"0.71876234",
"0.7178591",
"0.71595466",
"0.71595466",
"0.71483284",
"0.7133109",
"0.71328086",
"0.71328086",
"0.71328086",
"0.71328086",
"0.7120174",
"0.70945644",
"0.70928025",
"0.70928025",
"0.70928025",
"0.70928025",
"0.70928025",
"0.70928025",
"0.70928025",
"0.70766693",
... | 0.6851658 | 29 |
Returns the hostname for the DRb server. | def drb_host
instance.options[:drb_host]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_server_hostname\n (`hostname`).strip\n end",
"def hostname\n Socket.gethostname.split('.').first.strip\n end",
"def hostname\n @hostname ||= `hostname`.strip\n end",
"def hostname\n @hostname ||= `hostname`.chomp\n end",
"def hostname\n Socket.gethostname\n e... | [
"0.8333672",
"0.8114324",
"0.7988389",
"0.7946411",
"0.78441477",
"0.78441477",
"0.77882487",
"0.77625924",
"0.7716973",
"0.7707606",
"0.7681261",
"0.7625978",
"0.7564779",
"0.7535949",
"0.7526177",
"0.74967456",
"0.7488563",
"0.7444619",
"0.74378985",
"0.7405823",
"0.7398562... | 0.69291645 | 49 |
Returns the port for the DRb server. | def drb_port
instance.options[:drb_port]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port\n return @port.to_i\n end",
"def port\n return @port if @port\n\n @server = TCPServer.new('127.0.0.1', 0)\n @port = @server.addr[1].to_i\n @server.close\n\n return @port\n end",
"def obtain_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n port ... | [
"0.78573924",
"0.7751077",
"0.7741788",
"0.7621609",
"0.7609246",
"0.7569713",
"0.7567313",
"0.7535585",
"0.7535585",
"0.7478608",
"0.74193746",
"0.7378621",
"0.73672485",
"0.73563725",
"0.73563725",
"0.7347567",
"0.72674215",
"0.72454524",
"0.72010654",
"0.71956474",
"0.7182... | 0.777007 | 2 |
Returns the height for the fake terminal in the DRb server. | def drb_height
instance.options[:drb_height]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n Terminal.height\n end",
"def terminal_height\n terminal_size.last\n end",
"def terminal_height; end",
"def terminal_height; end",
"def height\n `#{clientRect}.height`\n end",
"def terminal_size\n m_GetStdHandle = Win32API.new( 'kernel32',\n ... | [
"0.81953776",
"0.81500757",
"0.7879972",
"0.7879972",
"0.6810739",
"0.670882",
"0.66298324",
"0.65752274",
"0.657413",
"0.6557479",
"0.6557479",
"0.6541053",
"0.65252703",
"0.6478256",
"0.6478256",
"0.6466753",
"0.64069104",
"0.63990843",
"0.6390148",
"0.6354114",
"0.6345416"... | 0.6467048 | 16 |
Returns the width for the fake terminal in the DRb server. | def drb_width
instance.options[:drb_width]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminal_width\n terminal_size.first\n end",
"def width\n Terminal.width\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def retrieve_terminal_width\n ts = TerminalSize::TerminalS... | [
"0.81788385",
"0.81221664",
"0.80832714",
"0.80832714",
"0.8067197",
"0.8058721",
"0.8058721",
"0.8049164",
"0.80297434",
"0.79175663",
"0.7636462",
"0.7485408",
"0.7287358",
"0.7211136",
"0.71877944",
"0.71762216",
"0.71762216",
"0.71291876",
"0.7061458",
"0.7061458",
"0.704... | 0.64504623 | 43 |
Return the configured foreground colour for the client application. | def foreground
instance.options[:foreground]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context_get_fgcolor()\n return $gimp_iface.gimp_context_get_foreground()[0]\nend",
"def fg(c)\n return self unless ANSI_COLORS[c]\n return colorize(ANSI_COLORS[c])\n end",
"def foreground(color=nil)\n @options[:foreground] = color unless color.nil?\n @options[:foreground]\n end",
"de... | [
"0.7220582",
"0.6944194",
"0.69083774",
"0.68901694",
"0.65666145",
"0.63970095",
"0.63934714",
"0.629649",
"0.6244703",
"0.62362814",
"0.62349343",
"0.620977",
"0.61222553",
"0.60984665",
"0.60984665",
"0.6093749",
"0.6068151",
"0.60643",
"0.6055229",
"0.60005957",
"0.598882... | 0.73054874 | 0 |
Returns the client defined height for the terminal. | def height
instance.options[:height]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n Terminal.height\n end",
"def terminal_height\n terminal_size.last\n end",
"def height\n `#{clientRect}.height`\n end",
"def terminal_height; end",
"def terminal_height; end",
"def max_height\n FFI::NCurses.getmaxy FFI::NCurses.stdscr\n end",
"def window_heig... | [
"0.80022955",
"0.7961311",
"0.7796024",
"0.74394196",
"0.74394196",
"0.69349074",
"0.66931736",
"0.66673386",
"0.66026163",
"0.66026163",
"0.6565395",
"0.6558424",
"0.654131",
"0.65285957",
"0.64757663",
"0.64489186",
"0.6439559",
"0.6391138",
"0.63764066",
"0.6341309",
"0.63... | 0.5967757 | 61 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.