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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
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
There are hundreds of different computer languages. Most experienced programmers know a dozen or so. To understand computer languages we have to know the beginning: | |
Machine Language : these are the actual instructions, one for one, executed by the computer. They are simply binary numbers, sometimes called steps, that look like this: | |
1 110010110011 | |
2 111000101010 | |
3 111101010110 | |
In the beginnings of programming they were toggled in, one by one using switches on the front of the computer with each switch representing a 1 or 0. Once entered the sequence could be executed all at once by pressing a button on the computer console. Programming languages were invented because Machine Language is difficult for humans to understand but it is the only language that any computer can actually execute, all other languages must be always somehow translated to Machine Language. Each kind of CPU chip like Intel or IBM has a different machine language. |
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
helpers do | |
def current_user | |
@current_user ||= User.find_by(id: session[:user_id]) if session[:user_id] | |
end | |
end | |
get '/' do | |
redirect '/login' | |
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
An account for <%= current_user.username %> was just created! | |
Why don't you try <a href="/profile">looking at the profile?</a> |
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
account created |
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
class Movie < ActiveRecord::Base | |
has_many :reviews | |
has_many :users, through: :reviews | |
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
#!/bin/sh | |
mkdir bash-fix | |
cd bash-fix | |
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf - | |
cd bash-92/bash-3.2 | |
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0 | |
curl http://alblue.bandlem.com/bash32-053.patch | patch -p0 | |
cd .. | |
xcodebuild | |
sudo cp /bin/bash /bin/bash.old |
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
# Fixnum and Bignum :to_en function | |
# For Ruby Hack Night, May 7, 2012 | |
# By David Andrews, Ryatta Group | |
class Unit | |
UNITS = [ "thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", "undecillion", "duodecillion", "tredecillion", "quattuordecillion", "quindecillion", "sexdecillion", "septendecillion", "octodecillion", "novemdecillion", "vigintillion" ] | |
HUNDRED = "hundred and" | |
def self.how_big(zeroes) | |
return HUNDRED if zeroes == 2 |