Skip to content

Instantly share code, notes, and snippets.

View shawnsandy's full-sized avatar

Shawn Sandy shawnsandy

View GitHub Profile
@eldh
eldh / InViewWrapper.coffee
Created April 24, 2015 08:30
react-in-view
module.exports = React.createClass
displayName: 'InViewWrapper'
propsTypes:
onInView: React.PropTypes.func.isRequired
inViewOffset: React.PropTypes.number
getDefaultProps: ->
inViewOffset: 0
@akbr
akbr / gist:10663723
Last active July 8, 2016 10:48
gulp + browserify
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var libs = ["underscore", "jquery"];
gulp.task("vendor", function () {
var b = browserify();
libs.forEach(function (lib) {
@eric-hu
eric-hu / Open iterm tab here
Last active March 11, 2022 02:45
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
@shawnsandy
shawnsandy / Selected_Users_Control.php
Created December 18, 2012 04:04
A simple custom control I wrote for the WordPress theme customizer that allows you to create user select drop-down list...
<?php
if (class_exists('WP_Customize_Control')):
class Selected_Users_Control extends WP_Customize_Control {
public $type = 'option';
public $query = array('orderby' => 'nicename');
public $description = '';
public function render_content() {
$query = $this->query;
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@billerickson
billerickson / gist:1320990
Created October 27, 2011 21:53
Limit Gallery Metabox to Amenities Page Template
<?php
/**
* Limit Gallery Metabox to Amenities Page Template
* @author Bill Erickson
* @link http://www.wordpress.org/extend/plugins/gallery-metabox
* @since 1.0
*
* @param bool display metabox
* @param string post ID
@GaryJones
GaryJones / gist:1258784
Created October 3, 2011 09:37 — forked from jaredatch/gist:1256954
Using the template_include filter in WordPress
<?php
add_filter( 'template_include', 'ja_template_include' );
/**
* Apply a template to all subcategories of a certain parent category.
*
* @author Jared Atchison
* @link http://www.jaredatchison.com/2011/10/02/taking-advantage-of-the-template_include-filter/
*
* @param string $template Existing path to template file
* @return string Potentially amended path to template file
@necolas
necolas / css-responsive-images.html
Created May 18, 2011 13:33
Idea for CSS-only responsive images using CSS3 generated content and attr() function. No browser implementation as of May 2011
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS responsive images</title>
<style>
/* Doesn't stop original source image being
downloaded too */
@media (min-device-width:600px) {
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,