Skip to content

Instantly share code, notes, and snippets.

View ffffranklin's full-sized avatar

Franklin Clark ffffranklin

View GitHub Profile
@ffffranklin
ffffranklin / README.md
Created December 2, 2021 21:47 — forked from anthonysimone/README.md
How a Browser Works

How a Browser Works

   

   

Diagram

My thoughts on writing tiny reusable modules that each do just one
thing. These notes were adapted from an email I recently sent.
***
If some component is reusable enough to be a module then the
maintenance gains are really worth the overhead of making a new
project with separate tests and docs. Splitting out a reusable
component might take 5 or 10 minutes to set up all the package
overhead but it's much easier to test and document a piece that is
@ffffranklin
ffffranklin / pre-commit
Created August 3, 2018 21:00 — forked from kuy/pre-commit
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1

Keybase proof

I hereby claim:

  • I am ffffranklin on github.
  • I am ffffranklin (https://keybase.io/ffffranklin) on keybase.
  • I have a public key ASAwZGyzPydTgaXZFMjxEmf1LInQ0b5H8oZYzxKThQoUAQo

To claim this, I am signing this object:

@ffffranklin
ffffranklin / after.js
Created June 22, 2017 18:07
Case vs Lookup with type discrimination support
/**
* Prop getter
* @inspiredby https://blog.mariusschulz.com/2017/01/06/typescript-2-1-keyof-and-lookup-types
*/
function prop<T, K extends keyof T>(obj: T, key: K) {
return obj.hasOwnProperty(key) ? obj[key] : undefined;
}
export function buildAddFieldParams(field: ModelFieldTypes, zone: 'DISCRETE' | 'CONTINUOUS' | 'AGGREGATE'): EncField {
let lookup = {
@ffffranklin
ffffranklin / package.json
Last active September 2, 2016 20:29
Phantom JS Web Security Enabled Bug
{
"name": "phantomjs-bug",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "phantomjs script.js"
},
"author": "",
"license": "ISC",
@ffffranklin
ffffranklin / name-that-color.js
Created February 19, 2016 23:45
Name That Color - Created by Chirag Mehta
/*
+-----------------------------------------------------------------+
| Created by Chirag Mehta - http://chir.ag/projects/ntc |
|-----------------------------------------------------------------|
| ntc js (Name that Color JavaScript) |
+-----------------------------------------------------------------+
All the functions, code, lists etc. have been written specifically
for the Name that Color JavaScript by Chirag Mehta unless otherwise
@ffffranklin
ffffranklin / index.html
Last active January 23, 2016 01:06 — forked from anonymous/index.html
JS Bin// source https://jsbin.com/kecokok
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.0.0-alpha1.js"></script>
<script src="https://cdn.jsdelivr.net/momentjs/2.10.6/moment-with-locales.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.day {
@ffffranklin
ffffranklin / succ.js
Last active October 10, 2015 02:29 — forked from devongovett/succ.js
An implementation of Ruby's string.succ method in JavaScript
/*
* An implementation of Ruby's string.succ method.
* By Devon Govett
*
* Returns the successor to str. The successor is calculated by incrementing characters starting
* from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the
* string. Incrementing a digit always results in another digit, and incrementing a letter results in
* another letter of the same case.
*
* If the increment generates a carry, the character to the left of it is incremented. This
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person