Skip to content

Instantly share code, notes, and snippets.

View raykao's full-sized avatar
🇨🇦
¯\_(ツ)_/¯

Raymond Kao raykao

🇨🇦
¯\_(ツ)_/¯
View GitHub Profile

Basic Git/GitHub Commands:

Creating an initial repository

Assuming you've created a directory called project_dir and all your code/files/folders/assets etc are in this folder then you can initialize your git repo by running the following in your $ shell/terminal prompt:

project_dir$ git init
@raykao
raykao / bash_profile
Created May 13, 2013 02:17
bash_profile settings
export PATH=/usr/local/bin:$PATH
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source $GITAWAREPROMPT/main.sh
export PS1="\u@\h \W \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
@raykao
raykao / retina.css
Created May 15, 2013 17:35
Retina CSS Examples
#stripe{
height:5px;
background:url('/static/img/stripe.gif') repeat-y center top;
-webkit-background-size:1000px 1px;
-moz-background-size:1000px 1px;
background-size:1000px 1px;
}
@media screen and (-webkit-device-pixel-ratio:2.0){
#stripe{
@raykao
raykao / MAMP mySQL2 gem libmysqlclient.18.dylib
Created June 4, 2013 18:41
Pointing mySQL2 libmysqlclient.18.dylib to the proper location with MAMP
http://blog.mirotin.net/35/mamp-1-9-5-mysql-5-5-9-and-ruby-mysql2
sudo install_name_tool -change libmysqlclient.18.dylib /Applications/MAMP/Library/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-2.0.0-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
gem install mysql2 -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
database.yml
socket: /Applications/MAMP/tmp/mysql/mysql.sock
http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion
@raykao
raykao / set_temp_key.rb
Last active December 21, 2015 04:09 — forked from krames/set_temp_key.rb
Ruby script to set temp_url_key for Rackspace Cloudfiles
require 'fog'
# Please replace these with the approprate values
RACKSPACE_USERNAME = ENV['RACKSPACE_USERNAME']
RACKSPACE_API_KEY = ENV['RACKSPACE_APIKEY']
RACKSPACE_TEMP_URL_KEY = ENV['RACKSPACE_CLOUDFILES_TEMPURL_KEY'] # Self generated random string used like an auth token
puts "Creating Storage Service"
@raykao
raykao / gist:6440925
Last active December 22, 2015 07:49
Adding System Stats display on SSH login for Ubuntu
$ sudo apt-get install update-motd
$ sudo apt-get install landscape-common
@raykao
raykao / box-sizing.css
Created September 15, 2013 13:27
CSS Set all elements box-sizing
*, *:before, *:after {
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}

Digital Ocean recently released private networking support in their NYC2 Data center.

They also published a blog post on how to setup a new droplet with private networking. But one thing the post doesn't do is tell you how to scale your private network for many boxes. One approach is obviously to edit /etc/hosts (but this gets annoying when you add a new box). A better way is to create an internal DNS zone (via the digital ocean web interface) and have your droplets use it:

Steps

setup the internal DNS zone file

  1. Login to digital ocean
  2. Click "DNS" on the right hand menu
@raykao
raykao / grunt-connect-rewrite-ember.js
Created December 21, 2013 20:40
Grunt-connect-rewrite config for Ember Apps. This config settings is for use in Development using grunt-contrib-connect and setting Router location property to history (location: 'history')
options: {
port: 9000,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
rules: [
// Internal rewrite
{from: '(^((?!css|html|js|images|fonts|\/$).)*$)', to: '/index.html#$1'}
],
dev: {
@raykao
raykao / jquery_to_console.js
Created January 23, 2014 02:36
add jquery to console
var jq = document.createElement('script');
jq.src = '//code.jquery.com/jquery-2.0.3.min.js';