Skip to content

Instantly share code, notes, and snippets.

View anthonyringoet's full-sized avatar

Anthony R anthonyringoet

View GitHub Profile
@toonketels
toonketels / Gruntfile.js
Last active August 16, 2016 09:06
Example gruntfile and package.json to spin up a server on port 8080, compile jade/sass, watch for changes to livereload html/css/js on the server.
'use strict';
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
@robmiller
robmiller / git-cleanup-repo
Last active November 24, 2024 19:55
A script for cleaning up Git repositories; it deletes branches that are fully merged into `origin/master`, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <[email protected]>
# Adapted from the original by Yorick Sijsling
git checkout master &> /dev/null
# Make sure we're working with the most up-to-date version of master.
git fetch
@brtdv
brtdv / .htaccess
Created March 5, 2013 08:09
Add GZIP compression to HTTP requests in the .htaccess
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
@tijsverkoyen
tijsverkoyen / scrollTo
Last active December 11, 2015 11:38
This snippet will animate the anchor links on the current page. Inspired on a script written by @mathiashelin
$(document).on('click', 'a[href*="#"]', function(e) {
var $anchor = $(this),
hash = $anchor.attr('href'),
url = hash.substr(0, hash.indexOf('#'));
hash = hash.substr(hash.indexOf('#'));
// if it is just the hash, we should reset it to body, which will make it scroll to the top of the page.
if(hash == '#') hash = 'body';
// check if we have an url, and if it is on the current page and the element exists
@mislav
mislav / jekyll-data.html
Created December 26, 2012 13:41
Reading JSON data in Jekyll
---
data: [
[ "apple", "red", "round" ],
[ "banana", "yellow", "long" ],
[ "potato", "brown", "bumpy" ]
]
---
<h1>Hello</h1>
@ndarville
ndarville / business-models.md
Last active June 13, 2025 01:26
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@postback
postback / gist:4175326
Created November 30, 2012 11:50
Hubot Alcohol script
# Description:
# Needing a drink. Fast.
#
# Commands:
# hubot alcohol - fetch a drink
# hubot ALCOHOL - fetch three drinks
# hubot ALCOHOL! - fetch a random number of drinks
module.exports = (robot) ->
robot.respond /(alcohol|ALCOHOL)(!)?$/i, (msg) ->
@cjohansen
cjohansen / gist:4135065
Created November 23, 2012 10:43
Naming this in nested functions

tl;dr

If you must nest functions in a way that requires access to multiple this', alias outer this to something meaningful - describe the value it's holding. Treat this as the invisible first argument.

In general though, avoiding the situation (nested functions and frivolous use of this) will frequently produce clearer results.

Naming this in nested functions

I was accidentally included in a discussion on how to best name this in nested functions in JavaScript. +1's were given to this suggestion of using _this.

Giving style advice on naming nested this without a meaningful context isn't too helpful in my opinion. Examples below have been altered to have at least some context, although a completely contrived and stupid one.

@svendecabooter
svendecabooter / gist:3987671
Created October 31, 2012 15:28
Disable Toolbar in colorbox iframe popups
/**
* Implements hook_preprocess_page().
*/
function NAME_preprocess_html(&$vars) {
if (arg(0) == "colorbox") {
// disable the Toolbar when we're in a colorbox popup
unset($vars['page']['page_top']['toolbar']);
}
}
@jacine
jacine / retina.md
Created October 17, 2012 18:36
Automated Retina Sprites with Compass

Automated Retina Sprites with Compass

I asked the following on Twitter the other day:

Thoughts, anyone? "Seems like there are a million ways to do retina sprites with Compass. What's the best way? #sass #compass" tweet

Specifically, what I wanted to do was to reference an icon once, like so:

.selector {
  @include the-sprite('once');