Skip to content

Instantly share code, notes, and snippets.

View devopsmariocom's full-sized avatar
💭
building Cloud Native Thermostat 🔥 🥶

Mario Vejlupek devopsmariocom

💭
building Cloud Native Thermostat 🔥 🥶
View GitHub Profile
@eric1234
eric1234 / 0_instructions.txt
Created April 9, 2011 01:12
Using Sprockets 2 in Rails 3.0.x with CoffeeScript & SASS
UPDATE: Please see some of the forks for an updated version of this guide. I
myself have moved onto the Rails 3.1 betas to get the asset pipeline. But if
you want to stay on stable there are other folks who are keeping this guide
relevant despite the changes constantly occurring on Sprockets 2. The comments
on this gist will lead you to the right forks. :)
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
@devopsmariocom
devopsmariocom / US_phone_formatter.js
Created March 30, 2011 17:51
Simply format number to US phone format using JavaScript, look at example on http://jsbin.com/etede5/5
var number = "1234567890";
var formatted_number = "";
var number_of_digits = number.length-1;
var bracket = false;
for(var i=number_of_digits; i>=0; i--) {
var digit = number[i];
var position = number_of_digits-i;
switch(position) {
def hash_to_params(hash)
hash.keys.inject("") do |qs, key|
qs << "&" unless qs.blank?
qs << if Array === hash[key]
k = CGI.escape(key.to_s)
hash[key].map { |value| "#{k}=" << CGI.escape(value.to_s) }.join("&")
else
CGI.escape(key.to_s) << "=" << CGI.escape(hash[key].to_s)
end
end
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install