Skip to content

Instantly share code, notes, and snippets.

View m3talsmith's full-sized avatar

Michael Christenson II m3talsmith

View GitHub Profile
var CommentController = {
current_users: [],
create: function(req, res) {
this.current_users.push('yada');
}
}
module.exports = CommentController;
@m3talsmith
m3talsmith / node-and-npm-in-30-seconds.sh
Last active December 12, 2015 12:19 — forked from twilson63/mac-osx.sh
Edited for zshell
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.zshrc
. ~/.zshrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-v0.2.3.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
wget http://npmjs.org/install.sh | sh

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@m3talsmith
m3talsmith / gist:2831127
Created May 29, 2012 22:14 — forked from phated/gist:2831051
JSON Serialized dojox/gfx object
{
"shapes": [
"shape": {
"type": "image",
"x": -78.81720430107526,
"y": 30,
"width": 777.6344086021505,
"height": 560,
"src": "https://super_cool_url.com/images/4fc523c4fa0b3510de00000f/lightning-original.jpg?1338319812",
"transform": {
# Very slightly modified version of this solution: http://stackoverflow.com/a/7508407/294449
Rails.application.assets.logger = Logger.new('/dev/null')
class Rails::Rack::Logger
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].match(/\/assets\//)
call_without_quiet_assets(env).tap do
@m3talsmith
m3talsmith / gist:1218645
Created September 15, 2011 05:59
test error
require 'spec_helper'
describe "Users" do
describe "signup" do
describe "failure" do
it "should not make a new user", :js => true do
visit new_user_registration_path
@m3talsmith
m3talsmith / bulletin.rb
Created July 8, 2011 05:28
Possible embedded heirarchy
class Bulletin
include Mongoid::Document
has_and_belongs_to_many :sections
end
@m3talsmith
m3talsmith / gist:268233
Created January 4, 2010 02:01 — forked from brianjlandau/gist:176754
A Capistrano Recipe using Git as the folder structure, not just the scm.
# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "[email protected]:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current
set(:latest_release) { fetch(:current_path) }
set(:release_path) { fetch(:current_path) }
set(:current_release) { fetch(:current_path) }