Skip to content

Instantly share code, notes, and snippets.

View clintonb's full-sized avatar

Clinton Blackburn clintonb

View GitHub Profile
@ldez
ldez / gmail-github-filters.md
Last active May 16, 2024 11:07
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@burtyish
burtyish / django-pageable-collection.coffee
Last active August 29, 2015 13:58
An extension of Backbone.PageableCollection to parse server responses created by Django Rest Framework.
define [
'jquery',
'underscore',
'backbone',
'backbone-pageable'
], ($, _, Backbone) ->
###
An extension of Backbone.PageableCollection to parse server responses created by Django Rest Framework.
The response structure is expected to match that provided by django-rest-framework's Pagination mechanism
@ryandotsmith
ryandotsmith / agg.sql
Created January 23, 2013 05:19
Postgres array concatenation aggregate function.
CREATE AGGREGATE array_accum (anyarray)
(
sfunc = array_cat,
stype = anyarray,
initcond = '{}'
);
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@selvan
selvan / application.rb
Created June 15, 2012 10:18
Custom Log Formatting - Rails 3
logger = Logger.new(File.join( Rails.root, "log", "my_#{ Rails.env}.log"), 'daily')
logger.level = Logger::INFO
logger.formatter = proc do |severity, datetime, progname, msg|
"#{datetime.strftime("%B %d %H:%M:%S")} #{Socket.gethostname}, [#{$$}]:, #{severity} MY_WEBAPP, #{msg}\n"
end
tag_log = ActiveSupport::TaggedLogging.new(logger)
config.logger = tag_log
# above code will produce log in format as shown below,
@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@yuchant
yuchant / capture.py
Created February 28, 2012 00:16
Django capture contents of block - variable assignment in template like Shopify
"""
Capture contents of block into context
--------------------------------------
Use case: variable accessing based on current variable values.
{% capture foo %}{{ foo.value }}-suffix{% endcapture %}
{% if foo in bar %}{% endif %}
Created on Monday, February 2012 by Yuji Tomita
@duanecilliers
duanecilliers / wp-bootstrap-walker-class.php
Created February 13, 2012 14:45
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
@mislav
mislav / index.haml
Created March 21, 2011 15:00
How to render Haml, Erb templates with a layout
%h1&= title
%p Hello world
@jittuu
jittuu / gist:792715
Created January 24, 2011 02:19
Test Omniauth Facebook Callback Controllers in Devise with rspec
require 'spec_helper'
describe Users::OauthCallbacksController, "handle facebook authentication callback" do
describe "#annonymous user" do
context "when facebook email doesn't exist in the system" do
before(:each) do
stub_env_for_omniauth
get :facebook