This file contains hidden or 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
//********* Timezone calculation | |
var localTimezone = function(){ | |
var timezone = "" | |
var d = new Date; | |
var offset = d.getTimezoneOffset() | |
timezone = (offset > 0) ? "-" : "+" | |
offset = offset / 60 * (-100) | |
var paddedOffset = pad(""+offset,4,'0'); | |
return timezone + paddedOffset | |
} |
This file contains hidden or 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
1. first check the kernel architecture using | |
uname-m | |
2. download and install the proper mysql server | |
3. if u got this error when running server | |
dyld: lazy symbol binding failed: Symbol not found: | |
_mysql_get_client_info | |
then u have to update mysql2 gem using |
This file contains hidden or 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
CONFIGURE_OPTS="--with-arch=i386" CFLAGS="-arch i386" LDFLAGS="-arch i386" rbenv install 1.9.3-p194 |
This file contains hidden or 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
http://shiny-bits-of-code.tumblr.com/post/4749553253/ssl-proxy-with-nginx | |
http://www.cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy/ |
This file contains hidden or 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
# list open sockets for PID | |
sudo lsof -p 13264 | egrep 'TCP|UDP' | |
# count of sockets | |
sudo lsof -p 13264 | egrep "TCP|UDP" | wc -l | |
# list the open sockets for all passengers | |
passenger-status | grep PID | awk '{ print $3}' | xargs -i sudo lsof -p {} | egrep 'TCP|UDP' |
This file contains hidden or 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
sudo port install libiconv +universal | |
sudo port install libxml2 +universal | |
sudo port install libxslt+universal |
This file contains hidden or 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
# http://snippets.dzone.com/posts/show/4148 | |
class Array | |
def find_dups | |
inject(Hash.new(0)) { |h,e| h[e] += 1; h }.select { |k,v| v > 1 }.collect { |x| x.first } | |
end | |
end |
This file contains hidden or 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
gem install mysql2 -v 0.2.11 --platform=ruby -- '--with-mysql-dir="C:\Program Files\MySQL\MySQL Server 5.1" --with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.1\lib\opt"' |
This file contains hidden or 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
def convert_seconds_to_time(seconds) | |
total_minutes = seconds / 1.minutes | |
seconds_in_last_minute = seconds - total_minutes.minutes.seconds | |
"#{total_minutes}m #{seconds_in_last_minute}s" | |
end |