Rails flash messages with AJAX requests
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
# setup | |
root_dir = ARGV[0] || "#{ENV['HOME']}/Desktop/coffee-to-browserify" | |
src = "#{root_dir}/src" | |
dst = "#{root_dir}/dst" | |
FileUtils.mkdir_p dst |
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
# save to /etc/init/nginx.conf and chmod +x on a Ubuntu server with upstart | |
# | |
# start with `sudo service nginx start` | |
# stop with `sudo service nginx stop` | |
# | |
# DAEMON is the full path to the nginx binary. in this case, nginx | |
# was installed with passenger - passenger-install-nginx-module | |
# | |
# PIDFILE is the full path to the nginx pidfile, defined with the pid | |
# directive in nginx.conf http://wiki.nginx.org/CoreModule#pid |
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
//--------------------------------------------------------------------------------------------------- | |
// a sassier grid for spree | |
// fixed-width - html whitespace not removed. | |
// intended to be used as magic-classes, coupling markup&style. | |
// based on skeleton v1.1 by dave gamache - thanks dude | |
// | |
//--------------------------------------------------------------------------------------------------- | |
//- Contents | |
//--- Grid classes | |
//--- Grid Variables |
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
/*! | |
* jQuery toggler plugin | |
* Original other: @ncherro | |
* Licensed under the MIT License | |
*/ | |
;(function ($, window, document, undefined) { | |
var plugin_name = 'toggler', | |
defaults = { | |
on_class: 'on', |
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
RSpec::Matchers.define :permit do |*args| | |
match do |permission| | |
expect(permission.allow?(*args)).to be_true | |
end | |
end | |
RSpec::Matchers.define :permit_param do |*args| | |
match do |permission| | |
expect(permission.allow_param?(*args)).to be_true | |
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
#!/bin/bash | |
# this recursively loops through all files ending in .php, then removes the | |
# zend framework hack code. tested on Ubuntu using sed v 4.2.1 | |
# | |
# best to run this as root so there aren't any permissions issues | |
find . -type f -name "*.php" -print | xargs sed -i.hacked 's/^<?php $zend_framework="\\x63\\162\\x65.*?>//g' | |
# now remove the hacked files |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions. | |
# Description: nginx init.d script for Ubuntu 8.10 and lesser versions. | |
### END INIT INFO |
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
#!/bin/bash | |
SRC=~/Pictures | |
DST=~/Pictures-flat | |
# 1. Recursively finds all files ending in .jpg, .jpeg, .cr2 and .png in the | |
# $SRC directory (extension search is case-insensitive) | |
# | |
# 2. Gets each file's date created and creates a YYYY-MM-DD directory in the | |
# $DST directory |
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
from django import template | |
register = template.Library() | |
@register.simple_tag | |
def format_date_range(date_from, date_to, separator=" - ", | |
format_str="%B %d, %Y", year_f=", %Y", month_f="%B", date_f=" %d"): | |
""" Takes a start date, end date, separator and formatting strings and | |
returns a pretty date range string | |
""" |