First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
require "open3" | |
def osascript language, script | |
Open3.capture3 "osascript", *["-l", language, :stdin_data => script] | |
end | |
def applescript script | |
osascript "AppleScript", script | |
end |
class RouteRecognizer | |
include Singleton | |
ROUTE_LIST = Rails.application.routes.routes.collect{|r| r.path.spec.to_s} | |
REGEX_ROUT_LIST = ROUTE_LIST.map{|r| | |
Regexp.new(r.gsub(/\:(.*)id/, "(\d+)").gsub("(.:format)", "")) | |
} | |
def self.is_route?(path) | |
REGEX_ROUT_LIST.each do |regex| |
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; |
Let's say you're a web developer who happens to work with both MAMP and Ruby when building different types of websites. Let's say you also like to keep your MySQL stuff in one place and don't like having to juggle both a local MySQL install as well as a MAMP MySQL install. Well, you can indeed connect your ruby apps to MAMP's MySQL. Here's a tutorial on how to do it.
Important! Before you do anything, download and install MAMP. MAMP Pro will work as well. At the time of this writing, MAMP 2.1.1 is the latest.
brew install rbenv
, follow any instructions homebrew gives you after the installation is complete.Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.
As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.
Here's how to get it set up on Mac OS X:
OpenConnect can be installed via homebrew:
brew update
brew install openconnect
#!/bin/bash | |
# CentOS rbenv system wide installation script | |
# Forked from https://gist.github.com/1237417 | |
# Installs rbenv system wide on CentOS 5/6, also allows single user installs. | |
# Install pre-requirements | |
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \ | |
make bzip2 autoconf automake libtool bison iconv-devel git-core |
literally always have to look up the meaning of :limit in migrations when it comes to integer values. Here's an overview. Now let's memorise it (oh, this works for MySQL, other databases may work differently): | |
:limit Numeric Type Column Size Max value | |
1 tinyint 1 byte 127 | |
2 smallint 2 bytes 32767 | |
3 mediumint 3 byte 8388607 | |
nil, 4, 11 int(11) 4 byte 2147483647 | |
5..8 bigint 8 byte 9223372036854775807 | |
Note: by default MySQL uses signed integers and Rails has no way (that I know of) to change this behaviour. Subsequently, the max. values noted are for signed integers. |