Skip to content

Instantly share code, notes, and snippets.

@dannyockilson
dannyockilson / ~.bashrc
Created March 4, 2019 10:00
Running static sites easily in docker
alias static-this='docker run --rm -v `pwd`:/usr/share/nginx/html -p 80:80 -d nginx:alpine'
function static_that() {
docker run --rm -v `pwd`/${1}:/usr/share/nginx/html -p 80:80 -d nginx:alpine
}
alias static-that='static_that'
@dannyockilson
dannyockilson / index.html
Created April 3, 2019 13:23
Spotify Connect based Pass the Parcel
<!DOCTYPE html>
<html>
<head>
<title>Spotify based Pass the Parcel</title>
</head>
<body>
<h1>Spotify based Pass the Parcel</h1>
<button id="resume">Start Passing that Parcel</button>
<script src="https://sdk.scdn.co/spotify-player.js"></script>
@dannyockilson
dannyockilson / index.ts
Created May 21, 2019 10:23
Angular Pre-render
import 'reflect-metadata';
// Load zone.js for the server.
import 'zone.js/dist/zone-node';
import { enableProdMode } from '@angular/core';
import { renderModuleFactory } from '@angular/platform-server';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
@dannyockilson
dannyockilson / index.js
Created July 11, 2019 07:52
Puppeteer for html to pdf
#!/bin/node
const puppeteer = require('puppeteer');
const join = require('path').join;
const url = process.argv[2] || 'http://localhost:4000/sponsorship-opportunities';
const filename = process.argv[3] || 'sponsor-pack.pdf';
(async () => {
try {
const browser = await puppeteer.launch();
@dannyockilson
dannyockilson / lint-staged.config.js
Last active August 23, 2019 12:07
get lint staged working with angular cli (v8)
const path = require('path')
module.exports = {
'*.ts': relativePaths => {
return [
`ng lint --fix --files ${relativePaths.join(' --files ')}`,
`git add ${relativePaths.join(' ')}`,
];
}
}