Skip to content

Instantly share code, notes, and snippets.

View Widdershin's full-sized avatar

Nick Johnstone Widdershin

View GitHub Profile
@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.
@Widdershin
Widdershin / mvrb.rb
Last active August 29, 2015 14:05
A simple utility for moving and renaming Ruby/Rails app and spec code with one command.
#!/usr/bin/env ruby
require 'fileutils'
class Mvrb
CODE_EXTENSION = '.rb'
attr_reader :old_path, :new_path
def initialize(old_path, new_path)
@old_path = old_path
@Widdershin
Widdershin / .gitignore
Last active August 29, 2015 14:05
Citrix Auto Time Entry App
credentials.sh
@Widdershin
Widdershin / countdown.js
Last active August 29, 2015 14:06
Countdown Cart ID Extractor
products = $('.product-stamp-body');
productDataExtractor = function (index, item) {
quantity = parseFloat($(".quantity-container").eq(index).text(), 10);
url = $(item).find(".details-container a").attr('href');
itemID = parseInt(/\d{5,7}/.exec(url)[0]);
return [[itemID, quantity]];
}
JSON.stringify($.makeArray(products.map(productDataExtractor)));
@Widdershin
Widdershin / stream_comparison.py
Created October 16, 2014 11:22
Lazy Stream Comparison in Python
#!/usr/bin/env python
"""
Compare files lazily.
Usage:
./stream_comparison.py <file1> <file2>
"""
import sys