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 |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions. | def set_task
@task = Task.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def task_params
params.require(:task).permit(:task_name, :due_date, :weight, :progress, :priority, :required_time, :user_id, :tag, :algorithm)
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 |
here is the correction | def equal_to_four(x)
if x == 4
puts "yup"
else
puts "nope"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored; end",
"def corrections; end",
"def schumann; end",
"def formation; end",
"def rassoc(p0) end",
"def schubert; end",
"def malts; end",
"def transformations; end",
"def suivre; end",
"def correction \nend",
"def trd; end",
"def transform; end",
"def terpene; end",
"def stde... | [
"0.66920817",
"0.6444907",
"0.64334136",
"0.63466424",
"0.624454",
"0.6218231",
"0.621482",
"0.6185497",
"0.6156392",
"0.61353296",
"0.6096717",
"0.6082259",
"0.6004857",
"0.60028404",
"0.5982867",
"0.5934968",
"0.5905588",
"0.5882177",
"0.5842527",
"0.5831545",
"0.5803989",
... | 0.0 | -1 |
what to do with rejected invites? destroy? can be reinvited? | def rejected!
# pending => rejected
if !pending?
errors.add(:state, :invalid_transition)
return false
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\t\tredirect_to guild_invites_url, :alert => \"Already used\" and return unless @guild.invites.find(params[:id]).state == \"waiting\"\n\t\t@guild.invites.destroy(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to guild_invites_url, notice: 'Invite was successfully destroyed.' }\... | [
"0.7170773",
"0.71532446",
"0.71436685",
"0.7039708",
"0.6919034",
"0.69160354",
"0.6905446",
"0.6896745",
"0.68683684",
"0.67602074",
"0.67557627",
"0.67069966",
"0.6652815",
"0.66380864",
"0.6584211",
"0.6578564",
"0.6523104",
"0.6521097",
"0.6517942",
"0.6513027",
"0.65125... | 0.0 | -1 |
sauvegarde dans google drive | def save_from_on_GoogleDrive
session = GoogleDrive::Session.from_config("config.json")
# ws = session.spreadsheet_by_key("1PzbUao-3UscYOWh48FL061r5yYcH2TBl1oWXtmaW1cw").worksheets[0] #cle a changer en fonction du lien url du fichier google drive
ws = session.spreadsheet_by_key("1PzbUao-3UscYOWh48FL061r5yYcH2T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruby_gdrive\n def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n file_store = Google::APIClient::FileStore.new(CREDENTIALS_PATH)\n storage = Google::APIClient::Storage.new(file_store)\n auth = storage.authorize\n\n if auth.nil? || (auth.expired? && auth.refresh_token.nil?)\n ... | [
"0.6683698",
"0.64056253",
"0.60497725",
"0.5954882",
"0.5946513",
"0.59106606",
"0.59053177",
"0.58631027",
"0.5853719",
"0.58194226",
"0.58172584",
"0.56314486",
"0.56086963",
"0.56083286",
"0.5529336",
"0.5528596",
"0.55272543",
"0.5460723",
"0.5430668",
"0.5409804",
"0.53... | 0.61027384 | 2 |
GET /member_contacts GET /member_contacts.json | def index
@member_contacts = MemberContact.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end",
"def get_contacts(params={})\n @obj.get('get-contacts', @auth.merge(params))\n end",
"def get_contacts(options = {})\n send_request(\"get\", contacts_ur... | [
"0.794394",
"0.79016393",
"0.7704371",
"0.7587526",
"0.75623846",
"0.73903394",
"0.7345908",
"0.73260087",
"0.7315556",
"0.72893995",
"0.7250308",
"0.72122777",
"0.7211763",
"0.7206041",
"0.7194601",
"0.7162923",
"0.7151246",
"0.7102874",
"0.7071641",
"0.7060894",
"0.70580465... | 0.7634133 | 3 |
GET /member_contacts/1 GET /member_contacts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end",
"def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end",
"def get_contacts(params={})\n @obj.get('get-contacts', @auth.merge(para... | [
"0.7718408",
"0.75337887",
"0.74943495",
"0.7414457",
"0.7295398",
"0.7279983",
"0.7135243",
"0.7117879",
"0.7082628",
"0.7057509",
"0.70532286",
"0.7048273",
"0.7030718",
"0.7008904",
"0.6995033",
"0.69924575",
"0.69773036",
"0.6955392",
"0.69105524",
"0.68713826",
"0.686454... | 0.0 | -1 |
POST /member_contacts POST /member_contacts.json | def create
@member_contact = MemberContact.new(member_contact_params)
respond_to do |format|
if @member_contact.save
format.html { redirect_to @member_contact, notice: 'Member contact was successfully created.' }
format.json { render action: 'show', status: :created, location: @member_con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end",
"def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n ... | [
"0.75667214",
"0.73414004",
"0.7295675",
"0.72427684",
"0.71301275",
"0.70967263",
"0.7079298",
"0.70083827",
"0.695022",
"0.6917636",
"0.6910837",
"0.67836225",
"0.6756102",
"0.67063594",
"0.6670463",
"0.6663385",
"0.66619563",
"0.6660648",
"0.66485727",
"0.6645864",
"0.6645... | 0.71505904 | 4 |
PATCH/PUT /member_contacts/1 PATCH/PUT /member_contacts/1.json | def update
respond_to do |format|
if @member_contact.update(member_contact_params)
format.html { redirect_to @member_contact, notice: 'Member contact was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end",
"def update\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n return\n end\n\n #really update the contacts\n contact = UrContact.find(params[:id])\n\n... | [
"0.7210754",
"0.7161393",
"0.70098925",
"0.69891435",
"0.6925436",
"0.69166297",
"0.6912942",
"0.68612087",
"0.6789405",
"0.6766203",
"0.6755278",
"0.67367685",
"0.6720518",
"0.6699788",
"0.6694901",
"0.66759735",
"0.6652066",
"0.66069853",
"0.6599197",
"0.6599197",
"0.659919... | 0.7117996 | 2 |
DELETE /member_contacts/1 DELETE /member_contacts/1.json | def destroy
@member_contact.destroy
respond_to do |format|
format.html { redirect_to member_contacts_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @contact.destroy\n render json: {status: 204}\n end",
"def delete(contactname)\n\n end",
"def destroy\n @contact.destroy\n #Contact.delete(@contact.id)\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n en... | [
"0.7705488",
"0.75858784",
"0.74806917",
"0.7433243",
"0.7407924",
"0.73980576",
"0.73980576",
"0.73980576",
"0.73942757",
"0.73764503",
"0.73640895",
"0.7357317",
"0.7337678",
"0.7337678",
"0.7337678",
"0.7337678",
"0.73371196",
"0.7312382",
"0.7307085",
"0.72948664",
"0.727... | 0.7872336 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_member_contact
@member_contact = MemberContact.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 member_contact_params
params.require(:member_contact).permit(:member_id, :contact_name, :contact_number, :degree_kinship)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
GET /reports GET /reports.json | def index
@reports = Report.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.jso... | [
"0.7896447",
"0.78636414",
"0.77486503",
"0.7707248",
"0.7619338",
"0.7569814",
"0.75290066",
"0.74211705",
"0.73762834",
"0.73735154",
"0.73633385",
"0.7334833",
"0.733009",
"0.72732675",
"0.7264923",
"0.7264923",
"0.7264923",
"0.7264923",
"0.7264923",
"0.7264923",
"0.726492... | 0.0 | -1 |
POST /reports POST /reports.json | def create
@review=Review.find(params[:reported_id])
@report = Report.new(report_params)
@user=User.find(params[:reporter_id])
if @report.save
@review.passive_reports<<@report
@user.active_reports<<@report
flash[:success] = "report created!"
redirect_to "/items/"+... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\n @report = Report.create(reports_params)\n if @report.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create report' }, status: :internal_server_error\n end\n end",
"def create\n @report = Report.new(report_params)\n\n re... | [
"0.77267456",
"0.71440965",
"0.7033348",
"0.70297456",
"0.7006169",
"0.6989695",
"0.6989695",
"0.698222",
"0.6979302",
"0.6979302",
"0.6979302",
"0.6961894",
"0.6960234",
"0.695844",
"0.68224156",
"0.6808665",
"0.68054426",
"0.67791307",
"0.6777732",
"0.67731243",
"0.67679095... | 0.0 | -1 |
DELETE /reports/1 DELETE /reports/1.json | def destroy
@report.destroy
flash[:success] = "report deleted"
redirect_to reports_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n ... | [
"0.78883916",
"0.77925867",
"0.7791945",
"0.7791945",
"0.7791945",
"0.7768737",
"0.7727435",
"0.7727435",
"0.7727435",
"0.7727435",
"0.7672675",
"0.75966144",
"0.75292933",
"0.75292933",
"0.75199825",
"0.7518596",
"0.7518159",
"0.7505007",
"0.7485241",
"0.7485241",
"0.7485241... | 0.70890725 | 82 |
Use callbacks to share common setup or constraints between actions. | def set_report
@report = Report.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def report_params
params.permit(:reported_id, :reporter_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: create empty variable have a method that takes inputs (item, quantity, ) set default quantity = 1 print the list to the console [can you use one of your other methods here?] output: hashes Method to add an item to a list input: i... | def grocery_list
puts "What do you need to buy?"
list = gets.chomp
listarray = list.split(" ")
listhash = Hash.new
listarray.each do |item|
listhash[item] = 1
end
listhash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list... | [
"0.80840665",
"0.7570445",
"0.744284",
"0.73329616",
"0.7316761",
"0.7278561",
"0.7275662",
"0.7192533",
"0.7183117",
"0.7169013",
"0.7167687",
"0.7133602",
"0.7083702",
"0.7060902",
"0.7051228",
"0.7014463",
"0.69647855",
"0.69619286",
"0.6954955",
"0.69429237",
"0.69350713"... | 0.0 | -1 |
==== Parameters port:: The port to check for Merb instances on. ==== Returns Boolean:: True if Merb is running on the specified port. :api: private | def alive?(port)
pidfile = pid_file(port)
pid = pid_in_file(pidfile)
Process.kill(0, pid)
true
rescue Errno::ESRCH, Errno::ENOENT
false
rescue Errno::EACCES => e
Merb.fatal!("You don't have access to the PID file at #{pidfile}: #{e.message}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appium_port_available?(port)\n `netstat -vanp tcp | awk '{ print $4 }' | grep \"\\.#{port}$\"`.empty?\n end",
"def visit_port?(port)\n @port_rules.accept?(port)\n end",
"def bootstrap(address:, port:)\n rpc(:bootstrap, address: address, port: port).key?(:success)\n end",
"def ... | [
"0.627418",
"0.62071466",
"0.60988545",
"0.60712534",
"0.59550375",
"0.59510076",
"0.5935834",
"0.59327126",
"0.5898663",
"0.58439106",
"0.5775571",
"0.57627195",
"0.5732654",
"0.56911486",
"0.56176794",
"0.5614192",
"0.5543837",
"0.54865044",
"0.5469411",
"0.5465513",
"0.543... | 0.61837846 | 2 |
==== Parameters port:: The port of the Merb process to kill. sig:: The signal to send to the process, the default is 9 SIGKILL. No Name Default Action Description 1 SIGHUP terminate process terminal line hangup 2 SIGINT terminate process interrupt program 3 SIGQUIT create core image quit program 4 SIGILL create core im... | def kill(port, sig = "INT")
if sig.is_a?(Integer)
sig = Signal.list.invert[sig]
end
Merb::BootLoader::BuildFramework.run
# If we kill the master, then the workers should be reaped also.
if %w(main master all).include?(port)
# If a graceful exit is re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill\n sig :KILL\n end",
"def kill(signal = 'TERM')\n Process.kill(signal, @pid)\n end",
"def kill(signo)\n Process.kill(signo, pid)\n end",
"def kill(target, signal = 9)\n kill_signal = \" -#{signal}\" if signal\n\n cmd = if target.class.to_s =... | [
"0.71354556",
"0.71240515",
"0.7078754",
"0.6957037",
"0.683841",
"0.6741201",
"0.66594434",
"0.6648608",
"0.65352714",
"0.65114975",
"0.6497892",
"0.6496894",
"0.64404935",
"0.6425761",
"0.63721806",
"0.63188714",
"0.6305187",
"0.629803",
"0.62398696",
"0.62397546",
"0.62068... | 0.7971776 | 0 |
Sends the provided signal to the process pointed at by the provided pid file. :api: private | def kill_pid(sig, file)
begin
pid = pid_in_file(file)
Merb.logger.fatal! "Killing pid #{pid} with #{sig}"
Process.kill(sig, pid)
FileUtils.rm(file) if File.exist?(file)
rescue Errno::EINVAL
Merb.logger.fatal! "Failed to kill PID #{pid} with #{sig}: '#{si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_signal(signal, pid_file)\r\n pid = open(pid_file).read.to_i\r\n print \"Send signal #{signal} to AP4R at PID #{pid} ...\"\r\n begin\r\n Process.kill(signal, pid)\r\n rescue Errno::ESRCH\r\n puts \"Process not found.\"\r\n end\r\n puts \"Done.\"\r... | [
"0.8478117",
"0.83615774",
"0.78303987",
"0.72374874",
"0.668388",
"0.6532442",
"0.6485055",
"0.62172943",
"0.6216962",
"0.6189925",
"0.607461",
"0.6024443",
"0.59982026",
"0.5883291",
"0.58456224",
"0.5796521",
"0.57935566",
"0.5762693",
"0.5750303",
"0.57126206",
"0.5680330... | 0.65965164 | 5 |
==== Parameters port:: The port of the Merb process to daemonize. :api: private | def daemonize(port)
Merb.logger.warn! "About to fork..." if Merb::Config[:verbose]
fork do
Process.setsid
exit if fork
Merb.logger.warn! "In #{Process.pid}" if Merb.logger
File.umask 0000
STDIN.reopen "/dev/null"
STDOUT.reopen "/dev/null", "a"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pid_file(port)\n pidfile = Merb::Config[:pid_file] || (Merb.log_path / \"merb.%s.pid\")\n pidfile % port\n end",
"def set_port port\n @port = port\n end",
"def port; config[:port]; end",
"def port(port)\n @options[:port] = port\n end",
"def port\n super\n end... | [
"0.63246137",
"0.62226796",
"0.6172038",
"0.61276925",
"0.6072619",
"0.6072619",
"0.6059469",
"0.60482556",
"0.6042272",
"0.6042272",
"0.6042272",
"0.6042272",
"0.6042272",
"0.6042272",
"0.6042272",
"0.6042272",
"0.6033699",
"0.5979203",
"0.59739256",
"0.59739256",
"0.5973925... | 0.7705445 | 0 |
Starts up Merb by running the bootloader and starting the adapter. :api: private | def bootup
Merb.trap("TERM") { shutdown }
Merb.logger.warn! "Running bootloaders..." if Merb::Config[:verbose]
BootLoader.run
Merb.logger.warn! "Starting Rack adapter..." if Merb::Config[:verbose]
Merb.adapter.start(Merb::Config.to_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drb_start!\n Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }\n end",
"def start!\n setup\n adapter.start!\n end",
"def start(argv = ARGV)\n Merb::Config[:original_log_stream] = Merb::Config[:log_stream]\n Merb::Config[:log_stream] ||= STDOUT\n if Hash =... | [
"0.64909333",
"0.63252676",
"0.62763536",
"0.6237795",
"0.60663664",
"0.60442543",
"0.60028344",
"0.6001606",
"0.5985731",
"0.59052426",
"0.5789693",
"0.5768427",
"0.5765995",
"0.5755694",
"0.57537127",
"0.57359326",
"0.5712193",
"0.5689368",
"0.5674031",
"0.56366694",
"0.562... | 0.7640269 | 0 |
Shut down Merb, reap any workers if necessary. :api: private | def shutdown(status = 0)
# reap_workers does exit but may not be called...
Merb::BootLoader::LoadClasses.reap_workers(status) if Merb::Config[:fork_for_class_load]
# which is why we exit explicitly here
exit(status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown!\n shutdown\n kill_jobs\n end",
"def shutdown\n @workers.each { |pid| Process.waitpid(pid) }\n DRb.stop_service\n end",
"def shutdown_zombies\n dispatchers.jobs {\n |jobs|\n jobs.each {\n |job|\n next if job['help... | [
"0.7017191",
"0.6973733",
"0.6812961",
"0.65301955",
"0.64201677",
"0.6399079",
"0.6397325",
"0.63468486",
"0.63024455",
"0.62729394",
"0.62248117",
"0.6223498",
"0.6209439",
"0.61790884",
"0.61709815",
"0.61662453",
"0.61532646",
"0.613917",
"0.613579",
"0.6119357",
"0.61169... | 0.6532856 | 3 |
Change process user/group to those specified in Merb::Config. :api: private | def change_privilege
if Merb::Config[:user] && Merb::Config[:group]
Merb.logger.verbose! "About to change privilege to group " \
"#{Merb::Config[:group]} and user #{Merb::Config[:user]}"
_change_privilege(Merb::Config[:user], Merb::Config[:group])
elsif Merb::Config[:user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_user_config(user_id)\r\n user_id = user_id.to_i\r\n exec(\r\n 'require_once(\"auth.inc\");',\r\n \"$user_entry = $config[\\\"system\\\"][\\\"user\\\"][#{user_id}];\",\r\n '$user_groups = array();',\r\n 'foreach ($config[\"system\"][\"group\"] as $gidx => $gro... | [
"0.6450362",
"0.6226097",
"0.6216566",
"0.6061149",
"0.585792",
"0.5832068",
"0.57895625",
"0.5717246",
"0.5632205",
"0.56178856",
"0.5595277",
"0.5574413",
"0.55730015",
"0.54906136",
"0.54448974",
"0.54428524",
"0.5431412",
"0.5400203",
"0.538527",
"0.5370821",
"0.5355217",... | 0.5821759 | 6 |
Removes a PID file used by the server from the filesystem. This uses :pid_file options from configuration when provided or merb..pid in log directory by default. ==== Parameters port:: The port of the Merb process to whom the the PID file belongs to. ==== Alternatives If Merb::Config[:pid_file] has been specified, that... | def remove_pid_file(port)
pidfile = pid_file(port)
if File.exist?(pidfile)
Merb.logger.warn! "Removing pid file #{pidfile} (port/socket: #{port})..."
FileUtils.rm(pidfile)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_pid(port)\n FileUtils.rm(pid_file(port)) if File.file?(pid_file(port))\n end",
"def pid_file(port)\n pidfile = Merb::Config[:pid_file] || (Merb.log_path / \"merb.%s.pid\")\n pidfile % port\n end",
"def remove_pid_file\n @commands_and_opts.push OPTIONAL_OPTS[:remov... | [
"0.79683656",
"0.70032275",
"0.68912756",
"0.6639734",
"0.63090956",
"0.6267915",
"0.6074444",
"0.6074444",
"0.58255655",
"0.5804433",
"0.573747",
"0.5719107",
"0.5624382",
"0.5619915",
"0.5593661",
"0.5593661",
"0.557836",
"0.54693997",
"0.54414594",
"0.53443986",
"0.5251294... | 0.83290327 | 0 |
Stores a PID file on the filesystem. This uses :pid_file options from configuration when provided or merb..pid in log directory by default. ==== Parameters port:: The port of the Merb process to whom the the PID file belongs to. ==== Alternatives If Merb::Config[:pid_file] has been specified, that will be used instead ... | def store_pid(port)
store_details(port)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pid_file(port)\n pidfile = Merb::Config[:pid_file] || (Merb.log_path / \"merb.%s.pid\")\n pidfile % port\n end",
"def store_details(port = nil)\n file = pid_file(port)\n begin\n FileUtils.mkdir_p(File.dirname(file))\n rescue Errno::EACCES => e\n Merb.... | [
"0.8192098",
"0.76347524",
"0.67828614",
"0.6712285",
"0.6544165",
"0.65428907",
"0.65209717",
"0.6500576",
"0.64916354",
"0.64916354",
"0.6476649",
"0.6467593",
"0.6467593",
"0.64454746",
"0.64367115",
"0.638793",
"0.638793",
"0.6322127",
"0.6236828",
"0.6233094",
"0.6195928... | 0.7326626 | 2 |
Delete the pidfile for the specified port/socket. :api: private | def remove_pid(port)
FileUtils.rm(pid_file(port)) if File.file?(pid_file(port))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_pid_file(port)\n pidfile = pid_file(port)\n if File.exist?(pidfile)\n Merb.logger.warn! \"Removing pid file #{pidfile} (port/socket: #{port})...\"\n FileUtils.rm(pidfile)\n end\n end",
"def delete\n @pid_path.delete\n rescue StandardError\n warn... | [
"0.8048553",
"0.7451472",
"0.7337085",
"0.7310641",
"0.72226006",
"0.6798323",
"0.66378033",
"0.6512481",
"0.65047383",
"0.6490511",
"0.64605016",
"0.64605016",
"0.63748145",
"0.6352215",
"0.6317382",
"0.62947035",
"0.6243624",
"0.62322104",
"0.6191831",
"0.61889714",
"0.6143... | 0.7917773 | 1 |
Stores a PID file on the filesystem. This uses :pid_file options from configuration when provided or merb..pid in log directory by default. ==== Parameters port:: The port of the Merb process to whom the the PID file belongs to. ==== Alternatives If Merb::Config[:pid_file] has been specified, that will be used instead ... | def store_details(port = nil)
file = pid_file(port)
begin
FileUtils.mkdir_p(File.dirname(file))
rescue Errno::EACCES => e
Merb.fatal! "Failed to store Merb logs in #{File.dirname(file)}, " \
"permission denied. ", e
end
Merb.logger.warn! "Storing p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pid_file(port)\n pidfile = Merb::Config[:pid_file] || (Merb.log_path / \"merb.%s.pid\")\n pidfile % port\n end",
"def store_pid(port)\n store_details(port)\n end",
"def pid_file\n @options[:pid_file] ||= File.join(\"/tmp\", \"#{@name}.pid\")\n end",
"def write_pid_file(... | [
"0.8189792",
"0.7325635",
"0.677972",
"0.6710668",
"0.65435815",
"0.65398633",
"0.6520778",
"0.6497804",
"0.6488606",
"0.6488606",
"0.64751774",
"0.6464898",
"0.6464898",
"0.6443348",
"0.6435634",
"0.6386894",
"0.6386894",
"0.6320455",
"0.6234434",
"0.62317693",
"0.61942875",... | 0.76341254 | 1 |
Gets the pid file for the specified port/socket. ==== Parameters port:: The port/socket of the Merb process to whom the the PID file belongs to. ==== Returns String:: Location of pid file for specified port. If clustered and pid_file option is specified, it adds the port/socket value to the path. :api: private | def pid_file(port)
pidfile = Merb::Config[:pid_file] || (Merb.log_path / "merb.%s.pid")
pidfile % port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pid\n return @pid unless @pid.nil?\n\n @pid = (open(pidpath, 'r').read.to_i if pidfile_exists?)\n end",
"def pid\n File.open( pid_path ) { |f| return f.gets.to_i } if File.exist?(pid_path)\n end",
"def pid_file\n base_info_file + '.pid'\n end",
"def pid\n return @pid unless @pid.nil?... | [
"0.64397234",
"0.6436797",
"0.6201071",
"0.6170312",
"0.6125403",
"0.6125403",
"0.61182445",
"0.61117285",
"0.60929805",
"0.6087833",
"0.6075227",
"0.6062688",
"0.60230935",
"0.60209274",
"0.59405863",
"0.58707076",
"0.5850054",
"0.58307266",
"0.5823276",
"0.5816645",
"0.5808... | 0.79056555 | 0 |
Get a list of the pid files. ==== Returns Array:: List of pid file paths. If not running clustered, the array contains a single path. :api: private | def pid_files
if Merb::Config[:pid_file]
if Merb::Config[:cluster]
Dir[Merb::Config[:pid_file] % "*"]
else
[ Merb::Config[:pid_file] ]
end
else
Dir[Merb.log_path / "merb.*.pid"]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_pid\n all_pid = Array.new\n Dir.foreach(\"/proc\") do |pid|\n if (File.exists?(\"/proc/#{pid}/status\"))\n all_pid.push(pid)\n end\n end\n return(all_pid)\n end",
"def pid_files\n Dir.entries(Titan::TITAN_DIRECTORY) - [\".\", \".... | [
"0.71984655",
"0.7072026",
"0.6991738",
"0.6854203",
"0.67098445",
"0.6690906",
"0.6690906",
"0.64933085",
"0.6183488",
"0.6132401",
"0.6121916",
"0.602215",
"0.60116726",
"0.60035306",
"0.5995323",
"0.5982201",
"0.5968164",
"0.5968164",
"0.5954073",
"0.5952896",
"0.59221506"... | 0.7387736 | 0 |
Change privileges of the process to the specified user and group. ==== Parameters user:: The user to change the process to. group:: The group to change the process to. ==== Alternatives If group is left out, the user will be used as the group. :api: private | def _change_privilege(user, group=user)
Merb.logger.warn! "Changing privileges to #{user}:#{group}"
uid, gid = Process.euid, Process.egid
begin
target_uid = Etc.getpwnam(user).uid
rescue ArgumentError => e
Merb.fatal!("Failed to change to user #{user}, does the user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_privilege(user, group=user)\n log \">> Changing process privilege to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change pr... | [
"0.84995776",
"0.84507537",
"0.82157916",
"0.79348654",
"0.6937691",
"0.6929564",
"0.6540767",
"0.6306309",
"0.6217978",
"0.6084935",
"0.59549195",
"0.5951272",
"0.59342",
"0.5933748",
"0.5882223",
"0.58567387",
"0.58567387",
"0.58567387",
"0.5812652",
"0.5788026",
"0.5753934... | 0.7893078 | 4 |
Add trap to enter IRB on SIGINT. Process exit if second SIGINT is received. :api: private | def add_irb_trap
Merb.trap("INT") do
if @interrupted
Merb.logger.warn! "Interrupt received a second time, exiting!\n"
exit
end
@interrupted = true
Merb.logger.warn! "Interrupt a second time to quit."
Kernel.sleep 1.5
ARGV.clear... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_repl_like_sigint\n orig_handler = trap(\"INT\") { raise Interrupt }\n yield\n rescue Interrupt\n puts(\"^C\")\n retry\n ensure\n trap(\"INT\", orig_handler)\n end",
"def on_interrupt(&block)\n trap(\"INT\") { yield \"SIGINT\" }\n trap(\"QUIT\") { yield \"SIGQ... | [
"0.77860266",
"0.73255765",
"0.7291255",
"0.7230773",
"0.72143",
"0.7211096",
"0.7211096",
"0.71926457",
"0.71238506",
"0.70965403",
"0.6916887",
"0.68618536",
"0.68618536",
"0.68306786",
"0.68032444",
"0.6779366",
"0.6749334",
"0.6724802",
"0.66747725",
"0.66683286",
"0.6643... | 0.7947068 | 0 |
Public: uploads the File to the cloud file_path String file_path to push to the cloud Raises FileNotFound Exception if file_path is invlaid Raises GitException if it fails to add, commit, or push | def upload!(file_path)
raise GitCloud::FileException.new("NotFound") unless File.exists? file_path
file = File.new(File.expand_path(file_path))
add(file)
commit
push
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(bucket, file); end",
"def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end",
"def upload local_file_path, storage_file_path, encryption_key: nil\n unless @bucket.file ... | [
"0.7390319",
"0.71696335",
"0.7111569",
"0.69492877",
"0.69377846",
"0.6917007",
"0.68661606",
"0.6772827",
"0.6767559",
"0.67601657",
"0.675455",
"0.673298",
"0.6683947",
"0.6665183",
"0.6650714",
"0.66324466",
"0.6552325",
"0.6552325",
"0.6544891",
"0.648841",
"0.6481711",
... | 0.88898885 | 0 |
Public: get the url for the pushed file path Returns the String url of the pushed file path | def url
type = File.directory?(file) ? "tree" : "raw"
name = file.path.split('/').last
%{#{upstream}/#{type}/#{branch}/#{folder_name}/#{name}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_url\n file.attached? ? url_for(file) : ''\n end",
"def url\n ::File.join \"/\", path.to_s\n end",
"def path\n file.url\n end",
"def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end",
"def url\n return nil unless @uploader.u... | [
"0.7281302",
"0.7279402",
"0.7157169",
"0.71406937",
"0.7084309",
"0.70111376",
"0.6965893",
"0.6909743",
"0.683789",
"0.6807398",
"0.6797729",
"0.6789636",
"0.67771316",
"0.6769994",
"0.6767996",
"0.6724032",
"0.6653086",
"0.6589534",
"0.65813905",
"0.6555005",
"0.65471125",... | 0.66183853 | 17 |
Private: the path to the git repo used by git_cloud. Returns the String path to git_cloud's git repo. | def repo_path
@config.get_value('GIT_REPO_ROOT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_path\n @repo_path ||= Pathname.new(Dir.pwd).descend { |p| break p if (p + '.git').directory? }\n end",
"def git_path\n File.join(\n user.storage_path,\n 'repositories',\n 'scratchpad')\n end",
"def repo_path\n current_user = User.current\n # root dir is the system home fol... | [
"0.8050157",
"0.7992726",
"0.7933296",
"0.7852651",
"0.78391093",
"0.77295446",
"0.76917845",
"0.7634269",
"0.76020795",
"0.7596211",
"0.7552846",
"0.73938954",
"0.7367731",
"0.73401546",
"0.7305811",
"0.72873616",
"0.7282172",
"0.72765064",
"0.72698146",
"0.7213484",
"0.7211... | 0.843417 | 0 |
Private: the url of the upstream git repo used by git_cloud. Returns the String path to git_cloud's git repo. | def upstream
@config.get_value('GIT_UPSTREAM')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_of_git_repo(remote_name)\n `git config remote.#{remote_name}.url`.strip\n end",
"def origin_url\n @origin_url ||= `git config --get remote.origin.url`.strip\n end",
"def get_repo_url\n repo_url = ENV['MXNET_GLUON_REPO'] || DEFAULT_REPO\n repo_url += '/' if repo_url[-1] != '/'\... | [
"0.7210081",
"0.7143662",
"0.71093625",
"0.70933294",
"0.69948334",
"0.6900975",
"0.68773293",
"0.68240005",
"0.6762165",
"0.6747562",
"0.6742407",
"0.6742407",
"0.6728531",
"0.67131966",
"0.6711857",
"0.67061734",
"0.66375387",
"0.66146916",
"0.6606951",
"0.6581608",
"0.6557... | 0.73415846 | 0 |
Private: the branch the local machine is using Returns the String branch of git_cloud's git repo. | def branch
%x[cd #{repo_path};git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}].chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branch_name\n $repo.current_branch\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n logger.info \"Deploying branch #{branch}\"\n branch\nend",
"def branch\n return git_fork_config.branch\n end",
"def current_branch\n ... | [
"0.84187406",
"0.8301462",
"0.8287405",
"0.8162062",
"0.81561714",
"0.81561714",
"0.8152102",
"0.8121655",
"0.8121655",
"0.8121655",
"0.8121655",
"0.8121655",
"0.8121655",
"0.80259055",
"0.8011108",
"0.7981855",
"0.796963",
"0.7953082",
"0.794075",
"0.7932742",
"0.7931218",
... | 0.85549057 | 0 |
Private: copies the file_path contents to the repo and gitadds it file the file path String Raises GitException if it fails to add | def add(file)
@file = file
FileUtils.cp_r(file.path,folder_path)
unless system("cd #{repo_path};git add .")
raise GitCloud::GitException.new("Add")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_add_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} add #{file_path}\"\n log.info(x) { \"[git] single file add command => #{git_add_cmd}\" }\n %x[#{git_... | [
"0.78552884",
"0.73549247",
"0.72829205",
"0.722584",
"0.69213194",
"0.68603617",
"0.6780116",
"0.6735458",
"0.6618001",
"0.65667",
"0.65662193",
"0.6475836",
"0.6460374",
"0.6347931",
"0.63012314",
"0.6266799",
"0.6251541",
"0.62328297",
"0.6202143",
"0.61232466",
"0.608002"... | 0.78865075 | 0 |
Private: gitcommits the repo_path Raises GitException if it fails to commit | def commit
system("cd #{repo_path};git commit -m 'to the cloud'")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit\n @repo.commit\n end",
"def commit_git_changes\n Dir.chdir(@repository_path) do\n status = @repo.status\n\n # Only add if we have untracked files\n if status.untracked.size > 0\n puts \"Adding new files to the repository...\"\n @repo.add(@repository_... | [
"0.72684634",
"0.7091545",
"0.70243716",
"0.6675804",
"0.6654251",
"0.6639542",
"0.65822554",
"0.6557153",
"0.653194",
"0.65143675",
"0.65074",
"0.6480614",
"0.64751595",
"0.6433122",
"0.6432954",
"0.6428536",
"0.6382829",
"0.63712466",
"0.63699406",
"0.6366478",
"0.6362352",... | 0.717353 | 1 |
Private: gitpushes the repo_path Raises GitException if it fails to push | def push
unless system("cd #{repo_path};git push origin #{branch}")
raise GitCloud::GitException.new("Push")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_repo\n UI.puts \"\\nPushing the `#{@repo}' repo\\n\".yellow\n repo_git('push', 'origin', 'HEAD')\n end",
"def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend",
"def push_repo\n reference_point = git_branch_name || git_t... | [
"0.76456743",
"0.7534217",
"0.74790925",
"0.7441323",
"0.73853576",
"0.73704845",
"0.7336061",
"0.7260309",
"0.71797943",
"0.7097956",
"0.7057933",
"0.7010734",
"0.6832589",
"0.6832589",
"0.6779666",
"0.676221",
"0.6758268",
"0.6746516",
"0.6744353",
"0.6740549",
"0.66656464"... | 0.7896761 | 0 |
Private returns the file we are manipulating Return File | def file
@file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file\n return @file\n end",
"def file\n return @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\r\n LocalFile\r\n end",
"def original_file # Accessor for probably protected value original_filename\r\n ... | [
"0.75236315",
"0.75236315",
"0.72661763",
"0.7108738",
"0.70155394",
"0.69636774",
"0.68927026",
"0.6792991",
"0.6782858",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
"0.67612565",
... | 0.7141867 | 6 |
Private: Takes care of bootstrapping the folder_path Return true if successfully create. | def bootstrap_folder
FileUtils.mkdir_p folder_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Bo... | [
"0.70869046",
"0.7036688",
"0.69592184",
"0.69385445",
"0.6679108",
"0.6665572",
"0.6572907",
"0.64565414",
"0.6447056",
"0.6447056",
"0.64277804",
"0.6370069",
"0.63481826",
"0.6324764",
"0.62857944",
"0.6232958",
"0.6229013",
"0.6147224",
"0.61376774",
"0.61101663",
"0.6082... | 0.7493478 | 0 |
Private: returns the folder name where we will store the passed in path Returns the String folder_name | def folder_layout
@config.get_value('FOLDER_LAYOUT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folder_path\n File.join(location.path, folder_name)\n end",
"def folder_path\n File.expand_path @folder_path\n end",
"def folder_name\n @folder_name\n end",
"def folder_pathname\n return unless exists?\n @folder_pathname ||= Pathname.new(folder_location)\n end",
"def path\n ... | [
"0.7838155",
"0.7823656",
"0.7723648",
"0.75424933",
"0.75071204",
"0.7445482",
"0.7397176",
"0.71624345",
"0.7127241",
"0.71115476",
"0.70773965",
"0.70716405",
"0.70593184",
"0.7048973",
"0.7002461",
"0.66998976",
"0.66859907",
"0.6685256",
"0.6667014",
"0.66661924",
"0.664... | 0.0 | -1 |
Private: returns the folder name where we will store the passed in path Returns the String folder_name | def folder_name
@folder_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folder_path\n File.join(location.path, folder_name)\n end",
"def folder_path\n File.expand_path @folder_path\n end",
"def folder_pathname\n return unless exists?\n @folder_pathname ||= Pathname.new(folder_location)\n end",
"def path\n folder.path + name\n end",
"def folder_name\n... | [
"0.7837498",
"0.7823513",
"0.7541402",
"0.75067824",
"0.7444723",
"0.73972976",
"0.71615887",
"0.71264625",
"0.7109643",
"0.70776105",
"0.7070803",
"0.7059647",
"0.7048531",
"0.70026153",
"0.66993284",
"0.66859853",
"0.6685557",
"0.6666496",
"0.66664433",
"0.6646869",
"0.6627... | 0.7723359 | 2 |
Private: the path to the folder in git_cloud to store new files. Returns the String path of the folder in git_cloud's git repo that new files will be copied to. | def folder_path
File.expand_path @folder_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone_dir\n \"#{RdocInfo.config[:tmp_dir]}/#{@project.owner}/#{@project.name}/blob/#{@project.commit_hash}\"\n end",
"def git_path\n File.join(\n user.storage_path,\n 'repositories',\n 'scratchpad')\n end",
"def store_dir\n \"city-of-meridian/files/\"\n end",
"def git_d... | [
"0.6807863",
"0.6383905",
"0.6360956",
"0.632169",
"0.62991804",
"0.6222583",
"0.6168046",
"0.61369514",
"0.6125453",
"0.6119143",
"0.60629714",
"0.60385406",
"0.60131896",
"0.599314",
"0.59795886",
"0.59708196",
"0.59338903",
"0.59294295",
"0.5925763",
"0.5925632",
"0.591722... | 0.0 | -1 |
GET /minha_paginas GET /minha_paginas.json | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # inde... | [
"0.7795306",
"0.73205966",
"0.7292275",
"0.721457",
"0.71466583",
"0.7115961",
"0.71075916",
"0.7065496",
"0.70336694",
"0.70292795",
"0.6969327",
"0.6848512",
"0.6822947",
"0.6795384",
"0.6724341",
"0.6723795",
"0.6723795",
"0.6723795",
"0.6722829",
"0.67023844",
"0.6690727"... | 0.0 | -1 |
GET /minha_paginas/1 GET /minha_paginas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # inde... | [
"0.7809964",
"0.73488486",
"0.7243121",
"0.7242994",
"0.71725214",
"0.70699847",
"0.70575994",
"0.70465577",
"0.70465577",
"0.70465577",
"0.7043368",
"0.69917125",
"0.6970989",
"0.69521725",
"0.6948579",
"0.69322383",
"0.6918003",
"0.68457574",
"0.68303555",
"0.6771438",
"0.6... | 0.0 | -1 |
POST /minha_paginas POST /minha_paginas.json | def create
@minha_pagina = MinhaPagina.new(minha_pagina_params)
respond_to do |format|
if @minha_pagina.save
format.html { redirect_to @minha_pagina, notice: 'Minha pagina was successfully created.' }
format.json { render :show, status: :created, location: @minha_pagina }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def create\n @pagina = Pagina.new(pagina_params)\n\n respond_to do |format|\n if @pagin... | [
"0.69144166",
"0.67800766",
"0.6625471",
"0.6613728",
"0.65470064",
"0.65332043",
"0.6507253",
"0.64977634",
"0.6493268",
"0.6443556",
"0.64409834",
"0.6408842",
"0.6395641",
"0.6376874",
"0.63656557",
"0.6343714",
"0.6342025",
"0.6341771",
"0.63350314",
"0.63326305",
"0.6324... | 0.68299663 | 1 |
PATCH/PUT /minha_paginas/1 PATCH/PUT /minha_paginas/1.json | def update
respond_to do |format|
if @minha_pagina.update(minha_pagina_params)
format.html { redirect_to @minha_pagina, notice: 'Minha pagina was successfully updated.' }
format.json { render :show, status: :ok, location: @minha_pagina }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @pagina.update(pagina_params)\n format.html { redirect_to edit_produto_pagina_path(@produto, @pagina), notice: 'Pagina was successfully updated.' }\n format.json { render :show, status: :ok, location: @pagina }\n else\n format.html { render... | [
"0.67847764",
"0.6783063",
"0.6700953",
"0.66871834",
"0.6678163",
"0.66566",
"0.6613682",
"0.6595442",
"0.65663314",
"0.6553234",
"0.6553234",
"0.65479535",
"0.64782864",
"0.6460535",
"0.6448281",
"0.64418286",
"0.6434909",
"0.6404928",
"0.6369655",
"0.63648623",
"0.6333352"... | 0.72261006 | 0 |
DELETE /minha_paginas/1 DELETE /minha_paginas/1.json | def destroy
@minha_pagina.destroy
respond_to do |format|
format.html { redirect_to minha_paginas_url, notice: 'Minha pagina was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mini_pago = MiniPago.find(params[:id])\n @mini_pago.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_pagos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :n... | [
"0.73860013",
"0.73689693",
"0.73069364",
"0.72454107",
"0.7234501",
"0.7229161",
"0.7214767",
"0.71233845",
"0.7092378",
"0.7089016",
"0.7089016",
"0.7055671",
"0.7023092",
"0.7016416",
"0.701569",
"0.70042396",
"0.7002078",
"0.69957936",
"0.6995477",
"0.69929814",
"0.698850... | 0.7466244 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_minha_pagina
@minha_pagina = MinhaPagina.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def minha_pagina_params
params.fetch(:minha_pagina, {})
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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
Returns the value of an index vector or a Vector with the values of a range v = Vector[1, 2, 3, 4] v[0] => 1 v[0..2] => Vector[1, 2, 3] | def [](i)
case i
when Range
Vector[*to_a.slice(i)]
else
index(i)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](index, *indexes)\n if indexes.empty?\n case index\n when Range\n range = \n if index.first.is_a?(Numeric)\n index\n else\n first = numeric_index_for index.first\n last = numeric_index_for index.last\n\n (first..last)\... | [
"0.703863",
"0.69494766",
"0.669856",
"0.66173553",
"0.59274954",
"0.585715",
"0.5847955",
"0.5746709",
"0.5715099",
"0.5627204",
"0.5589214",
"0.55497813",
"0.55291617",
"0.5497363",
"0.54129",
"0.53881055",
"0.5386136",
"0.53606194",
"0.5359311",
"0.5349151",
"0.5329336",
... | 0.6851693 | 2 |
Sets a vector value/(range of values) with a new value/(values from a vector) v = Vector[1, 2, 3] v[2] = 9 => Vector[1, 2, 9] v[1..2] = Vector[9, 9, 9, 9, 9] => v: Vector[1, 9, 9] | def []=(i, v)
case i
when Range
(self.size..i.begin - 1).each{|e| self[e] = 0} # self.size must be in the first place because the size of self can be modified
[v.size, i.entries.size].min.times {|e| self[e + i.begin] = v[e]}
(v.size + i.begin .. i.end).each {|e| self[e] = 0}
else
@el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set v\n if multiple?\n raise \"wrong number of values (#{v.length} for #{@min_count}..#{@max_count})\" if (v.length < min_count) || (max_count != :unlimited && v.length > max_count)\n @value = v.map {|w| single_value w }\n else\n @value = single_value v\n end\n self\n end",
"def a... | [
"0.67692083",
"0.6392605",
"0.6383424",
"0.6324432",
"0.59346515",
"0.58316106",
"0.57281",
"0.5633672",
"0.5625358",
"0.5572418",
"0.554698",
"0.5546872",
"0.55242866",
"0.5523071",
"0.54356503",
"0.54084325",
"0.5399895",
"0.53573906",
"0.5347858",
"0.5345892",
"0.5307111",... | 0.60127443 | 4 |
Changes the elements of vector and returns a Vector | def collect!
els = @elements.collect! {|v| yield(v)}
Vector.elements(els, false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_to(new_value)\n @v = Vector.new(@v.size, new_value)\n self\n end",
"def clone\n Vector.elements(@elements)\n end",
"def []= (i,v)\n \t\t@vector[i] = v\n \tend",
"def projected_onto( vector )\n dup.project_onto!( vector )\n end",
"def project_onto!( vector )\n raise \"can't m... | [
"0.68888485",
"0.67111796",
"0.6685722",
"0.6340925",
"0.62085104",
"0.6151202",
"0.6092479",
"0.6002922",
"0.5905326",
"0.58967835",
"0.5865233",
"0.57853365",
"0.577177",
"0.57565093",
"0.5714688",
"0.56859475",
"0.56766284",
"0.5622995",
"0.55631745",
"0.55430496",
"0.5542... | 0.55357426 | 21 |
Iterates the elements of a vector | def each
(0...size).each {|i| yield(self[i])}
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect!\n els = @elements.collect! {|v| yield(v)}\n Vector.elements(els, false)\n end",
"def each\n i = -1\n vectors.first.each { |e| i+=1; yield [e, timeseries.index2time(i+outidx)] }\n end",
"def each(&block)\n @v.each &block\n end",
"def each2(v) # :yield: e1, e2\n raise Type... | [
"0.6673771",
"0.6666998",
"0.6590703",
"0.6338973",
"0.631492",
"0.62023467",
"0.6176427",
"0.6101513",
"0.6032301",
"0.5957864",
"0.5952776",
"0.5897954",
"0.58742684",
"0.5860978",
"0.5818953",
"0.5794009",
"0.5794009",
"0.5794009",
"0.5793198",
"0.57851493",
"0.57777214",
... | 0.5565018 | 35 |
Returns the maximum element of a vector | def max
to_a.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(vec=0.0)\n min_max(vec, :max_among)\n end",
"def max\n @v.compact.max\n rescue\n nil\n end",
"def max_index\n max :vector\n end",
"def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i... | [
"0.79950595",
"0.7566818",
"0.74927557",
"0.7140914",
"0.7130038",
"0.7093485",
"0.7081851",
"0.7069149",
"0.70472276",
"0.7021475",
"0.70024574",
"0.6982041",
"0.6952363",
"0.6914485",
"0.688636",
"0.6871209",
"0.68050635",
"0.680248",
"0.6779689",
"0.6757107",
"0.67472947",... | 0.6548294 | 38 |
Returns the minimum element of a vector | def min
to_a.min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min\n @v.compact.min\n rescue\n nil\n end",
"def minimum(arr)\n m = arr.min\n m\n end",
"def min_element\n self.to_a.min\n end",
"def find_min_value(array)\n return array.min\nend",
"def min_index(*x, &block)\n x.index(min(*x, &block))\n end",
"def min\n ... | [
"0.72083247",
"0.6961336",
"0.68846333",
"0.68801284",
"0.6875942",
"0.683321",
"0.6782502",
"0.67571485",
"0.67289275",
"0.67250234",
"0.6724069",
"0.66848",
"0.66848",
"0.6674158",
"0.66418433",
"0.6634028",
"0.6625334",
"0.66113037",
"0.6606531",
"0.6605917",
"0.6604048",
... | 0.6438907 | 35 |
Returns the pnorm of a vector | def norm(p = 2)
Norm.sqnorm(self, p) ** (Float(1)/p)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm(p=2.0)\n if p.to_f == 2.0\n Blas::nrm2(@storage)\n else\n case p.infinite?\n when 1\n self[amax]\n when -1\n abs.min\n else\n map{|i| i**p}.asum**(1.0/p... | [
"0.72883135",
"0.72103465",
"0.71760994",
"0.70083624",
"0.69437945",
"0.68221927",
"0.6677405",
"0.6629034",
"0.6401631",
"0.6400189",
"0.6258194",
"0.61661047",
"0.61133796",
"0.60325706",
"0.60040677",
"0.5971994",
"0.5951545",
"0.59453803",
"0.5927326",
"0.586449",
"0.583... | 0.7541509 | 0 |
Returns a slice of vector | def slice(*args)
Vector[*to_a.slice(*args)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slice( range)\n ::Vector.elements( self.to_a.slice(range) )\n end",
"def slice(start, length)\n end",
"def slice(*rest) end",
"def slice(p0, *rest) end",
"def slice(*args)\n dup.slice!(*args)\n end",
"def offset!(vector, length=vector.length)\n end",
"def sub_slice(start = self.... | [
"0.7848746",
"0.69284695",
"0.6778617",
"0.67138636",
"0.6587286",
"0.6478554",
"0.64083725",
"0.63890976",
"0.6364528",
"0.6328311",
"0.63152695",
"0.6296737",
"0.6231233",
"0.6196467",
"0.6193831",
"0.6193831",
"0.616356",
"0.61549443",
"0.61549443",
"0.608123",
"0.60735416... | 0.8102655 | 0 |
Sets a slice of vector | def slice=(args)
case args[1]
when Range
slice_set(args[0], args[1].begin, args[1].last)
else
slice_set(args[0], args[1], args[2])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []= (i,v)\n \t\t@vector[i] = v\n \tend",
"def slice( range)\n ::Vector.elements( self.to_a.slice(range) )\n end",
"def offset!(vector, length=vector.length)\n end",
"def slice(*args)\n Vector[*to_a.slice(*args)]\n end",
"def offset_vector=(offset_vector)\n end",
"def []= *pos, v\n\t\t... | [
"0.6321912",
"0.6273313",
"0.6154766",
"0.6147054",
"0.61261487",
"0.59308887",
"0.59153026",
"0.5866758",
"0.5852297",
"0.5806668",
"0.57222605",
"0.5697643",
"0.5669056",
"0.56479305",
"0.5639169",
"0.56208235",
"0.56208235",
"0.56126153",
"0.56069756",
"0.56043303",
"0.555... | 0.70078135 | 0 |
Return the vector divided by a scalar | def /(c)
map {|e| e.quo(c)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def /(scalar)\n Vector.new @x / scalar.to_f, @y / scalar.to_f\n end",
"def /(scalar)\n if z\n Vector.new(x / scalar, y / scalar, z / scalar)\n elsif x && y\n Vector.new(x / scalar, y / scalar)\n else\n Vector.new\n end\n end",
"def /( scalar )\n\t\t\tscalar =... | [
"0.8244769",
"0.7612628",
"0.75282377",
"0.74671125",
"0.74217886",
"0.703403",
"0.6974093",
"0.6881798",
"0.6801057",
"0.6791267",
"0.6635258",
"0.65965533",
"0.6539218",
"0.64882064",
"0.6467716",
"0.64345694",
"0.63885313",
"0.62849957",
"0.62747",
"0.627326",
"0.6243818",... | 0.0 | -1 |
Return the matrix column coresponding to the vector transpose | def transpose
Matrix[self.to_a]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose_of_matrix matrix\n\treturn Matrix.new(matrix.line, matrix.col, matrix.values.transpose)\nend",
"def transpose(matrix)\n new_matrix = []\n (0...matrix.size).each { |index| new_matrix << column(matrix, index) }\n new_matrix\nend",
"def transpose\n Matrix.columns(@rows)\n end",
"def get_col... | [
"0.6845151",
"0.683186",
"0.6606125",
"0.6484633",
"0.64513427",
"0.642466",
"0.641606",
"0.6393784",
"0.63869286",
"0.6386309",
"0.63836473",
"0.63403076",
"0.62894815",
"0.6273563",
"0.625726",
"0.6243455",
"0.6243315",
"0.6213167",
"0.6203269",
"0.61944366",
"0.6138768",
... | 0.69482785 | 0 |
Computes the Householder vector (MC, Golub, p. 210, algorithm 5.1.1) | def house
s = self[1..length-1]
sigma = s.inner_product(s)
v = clone; v[0] = 1
if sigma == 0
beta = 0
else
mu = Math.sqrt(self[0] ** 2 + sigma)
if self[0] <= 0
v[0] = self[0] - mu
else
v[0] = - sigma.quo(self[0] + mu)
end
v2 = v[0] ** 2
beta ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute\n p1, p2 = self.support\n v = (p2 - p1).ortho * @height\n return [[:vector, p1, v, p2, v]]\n end",
"def vector\n result = []\n next_candiate = 2\n while result.size < @table_size\n (result << next_candiate) if prime?(next_candiate)\n next_candiate += 1\n end\n resul... | [
"0.66074157",
"0.6307552",
"0.61326176",
"0.6031373",
"0.6004139",
"0.5891717",
"0.5874933",
"0.58256316",
"0.57585466",
"0.57064",
"0.5692196",
"0.5667213",
"0.55879855",
"0.55504334",
"0.5545431",
"0.55337024",
"0.55098754",
"0.54951996",
"0.54896283",
"0.5474867",
"0.54727... | 0.70379704 | 0 |
Return the vector normalized | def normalize
self / self.norm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize\n mag = self.magnitude\n Vector.new @x/mag, @y/mag, @z/mag\n end",
"def normalize_vector(v)\n d = v[0]*v[0] + v[1]*v[1]\n if d != 1\n root = Math.sqrt(d)\n v[0] /= root\n v[1] /= root\n end\n v\n end",
"def normalize\n f = 1.0 / length\n Vector2.new(@x... | [
"0.8077167",
"0.79442954",
"0.78938603",
"0.77440685",
"0.75896895",
"0.75559556",
"0.7485231",
"0.72766966",
"0.70939285",
"0.6989658",
"0.6976706",
"0.69708645",
"0.696773",
"0.69190514",
"0.6913607",
"0.6912902",
"0.6896148",
"0.6758834",
"0.67362726",
"0.6681537",
"0.6677... | 0.77894676 | 3 |
For invoking a method in Ruby1.8 is working 'send' and in Ruby1.9 is working 'funcall' | def initialize_old(init_method, *argv)
if RUBY_VERSION < "1.9.0"
self.send(init_method, *argv) # in Ruby1.8
else
self.funcall(init_method, *argv) # in Ruby1.9
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(*args); __send__(*args); end",
"def method_missing(*args)\n send(*args)\n end",
"def call_method_from_string(str_method)\n send(str_method)\nend",
"def method_missing(func, *params)\n @reagent.send(func, *params) \n end",
"def call(method, args)\n send(method, *args)... | [
"0.6847049",
"0.6655017",
"0.65053576",
"0.6482181",
"0.6436654",
"0.6425554",
"0.6412401",
"0.63941365",
"0.63911235",
"0.63802063",
"0.63338333",
"0.63126206",
"0.6305863",
"0.6235575",
"0.62057054",
"0.6104211",
"0.6081593",
"0.60768384",
"0.6071996",
"0.6037392",
"0.60309... | 0.0 | -1 |
Return a clone matrix | def clone
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone\n Matrix.rows(@rows)\n end",
"def clone\n return (Matrix.new(@x,@y) do |i,j| self[i][j].clone end)\n end",
"def matrix_clone\n @matrix_clone ||= matrix.map { |row| row.clone }\n end",
"def deep_copy\n return Matrix.new(\n @matrix.map{|row| row.map{|e| e.dup}},\n ... | [
"0.8824151",
"0.8674237",
"0.86123794",
"0.8177842",
"0.8000178",
"0.78308207",
"0.7606744",
"0.73667514",
"0.732303",
"0.7128547",
"0.7113071",
"0.70425326",
"0.70425326",
"0.70425326",
"0.7041175",
"0.7041175",
"0.7041175",
"0.70207375",
"0.69660807",
"0.69660807",
"0.69502... | 0.6154723 | 60 |
Tests if all the elements of two matrix are equal in delta | def equal_in_delta?(m0, m1, delta = 1.0e-10)
delta = delta.abs
mapcar(m0, m1){|x, y| return false if (x < y - delta or x > y + delta) }
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diag_in_delta?(m1, m0, eps = 1.0e-10)\n n = m1.row_size\n return false if n != m0.row_size or m1.column_size != m0.column_size\n n.times{|i|\n return false if (m1[i,i]-m0[i,i]).abs > eps\n }\n true\n end",
"def ==(other)\n return false unless Matrix === other\n \n ... | [
"0.6708641",
"0.65432",
"0.6487131",
"0.6487131",
"0.64730054",
"0.6451648",
"0.6134656",
"0.6101966",
"0.6093091",
"0.6092326",
"0.6048756",
"0.60465246",
"0.60424966",
"0.6018511",
"0.5956081",
"0.5947718",
"0.59451586",
"0.5936265",
"0.5931695",
"0.59315",
"0.5924157",
"... | 0.7138825 | 0 |
Tests if all the diagonal elements of two matrix are equal in delta | def diag_in_delta?(m1, m0, eps = 1.0e-10)
n = m1.row_size
return false if n != m0.row_size or m1.column_size != m0.column_size
n.times{|i|
return false if (m1[i,i]-m0[i,i]).abs > eps
}
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal_move?\n delta_x == delta_y\n end",
"def diagonal_move\n (@initial_pos[0] - @final_pos[0]).abs == (@initial_pos[1] - @final_pos[1]).abs\n end",
"def equal_in_delta?(m0, m1, delta = 1.0e-10)\n delta = delta.abs\n mapcar(m0, m1){|x, y| return false if (x < y - delta or x > y + delta... | [
"0.65097404",
"0.64044815",
"0.64000213",
"0.63836837",
"0.63604414",
"0.62610227",
"0.6233375",
"0.62282944",
"0.62015826",
"0.61670816",
"0.61670816",
"0.6152731",
"0.60968983",
"0.6026953",
"0.59953904",
"0.59777886",
"0.59497505",
"0.5924242",
"0.59167",
"0.5899247",
"0.5... | 0.7459607 | 0 |
Returns the matrix divided by a scalar | def quo(v)
map {|e| e.quo(v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def /( scalar )\n\t\t\tscalar = Float(scalar)\n\t\t\traise ZeroDivisionError if scalar == 0.0\n\n\t\t\treturn self.class.new( self.collect {|elem| elem / scalar} )\n\t\tend",
"def /(scalar)\r\n\t\t#pre\r\n\t\tassert valid?\r\n\t\tassert scalar != 0\r\n\t\tassert scalar.is_a? Numeric\r\n\r\n\t\tresult = self.clon... | [
"0.7460109",
"0.71965545",
"0.6816649",
"0.6515864",
"0.6389831",
"0.6349834",
"0.63204557",
"0.63122386",
"0.61726135",
"0.61523384",
"0.6124992",
"0.60524833",
"0.5938026",
"0.59254515",
"0.5913041",
"0.5866518",
"0.58017313",
"0.5770807",
"0.5715666",
"0.56915796",
"0.5656... | 0.0 | -1 |
Set de values of a matrix and the value of wrap property | def set(m)
0.upto(m.row_size - 1) do |i|
0.upto(m.column_size - 1) do |j|
self[i, j] = m[i, j]
end
end
self.wrap = m.wrap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_replace(row, column, newvalue)\n self[row*9 + column] = newvalue\n end",
"def wrap=(mode = :torus)\n case mode\n when :torus then eval(wraplate(\"i %= row_size; j %= column_size\"))\n when :h_cylinder then eval(wraplate(\"i %= row_size\"))\n when :v_cylinder then eval(wraplate(\"j ... | [
"0.5612161",
"0.5594101",
"0.55717766",
"0.5563405",
"0.55251163",
"0.54500616",
"0.53182316",
"0.52813727",
"0.5253872",
"0.523902",
"0.5237116",
"0.5200717",
"0.5181147",
"0.5173583",
"0.5166484",
"0.51070845",
"0.5092219",
"0.5068184",
"0.50659835",
"0.50473773",
"0.504500... | 0.67121875 | 0 |
Set wrap feature of a matrix | def wrap=(mode = :torus)
case mode
when :torus then eval(wraplate("i %= row_size; j %= column_size"))
when :h_cylinder then eval(wraplate("i %= row_size"))
when :v_cylinder then eval(wraplate("j %= column_size"))
when :nil then eval(wraplate)
end
@wrap = mode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setWrap(bool)\n @textBox.wrap=bool\n self\n end",
"def set(m)\n 0.upto(m.row_size - 1) do |i|\n 0.upto(m.column_size - 1) do |j|\n self[i, j] = m[i, j]\n end\n end\n self.wrap = m.wrap\n end",
"def setWrapMode(term)\n return if (mode = switch?(term)).nil?\n if mo... | [
"0.5969804",
"0.5752658",
"0.5704683",
"0.55602354",
"0.55434275",
"0.54313755",
"0.52967316",
"0.5266039",
"0.5208664",
"0.5208664",
"0.5208664",
"0.51176715",
"0.5070755",
"0.5070755",
"0.50192845",
"0.4930209",
"0.4929948",
"0.4859292",
"0.48216307",
"0.48003176",
"0.48000... | 0.5903592 | 1 |
Returns the maximum length of column elements | def max_len_column(j)
column_collect(j) {|x| x.to_s.length}.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end",
"def max_column\n @columns&.max_by(&:size)\n end",
"def biggest_column\n @cols.max_by { |col| col.rows.length }\n end",
"def col_max\n return COLUMNS_MAX\n end",
"def max_columns(fit = T.unsafe(nil)); end",
"... | [
"0.87611014",
"0.8356859",
"0.81710464",
"0.8088443",
"0.7949121",
"0.79093146",
"0.7875928",
"0.78487957",
"0.78487957",
"0.78295594",
"0.7828895",
"0.77577746",
"0.77577746",
"0.7713602",
"0.7629956",
"0.7570512",
"0.7549234",
"0.75291157",
"0.7512641",
"0.7457493",
"0.7446... | 0.8681498 | 1 |
Returns a list with the maximum lengths | def cols_len
(0...column_size).collect {|j| max_len_column(j)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max\n @max ||= map {|a| a[0].length}.max\n end",
"def longest_string array\n array.max_by(&:length)\nend",
"def longest_string array\n\tarray.max_by(&:length)\nend",
"def longest(array)\n return array.max\nend",
"def longest(stringArray)\n return stringArray.max_by(&:length)\nend",
"def lo... | [
"0.77831185",
"0.7175674",
"0.7169582",
"0.71232104",
"0.7121606",
"0.7091445",
"0.704701",
"0.70268756",
"0.6978562",
"0.6952023",
"0.69507205",
"0.6873317",
"0.6859898",
"0.6837063",
"0.6812653",
"0.67924863",
"0.67755026",
"0.675455",
"0.6681894",
"0.668138",
"0.66696596",... | 0.6313223 | 64 |
Returns a string for nice printing matrix | def to_s(mode = :pretty, len_col = 3)
return super if empty?
if mode == :pretty
clen = cols_len
to_a.collect {|r| mapcar(r, clen) {|x, l| format("%#{l}s ",x.to_s)} << "\n"}.join("")
else
i = 0; s = ""; cs = column_size
each do |e|
i = (i + 1) % cs
s += format("%#{len_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n s = \"\"\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n s += \"#{@matrix[i][j].to_s}\\t\"\n j += 1\n end\n s += \"\\n\"\n i += 1\n end\n s\n end",
"def print_matr... | [
"0.8240007",
"0.82378894",
"0.8189451",
"0.8134971",
"0.8087535",
"0.80021334",
"0.7815845",
"0.776917",
"0.77416205",
"0.7727627",
"0.7715176",
"0.76720715",
"0.7644699",
"0.7639602",
"0.7425505",
"0.73772925",
"0.7372194",
"0.73361975",
"0.72927004",
"0.72714937",
"0.727147... | 0.66895676 | 81 |
Iterate the elements of a matrix | def each
@rows.each {|x| x.each {|e| yield(e)}}
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_matrix(matrix)\n matrix.each do |row|\n p row\n end\nend",
"def each\n @cols.length.times do |i|\n @rows.length.times do |j|\n yield [i, j]\n end\n end\n end",
"def each\n filas.times do |i|\n columnas.times do |j|\n yield self[i,j]\n end\n... | [
"0.68709123",
"0.68065506",
"0.68011767",
"0.65338707",
"0.6471068",
"0.63904494",
"0.62283707",
"0.62253726",
"0.62160844",
"0.6181807",
"0.6155005",
"0.6087867",
"0.60702187",
"0.59825045",
"0.5975863",
"0.59676266",
"0.59657407",
"0.59038824",
"0.5881228",
"0.58735394",
"0... | 0.5948971 | 17 |
Returns an array with the elements collected from the row "i". When a block is given, the elements of that vector are iterated. | def row_collect(i, &block)
f = MMatrix.default_block(block)
@rows[i].collect {|e| f.call(e)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(i) # :yield: e\n if block_given?\n for e in @rows[i]\n yield e\n end\n else\n Vector.elements(@rows[i])\n end\n end",
"def row!(i)\n if block_given?\n @rows[i].collect! {|e| yield e }\n else\n Vector.elements(@rows[i], false)\n end\n end",
"def each(&... | [
"0.7406281",
"0.7059474",
"0.6514574",
"0.6475967",
"0.6126945",
"0.60090554",
"0.58935153",
"0.5864728",
"0.5796475",
"0.57839996",
"0.577293",
"0.5763508",
"0.57343894",
"0.5722199",
"0.57178354",
"0.5707213",
"0.56936413",
"0.5687605",
"0.5686581",
"0.5678079",
"0.56727666... | 0.70686716 | 1 |
Returns row vector number "i" like Matrix.row as a Vector. When the block is given, the elements of row "i" are modified | def row!(i)
if block_given?
@rows[i].collect! {|e| yield e }
else
Vector.elements(@rows[i], false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(i) # :yield: e\n if block_given?\n for e in @rows[i]\n yield e\n end\n else\n Vector.elements(@rows[i])\n end\n end",
"def row_collect(i, &block)\n f = MMatrix.default_block(block)\n @rows[i].collect {|e| f.call(e)}\n end",
"def get_row(row)\n validate_pos(row,... | [
"0.73678833",
"0.65973127",
"0.63802665",
"0.61807936",
"0.6034076",
"0.59033406",
"0.57867616",
"0.57806754",
"0.5698145",
"0.5668019",
"0.56567603",
"0.5588136",
"0.5564368",
"0.55583787",
"0.55583787",
"0.5489275",
"0.54721063",
"0.54707235",
"0.54641294",
"0.54636675",
"0... | 0.7114633 | 1 |
Returns an array with the elements collected from the column "j". When a block is given, the elements of that vector are iterated. | def column_collect(j, &block)
f = MMatrix.default_block(block)
(0...row_size).collect {|r| f.call(self[r, j])}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(j) # :yield: e\n if block_given?\n 0.upto(row_size - 1) do\n |i|\n yield @rows[i][j]\n end\n else\n rows = @rows\n r_size = rows.size\n cols = Array.new(r_size)\n for i in 0..r_size-1 do\n cols[i] = rows[i][j]\n end\n Vector.elements(col... | [
"0.7156231",
"0.6992426",
"0.65813214",
"0.6282659",
"0.61526644",
"0.5943454",
"0.58933014",
"0.588229",
"0.58646244",
"0.5812829",
"0.58110905",
"0.58018464",
"0.5777254",
"0.5581285",
"0.5557543",
"0.55545443",
"0.5544366",
"0.54954296",
"0.5485287",
"0.547287",
"0.5444808... | 0.7449445 | 0 |
Returns column vector number "j" as a Vector. When the block is given, the elements of column "j" are mmodified | def column!(j)
if block_given?
(0...row_size).collect { |i| @rows[i][j] = yield @rows[i][j] }
else
column(j)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_collect(j, &block)\n f = MMatrix.default_block(block)\n (0...row_size).collect {|r| f.call(self[r, j])}\n end",
"def column(j) # :yield: e\n if block_given?\n 0.upto(row_size - 1) do\n |i|\n yield @rows[i][j]\n end\n else\n rows = @rows\n r_size = rows.si... | [
"0.7012441",
"0.6946116",
"0.65382874",
"0.62935084",
"0.61944264",
"0.61494935",
"0.6133998",
"0.5765934",
"0.5671987",
"0.5535026",
"0.5535026",
"0.5535026",
"0.55330366",
"0.5473431",
"0.5460399",
"0.53904736",
"0.5335863",
"0.5308023",
"0.53072137",
"0.5296195",
"0.525718... | 0.6328631 | 3 |
Tests if the matrix is empty or not | def empty?
@rows.empty? if @rows
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n @table.empty? ||\n @row == 0 || @col == 0 ||\n @row != @table.size ||\n @col != @table.first.size # assumes first element is also an Array\n end",
"def empty?\n @data.cells_count <= 0\n end",
"def empty?\n @row >= @data.columns_count || @col... | [
"0.8051037",
"0.8018406",
"0.7766333",
"0.77014816",
"0.7641109",
"0.7638173",
"0.7636938",
"0.7543018",
"0.7535083",
"0.7528964",
"0.751484",
"0.75061345",
"0.7505831",
"0.7505831",
"0.7493469",
"0.7493469",
"0.7493469",
"0.7488124",
"0.74802697",
"0.747715",
"0.747715",
"... | 0.7480362 | 18 |
Returns the row/s of matrix as a Matrix | def row2matrix(r)
a = self.send(:row, r).to_a
if r.is_a?(Range) and r.entries.size > 1
return Matrix[*a]
else
return Matrix[a]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_immut_matrix()\n return Matrix.rows self\n end",
"def to_matrix\n rows = Matrix.zero(@row_size, @column_size).to_a\n DelegateMatrix.iterate_matrix(rows, Proc.new do |x,y,v|\n rows[y][x] = self[x,y]\n end)\n Matrix.rows(rows)\n end",
"def transpose\n return Matrix.new @rows.tra... | [
"0.7501503",
"0.7386249",
"0.7177805",
"0.6988176",
"0.6959244",
"0.6917302",
"0.6903978",
"0.6900593",
"0.68929756",
"0.68037236",
"0.6745248",
"0.6733879",
"0.67133546",
"0.66873795",
"0.6674573",
"0.6665716",
"0.65303344",
"0.6476496",
"0.64745677",
"0.6424032",
"0.6395742... | 0.7641487 | 0 |
Returns the colomn/s of matrix as a Matrix | def column2matrix(c)
a = self.send(:column, c).to_a
if c.is_a?(Range) and c.entries.size > 1
return Matrix[*a]
else
return Matrix[*a.collect{|x| [x]}]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def component_matrix_correlation(m=nil)\n m||=@m\n raise \"m should be > 0\" if m<1\n omega_m=::Matrix.build(@n_variables, m) {0}\n gammas=[]\n m.times {|i|\n omega_m.column=i, @eigenpairs[i][1]\n gammas.push(Math::sqrt(@eigenpairs[i][0]))\n }\n gamma_m=::Matrix.dia... | [
"0.6271851",
"0.60519975",
"0.60032606",
"0.59636444",
"0.59298927",
"0.5928181",
"0.5916157",
"0.5890317",
"0.58695716",
"0.5816611",
"0.57761097",
"0.5751035",
"0.5733446",
"0.5671058",
"0.5664803",
"0.56213355",
"0.56187767",
"0.55820405",
"0.54953146",
"0.54676145",
"0.54... | 0.5771639 | 11 |
Modified Gram Schmidt QR factorization (MC, Golub, p. 232) A = Q_1 R_1 | def gram_schmidt
a = clone
n = column_size
m = row_size
q = Matrix.new(m, n){0}
r = Matrix.zero(n)
for k in 0...n
r[k,k] = a[0...m, k].norm
q[0...m, k] = a[0...m, k] / r[k, k]
for j in (k+1)...n
r[k, j] = q[0...m, k].t * a[0...m, j]
a[0...m, j] -= q[0...m, k] * ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iqr(data)\n return q3(data) - q1(data)\n end",
"def qr(a, mode:\"reduce\")\n qr,tau, = Lapack.call(:geqrf, a)\n *shp,m,n = qr.shape\n r = (m >= n && %w[economic raw].include?(mode)) ?\n qr[false, 0...n, true].triu : qr.triu\n mode = mode.to_s.downcase\n case mode\n when \"r\"\n... | [
"0.5906482",
"0.58892804",
"0.5707859",
"0.557221",
"0.5565266",
"0.55337274",
"0.553304",
"0.5500431",
"0.5456943",
"0.54195464",
"0.54110336",
"0.5270632",
"0.52612555",
"0.5183877",
"0.51756734",
"0.51655257",
"0.51523113",
"0.50910485",
"0.5050141",
"0.49953446",
"0.49650... | 0.62668735 | 0 |
Returns the Q_1 matrix of Modified Gram Schmidt algorithm Q_1 has orthonormal columns | def gram_schmidtQ
gram_schmidt[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gram_schmidt\n a = clone\n n = column_size\n m = row_size\n q = Matrix.new(m, n){0}\n r = Matrix.zero(n)\n for k in 0...n\n r[k,k] = a[0...m, k].norm\n q[0...m, k] = a[0...m, k] / r[k, k]\n for j in (k+1)...n\n r[k, j] = q[0...m, k].t * a[0...m, j]\n a[0...m, j] -... | [
"0.6533559",
"0.5765997",
"0.57236606",
"0.5526632",
"0.55031693",
"0.55031693",
"0.50442225",
"0.5035985",
"0.49475893",
"0.49364752",
"0.49187732",
"0.4813798",
"0.48068672",
"0.48009247",
"0.47703958",
"0.4697479",
"0.46973377",
"0.46960956",
"0.4677944",
"0.46670362",
"0.... | 0.5376642 | 6 |
Returns the R_1 upper triangular matrix of Modified Gram Schmidt algorithm | def gram_schmidtR
gram_schmidt[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gram_schmidt\n a = clone\n n = column_size\n m = row_size\n q = Matrix.new(m, n){0}\n r = Matrix.zero(n)\n for k in 0...n\n r[k,k] = a[0...m, k].norm\n q[0...m, k] = a[0...m, k] / r[k, k]\n for j in (k+1)...n\n r[k, j] = q[0...m, k].t * a[0...m, j]\n a[0...m, j] -... | [
"0.68452483",
"0.5621845",
"0.5404221",
"0.5375953",
"0.5297945",
"0.52891284",
"0.5230802",
"0.51799035",
"0.51735985",
"0.5158834",
"0.5142244",
"0.5118004",
"0.50904906",
"0.5058863",
"0.50577885",
"0.50376034",
"0.50267035",
"0.5017872",
"0.4996477",
"0.498304",
"0.498004... | 0.5333191 | 4 |
that the same letter repeats twice in a row. | def double_letter_count(string)
count = 0
prev = ""
string.each_char do |c|
if prev == c
count += 1
end
prev = c
end
return count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeating_letters?(str)\n # your code goes here\n # new_str = str.downcase\n # hash = Hash.new(0)\n\n # new_str.each_char do |char|\n # hash[char] += 1\n # end\n\n # hash.each do |k,v|\n # if v > 1\n # return true\n # end\n # end\n # false\n\n str.downcase.chars.uniq.length != str.length... | [
"0.734643",
"0.72987455",
"0.7261724",
"0.7216122",
"0.7192693",
"0.7179671",
"0.70098686",
"0.69702023",
"0.69560075",
"0.69193697",
"0.6875289",
"0.6853595",
"0.6817244",
"0.68072504",
"0.6805218",
"0.67880726",
"0.6756632",
"0.67525816",
"0.67438745",
"0.6711138",
"0.67086... | 0.61453706 | 99 |
If user has not set an email preference, EmailPreferences for a user will default to send only urgent requests. | def send_urgent?; preference == EmailSetting::OPTIONS[:'All Urgent Requests'] || preference.nil?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_email_preferences\n EmailPreference.default_set_for_user(self) if email_preferences.blank?\n end",
"def email_opt_in?\n if user\n user.email_opt_in?\n else\n true\n end\n end",
"def update_email_preferences\n prefs = preference_params\n authorize User\n pref = curre... | [
"0.743059",
"0.6561358",
"0.6551867",
"0.6545425",
"0.6541374",
"0.6484192",
"0.6484192",
"0.6484192",
"0.6433482",
"0.6386382",
"0.63154227",
"0.62639886",
"0.6252239",
"0.62152314",
"0.6202784",
"0.617315",
"0.6167792",
"0.6153324",
"0.6138478",
"0.6130121",
"0.61300164",
... | 0.7892369 | 0 |
this action is used to get the signed in user to update his/her data | def edit
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user\r\n \tself.user = update_user\r\n end",
"def update_user\n end",
"def user\n authentication.user\n end",
"def get_user\n @user = current_user\n end",
"def update_tcs\n @user = current_user\n end",
"def update_user\n current_user.update_last_access if current_user && s... | [
"0.7197128",
"0.7177988",
"0.7131139",
"0.7048558",
"0.69111925",
"0.6906068",
"0.6901782",
"0.68983287",
"0.6896458",
"0.6888336",
"0.6888336",
"0.6888336",
"0.6888336",
"0.6888336",
"0.6888336",
"0.6888336",
"0.6888336",
"0.68832666",
"0.68606555",
"0.68606555",
"0.68542373... | 0.68073785 | 39 |
updates the signed in information | def update
@user = current_user
if @user.update(user_params)
redirect_to root_url
else
render 'edit'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_signature!; end",
"def update_signature!; end",
"def signing_information\n super\n end",
"def signing_input; end",
"def signing_input; end",
"def mark_signed!\n @signed = true\n end",
"def computed_signed_info\n \n llave = CFDI::Key.new @key, @password\n\n return B... | [
"0.6721611",
"0.6721611",
"0.6515099",
"0.6391401",
"0.6391401",
"0.6386158",
"0.6356945",
"0.61542547",
"0.6020782",
"0.5997972",
"0.59949374",
"0.59949374",
"0.593376",
"0.58967197",
"0.58967197",
"0.58470637",
"0.5815313",
"0.58048224",
"0.5710759",
"0.5660023",
"0.5653072... | 0.0 | -1 |
POST /transactions POST /transactions.json | def create_transfer
@transaction = Transaction.new(transaction_params)
@transaction.amount = @transaction.amount * -1
@transaction.sign = -1
@transaction_to = Transaction.new(transaction_params)
@transaction_to.account = Account.find params[:transaction][:account_to_id].to_i
@transaction_to.sig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/js... | [
"0.7124941",
"0.71085167",
"0.7107366",
"0.70616746",
"0.6970805",
"0.69395524",
"0.6882131",
"0.6873944",
"0.6864678",
"0.68382066",
"0.682873",
"0.6797429",
"0.6790942",
"0.67898583",
"0.6742485",
"0.67210656",
"0.67054796",
"0.66835666",
"0.6677946",
"0.66753876",
"0.66521... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_transaction
@transaction = Transaction.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def transaction_params
params.require(:transaction).permit(:amount, :account_id, :note, :sign, :account_to_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Handle the loading and unloading of the auto_network pool | def call(env)
@env = env
deserialize!
@app.call(@env)
serialize!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload_pool_nodes\n @mutex.synchronize do\n reload_pool_nodes_unsync\n end\n end",
"def loadAll()\n # Load the configuration from global.rb\n SHAREDPOOLS.each_key do |k|\n p = Pool.new(k, SHAREDPOOLS[k][:zone],\n SHAREDPOOLS[k][:all... | [
"0.60778487",
"0.60184705",
"0.5839158",
"0.5802449",
"0.5780801",
"0.5615641",
"0.5615641",
"0.5532313",
"0.552316",
"0.5505288",
"0.54973996",
"0.5483726",
"0.5456018",
"0.5432057",
"0.5419502",
"0.5419502",
"0.5369445",
"0.5344025",
"0.53301924",
"0.53301924",
"0.5315313",... | 0.0 | -1 |
Returns fields, embeds and relations based on current user's allowed info. | def info(current_user = nil, options = {})
if current_user.present?
if self.class.respond_to? :allowed_info_names
exposed_info = self.class.allowed_info_names(current_user)
else
exposed_info = Gatekeeper.default_allowed_info_names(current_user, self.class)
end
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_access_by_embed\n strong_memoize(:user_access_by_embed) do\n unique_embeds.each_with_object({}) do |embed, access|\n project = projects_by_path[embed.project_path]\n\n access[embed] = Ability.allowed?(user, embed.permission, project)\n end\n end\n ... | [
"0.6068449",
"0.6053812",
"0.6032478",
"0.59367657",
"0.5928759",
"0.5923954",
"0.5910413",
"0.5884037",
"0.5855833",
"0.5777434",
"0.57606363",
"0.573963",
"0.57328457",
"0.56981087",
"0.5697018",
"0.56722903",
"0.56678015",
"0.5666059",
"0.5666059",
"0.56564146",
"0.5623845... | 0.6118477 | 0 |
GET /collections GET /collections.json | def index
@collections = Collection.all.order("created_at DESC")
@total = @collections.sum(:amount)
@balance = (10000 - @total)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end",
"def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"def list\n @collection... | [
"0.7903878",
"0.7902042",
"0.7901478",
"0.7798958",
"0.76547277",
"0.74742806",
"0.7404062",
"0.73411196",
"0.73396087",
"0.7331687",
"0.7301158",
"0.7301158",
"0.7140841",
"0.70761335",
"0.7036882",
"0.70322394",
"0.70099014",
"0.6999159",
"0.6996238",
"0.6944972",
"0.694326... | 0.0 | -1 |
GET /collections/1 GET /collections/1.json | def show
# @family = Family.find_by("id = ?", params[:trip][:family_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end",
"def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"def show\n\n @collecti... | [
"0.7678446",
"0.76061696",
"0.75371283",
"0.7443003",
"0.72130686",
"0.7119864",
"0.7102526",
"0.7100734",
"0.7100734",
"0.709121",
"0.7061903",
"0.704557",
"0.70365316",
"0.7006357",
"0.6956208",
"0.6920214",
"0.6828716",
"0.6815708",
"0.68125314",
"0.6763249",
"0.6738598",
... | 0.0 | -1 |
POST /collections POST /collections.json | def create
@collection = Collection.new(collection_params)
respond_to do |format|
if @collection.save
format.html { redirect_to root_path, notice: 'Collection was successfully created.' }
format.json { render :show, status: :created, location: @collection }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end",
"def create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @col... | [
"0.7406109",
"0.73826146",
"0.7293025",
"0.70655507",
"0.70375437",
"0.6995771",
"0.6995771",
"0.6955021",
"0.6950639",
"0.6943942",
"0.6942102",
"0.69265264",
"0.6894755",
"0.6851965",
"0.6742832",
"0.67059416",
"0.6694796",
"0.6656791",
"0.6656791",
"0.65599173",
"0.6536105... | 0.69555485 | 7 |
PATCH/PUT /collections/1 PATCH/PUT /collections/1.json | def update
respond_to do |format|
if @collection.update(collection_params)
format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }
format.json { render :show, status: :ok, location: @collection }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(... | [
"0.72571427",
"0.702268",
"0.6986819",
"0.6986819",
"0.6986819",
"0.6965218",
"0.692853",
"0.6919478",
"0.6828129",
"0.67981243",
"0.67556304",
"0.67170775",
"0.66873676",
"0.66365945",
"0.6583942",
"0.65816027",
"0.6574231",
"0.65659994",
"0.6508719",
"0.644799",
"0.6390676"... | 0.6770043 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.