Skip to content

Instantly share code, notes, and snippets.

View dylanjha's full-sized avatar

Dylan Jhaveri dylanjha

  • Mux
  • San Francisco
View GitHub Profile
@dylanjha
dylanjha / example-1.js
Last active November 2, 2017 23:11
example file for issue
const obj = {}
function doSomething () {
return new Promise((resolve, reject) => {
obj.create({
name: 'Dylan',
username: 'dylan',
photo: 'avatarurl.com',
email: 'dylan@myemail.com'
},

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 / crypto-pbkdf2-example.js
Created November 15, 2017 00:29 — 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
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
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 / airports.json
Created December 26, 2018 23:38 — forked from tdreyno/airports.json
JSON data for airports and their locations
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",
"woeid": "12512819",

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 / gatsby-config.js
Last active January 12, 2021 06:04 — forked from ajmalafif/gatsby-config.js
single rss.xml from 2 sources (MDX & Sanity.io)
// Load variables from `.env` as soon as possible
require('dotenv').config({
path: `.env.${process.env.NODE_ENV || 'development'}`
})
const clientConfig = require('./client-config')
const isProd = process.env.NODE_ENV === 'production'
// Portable Text Serialization
const PortableText = require("@sanity/block-content-to-html")
@dylanjha
dylanjha / airplay-button.jsx
Last active December 17, 2021 17:17
React airplay control for media-chrome
const ButtonPressedKeys = ['Enter', ' '];
const AirPlayButton = ({ onClick }) => {
const onKeyPress = (evt) => {
const { key } = evt;
if (!ButtonPressedKeys.includes(key)) return;
onClick(evt);
};
return (
<div