Skip to content

Instantly share code, notes, and snippets.

View ecasilla's full-sized avatar
🏠
Working from home

Ernie Casilla ecasilla

🏠
Working from home
  • This Crust Planet
  • Washington,DC
View GitHub Profile

The workflow we will follow looks like this:

  1. Planning
  2. Initializing Application
  3. Building the Rails Model
  4. Configure our Dev Environment
  5. Defining Routes
  6. Writing Controllers and their Views (iterate)
  7. Styling Views
  8. Share!
@ecasilla
ecasilla / Cycle Speed
Created January 3, 2014 22:05
Processors
# The first term is the speed of light in meters per second
# (this is actually exact - a meter is defined as
# "the length of the path travelled by light in vacuum during a time interval of 1/299 792 458 of a second.".
# The second term, 100 is the number of centimeters in a meter.
# The third term, 1.0/1000000000 is one billionth. (Note that we need the .0 here (or at least 1.)
# to make Ruby do floating point division. Otherwise, 1/1000000000 would evaluate to 0.)
# So, the first three terms in the product compute the distance in centimeters
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
margin: 0;
background: #222;
min-width: 960px;
}
@ecasilla
ecasilla / bash
Last active August 29, 2015 13:56
bash_profile
eval "$(rbenv init -)"
# =================
# Bash Prompt
# =================
# --------------------
# Colors for the prompt
# --------------------
RED="\[\033[0;31m\]"
@ecasilla
ecasilla / bashrc
Created February 27, 2014 03:09
bash_rc
PATH=$PATH:$HOME/.rvm/bin
@ecasilla
ecasilla / !sudo
Created March 1, 2014 21:30
!sudo Anymore
Ensure the correct permissions are set by running the following in Terminal:
sudo chown -R $USER /usr/local

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@ecasilla
ecasilla / Demo.js
Created March 6, 2014 16:23
Js Inhertiance
Inheritance
Inheritance allows a class of objects to inherit the properties of another class.
Lets say for example we want to have a Parent and Child classes. We want the Child class to inherit from Parent.
function Parent() {};
Parent.prototype.name = 'Parent';
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@ecasilla
ecasilla / closure
Last active August 29, 2015 14:07
Using this as a way to show students about closures and scope
for (var i = 1; i <=5; i++){
setTimeout(function(){
console.log("vaule of i is: " + i);
},i*1000);
}
for (var i = 1; i <=5; i++){
(function(i){
setTimeout(function(){