This file contains 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
#where OFFSET is seconds | |
ActiveSupport::TimeZone.all.find { |z| ((z.now.dst? && z.utc_offset == OFFSET-3600) || (!z.now.dst? && z.utc_offset == OFFSET))} |
This file contains 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
;; emacs kicker --- kick start emacs setup | |
;; Copyright (C) 2010 Dimitri Fontaine | |
;; | |
;; Author: Dimitri Fontaine <dim@tapoueh.org> | |
;; URL: https://github.com/dimitri/emacs-kicker | |
;; Created: 2011-04-15 | |
;; Keywords: emacs setup el-get kick-start starter-kit | |
;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/ | |
;; | |
;; This file is NOT part of GNU Emacs. |
This file contains 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
du -h / | grep ^[0-9.]*G |
This file contains 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
Android applications can maintain their own internal preferences (and allow them to be modified by users) with very little coding. In fact, you don't even need to write an code to explicitly save these preferences, it's all handled automatically! | |
Create a new Android project, with an intial activity title Main. | |
Create two more activities: | |
ShowPrefs, which extends Activity | |
Set Prefs, which extends PreferenceActivity | |
Add these two to your AndroidManifest.xml file: |
This file contains 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
class SomeClass < ActiveRecord::Base | |
STATES = {:is_valid => 0, :needs_review => 1, :reviewed => 2, :is_invalid => 3} | |
def initialize(*args) | |
super(*args) | |
end | |
attr_accessible :state |
This file contains 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
1. create .sh file, add this to it: | |
#!/bin/sh | |
/Applications/Emacs.app/Contents/MacOS/Emacs --daemon | |
2. Use platypus to wrap the .SH file as a .app. | |
3. Add .app to Login Items | |
4. Edit .tmux.conf and add "new session" |
This file contains 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
IRB.conf[:PROMPT_MODE] = :DEFAULT | |
def pbcopy(input) | |
str = input.to_s | |
IO.popen('pbcopy', 'w') { |f| f << str } | |
str |
This file contains 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
ENV["WATCHR"] = "1" | |
system 'clear' | |
def growl(message) | |
growlnotify = `which growlnotify`.chomp | |
title = "Watchr Test Results" | |
puts message | |
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" | |
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
system %(#{growlnotify} #{options} &) |
This file contains 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
#!/usr/bin/env bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} |
This file contains 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
-------- request JSON --------- | |
"build": { | |
"monogram": { | |
"name": "Monogram", | |
"id": 33 | |
}, | |
"placket": { | |
"name": "Placket", | |
"id": 18 | |
}, |