Skip to content

Instantly share code, notes, and snippets.

View jimmylee's full-sized avatar
📑
making a website.

jim jimmylee

📑
making a website.
View GitHub Profile
@jimmylee
jimmylee / example.js
Created May 8, 2019 01:10
NProgress with anchors and nextjs
// NOTE(jim): This is a little hacky because we actually make server trips.
if (process.browser) {
NProgress.configure({
showSpinner: false,
easing: 'ease',
speed: 300,
minimum: 0.8,
});
NProgress.done(true);

The Problem

We don't want hashes in our urls. But we also don't want exceptions, broken routes, and users to return without the right url. This document details how I solved the problem for http://jimmyl.ee - a static website hosted on S3.

My Router

import reducers from './reducers/index';
import { middleware } from './common/middleware';
import { createRoutes } from './common/routing';
import { Router } from 'react-router';
Verifying that "jimlee.id" is my Blockstack ID. https://onename.com/jimlee

Keybase proof

I hereby claim:

  • I am jimmylee on github.
  • I am jyl (https://keybase.io/jyl) on keybase.
  • I have a public key whose fingerprint is 7CFF 9C05 87B0 6EB2 F758 E2C6 CBBA 4396 FB85 F462

To claim this, I am signing this object:

Verifying that "jimlee.id" is my Blockstack ID. https://onename.com/jimlee
// STEP 1:
// I use a tool like Dropzone to get the JavaScript file object but I mean you
// can do whatever your heart desires. you're going to listen to the drop event.
// STEP 2:
// Have a method thats like a callback
_handleFilesDropped(files) {
if (files.length) {
const file = files[0];
return uploadFile(file);
@jimmylee
jimmylee / keybase.md
Created February 22, 2016 23:41
keybase.md

Keybase proof

I hereby claim:

  • I am meanjim on github.
  • I am jyl (https://keybase.io/jyl) on keybase.
  • I have a public key whose fingerprint is 7CFF 9C05 87B0 6EB2 F758 E2C6 CBBA 4396 FB85 F462

To claim this, I am signing this object:

@jimmylee
jimmylee / tweet.js
Last active September 12, 2015 00:11
Hook.io Tweet
module['exports'] = function tweet(hook) {
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: hook.env.twitter_consumer_key,
consumer_secret: hook.env.twitter_consumer_secret,
access_token_key: hook.env.twitter_token,
access_token_secret: hook.env.twitter_token_secret
});
@jimmylee
jimmylee / gist:de0ad5377ea95e1cddc7
Last active August 29, 2015 14:07
One line for checking grid
[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})