Skip to content

Instantly share code, notes, and snippets.

View thathurtabit's full-sized avatar
:bowtie:

Stephen Fairbanks thathurtabit

:bowtie:
View GitHub Profile
@balupton
balupton / README.md
Last active July 13, 2024 17:32
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@fpillet
fpillet / scale.js
Created May 26, 2011 12:07
Javascript value scaling between two ranges
/* Scale a value from one range to another
* Example of use:
*
* // Convert 33 from a 0-100 range to a 0-65535 range
* var n = scaleValue(33, [0,100], [0,65535]);
*
* // Ranges don't have to be positive
* var n = scaleValue(0, [-50,+50], [0,65535]);
*
* Ranges are defined as arrays of two values, inclusive
anonymous
anonymous / gruntfile.js
Created April 12, 2013 05:55
Gruntfile i am using for a current project with two main tasks, grunt and grunt dev. The default task is for when you're working on a project to see live changes. Grunt dev is for deployment
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
asmblconfig: grunt.file.readJSON('config/assemble.json'),
csslintlconfig: grunt.file.readJSON('config/csslint.json'),
mymodule {
@at-root {
.#{&}-header { ... }
.#{&}-footer { ... }
.#{&}-body {
a { ... }
span { ... }
p { ... }
}
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
@shovon
shovon / gulpfile.js
Created December 15, 2014 15:06
A gulpfile to bundle Browserify code, and watch for changes
var gulp = require('gulp');
var browserify = require('browserify');
var del = require('del');
var source = require('vinyl-source-stream');
var webserver = require('gulp-webserver');
var path = require('path');
var runsequence = require('gulp-run-sequence');
var gutil = require('gulp-util');
/*
@nkbt
nkbt / .eslintrc.js
Last active November 6, 2024 13:01
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@Erichain
Erichain / msconvert.js
Last active December 25, 2023 19:15 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS( milliseconds ) {
var day, hour, minute, seconds;
seconds = Math.floor(milliseconds / 1000);
minute = Math.floor(seconds / 60);
seconds = seconds % 60;
hour = Math.floor(minute / 60);
minute = minute % 60;
day = Math.floor(hour / 24);
hour = hour % 24;
return {
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@jaydenseric
jaydenseric / RouteIndicator.js
Last active November 29, 2023 11:34
A route change indicator for Next.js using React hooks.
import classNameProp from 'class-name-prop';
import { useRouter } from 'next/router';
import React from 'react';
import styles from './RouteIndicator.module.css';
const DONE_DURATION = 250;
export default function RouteIndicator() {
const router = useRouter();