Skip to content

Instantly share code, notes, and snippets.

View HoundstoothSTL's full-sized avatar

Rob Bennet HoundstoothSTL

View GitHub Profile
@HoundstoothSTL
HoundstoothSTL / anchor-scroll-with-offset.js
Created May 3, 2013 15:43
Anchor scroll with fixed header offset
(function($) {
$('a[href*=#]:not([href=#])').click(function()
{
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname)
{
var target = $(this.hash),
headerHeight = $(".primary-header").height() + 5; // Get fixed header height
@HoundstoothSTL
HoundstoothSTL / Embed.js
Last active October 12, 2020 03:29
On-demand vimeo embedded videos with oEmbed API, no jQuery, just javascript. Videos are not loaded on page load for performance reasons, use placeholder images, then on click, fire off the javascript.
var Embed = {
config : {
elementId : 'embed',
trigger: document.querySelectorAll('[data-js="embedTrigger"]'),
videoId : 7100569,
autoplay : true,
vidWidth: 640,
vidHeight: 400
},
@HoundstoothSTL
HoundstoothSTL / wp-download.sh
Created November 15, 2012 20:10
Download Wordpress through terminal and cleanup
#!/bin/bash
#Download the latest copy of WordPress into a directory, grab all the files in the new /wordpress folder
#Put all the files in the current directory, remove the now empty /wordpress directory
#Remove the tarball
#download latest wordpress with wget
wget http://wordpress.org/latest.tar.gz
#OR using CURL
@HoundstoothSTL
HoundstoothSTL / php_object_literal.php
Created June 1, 2013 02:48
PHP Object Literal Pattern
<?php
/**********
***** PHP Object Literal Pattern
***********/
$object = (object) [
'config' => (object) [
'username' => 'Rob Bennet',
'email' => 'rob@madebyhoundstooth.com'
],
@HoundstoothSTL
HoundstoothSTL / rsync.bash
Created September 25, 2013 22:15
Rsync syntax
rsync -zvr /from/here /to/here
@HoundstoothSTL
HoundstoothSTL / Tumblr.js
Created September 23, 2013 17:50
Load Tumblr Posts from Tumblr.js module
var Tumblr = {
posts: {
// this will get filled by the ajax response upon success
},
config: {
dataType: 'jsonp',
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
limit: '1',
endpoint: 'http://api.tumblr.com/v2/blog/pixelpressgame.tumblr.com/posts/text',
@HoundstoothSTL
HoundstoothSTL / sql_import.bash
Created September 13, 2013 16:42
Add sql data from file
mysql -u USERNAME -p -h localhost YOUR-DATA-BASE-NAME-HERE < YOUR-.SQL.FILE-NAME-HERE

DocPad: Minify your assets with Grunt

The following will minify your assets with grunt each time a generation write completes.

Installation

  1. Install Dependencies
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt