Skip to content

Instantly share code, notes, and snippets.

Raphael Sofaer rsofaer

Block or report user

Report or block rsofaer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View nice_trie_spec.js
describe("NiceTrie", function() {
it("can be initialized", function() {
var t = new Trie();
});
describe("with a trie", function(){
var t;
beforeEach(function() {
t = new Trie();
});
View haters.html
<html>
<head>
<script>
var flip = function(ele){
ele.classList.toggle('flipped');
}
var move = 10;
var moveBoss = function(){
ele = document.querySelector('#boss');
View adventure_sys.rb
# 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",
View debugging.md

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

View living_in_the_command_line.md

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 Dec 31, 2015
Steps for installing starting software for GA WDI 2013
View installfest_steps.md

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 Dec 30, 2015
Hint file for postfix to infix
View postfixhints.rb
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 Dec 30, 2015
Complexity Classes
View gist:7765178
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 Mar 27, 2011
Got curious after seeing something on reddit/r/ruby
View Blocks vs modules
require 'benchmark'
module RoflModule
def rofladd(ping, pong)
ping + pong
end
end
RoflBlock = <<BLOCK
def rofladd(ping, pong)
View jdubs gitconfig
[user]
name = Raphael Sofaer
email = raphael@joindiaspora.com
[github]
user = rsofaer
token = <REDACTED>
[branch]
autosetuprebase = always
autosetupmerge = true
[color]
You can’t perform that action at this time.