Skip to content

Instantly share code, notes, and snippets.

@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
};
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 / 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) {
@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
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 / 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
#!/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 / icon.component.ts
Last active October 24, 2024 04:50
An awesome icon component I created for Angular
import { Component, Input, ElementRef, Renderer2, PLATFORM_ID } from '@angular/core';
import { isPlatformServer } from '@angular/common';
import { RequestResponseAdapter } from '@gethuman/adapters';
import { config } from '@gethuman/config';
import { GhWebState } from '@gethuman/state';
@Component({
selector: 'icon',
standalone: true,
template: ``, // no content for <icon></icon> since we are setting a mask-image