This file contains hidden or 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
*.rbc | |
*.sassc | |
.sass-cache | |
capybara-*.html | |
.rspec | |
/.bundle | |
/vendor/bundle | |
/log/* | |
/tmp/* | |
/db/*.sqlite3 |
This file contains hidden or 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
http://dev.opera.com/articles/view/beautiful-ui-styling-with-css3-text-shadow-box-shadow-and-border-radius/ | |
Here I’ve applied rgba colours to the shadows, so most of this box is semi-transparent. I have added a second div around the first one with a repeating background pattern image applied to it, so you can appreciate the full extent of this effect. | |
div { | |
width: 100px; | |
height: 100px; | |
margin: 10px; | |
padding: 0; | |
border: 1px solid rgba(0,0,0,0.5); |
This file contains hidden or 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 ApplicationHelper | |
def content_for_or_pjax(name, &block) | |
request.headers['X-PJAX'] ? capture(&block) : content_for(name, &block) | |
end | |
end |
This file contains hidden or 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
(function($) { | |
$.Loadingdotdotdot = function(el, options) { | |
var base = this; | |
base.$el = $(el); | |
base.$el.data("Loadingdotdotdot", base); | |
This file contains hidden or 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
# application_helper.rb | |
def backbone_router(resource, collection) | |
<<-eos | |
$(function() { | |
window.router = new #{APP_NAME.capitalize}.Routers.#{resource.capitalize}Router({#{resource.downcase}:#{collection.to_json.html_safe}}); | |
Backbone.history.start(); | |
}); | |
eos | |
end |
This file contains hidden or 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
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html | |
Hi everyone, I'm Chris Wanstrath. | |
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But | |
then I took a few moments and thought, Wait, why? Why me? What am I supposed | |
to say that's interesting? Something about Ruby, perhaps. Maybe the | |
future of it. The future of something, at least. That sounds | |
keynote-y. |
This file contains hidden or 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
ActiveRecord::Base.connection.tables.map do |model| | |
model.capitalize.singularize.camelize | |
end | |
# returns ["Activity", "Article", "User", "Video", "Vote"] |
This file contains hidden or 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
SC._detectBrowser = function(userAgent, language) { | |
var version, webkitVersion, browser = {}; | |
userAgent = (userAgent || navigator.userAgent).toLowerCase(); | |
language = language || navigator.language || navigator.browserLanguage; | |
version = browser.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[\/: ](.+?)([ \);]|$)/) || [])[1]; | |
webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1]; | |
browser.windows = browser.isWindows = !! /windows/.test(userAgent); | |
browser.mac = browser.isMac = !! /macintosh/.test(userAgent) || (/mac os x/.test(userAgent) && !/like mac os x/.test(userAgent)); | |
browser.lion = browser.isLion = !! (/mac os x 10_7/.test(userAgent) && !/like mac os x 10_7/.test(userAgent)); | |
browser.iPhone = browser.isiPhone = !! /iphone/.test(userAgent); |
This file contains hidden or 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
(function() { | |
var supportsCanvas = !!document.createElement('canvas').getContext; | |
supportsCanvas && (window.onload = greyImages); | |
function greyImages() { | |
var ctx = document.getElementsByTagName('canvas')[0].getContext('2d'), | |
img = document.getElementById('cvs-src'), | |
imageData, px, length, i = 0, | |
red, green, blue, grey; |
This file contains hidden or 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 'action_controller/test_process' | |
# Paperclip attachments in factories, made easy based on technicalpickles | |
Factory.class_eval do | |
def attach(name, path, content_type = nil) | |
if content_type | |
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}", content_type) | |
else | |
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}") | |
end |