This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monkey-patching here, but extract and include however you like | |
module DateAndTime | |
module Calculations | |
# Returns true if the date/time is within the current week. | |
def current_week? | |
::Date.current.all_week.include?(to_date) | |
end | |
alias this_week? current_week? | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config for https://github.com/jigish/slate | |
bind a:cmd,alt,ctrl focus 'Basecamp 3' | |
bind b:cmd,alt,ctrl focus 'Safari' | |
#bind c:cmd,alt,ctrl focus 'Google Chrome' | |
bind c:cmd,alt,ctrl focus 'Firefox' | |
bind d:cmd,alt,ctrl focus 'Dash' | |
bind f:cmd,alt,ctrl focus 'Finder' | |
bind g:cmd,alt,ctrl focus 'GitHub Desktop' | |
bind h:cmd,alt,ctrl focus 'Atom' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# rake db:snap:save[name] | |
# rake db:snap:load[name] | |
# if no name is passed the current git branch name is used | |
require File.dirname(__FILE__) + '/../postgres_utils' | |
namespace :db do | |
namespace :snap do | |
desc 'Save a named snapshot of the development database' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Deploy rails app from localhost to remote servers | |
- name: Set up AWS infrastructure | |
hosts: localhost | |
connection: local | |
roles: | |
- setup_aws | |
- name: Package app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from http://effortlesscode.com/auto-layout-keyboard-shown-hidden/ | |
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillToggleNotification), name: .UIKeyboardWillShow, object: nil) | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillToggleNotification), name: .UIKeyboardWillChangeFrame, object: nil) | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillToggleNotification), name: .UIKeyboardWillHide, object: nil) | |
} | |
override func viewWillDisappear(_ animated: Bool) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The Mythbusters episode on the Monty Hall problem inspired me to prove their conclusion in code. | |
# After writing this I looked around and didn't find anything much more concise. IMHO this | |
# is also more readable than most, as it's a straightforward representation of how you might | |
# perform a physical experiment. | |
ROUNDS = 100000 | |
DOORS = [0,1,2] | |
choices = { | |
stick: 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###* | |
# SheetClip - Spreadsheet Clipboard Parser | |
# version 0.2 | |
# | |
# This tiny library transforms JavaScript arrays to strings that are pasteable by LibreOffice, OpenOffice, | |
# Google Docs and Microsoft Excel. | |
# | |
# Copyright 2012, Marcin Warpechowski | |
# Licensed under the MIT license. | |
# http://github.com/warpech/sheetclip/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# rake db:snap:save[anyname] | |
# rake db:snap:load[somename] | |
# if no name is passed the current git branch name is used | |
namespace :db do | |
namespace :snap do | |
desc 'Save a named snapshot of the development sqlite database' | |
task :save, :name do |t, args| | |
name = args[:name] || `git rev-parse --abbrev-ref HEAD`.strip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Woot-off tracker that does notifications for new items | |
# across all Woot sites. | |
# | |
# 2017-08-29 | |
# Fixed main URL | |
# | |
# 2013-06-17 | |
# Fixed for new site layout | |
# Notifications now via OS X Notification Center (see gem below) | |
# Clicking on notification launches site |