Skip to content

Instantly share code, notes, and snippets.

View duhaime's full-sized avatar

Douglas Duhaime duhaime

View GitHub Profile
const restaurantOwnerOnlyMiddleware = (req, res, next) => {
const {restaurantId} = req.params; // in this case, the id is part of the path
const user = req.user; // available if you're using Google Firebase Authentication Middleware
const hasPermission = (id, user) => true; // do your checks here instead
if (!hasPermission(restaurantId, user)) {
res.status(403).send("Unauthorized");
return;
}
map(['🐮','🍠', '🐔', '🌽'], cook);
=> ['🍔', '🍟', '🍗', '🍿'];
filter(['🍔', '🍟', '🍗', '🍿'], isVegetarian);
=> ['🍟', '🍿'];
reduce(['🍔', '🍟', '🍗', '🍿'], eat);
=> ['💩'];
@tcya
tcya / index.html
Last active February 10, 2023 01:00
海德沙龙刷机包
<!DOCTYPE html>
<html>
<head>
<title>海德沙龙刷机包</title>
<style>
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 3px;
}

👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋

@kylemcdonald
kylemcdonald / biggan-search.ipynb
Last active December 16, 2018 03:34
BigGAN Search
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnhw
johnhw / umap_sparse.py
Last active January 6, 2024 16:09
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@conquistadorjd
conquistadorjd / convert_daily_to_monthly.py
Last active August 1, 2022 14:24
Pandas Equity Market
################################################################################################
# name: convert_daily_to_monthly.py
# desc: takes inout as daily prices and convert into monthly data
# date: 2018-06-15
# Author: conquistadorjd
################################################################################################
import pandas as pd
import numpy as np
print('*** Program Started ***')
@gladiatorAsh
gladiatorAsh / pwd.js
Created May 17, 2018 04:53
List of most used passwords (Why this approach??)
{passwords:"123456,password,12345678,qwerty,123456789,12345,1234,111111,1234567,dragon,123123,baseball,abc123,football,monkey,letmein,shadow,master,696969,mustang,666666,qwertyuiop,123321,1234567890,pussy,superman,654321,1qaz2wsx,7777777,fuckyou,qazwsx,jordan,123qwe,000000,killer,trustno1,hunter,harley,zxcvbnm,asdfgh,buster,batman,soccer,tigger,charlie,sunshine,iloveyou,fuckme,ranger,hockey,computer,starwars,asshole,pepper,klaster,112233,zxcvbn,freedom,princess,maggie,pass,ginger,11111111,131313,fuck,love,cheese,159753,summer,chelsea,dallas,biteme,matrix,yankees,6969,corvette,austin,access,thunder,merlin,secret,diamond,hello,hammer,fucker,1234qwer,silver,gfhjkm,internet,samantha,golfer,scooter,test,orange,cookie,q1w2e3r4t5,maverick,sparky,phoenix,mickey,bigdog,snoopy,guitar,whatever,chicken,camaro,mercedes,peanut,ferrari,falcon,cowboy,welcome,sexy,samsung,steelers,smokey,dakota,arsenal,boomer,eagles,tigers,marina,nascar,booboo,gateway,yellow,porsche,monster,spider,diablo,hannah,bulldog,junior,london,purple,co
@naught101
naught101 / separate_points.py
Created February 16, 2018 04:47
Separating points on a map
def lat_lon_hex_mesh(bounds, d=3):
"""Creates a hexagonal lat/lon mesh within bounds that has a radial separation of d"""
lone, lonw, lats, latn = bounds
# heigt of equilatral triangle from radial distance sqrt(r^2 - (r/2)^2)
h = np.sqrt(0.75) * d
w = d / 2
lat_vals = np.arange(lats, latn, h)
W = 500
H = 585
W1 = W - 1
H1 = H - 1
def setup
@img = load_image '../scratch/girl.png'
@img.filter BLUR, 3
@img.load_pixels
end