Skip to content

Instantly share code, notes, and snippets.

Joshua Levy jlevy

Block or report user

Report or block jlevy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jlevy / simple-hash.js
Created Oct 23, 2019
Fast and simple insecure string hash for JavaScript
View simple-hash.js
// This is a simple, *insecure* hash that's short, fast, and has no dependencies.
// For algorithmic use, where security isn't needed, it's way simpler than sha1 (and all its deps)
// or similar, and with a short, clean (base 36 alphanumeric) result.
// Loosely based on the Java version; see
const simpleHash = str => {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
jlevy / pjson
Created May 28, 2019
Command-line JSON pretty-printer
View pjson
# Convenience script to pretty-print and browse colored JSON without remembering flags.
# Read from files or stdin.
jq -C . "$@" | less -R -m
jlevy / diffjson
Created May 28, 2019
Command-line JSON diff (colorized and with normalized key ordering)
View diffjson
set -euo pipefail
Usage: $(basename $0) file1.json file2.json
Show diff of JSON, normalizing key ordering.
yossorion /
Last active Feb 25, 2020
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

leonardofed /
Last active Feb 26, 2020
A curated list of AWS resources to prepare for the AWS Certifications

A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

jdmaturen /
Last active Feb 18, 2020
Who pays when startup employees keep their equity?

Who pays when startup employees keep their equity?

JD Maturen, 2016/07/05, San Francisco, CA

As has been much discussed, stock options as used today are not a practical or reliable way of compensating employees of fast growing startups. With an often high strike price, a large tax burden on execution due to AMT, and a 90 day execution window after leaving the company many share options are left unexecuted.

There have been a variety of proposed modifications to how equity is distributed to address these issues for individual employees. However, there hasn't been much discussion of how these modifications will change overall ownership dynamics of startups. In this post we'll dive into the situation as it stands today where there is very near 100% equity loss when employees leave companies pre-exit and then we'll look at what would happen if there were instead a 0% loss rate.

What we'll see is that employees gain nearly 3-fold, while both founders and investors – particularly early investors – get dilute

bitinn /
Last active Dec 12, 2018
A soft-fullscreen prompt for iOS7+

A soft-fullscreen prompt for iOS7+


iOS 7.0 and iOS 8 (Beta) do not have support for minimal-ui viewport keyword, nor do they response to window.slideTo(0,1) or support Fullscreen API, which means there is no easy way to tell Mobile Safari to hide address bar/menu without user interaction.

This is a problem for Web App that mimics Native App design, where html/body are commonly set to height: 100%, so browser viewport = available screen estate. There are currently no solution besides adding apple-mobile-web-app-capable meta and ask users to manually Save to Homescreen.

Frustrated by this limit, we present a soft-fullscreen prompt design, which, coupled with proper CSS hack, can achieve soft-fullscreen with relatively small effort from users.

johndgiese / winstonConfig.js
Last active May 6, 2019
Make node's winston logger print stack traces
View winstonConfig.js
// Extend a winston by making it expand errors when passed in as the
// second argument (the first argument is the log level).
function expandErrors(logger) {
var oldLogFunc = logger.log;
logger.log = function() {
var args =, 0);
if (args.length >= 2 && args[1] instanceof Error) {
args[1] = args[1].stack;
return oldLogFunc.apply(this, args);
pjobson /
Last active Jan 15, 2020
OSX McAfee Removal

Removal of McAfee from OSX

Note: This was written in 2015, it may be out of date now.

There are a lot of commands here which I use sudo if you don't know what you're doing with sudo, especially where I rm you can severely screw up your system.

There are many reasons which you would want to remove a piece of software such as McAfee, such as not wanting it to hammer your CPU during work hours which seems like primetime for a virus scan.

I intend this to be a living document, I have included suggestions from peoples' replies.

You can’t perform that action at this time.