Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am weisjohn on github.
  • I am weisjohn (https://keybase.io/weisjohn) on keybase.
  • I have a public key whose fingerprint is 0D82 1A64 9177 3831 5AD6 A57A 5013 D03D 7310 E3E2

To claim this, I am signing this object:

@weisjohn
weisjohn / colors.unmin.js
Created May 23, 2017
froala color beautified
View colors.unmin.js
/*!
* froala_editor v2.6.1 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2017 Froala Labs
*/
! function(a) {
"function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof module && module.exports ? module.exports = function(b, c) {
return void 0 === c && (c = "undefined" != typeof window ? require("jquery") : require("jquery")(b)), a(c)
} : a(window.jQuery)
View notes for Frontend Masters - Complete Intro to React v2 - March 20th, 2017
# Frontend Masters - Complete Intro to React v2 - March 20th, 2017
## JSX
- SoC smashed together
- `{}` - output the value of this js expression
- `webpack --watch`
- `npm run-script foo -- ` then after `--` is sent to command
## JSX vs. createElement
@weisjohn
weisjohn / fem-react-2017.03.27.md
Created Mar 23, 2017
notes for Frontend Masters - Complete Intro to React v2 - March 27th, 2017
View fem-react-2017.03.27.md

Frontend Masters - Complete Intro to React v2 - March 27th, 2017

Routing in React

  • react-router@v4-alpha

HashRouter Configuration

  • HashRouter - higher-order component
  • Match elements with a component passed in via prop
@weisjohn
weisjohn / fem-react-2017.03.13.md
Created Mar 13, 2017
notes for Frontend Masters - Complete Intro to React v2 - March 13th, 2017
View fem-react-2017.03.13.md
@weisjohn
weisjohn / fake-age-bins.js
Created Dec 23, 2016
fake age range numbers via gaussian distribution
View fake-age-bins.js
var gaussian = require('gaussian');
// mean is the center of the distritubion
var mean = 34.5;
var variance = 300;
var distribution = gaussian(mean, variance);
// number of samples
@weisjohn
weisjohn / cors-https-proxy.js
Created Aug 11, 2016
node es6 cors https proxy
View cors-https-proxy.js
const http = require('http');
const https = require('https');
const server = http.createServer();
const host = 'example.com';
server.on('request', (req, res) => {
// set cors on the response
@weisjohn
weisjohn / get.js
Created Jan 9, 2014
a simple err-first callback function to make a GET request with jQuery, XHR, or Node.js
View get.js
function get(url, cb) {
// use jQuery if you can, if not, XHR, or try to node
if (typeof $ !== "undefined" && !!$().jquery) {
$.ajax(url).then(function(data) {
cb(null, data);
}, function(j, t, e) {
cb(e);
});
} else if (typeof XMLHttpRequest !== "undefined") {
// simple XHR attempt
@weisjohn
weisjohn / README.md
Last active Jan 1, 2016
how to turn a keyframe animation into an animated png using phantomjs, imagemagick, and apngasm
View README.md

jumping through hoops

A wonderfully warm winter day. Everything was perfect. Lofty visions of CSS3 animations dazzled my eyes. Nay, what's this? A browser from years ago appears. What's that you say? It doesn't support keyframes? Ghast. Make an animated gif! Oh, wait, we need transparency? Make an animated png!

This is the final outcome (sans history) of half a day spent to ensure experience parity on a super old (Opera 9.8) browser that we absolutely have to support.

It took hours, and it wasn't probably worth it, but I learned so much, and in the end it works pretty well.

technique

View CertificateGeneration.sh
###
#Step 1 - Generate server certificates etc... (most of this code is horribly ripped off from nodejs docs currently -> http://nodejs.org/docs/latest/api/tls.html)
###
#Assuming your starting from a clean directory
mkdir server
cd server
#generate private key
You can’t perform that action at this time.