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
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
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
require 'rdoc/task' | |
namespace :doc do | |
namespace :generate do | |
## to regenerate documentation | |
## bundle exec rake doc:generate:reapi | |
RDoc::Task.new :api do |rd| | |
# config example | |
# http://snipplr.com/view/27986/ | |
rd.rdoc_dir = 'doc/api/v2' |
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
0x50858f2c7873fac9398ed9c195d185089caa7967 |