Skip to content

Instantly share code, notes, and snippets.

View shingonoide's full-sized avatar

Rui Andrada shingonoide

View GitHub Profile
@did
did / loco_tip_1.html
Created June 3, 2011 00:24
How to post a comment related to an artist
<h2>{{ artist.name }}</h2>
<div>{{ artist.bio }}</div>
{% with_scope artist: artist._id %}
{% assign comments = contents.comments %}
{% if comments == empty %}
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@beberlei
beberlei / ActiveEntity.php
Created June 19, 2011 11:11
Doctrine 2.2 Traits Preview
<?php
use Doctrine\ORM\EntityManager,
Doctrine\ORM\Configuration,
Doctrine\ORM\Mapping\ClassMetadata;
/**
* Active Entity trait
*
* Limitations: a class can only ever be assocaited with ONE active entity manager. Multiple entity managers
@philippbosch
philippbosch / redmine_heroku_deploy.sh
Created August 7, 2011 12:13 — forked from brototyp/redmine_heroku_deploy
Deploy Redmine to Heroku
#!/bin/bash
set -e
REDMINE_URL="http://rubyforge.org/frs/download.php/75097/redmine-1.2.1.tar.gz"
S3_ACCESS_KEY_ID=""
S3_SECRET_ACCESS_KEY=""
S3_BUCKET_NAME=""
HEROKU_APP_NAME=""
@olivierlacan
olivierlacan / sublime-text-2-settings.json
Last active January 11, 2024 15:38
Basic Sublime Text 2 settings for Rails development
{
"use_simple_full_screen": false,
// calculates indentation automatically when pressing enter
"auto_indent": true,
// sets the colors used within the text area (default)
// see https://github.com/olivierlacan/monokaim to download
// the customized Monokai I use.
"color_scheme": "Packages/Color Scheme - Default/Monokaim.tmTheme",
@TimFletcher
TimFletcher / gunicorn_startup.sh
Created August 20, 2011 14:45
Gunicorn Startup Script
#!/bin/sh
# http://nathanvangheem.com/news/gunicorn-startup-script-for-django
# Place the script in the file - /etc/init.d/gunicorn or whatever you'd like to call it
# make it executable - chmod +x /etc/init.d/gunicorn
# And finally, wire it up - update-rc.d gunicorn defaults
ADDRESS='127.0.0.1'
PYTHON="/opt/django/bin/python"
GUNICORN="/opt/django/bin/gunicorn_django"
@edavis10
edavis10 / screenshot-web.rb
Created September 6, 2011 22:30
Take a full page screenshot of a website.
#!/usr/bin/env ruby
require 'rubygems'
require 'trollop'
require 'vapir'
def filename_for_url(url)
url.
downcase.
gsub(/https?:\/\//,'').
gsub(/\//, '_').
@aganov
aganov / datetime_ui_input.rb
Created October 4, 2011 13:48
Formtastic jQuery UI date and time picker input
# http://jqueryui.com/demos/datepicker/
# http://fgelinas.com/code/timepicker/
class DatetimeUiInput
include Formtastic::Inputs::Base
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M"
def to_html
@BDQ
BDQ / gist:1321842
Created October 28, 2011 08:05
Deface DSL
surround :body, :for => 'layouts/spree_application', :name => 'wrap_body' do
%Q{<div class="wrapper">
<div class="w1">
<div class="w2">
<div class="w3">
<div class="main">
<div id="header">
<h1><a href="http://depts.washington.edu/uwc4c/">University of Washington Center for Commercialization</a></h1><a href="http://www.washington.edu/" class="ad-w">UW</a>
</div>
<%= render_original %>
@carlopires
carlopires / redis_session_store.py
Created December 9, 2011 15:22
Werkzeug Redis Session Store
# -*- coding: utf-8 -*-
"""
Created on 09/11/2011
@author: Carlo Pires <[email protected]>
"""
import tnetstring
from werkzeug.contrib.sessions import SessionStore
SESSION_TIMEOUT = 60*60*24*7 # 7 weeks in seconds