Skip to content

Instantly share code, notes, and snippets.

@whmountains
whmountains / appcache-precache.js
Last active November 1, 2017 14:19
Create AppCache based on parameters from sw-precache
const SW_PRECACHE_CONFIG = './sw-precache-config'
const OUT_FILE = 'build/precache.appcache'
const glob = require('globby')
const { staticFileGlobs, stripPrefix } = require(SW_PRECACHE_CONFIG)
const fs = require('fs')
const path = require('path')
glob(staticFileGlobs).then(files => {
// filter out directories
@whmountains
whmountains / Image.js
Last active September 5, 2017 15:18
React Responsive Image Component for Gatsby
import React from 'react'
import styled from 'styled-components'
import autoBind from 'auto-bind'
const Container = styled.div`
position: relative;
overflow: hidden;
background-color: #f6f6f6;
${p => `width: ` + p.width + ';'}
${p => `height: ` + p.height + ';'}
@whmountains
whmountains / 01_Readme.md
Last active August 28, 2017 15:34
Rust macro for defining DynamoDB items

This is a Rust macro for defining DynamoDB items for use with rusoto_dynamodb. It also requires that the hashmap! macro from the maplit crate be in scope.

@whmountains
whmountains / main.rs
Created August 2, 2017 14:11
CLI Calculator
use std::io;
use std::io::Write;
// function to write the prompt
fn prompt(message: &str, result: &mut String) {
// print the message and flush the buffer
print!("{}", message);
io::stdout().flush()
.expect("Error flushing output");
.reset-container:not(#nothing):not(#nothing):not(#nothing) * {
animation : none;
animation-delay : 0;
animation-direction : normal;
animation-duration : 0;
animation-fill-mode : none;
animation-iteration-count : 1;
animation-name : none;
animation-play-state : running;
animation-timing-function : ease;
@whmountains
whmountains / build.log
Created August 25, 2015 15:37
crosstool-ng build logs
[INFO ] Performing some trivial sanity checks
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] Testing '! ( -n )'
[DEBUG] ==> Executing: 'mkdir' '-p' '/Volumes/crosstool-ng/ctng/.build'
[DEBUG] ==> Executing: 'rm' '-f' '/Volumes/crosstool-ng/ctng/.build/backtrace'
[DEBUG] ==> Executing: 'touch' '/Volumes/crosstool-ng/ctng/.build/foo'
year count
1900 3
1901 2
1902 4
1903 1
1904 1
1905 4
1906 4
1907 3
1908 2
@whmountains
whmountains / Redirector.rjson
Last active August 29, 2015 14:10
prevent various sites from getting past the homepage
{
"createdBy": "Redirector v2.7.1",
"createdAt": "2014-12-01T20:42:47.346Z",
"redirects": [
{
"exampleUrl": "http://www.lego.com/es-ar/city/products/arctic/60062-arctic-icebreaker",
"description": "",
"includePattern": "*lego.com*",
"excludePattern": "http://www.lego.com/es-ar/city",
"redirectUrl": "http://www.lego.com/es-ar/city",
@whmountains
whmountains / test.js
Created November 13, 2014 11:51
problems with node-groove
groove = require('groove');
console.log("opening file (1)");
groove.open('t1.mp3', function(err, file) {
console.log("opened file (1)");
if (err) console.log(err);
var playlist = groove.createPlaylist();
playlist.insert(file);
@whmountains
whmountains / groove.js
Created November 10, 2014 21:06
bug with node-groove
var _ = require('lodash');
var groove = require('groove');
var l = require('../../l/l.js');
var util = require('util');
var events = require('events');
var async = require('async');
var EventEmitter = require('events').EventEmitter;
var Debug = require('debug');