Skip to content

Instantly share code, notes, and snippets.

View dreki's full-sized avatar

Sean Gilbertson dreki

  • MN
View GitHub Profile
@dreki
dreki / dst_helper.rb
Created June 20, 2012 20:12
Fix for unexpected :time column behavior in Rails 3.2
module DstHelper
# Have a Time inherit DST status from a Date.
def inherit_dst date, time
time = time.change(:year => date.year, :month => date.mon, :day => date.day)
end
def self.included includer
# Mix in class methods.
includer.extend ClassMethods
end
@dreki
dreki / flash_db.rake
Created August 8, 2012 20:21
Easily flash your local Rails database with data from your Heroku environment
# Flash your local Rails database with data from your Heroku environment.
# Much faster than heroku db:pull.
#
# Notes:
# - Requires that you use postgres locally
# - Requires that pg_restore is available
# - Requires initialized Heroku setup for the given project
# - Requires that the pgbackups addon be installed for the given Heroku app
require "open-uri"
@dreki
dreki / safari-tabs-with-favicons.applescript
Created April 15, 2014 13:38
Update to "Back up Safari Tabs to Evernote" Applescript by twitter.com/ttscoff that adds favicons.
-- SET METADATA
property Title : "Title: URL List from Safari Tabs"
property Notebook : "Notebook: Reading List"
property Tags : "Tags: linklist, temp"
-- DATE STAMP
set dateStamp to do shell script "date '+%Y-%m-%d, %I:%M %p'"
-- PREPARE THE LIST
set urlList to {}
@dreki
dreki / scss-rules-for-ctags
Created October 16, 2014 14:05
SCSS rules for ctags
--langdef=scss
--langmap=scss:.scss
--regex-scss=/^[ \t]*\.([A-Za-z0-9_-]+)/.\1/c,class,classes/
--regex-scss=/^[ \t]*#([A-Za-z0-9_-]+)/#\1/i,id,ids/
--regex-scss=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-scss=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/
--regex-scss=/^[ \t]*\$([A-Za-z0-9_-]+)/\$\1/v,var,variables/
@dreki
dreki / rinari-cheat-sheet
Created October 28, 2014 16:08
rinari cheat sheet, for v20141021.827
`rinari-minor-mode' Minor Mode Bindings:
key binding
--- -------
C-c Prefix Command
C-c ' Prefix Command
C-c ; Prefix Command
C-c ' ' rinari-find-by-context
@dreki
dreki / demo-feature-driven.js
Last active August 29, 2015 14:19
Feature-driven
// Feature definitions:
var features = {
'incoming email': [
when('email with link arrives', function() {
doThese([
action('extract article from link'),
action('send article as HTML attachment to Kindle')
]);
@dreki
dreki / styles.less
Created October 8, 2015 16:54
Horizontally scrolling tabs in Atom
.tab-bar {
overflow-x: auto;
}
.tab-bar .tab {
min-width: 125px; // also prevents from becoming squished
padding-right: 15px;
}
The man was in a cabin on a cruise ship and sleepwalked over the side and into the ocean.

Keybase proof

I hereby claim:

  • I am dreki on github.
  • I am seangilbertson (https://keybase.io/seangilbertson) on keybase.
  • I have a public key whose fingerprint is 7C9F 2610 F048 7E96 BF90 0FF3 4683 3068 E26C 3245

To claim this, I am signing this object:

@dreki
dreki / index.js
Last active May 6, 2017 02:42
requirebin sketch
/* global document */
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const diff = require('diffhtml');
const container = document.querySelector('.js-container');
document.querySelector('.js-add').addEventListener('click', () => {
/*