Skip to content

Instantly share code, notes, and snippets.

View aharris's full-sized avatar

Ashton Harris aharris

View GitHub Profile
@aharris
aharris / Dynamic Height
Last active December 20, 2015 08:59
Dynamic Height
$().ready(function() {
setHeight();
$(window).resize(function(){
setHeight();
});
});
function setHeight(){
$(selector).css("height", $(selector).width() + "px" );
}
$beccapurple: #663399;
$turquoise: #1abc9c;
$greenSea: #16a085;
$emerland: #2ecc71;
$nephritis: #27ae60;
$peterRiver: #3498db;
$belizeHole: #2980b9;
$amethyst: #9b59b6;
$wisteria: #8e44ad;
$wetAsphalt: #34495e;
@aharris
aharris / normalize.styl
Created October 9, 2014 01:01
Normalize for stylus
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
*
box-sizing border-box
@aharris
aharris / bind, call, apply
Created January 21, 2015 16:13
Example usage of bind, call, and apply
var fx = function (arg1, arg2) {
console.log("___________________________________________");
console.log(this.use);
console.log(arg1, arg2);
console.log("___________________________________________");
};
var callObj = {
use: "Using Call"
};
var App = window.App || {
beacon: $('.beacon').css('width'),
// Store the beacon Value
lastBeacon: this.beacon,
init: function () {
// Fire the initial functions for first screen size
this.getBeacon(this.beacon);
@aharris
aharris / VPN Split Tunnel
Last active August 29, 2015 14:17
VPN Split Tunnel
// 1. Get default Gateway
$ netstat -rn | grep "default"
// 2. Start VPN
// 3. Run Command after replacing <my_default_gateway>
$ sudo route -nv add -net 10 -interface ppp0 && sudo route change default <my_default_gateway>
@aharris
aharris / gulpfile.js
Created August 19, 2015 13:40
Gulp Browserify
gulp.task('browserify-js', function () {
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var globby = require('globby');
var through = require('through2');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var reactify = require('reactify');
var gutil = require('gulp-util');
@aharris
aharris / Gruntfile.js
Last active October 1, 2015 15:29
Pre commit hooks with gulp and grunt
// npm install
// Require dependencies
// set up git hooks
// set up jshint
// register Task
@aharris
aharris / gulpfile.js
Created November 25, 2015 14:28
Browserify with watchify
var gulp = require('gulp');
var source = require('vinyl-source-stream'); // Used to stream bundle for further handling
var browserify = require('browserify');
var watchify = require('watchify');
var reactify = require('reactify');
var concat = require('gulp-concat');
gulp.task('browserify', function() {
var bundler = browserify({
entries: ['./app/main.js'], // Only need initial file, browserify finds the deps
@aharris
aharris / package-exact.js
Last active June 12, 2018 15:26 — forked from kentcdodds/package-exact.js
make your package.json dependencies be the exact version that's in your node_modules currently
/* jshint node:true */
/* eslint-env node */
/*
* This will look at the current version of all of your dependencies and update your package.json
* with the specific version that you currently have in node_modules. This will save you from the
* sadness that is: DEPENDENCY MANAGEMENT
*
* Place this file at the same level as your package.json and node_modules
* Then simply run: node ./package-strict