Skip to content

Instantly share code, notes, and snippets.

View DanielleSucher's full-sized avatar

Danielle Sucher DanielleSucher

View GitHub Profile
@akaptur
akaptur / collections.py
Created July 30, 2014 14:01
Named tuples from Python's Lib/collections.py
################################################################################
### namedtuple
################################################################################
_class_template = '''\
class {typename}(tuple):
'{typename}({arg_list})'
__slots__ = ()
@bsodmike
bsodmike / spec_helper.rb
Created June 27, 2011 10:52
RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

Steps to follow, Ref:

  • Update Gemfile
  • bundle install
  • rails g rspec:install
  • Edit .rspec
The point of sore or milk in hot cream. Any
Such matters. Boil for twenty minutes then
Whip made it properly and crumb of many
Cooks. Bake the public. Make the point. For men
To english cooks to swell them stew the skin
At once in every week we doubt the soles
Among the custard cut into a tin
Which sprinkle over each half pints of holes
And ham into a delicate digestion
And finish cooking. See page. Lemonade
@codeswimmer
codeswimmer / NSNumber+Ranges.m
Created July 22, 2012 02:31 — forked from pcperini/NSNumber+Ranges.m
Quick Ranges from NSNumbers
// .h
@interface NSNumber (Ranges)
- (NSRange)to:(NSNumber *)rangeEnd;
- (BOOL)isInRange:(NSRange)range;
@end
// .m
@implementation NSNumber (Ranges)
@rogerleite
rogerleite / Gemfile
Last active December 14, 2015 14:38
Tail call optimization in Ruby
source 'https://rubygems.org'
gem "method_source", "~> 0.8.1"
@indirect
indirect / tmux-named
Last active December 28, 2015 13:49
tmux session manager. invoke with `tmux-named NAME` to jump to a set of tmux windows with that name. switch to another session the same way. I suggest changing your Terminal application's "new window" command to `/path/to/tmux-named main`. I also create a bash alias named `mux`, because it's short and easy to type.
#!/bin/bash
# Set up paths and whatnot
test -e ~/.bashrc && source ~/.bashrc
# We need tmux. Obvs.
if [[ -z `which tmux` ]]; then echo "You need tmux first!"; exit 1; fi
# Named variables are much more flexible
name="$1"
@jamesgary
jamesgary / gist:5504200
Last active February 27, 2017 12:46
How to Talk to Developers - Ben Orenstein (@r00k) - RailsConf 2013

How to Talk to Developers

Ben Orenstein (@r00k)

Obey Law of Demeter

  • Reduces coupling
  • Enables refactoring

Throw something weird at people to keep their attention. Bored people don't learn anything, so focus on entertainment over being informative.

Write like a newspaper

@jvns
jvns / blogs.md
Last active April 16, 2020 09:34
Tech blogs I subscribe to
@mislav
mislav / procs-vs-lambda.md
Last active March 26, 2021 18:34
Jim Weirich on the differences between procs and lambdas in Ruby

Jim Weirich:

This is how I explain it… Ruby has Procs and Lambdas. Procs are created with Proc.new { }, lambdas are created with lambda {} and ->() {}.

In Ruby 1.8, proc {} creates lambda, and Ruby 1.9 it creates procs (don't ask).

Lambdas use method semantics when handling parameters, procs use assignment semantics when handling parameters.

This means lambdas, like methods, will raise an ArgumentError when called with fewer arguments than they were defined with. Procs will simply assign nil to variables for arguments that were not passed in.

@zmaril
zmaril / softwarehelpskill.md
Last active August 3, 2021 04:52
I want to write software that helps kill people.

I want to write software that helps kill people.

Please, before you call the police and get my github account put on lockdown, allow me a moment to explain. What I really want to do is work on projects that advance the human condition and improve people's lives. I've been in a mad dash to learn how to program for the past four or five years exactly because I realized how much good I could do for the world with a computer.