Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# this is from https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
if [ "$#" -ne 1 ]; then
echo "Usage: Must supply a domain"
exit 1
fi
# Change these as appropriate for your organization
@jeffwhelpley
jeffwhelpley / backup.ts
Created January 22, 2020 15:45
Generate Firestore backup
export async function exportData(projectId: string, clientEmail: string, privateKey: string) {
const timestamp = moment().format('YYYY-MM-DD_x');
const name = `projects/${projectId}/databases/(default)`;
const outputUriPrefix = `gs://${projectId}.appspot.com/backups/${timestamp}`;
const fsAdmin = new v1.FirestoreAdminClient({
projectId,
credentials: {
client_email: clientEmail,
private_key: privateKey
class Cli
def run
# get the hash of fish data by scrapping the website (see further below)
fish_hash = self.get_fish_hash
# CLI stays in loop until user types quit
is_cli_active = true
while is_cli_active
@jeffwhelpley
jeffwhelpley / webpack_typescript_npmlink.md
Last active May 26, 2017 11:51
"Cannot find source file": Webpack issue compiling TypeScript project when npm linking to other TypeScript projects
@jeffwhelpley
jeffwhelpley / decorators.js
Last active February 14, 2017 02:40
Examples of different types of decorators
export function ClassDecorator(meta?: any): Function {
return function (target: any) {
let targetProto = target.prototype;
let targetMeta = targetProto.__meta = targetProto.__meta || {};
targetMeta.cls = meta;
};
}
export function MethodDecorator(meta?: any): Function {
return function (targetProto: any, methodName: string) {
server {
listen 80;
server_name dev.gethuman.com *.dev.gethuman.com;
location / {
proxy_pass http://localhost:8181;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@jeffwhelpley
jeffwhelpley / gist:2d14a615790af18b3549
Last active July 13, 2018 11:48
Using window object in Angular 2
// interface for Window
interface Window {
// add some stuff here
}
let someMockWindowObject = {
// add some mock functionality here
};
@jeffwhelpley
jeffwhelpley / sample.js
Last active September 24, 2015 14:43
Sample Angular Page
module.exports = {
model: function (postService, tokens, postUtil) {
return postService.find({ where: { urlId: tokens.urlId }, findOne: true })
.then(function (post) {
return {
pageHead: postUtil.getPageHeaderInfo(post),
post: post,
noindex: post.status === 'rejected' || !!post.duplicateOf
};
});
@jeffwhelpley
jeffwhelpley / gist:056e012544c631438ad2
Created July 12, 2015 02:06
playing nice: continuation-local-storage, hapi.js and pm2

I had a lot of issues trying to get continuation-local-storage (cls) working on a hapi.js app with pm2 in cluster_mode. Long story short, my mistake was wrapping cls around my server.start() when I should have been running it in a request handler. Here is the code you should use to get all this working:

var cls = require('continuation-local-storage');
var ns = cls.createNamespace('mySession');

var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({ port: 80 });

I am returning to SoCal for the first time in 3 years after living there for 8 years. Here are my top 10 things to eat around the LA/Orange County area. I am hoping to hit all 10 of these:

  1. The Godmother at Bay Cities Deli, Santa Monica
  2. Fresh sangak at Wholesome Choice, Irvine
  3. Fried potatoes and falafel plate at Open Sesame, Long Beach
  4. Mole burrito and carnitas tostada from Hole Mole, Long Beach
  5. Bánh Mì at Che Cal, Garden Grove
  6. Egg tart and pastries at 85°C Bakery Cafe, Irinve
  7. [Burger and fries animal style at In 'n Out](http://