Skip to content

Instantly share code, notes, and snippets.

View Thorsson's full-sized avatar
💎
Focusing

Ivan Turkovic Thorsson

💎
Focusing
View GitHub Profile
function work {
if [ -z "$1" ]; then
cd ~/Projects/ && ls
else
project=~/Projects/$1
if [ -d $project ]; then
cd $project;
osascript 2>/dev/null <<EOF
tell application "Terminal"
activate

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
(function(){
'use strict';
angular
.module('app', [])
.directive('ngInsert', ngInsert)
.directive('ngInsert', ngInsertFillContentDirective);
ngInsert = ['$templateRequest', '$anchorScroll', '$animate', '$sce'];
function ngInsert($templateRequest, $anchorScroll, $animate, $sce) {
@Thorsson
Thorsson / .railsrc
Last active August 29, 2015 14:08 — forked from ivanoats/.railsrc
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'
@Thorsson
Thorsson / Gemfile
Created January 28, 2014 14:05 — forked from vhodges/Gemfile
source 'http://rubygems.org'
gem "hiredis", "~> 0.3.1"
gem "em-synchrony"
gem 'em-hiredis'
#gem "redis", "~> 2.2.0", :require => ["redis/connection/synchrony", "redis"]
gem "goliath"
#gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git'
worker_processes 1;
error_log /usr/local/var/log/nginx.error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
require 'net/http'
require 'rack'
# todo
# - detect ssl
# - keepalive?
module Rack
class Forwarder
def initialize(host, port=80)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)