Skip to content

Instantly share code, notes, and snippets.

Dylan Jhaveri dylanjha

Block or report user

Report or block dylanjha

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
View keybase.md

Keybase proof

I hereby claim:

  • I am dylanjha on github.
  • I am dylanj (https://keybase.io/dylanj) on keybase.
  • I have a public key ASCL1W5WGRpMp0XKfIrTOB6SUQYlzB35MH3D6zVR5tLbmAo

To claim this, I am signing this object:

@dylanjha
dylanjha / airports.json
Created Dec 26, 2018 — forked from tdreyno/airports.json
JSON data for airports and their locations
View airports.json
This file has been truncated, but you can view the full file.
[
{
"code": "AAA",
"lat": "-17.3595",
"lon": "-145.494",
"name": "Anaa Airport",
"city": "Anaa",
"state": "Tuamotu-Gambier",
"country": "French Polynesia",
View setup.js
const execa = require('execa')
const Listr = require('listr')
const PROD_APP_NAME = '<replace with: heroku name of prod app>'
const STAGING_APP_NAME = '<replace with: heroku name of staging app>'
const tasks = new Listr([
{
title: 'setup git remote - staging',
task: () =>
@dylanjha
dylanjha / crypto-pbkdf2-example.js
Created Nov 15, 2017 — forked from skeggse/crypto-pbkdf2-example.js
Example of using crypto.pbkdf2 to hash and verify passwords asynchronously, while storing the hash and salt in a single combined buffer along with the original hash settings
View crypto-pbkdf2-example.js
var crypto = require('crypto');
// larger numbers mean better security, less
var config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// more iterations means an attacker has to take longer to brute force an
View so-proper-redux-store-shape.md

Example 1

  1. User goes to /posts
  2. User goes to /authors/1
  3. User goes to /posts

Example 2

  1. User goes to /authors/1
  2. User goes to /authors/2
@dylanjha
dylanjha / example-1.js
Last active Nov 2, 2017
example file for issue
View example-1.js
const obj = {}
function doSomething () {
return new Promise((resolve, reject) => {
obj.create({
name: 'Dylan',
username: 'dylan',
photo: 'avatarurl.com',
email: 'dylan@myemail.com'
},
@dylanjha
dylanjha / express-test.js
Created Jun 1, 2017
Testing out express process exit behavior
View express-test.js
'use strict'
const express = require('express')
const app = express()
const http = require('http')
const server = http.createServer(app).listen(9000, () => {
console.log('debug', 'express started process:', process.pid)
app.get('/test-1', (req, res, next) => {
@dylanjha
dylanjha / history.sh
Last active Apr 28, 2017
See what commands you run in your terminal most often. Run this to see which commands you should create new aliases for. Stolen from here: https://superuser.com/questions/250227/how-do-i-see-what-my-most-used-linux-command-are
View history.sh
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
View uri-encoding.md

Inconsistent uri encoding with parenthesis. Notice in the first 3 examples the parenthesis are still there, in the fourth example the parenthesis are replaced with %28 and %29:

This is the string being encoded in each example: www.google.com?q=some string with (parens)

===

Javascript (node 6.9.0):

encodeURI("www.google.com?q=some string with (parens)")
@dylanjha
dylanjha / hosts
Created Oct 21, 2016
add this to /etc/hosts file
View hosts
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.44.133 assets-cdn.github.com
You can’t perform that action at this time.