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
ico_file = "some-file.ico" | |
png_file = "output.png" | |
Devil.load(ico_file) do |img| | |
img.resize(16, 16).save(png_file) | |
end |
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
module Commerce | |
class Refund | |
include DataMapper::Resource | |
include Defaults | |
PENDING = 'pending' | |
SUCCESSFUL = 'successful' | |
DECLINED = 'declined' | |
ERROR = 'error' | |
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
module VerboseJob | |
module ClassMethods | |
def wrap_perform! | |
class << self | |
def perform_with_verbose(*args) | |
JobLogger.verbose { perform_without_verbose(*args) } | |
end | |
alias_method_chain :perform, :verbose \ | |
unless instance_method(:perform) == instance_method(:perform_with_verbose) |
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 'spec_helper' | |
class AbstractStoreSubclass < ActionDispatch::Session::AbstractStore | |
def get_session(env, sid) | |
[sid || generate_sid, nil] | |
end | |
def set_session(env, sid, data, options) | |
end |
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
(string-prefix-p (file-name-as-directory (site-lisp-dir-for name)) f) | |
(and f (string-prefix-p (file-name-as-directory ...) f)) | |
(let ((f ...)) (and f (string-prefix-p ... f))) | |
site-lisp-library-loadable-p(package) | |
(if (site-lisp-library-loadable-p name) nil (download-site-lisp-module name url)) | |
(unless (site-lisp-library-loadable-p name) (download-site-lisp-module name url)) | |
ensure-lib-from-url(package "http://repo.or.cz/w/emacs.git/blob_plain/1a0a666f941c99882093d7bd08ced15033bc3f0c:/lisp$ | |
(if (> emacs-major-version 23) nil (ensure-lib-from-url (quote package) "http://repo.or.cz/w/emacs.git/blob_plain/1a$ | |
(unless (> emacs-major-version 23) (ensure-lib-from-url (quote package) "http://repo.or.cz/w/emacs.git/blob_plain/1a$ |
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
;;; dwim-tab.el --- minor mode to force indentation when TAB would otherwise stall | |
; internal tracking variables | |
(setq dwim-tab-point-before nil) | |
(setq dwim-tab-point-after nil) | |
(defun dwim-tab () | |
"Indents normally once, then switches to tab-to-tab-stop if invoked again. | |
Always performs tab-to-tab-stop if the first TAB press does not cause the | |
point to move." |
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
;;; dwim-tab.el --- minor mode to force indentation when TAB would otherwise stall | |
(defun dwim-tab () | |
"Indents normally once, then switches to tab-to-tab-stop if invoked again. | |
Always performs tab-to-tab-stop if the first TAB press does not cause the | |
point to move." | |
(interactive) | |
(when (or (eq last-command this-command) | |
(= (point) (progn | |
(indent-for-tab-command) |
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
/home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:490:in `load_missing_constant': Expected /home/chris/flippa/flippa-rails/app/models/nda.rb to define Nda (LoadError) | |
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:181:in `block in const_missing' | |
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in `each' | |
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in `const_missing' | |
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0.rc2/lib/dm-core/support/ext/object.rb:25:in `block in full_const_get' | |
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0.rc2/lib/dm-core/support/ext/object.rb:22:in `each' | |
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/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
class Message | |
include DataMapper::Resource | |
property :id, Serial | |
property :deleted, Boolean | |
belongs_to :sender, | |
'User' | |
belongs_to :recipient, |
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 CoercedArray < Array | |
def initialize(type) | |
super() | |
@type = type | |
end | |
def push(object) | |
object = @type.new(object) unless object.kind_of?(@type) | |
super | |
end |