Extensions list
- ESLint
- HTML Snippets
- Material Icon theme
- Rainglow
- Ruby
- ruby-on-rails-snippets
- ruby-snippet
- Simple Ruby ERB
# Start a worker with proper env vars and output redirection | |
def run_worker(queue, count = 1) | |
puts "Starting #{count} worker(s) with QUEUE: #{queue}" | |
ops = {:pgroup => true, :err => [(Rails.root + "log/workers_error.log").to_s, "a"], | |
:out => [(Rails.root + "log/workers.log").to_s, "a"]} | |
env_vars = {"QUEUE" => queue.to_s} | |
count.times { | |
## Using Kernel.spawn and Process.detach because regular system() call would | |
## cause the processes to quit when capistrano finishes | |
pid = spawn(env_vars, "rake resque:work", ops) |
Extensions list
// Update with your config settings. | |
module.exports = { | |
development: { | |
client: 'postgresql', | |
connection: { | |
database: 'db_name', | |
charset: 'utf8' | |
}, |
var objects; | |
$.ajax({ | |
url: "/path", | |
done: function(response){ | |
// Return here the value | |
objects = response; | |
} | |
}); |
module Ci | |
class SSH | |
attr_reader :user, :host, :password, :port, :buffer, :session | |
def initialize(options={}) | |
# | |
# Argument validations | |
# |
weight = 85 # Kilograms | |
height = 1.77 # Meters | |
bmi = BodyMassIndex.new(weight, height) | |
bmi.calculate_index # 27.1 |
exports.up = function(knex, Promise) { | |
return knex.schema.hasTable('short_urls').then(function(exists) { | |
if (!exists) { | |
return knex.schema.createTable('short_urls', function(t) { | |
t.increments('id').primary(); | |
t.text('long_url'); | |
t.string('token', 11); | |
t.index(['token'], 'short_urls_token_idx') | |
t.timestamps(); | |
}); |
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Enable service provided by daemon. |
class Api::V1::SessionsController < ApplicationController | |
respond_to :json | |
def create | |
return invalid_login_attempt if params[:user_login].nil? | |
resource = User.find_for_database_authentication(email: params[:user_login][:email]) | |
return invalid_login_attempt unless resource |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |