Because loading gems can take longer than you think
Now available as a gem - get it here
module Paperclip | |
class Geometry | |
def self.from_file file | |
parse("100x100") | |
end | |
end | |
class Thumbnail | |
def make | |
src = Test::FileHelper.fixture_file('white_pixel.jpg') | |
dst = Tempfile.new([@basename, @format].compact.join(".")) |
images = Dir.glob('public/images/*') | |
images.each do |image| | |
unless File.directory?(image) | |
puts "Checking #{image}..." | |
if IO.popen("ack-grep -1 -G '(app|public)' --ruby --html --css #{File.basename(image)}").eof? | |
IO.popen("svn delete #{image}") | |
puts " Deleted" | |
end | |
end |
### Show stack trace for 500 errors | |
### (adapted from https://gist.github.com/1079020) | |
# Given an application, yield to a block to handle exceptions | |
class ExceptionRaiserApp | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
diff --git a/.gitignore b/.gitignore | |
index 923b697..eb3489a 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -1,5 +1,15 @@ | |
-.bundle | |
-db/*.sqlite3 | |
-log/*.log | |
-tmp/ | |
-.sass-cache/ |
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
alert = UIAlertView.new | |
alert.message = t('start') | |
alert.show | |
true | |
end | |
def t(key) | |
NSBundle.mainBundle.localizedStringForKey(key, value:nil, table:nil) |
class UILabel_Adjustable | |
# Borrowed and modified the excellent example at http://www.11pixel.com/blog/28/resize-multi-line-text-to-fit-uilabel-on-iphone/ | |
# adapting it for RubyMotion | |
# This applies only to a multi-line label. You can use '.adjustsFontSizeToFitWidth = true' for a single-line label | |
# usage is: | |
# text = "It's bad luck to be superstitious" | |
# text_label = UILabel.alloc.initWithFrame([[20, 20], [70, 120]]) | |
# text_label.numberOfLines = 0 # set 0 for word wrap | |
# text_label.lineBreakMode = UILineBreakModeWordWrap |
require 'delegate' | |
class Base | |
def foo | |
"foo" | |
end | |
def bar | |
"bar" | |
end | |
end |
RSpec.configure do |config| | |
config.around do |example| | |
# For examples using capybara-webkit for example. | |
# Remove this if you don't use it or anything similar | |
if example.metadata[:js] | |
example.run | |
ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY") | |
else | |
ActiveRecord::Base.transaction do |
/* ============================================================= | |
* bootstrap-typeahead.js v2.2.2 | |
* http://twitter.github.com/bootstrap/javascript.html#typeahead | |
* ============================================================= | |
* Copyright 2012 Twitter, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* |
Because loading gems can take longer than you think
Now available as a gem - get it here