This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
input = [["GREY", "1"], ["GREY", "2"], ["GREY", "3"], ["LIME", "1"], ["LIME", "2"], ["LIME", "3"], ["PINK", "1"], ["PINK", "2"], ["PINK", "3"], ["RED", "1"], ["RED", "2"], ["RED", "3"]] | |
out = {} | |
input.each do |a| | |
out[a.first] ||= [] | |
out[a.first] << a.last | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def sort_colours(str) | |
ranking = { | |
"blue" => 1, | |
"orange" => 2, | |
"green" => 3, | |
"yellow" => 4, | |
"pink" => 5, | |
"red" => 6, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
General steps for a RoR deployment on linux. | |
For Ubuntu, see ubuntu-deploy.txt | |
For CentOS, see centos-deploy.txt | |
Information: | |
------------ | |
- users | |
cat /etc/passwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setup: | |
------ | |
See ror-deploy.txt for general instructions. | |
Packages: | |
--------- | |
sudo aptitude update | |
sudo aptitude safe-upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setup: | |
------ | |
See ror-deploy.txt for general instructions. | |
Create user: | |
------------ | |
groupadd staff | |
useradd [user] -g staff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: nginx init.d dash script for Ubuntu <=9.10. | |
# Description: nginx init.d dash script for Ubuntu <=9.10. | |
### END INIT INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# nginx - this script starts and stops the nginx daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx | |
# config: /etc/nginx/nginx.conf | |
# config: /etc/sysconfig/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2011, 2012 Solano Labs All Rights Reserved | |
namespace :tddium do | |
desc "load database extensions" | |
task :db_hook do | |
Rake::Task["db:create"].invoke | |
Kernel.system("psql #{ENV['TDDIUM_DB_NAME']} -c 'CREATE EXTENSION hstore;'") | |
Rake::Task["tddium:default_db_hook"].invoke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :enable do | |
desc "enable hstore extension" | |
task :hstore => [:environment, :load_config] do | |
ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS hstore;') | |
end | |
end | |
Rake::Task['db:schema:load'].enhance ['db:enable:hstore'] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
YUI().use('node', 'io', 'event', function (Y) { | |
// Outbound Link Tracking with Google Analytics | |
// http://wptheming.com/2012/01/tracking-outbound-links-with-google-analytics/ | |
// Modified for YUI3 | |
Y.one(Y.config.doc).delegate('click', function(e) { | |
var url = this.getDOMNode(); | |
if (url.host != window.location.host) { | |
_gaq.push(['_trackEvent', 'Outbound Links', url.host, url.href, 0]); |
OlderNewer