Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jasonhwest on github.
  • I am jasonhwest (https://keybase.io/jasonhwest) on keybase.
  • I have a public key ASBLX3RG_cOipMY-IzGj9kWPcM_zpyt2yuUerP3xWaz58Qo

To claim this, I am signing this object:

// https://hackernoon.com/measuring-web-performance-its-really-quite-simple-adeda8f7f39e
function logTimes(message) {
performance.mark(message); // this one is for WebPageTest
console.timeStamp(message); // this is for the Performance tab in Chrome DevTools
console.info(message, performance.now()); // this is for the console, duh
// this here is for Google Analytics
ga('send', {
hitType: 'timing',

GIT

  • create a new repository
    • create a new directory, open it and perform a git init to create a new git repository.
  • checkout a repository
    • create a working copy of a local repository by running the command git clone /path/to/repository when using a remote server, your command will be git clone username@host:/path/to/repository
  • add & commit
    • You can propose changes (add it to the Index) using git add <filename> git add * This is the first step in the basic git workflow. To actually commit these changes use git commit -m "Commit message" Now the file is committed to the HEAD, but not in your remote repository yet.
  • pushing changes
@jasonhwest
jasonhwest / color-overlay.scss
Last active August 29, 2015 13:57 — forked from nimbupani/color-overlay.scss
Collection of SCSS mixins
// Use @include colorize('image.png', red, 0.5)
@mixin colorize($image, $color, $opacity) {
background: $color;
$color: transparentize($color, 1 - $opacity);
background: -webkit-linear-gradient(left, $color, $color), url($image);
background: -moz-linear-gradient(left, $color, $color), url($image);
background: -ms-linear-gradient(left, $color, $color), url($image);
background: -o-linear-gradient(left, $color, $color), url($image);
}

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.
@jasonhwest
jasonhwest / gist:4195171
Created December 3, 2012 13:51
JavaScript: Recursive setTimeout
//original from http://www.erichynds.com/javascript/a-recursive-settimeout-pattern/
var poller = {
// number of failed requests
failed: 0,
// number of failed requests allowed
failedLimit: 10,
// starting interval - 5 seconds
@jasonhwest
jasonhwest / sticky.css
Created November 24, 2012 18:54 — forked from mokagio/sticky.css
Twitter Bootstrap + Sticky Footer + Fixed Nav Bar
html, body, .container, .content {
height: 100%;
}
.container, .content {
position: relative;
}
.proper-content {
padding-top: 40px; /* >= navbar height */
@jasonhwest
jasonhwest / userLocalTime.js
Created October 10, 2012 19:06
User Local Time
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var suffix = "AM";
if (hours >= 12) {
suffix = "PM";
hours = hours - 12;
}
if (hours == 0) {