Skip to content

Instantly share code, notes, and snippets.

View Widdershin's full-sized avatar

Nick Johnstone Widdershin

View GitHub Profile
class Worm:
def __init__(self, pName):
self.name = pName
class Apple:
def __init__(self):
self.myWorm = None
self.myWorm = self.makeWorm()
print self.myWorm.name # works
@Widdershin
Widdershin / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:57 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
def sign(number)
if number > 0
return 1
elsif number < 0
return -1
end
0
end
@Widdershin
Widdershin / Rakefile
Created June 14, 2014 10:16
EDA Rakefile
require 'rake'
require 'rspec/core/rake_task'
require ::File.expand_path('../config/environment', __FILE__)
# Include all of ActiveSupport's core class extensions, e.g., String#camelize
require 'active_support/core_ext'
namespace :generate do
desc "Create an empty model in app/models, e.g., rake generate:model NAME=User"
@Widdershin
Widdershin / application.js
Last active August 29, 2015 14:02
EDA Portfolio Challenge 6 - JS Refactor
$(document).ready(function () {
DiceController = {
dice: [],
$diceContainer: $('.dice'),
addDie: function () {
die = new Die ();
this.dice.push(die);
this.$diceContainer.append(die.rootNode());
@Widdershin
Widdershin / presentation.md
Last active August 29, 2015 14:03
EDA Phase 3 Week 1 Presentation

Imgur

##Drying up tests with it_behaves_like:

shared_examples_for_shop_plugin.rb
Imgur

shop_plugins/ultimate_boards_spec.rb
Imgur

# Add yourself some shortcuts to projects you often work on
# Example:
#
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
#
spec () {
command touch "spec/$1_spec.rb"
}
@Widdershin
Widdershin / diif_migrate.py
Created July 24, 2014 07:08
Diff two migration folders
from unipath import Path
import re
MIGRATION_NAME_PATTERN = r"^\d+_(.*).rb$"
def get_migration_names(path):
return set(migration_name(migration_filename)
for migration_filename in
Path(path).listdir(names_only=True))
(bpython) ✘ ⚙ nick@localhost  ~ 
λ bpython-curtsies
>>> help()
Welcome to Python 2.7! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
@Widdershin
Widdershin / mkrb.py
Last active August 29, 2015 14:05
A simple utility for creating Ruby/Rails app and spec code with one command.
#!/usr/bin/env python
"""
mkrb.py
Usage:
mkrb.py path_to_file
Example:
mkrb services/widget_extractor
@Widdershin
Widdershin / mvrb.py
Created August 25, 2014 21:57
A simple utility for moving and renaming Ruby/Rails app and spec code with one command.
#!/usr/bin/env python
"""
mvrb
A simple utility to move and rename Rails app and spec code
Usage:
mvrb services/widget_extractor concepts/widget_concatenator
Would move app/services/widget_extractor.rb to app/concepts/widget_concatenator.