Skip to content

Instantly share code, notes, and snippets.

View kaanon's full-sized avatar

Kaanon MacFarlane kaanon

View GitHub Profile
@kaanon
kaanon / bundle.js
Last active August 29, 2015 14:08 — forked from jackgill/bundle.js
/*
* This script will download a package (and all of its dependencies) from the
* online NPM registry, then create a gzip'd tarball containing that package
* and all of its dependencies. This archive can then be copied to a machine
* without internet access and installed using npm.
*
* The idea is pretty simple:
* - npm install [package]
* - rewrite [package]/package.json to copy dependencies to bundleDependencies
* - npm pack [package]
/** Dependencies and Libraries */
var gulp = require('gulp'),
fs = require('fs'),
jshint = require('gulp-jshint'),
util = require('gulp-util'),
argv = require('yargs').argv,
args = argv['_'].slice(1);
/**
* Prebuild tasks
@kaanon
kaanon / scrollTo.js
Created September 4, 2013 07:21
Scroll To
$('a.scroll').click(function (event) {
event.preventDefault();
var full_url = this.href;
var parts = full_url.split("#");
var trgt = parts[1];
if (trgt && $("#" + trgt).length) {
var target_offset = $("#" + trgt).offset();
var target_top = target_offset.top - 100;
$('html, body').animate(
{scrollTop: target_top}, //properties to animate