Skip to content

Instantly share code, notes, and snippets.

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... yes
describe("NiceTrie", function() {
it("can be initialized", function() {
var t = new Trie();
});
describe("with a trie", function(){
var t;
beforeEach(function() {
t = new Trie();
});
<html>
<head>
<script>
var flip = function(ele){
ele.classList.toggle('flipped');
}
var move = 10;
var moveBoss = function(){
ele = document.querySelector('#boss');
# Classes and Objects
## Code Along
require 'pry'
story_hash = {
"question" => "Welcome to the haunted hotel. What room would you like to go into?",
"room 1" => "you're dead",
"room 2" => { "question" => "You picked a good room. What would like to do?",
"sleep" => "You're rested for the morning",

Debugging and Exceptions

Agenda

  1. Debugging Philosophy and Techniques
  2. Basic Errors and Reading an Exception
  3. Methods and the Stack, Reading a Backtrace
  4. Error Classes, Raising and Rescuing
  5. More Debugging Techniques, a Glimpse of Testing

Debugging in the Abstract

Living in the Command Line

Web programmers have to live on the command line. It gives us fast, reliable, and automatable control over computers. Web servers usually don't have graphical interfaces, so we need to interact with them through command line and programmatic interfaces. Once you become comfortable using the command line, staying on the keyboard will also help you keep an uninterrupted flow of work going without the disruption of shifting to the mouse.

Notes before we start

For any command we discuss here, the command man, short for manual, will give a (hopefully) detailed explanation of that command. Sometimes that explanation will be too detailed for you. When you get lost in a man page and you want to understand it, start again from the beginning of of the man page and keep repeating. Hopefully you will get further into the page each time you read it.

Metaphors

The command line is my home. I literally think of using the command line as walking around a building.

Wh

@rsofaer
rsofaer / installfest_steps.md
Last active December 31, 2015 07:09
Steps for installing starting software for GA WDI 2013

GA_Logo

#WDI Installfest

We are going to install the tools necessarily to program with Ruby and Rails on your computer.

If you are on a Mac which is not running the latest version of OSX, please upgrade through the Mac App Store. Apple has made it easier to set up a computer for software development in OSX Mavericks, and keeping the differences between computers to a minimum will help us get everything installed quickly and correctly.

If you are unsure or run into problems during installation, stop and don't worry; We will finish up any of the loose ends on Installfest. Do not try to troubleshoot on your own, you might break your environment further.

@rsofaer
rsofaer / postfixhints.rb
Last active December 30, 2015 04:59
Hint file for postfix to infix
class TreeNode
attr_accessor :val, :left, :right
def initialize(v)
@val = v
end
def leaf?
# A node is a leaf if it has no children.
end
end
@rsofaer
rsofaer / gist:7765178
Last active December 30, 2015 02:49
Complexity Classes
O(1) - Constant time
"Get the first value of a list"
"Random sample from a list"
O(logN) - Divide and Pick
Typical of algorithms that divide the input, then look at one of the sections
Searching sorted data
O(N) - For each ....
Sum an array
@rsofaer
rsofaer / Blocks vs modules
Created March 27, 2011 19:06
Got curious after seeing something on reddit/r/ruby
require 'benchmark'
module RoflModule
def rofladd(ping, pong)
ping + pong
end
end
RoflBlock = <<BLOCK
def rofladd(ping, pong)