Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@cyberdelia
cyberdelia / fabfile.py
Created April 3, 2010 14:05
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@alx
alx / git.rb
Created December 6, 2010 14:24
Jekyll plugin to add Git activity inside a list
require 'git'
module Jekyll
class GitActivityTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
@jessykate
jessykate / Jekyll nd Octopress Liquid tag for MathJax.rb
Created February 18, 2011 23:37
A simple liquid tag for Jekyll/Octopress that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end
@mbostock
mbostock / .block
Last active June 9, 2024 02:00
Polar Clock
license: gpl-3.0
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@wrburgess
wrburgess / gist:2187164
Created March 24, 2012 19:37
Setting up a Rails has_many :through relationship with meaningful relationship table #rails #activerecord #relations

##References

##Create Models

Create tables:

rails g model Location
rails g model User
rails g model Checkin
@kamiaka
kamiaka / convert_kana.js
Last active August 3, 2023 03:50
JS Convert "Kana" one from another (zen-kaku, han-kaku and more)
/**
* Convert "Kana" one from another
* (zen-kaku, han-kaku and more)
*
* @param string str
* @param string option (optionaly)
* @return string converted string
*/
function convert_kana (str, option) {
option = option || "KV";
@anthonyshort
anthonyshort / _image-rendering.sass
Created October 28, 2012 05:15
Image rendering mixins
// Sharpen an image if it has become blurry due to upscaling or downscaling
// https://developer.mozilla.org/en/CSS/image-rendering
@mixin sharpen-image
image-rendering:-moz-crisp-edges
// When photos are upscaled or downscaled, they often get blurry. Don't use
// this on flat color images, they will still appear blurry.
// https://developer.mozilla.org/en/CSS/image-rendering
@mixin high-quality-image
image-rendering:optimizeQuality
@farleyknight
farleyknight / Gemfile
Created December 2, 2012 20:08
ComfortableMexicanSofa (CMS) + Spree + Devise + OmniAuth + Heroku
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Postgres Database
gem 'pg'
# Twitter API
gem 'twitter'