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
# Link to /sign-in/:provider?return_to=current_page in your view. This example shows auth using Twitter in a HAML view | |
%a{ :href => "/sign-in/twitter?return_to=" + request.env['PATH_INFO'] } |
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
/* replace filenames and other stuff as needed | |
* the main point is to have the four formats available | |
* see also fontsquirrel.com, this is where I got it | |
*/ | |
@font-face { | |
font-family: 'ChunkFiveRegular'; | |
src: url('Chunkfive-webfont.eot'); | |
src: url('Chunkfive-webfont.eot?iefix') format('eot'), | |
url('Chunkfive-webfont.woff') format('woff'), |
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 ApplicationController < ActionController::Base | |
# Tell Devise to redirect after sign_in | |
def after_sign_in_path_for(resource_or_scope) | |
some_url(:protocol => 'http') | |
end | |
# Tell Devise to redirect after sign_out | |
def after_sign_out_path_for(resource_or_scope) | |
some_url(:protocol => 'http') | |
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
# app/common/templatetags/expr.py | |
from django import template | |
from django.utils.translation import gettext_lazy as _ | |
from django.conf import settings | |
import re | |
register = template.Library() | |
class ExprNode(template.Node): |
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
# app/validators/reserved_name_validator.rb | |
class ReservedNameValidator < ActiveModel::EachValidator | |
RESERVED_NAMES = %w{ | |
about account add admin api | |
app apps archive archives auth | |
blog | |
config connect contact create | |
delete direct_messages downloads | |
edit email | |
faq favorites feed feeds follow followers following |
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
db/*.sqlite3 | |
log/*.log | |
tmp/**/* | |
bin/* | |
vendor/gems/ruby/1.8/* | |
!vendor/gems/ruby/1.8/cache/ |
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
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb | |
# and made a lot more robust by me | |
# this implementation uses erb by default. if you want to use any other template mechanism | |
# then replace `erb` on line 13 and line 17 with `haml` or whatever | |
module Sinatra::Partials | |
def partial(template, *args) | |
template_array = template.to_s.split('/') | |
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}" | |
options = args.last.is_a?(Hash) ? args.pop : {} | |
options.merge!(:layout => false) |
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
Element.Methods.centerIsWithinViewport = function(element) { | |
var dim = document.viewport.getDimensions(); | |
var so = document.viewport.getScrollOffsets(); | |
var co = element.cumulativeOffset(); | |
var edim = element.getDimensions(); | |
// x and y measured from upper left | |
var center = { | |
x: co.left + (edim.width / 2), | |
y: co.top + (edim.height / 2) | |
} |
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
# List of environments and their heroku git remotes | |
ENVIRONMENTS = { | |
:staging => 'myapp-staging', | |
:production => 'myapp-production' | |
} | |
namespace :deploy do | |
ENVIRONMENTS.keys.each do |env| | |
desc "Deploy to #{env}" | |
task env do |