Skip to content

Instantly share code, notes, and snippets.

View ncherro's full-sized avatar
🎯
Focusing

Nick Herro ncherro

🎯
Focusing
View GitHub Profile
#!/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
@ncherro
ncherro / README.md
Created February 11, 2014 19:32 — forked from linjunpop/README.md
@ncherro
ncherro / nginx.conf
Last active January 4, 2016 20:10
upstart script for nginx
# 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
//---------------------------------------------------------------------------------------------------
// 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
@ncherro
ncherro / jquery.toggler.js
Last active December 22, 2015 16:18
jquery toggler plugin
/*!
* jQuery toggler plugin
* Original other: @ncherro
* Licensed under the MIT License
*/
;(function ($, window, document, undefined) {
var plugin_name = 'toggler',
defaults = {
on_class: 'on',
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
@ncherro
ncherro / remove-zend_framework-hack.sh
Last active December 18, 2015 16:09
script to recursively removed $zend_framework hacks from php files
#!/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
#! /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
#!/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
@ncherro
ncherro / format_date_range.py
Created April 10, 2013 20:13
django template tag - format date range
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
"""