Skip to content

Instantly share code, notes, and snippets.

@yhordi
yhordi / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:56 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
class BoggleBoard
def initialize(board)
@board = board
end
def create_word(board, *coord)
coord.map { |coord| @board[coord.first][coord.last]}.join("")
end
@yhordi
yhordi / 0.2.1-boggle_class_from_methods.rb
Created February 24, 2014 02:08 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
#your code here
end
dice_grid = [["b", "r", "a", "e"],
["i", "o", "d", "t"],
["e", "c", "l", "r"],
@yhordi
yhordi / 0_reuse_code.js
Created April 27, 2014 02:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yhordi
yhordi / rails_resources.md
Created April 27, 2014 02:01 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@yhordi
yhordi / javascript_resources.md
Created April 27, 2014 02:01 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@yhordi
yhordi / enterprise.rb
Last active August 29, 2015 14:26
Code from my testing lecture
#this is the enterprise class with driver code at the bottom
class Enterprise
attr_accessor :crew, :loadout, :assignment
def initialize
@crew = []
@loadout = { beam: nil, projectile: nil }
@assignment = { on_mission: [], on_ship: [], on_leave: [] }
end
def find_git_root(path = Dir.pwd)
return nil if path == '/'
git_present = Dir.entries(path).include?('.git')
if !git_present
Dir.chdir(File.expand_path("..", Dir.pwd))
find_git_root(Dir.pwd)
end
p 'found git'
end
@yhordi
yhordi / README.md
Last active August 29, 2015 14:26
refactored code from my "Applying Object Orientation"

Flexibility

Part of why we want to separate code into separate classes and modules is that it keeps things flexible. For example, let's say that there is no GothamCrimeFigher class and there is only a Human class. If we wanted to include the UtilityBelt module in the human class we would be giving all humans utility belts. While this would be fantastic, it is unnecessary. Therefore, we abstract out the functionality that is not shared across all of humanity into a subclass that we can change as we see fit

Modules vs Classes

@yhordi
yhordi / com.googlecode.iterm2.plist
Created September 26, 2016 17:12
My iTerm2 Preferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdjustWindowForFontSizeChange</key>
<true/>
<key>AllowClipboardAccess</key>
<false/>
<key>AnimateDimming</key>
<false/>
@yhordi
yhordi / .bash_profle
Last active March 3, 2017 20:14
My .bash_profile
# echo is like puts for bash (bash is the program running in your terminal)
echo "Loading ~/.bash_profile a shell script that runs in every new terminal you open"
# $VARIABLE will render before the rest of the command is executed
echo "Logged in as $USER at $(hostname)"
echo "You'll be okay."
# Rbenv autocomplete and shims
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Path for RBENV
test -d $HOME/.rbenv/ && PATH="$HOME/.rbenv/bin:$PATH"