Skip to content

Instantly share code, notes, and snippets.

View k00ka's full-sized avatar
Listening to Radio Paradise

David A k00ka

Listening to Radio Paradise
View GitHub Profile
@k00ka
k00ka / Vagrantfile
Last active November 29, 2018 16:39
OSX (host) with Windows 10 (guest) audio pass-through enable #virtualbox #vagrant
# -*- 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
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.
@k00ka
k00ka / actions.rb
Created April 29, 2015 01:35
W6D1 All Sinatra Routes
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
@k00ka
k00ka / account_created.erb
Created April 23, 2015 01:09
W5D2 Session Management
An account for <%= current_user.username %> was just created!
Why don't you try <a href="/profile">looking at the profile?</a>
@k00ka
k00ka / account_created.erb
Created April 21, 2015 01:42
W5D1 Lighthouse PT Toronto
account created
@k00ka
k00ka / movie.rb
Created April 16, 2015 14:16
W4D2 Lighthouse PT Toronto - ActiveRecord Associations
class Movie < ActiveRecord::Base
has_many :reviews
has_many :users, through: :reviews
end
@k00ka
k00ka / bash-fix.sh
Created September 26, 2014 14:33
BASH Fix for OSX
#!/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
@k00ka
k00ka / to_en.rb
Created May 8, 2012 21:37
Fixnum/Bignum to_en function - convert numbers to English. Useful for testing your Euler 17 solution (hint, hint)
# 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