Skip to content

Instantly share code, notes, and snippets.

View nhocki's full-sized avatar
💭
I may be slow to respond.

Nicolás Hock-Isaza nhocki

💭
I may be slow to respond.
View GitHub Profile
@nhocki
nhocki / gist:437255
Created June 14, 2010 03:46 — forked from dhh/gist:45076
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName example.com
# ServerAlias *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
@nhocki
nhocki / gist:1015324
Created June 8, 2011 20:29 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@nhocki
nhocki / rvm(ree and system)-nginx-unicorn.sh
Created June 20, 2011 19:04
linode stack script to setup a headless ubuntu linode w/ RVM, MySQL, Nginx, and Unicorn
#!/bin/bash
#<udf name="hostname" label="System Host Name">
#<udf name="adminuser" default="admin" label="Admin user name">
#<udf name="adminpassword" label="Admin user password">
#<udf name="deployuser" default="deploy" label="Deploy user name">
#<udf name="deploypassword" label="Deploy user password">
#<udf name="mysql_password" label="MySQL Password">
source <ssinclude StackScriptID=1>
@nhocki
nhocki / README.md
Created June 20, 2011 19:02 — forked from jpantuso/README.md
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@nhocki
nhocki / s3_transfer.rb
Created August 3, 2011 06:06
Transfer PaperClip attachment files from S3 to the filesystem
@base = File.join(Rails.root, "public/system/attachments/#{Rails.env}/")
# model: Class
# method: :symbol
# eg transfer(Image, :file)
def transfer(model, method)
dummy = model.new.send(method)
styles = [nil] + dummy.styles.keys
model.all.each do |obj|
styles.each do |style|
@nhocki
nhocki / caveatPatchor.js
Created September 6, 2011 17:21 — forked from dstrelau/caveatPatchor.js
caveatPatchor.js file for use in Propane
var displayAvatars = true;
var displayCloudAppImages = true;
var displayGists = true;
if (displayAvatars) {
Object.extend(Campfire.Message.prototype, {
addAvatar: function() {
if (this.actsLikeTextMessage()) {
var author = this.authorElement();
@nhocki
nhocki / installation.sh
Created January 4, 2012 03:12 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@nhocki
nhocki / uri.js
Created September 6, 2012 03:47 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@nhocki
nhocki / hack.sh
Created November 7, 2013 03:21 — forked from wm/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@nhocki
nhocki / introrx.md
Created May 9, 2016 22:14 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing