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 ruby | |
# | |
# Convert a MySQL database from latin1 to utf8 charset. | |
# | |
# Based on the short but slightly limited shell script in this article: | |
# http://yoonkit.blogspot.com/2006/03/mysql-charset-from-latin1-to-utf8.html | |
# | |
# Use at your own risk! I take not responsiblity for anything or | |
# anyone that might be damaged, lost, or killed from using this |
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
# >> First workflow | |
git svn clone <svn_repo> | |
git checkout -b featureZ | |
# hack hack hack | |
git commit -a | |
git svn rebase | |
git svn dcommit # you can add -e to enter new |
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
Item.create( | |
:name => "Lolcat", | |
:fans => 0, | |
:views => 0 | |
) | |
item = Item.find_by_name("Lolcat") #=> <Item name:"Lolcat" fans:0 views:0> | |
item.increment_attributes({ :fans => 4, :views => 3 }) |
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
### | |
Handy url redirection that's as flexible as the href attribute of A tags. | |
There might have been an easier way to do this, if so, let me know how stupid | |
I am :) | |
Example: | |
// Browser is on http://my.domain.com:3000/hello/world.html | |
window.redirect_to "world2.html" |
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
# | |
# NOTICE: The stop/restart tasks won't work properly due to a bug in the daemons gem | |
# unless you use the ghazel-daemons gem by putting this in your environment.rb file: | |
# | |
# config.gem "ghazel-daemons", :lib => "daemons" | |
# gem "ghazel-daemons" | |
# require "daemons" | |
# | |
# This will force-load the 'ghazel-daemons' gem and make sure it's used instead of | |
# the 'daemons' gem. It works even with the 'daemons' gem installed, so you won't |
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
# | |
# UPDATE! | |
# Instead of using this monkey-patch, it's better if you simply use the following | |
# in your environment.rb file: | |
# | |
# config.gem "ghazel-daemons", :lib => "daemons" | |
# gem "ghazel-daemons" | |
# require "daemons" | |
# | |
# This will force-load the 'ghazel-daemons' gem and make sure it's used instead of |
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
# Public: Wait while block returns false by repeatedly calling the block until | |
# it returns true. | |
# | |
# Useful to wait for external systems to do something. Like launching daemons | |
# in integration tests. Which you're not actually doing right? >_< | |
# | |
# timeout - Integer specifying how many seconds to wait for. | |
# retry_interval - Interval in seconds between calling block while it's | |
# - returning false. | |
# block - A block which returns true or false. It should only return |
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
# encoding: utf-8 | |
class FuzzyClock | |
@@locales ||= {} | |
@@locales[:en] = { | |
:about => "it's about %t", | |
:hour => { | |
0 => "twelve", | |
1 => "one", | |
2 => "two", |
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
;;; birds-of-paradise-theme.el --- custom theme for faces | |
;; Copyright (C) 2011 Paul M. Rodriguez <paulmrodriguez@gmail.com> | |
;; This file is not part of GNU Emacs. | |
;; GNU Emacs is free software: you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or | |
;; (at your option) any later version. |
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
;; | |
;;; FlyMake Lisp | |
;; | |
;; from: http://www.emacswiki.org/emacs/FlymakeElisp | |
;; | |
(defun flymake-elisp-init () | |
(unless (string-match "^ " (buffer-name)) | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) |