Skip to content

Instantly share code, notes, and snippets.

@doingweb
doingweb / Gruntfile.js
Created August 13, 2014 17:37
Templating data with Assemble
module.exports = function(grunt) {
grunt.initConfig({
assemble: {
options: {
data: 'data.yml'
},
page: {
src: 'index.hbs',
dest: 'index.html'
@doingweb
doingweb / json.js
Created August 13, 2014 17:51
Assemble (Handlebars) helper for printing JSON
module.exports.register = function (Handlebars, options, params) {
Handlebars.registerHelper('json', function(context) {
return JSON.stringify(context, null, 2);
});
};
@doingweb
doingweb / resharper-template-ut.cs
Created December 19, 2014 23:30
ReSharper LiveTemplate for an NUnit Test
[Test, Description("$description$")]
public void $test_name$ ()
{
$END$Assert.Inconclusive("This test hasn't been written yet.");
}
@doingweb
doingweb / post-receive
Created November 21, 2016 02:38
Git post-receive hook for remote configuration of OpenHAB
#!/bin/sh
etc_dir=/etc/openhab
config_dir=configurations
rm -rf $etc_dir/$config_dir
GIT_WORK_TREE=$etc_dir git checkout -f HEAD $config_dir
chgrp -R openhab $etc_dir/$config_dir
chmod -R g+w $etc_dir/$config_dir
@doingweb
doingweb / print-all-the-twitters.js
Created March 31, 2017 00:23
Print all your twitters!
const Twitter = require('twitter');
let client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
});
async function getTwitters (maxId) {
@doingweb
doingweb / README.md
Last active October 16, 2017 22:49
BackstopJS Example Config

BackstopJS Example Config

This is an example of the kind of config I've been using to experiment with BackstopJS, a pretty cool visual regression testing tool.

Note: I've only been using this config for individual development testing purposes. If you want to use this in some big CI process or something, you'll probably need to make it a bit more sophisticated. Or maybe it won't even work for you for any purpose at all because the sites I'm working on are different enough from the sites you're working on. Hopefully it can at least give you a good place to start or give you some ideas :)

Usage

  • Copy the files to an empty directory (or your project). You may also want to put the onBefore and onReady scripts into an appropriate subdirectory and update the engine_scripts path to point to them.
  • Set up your scenarios to point to the pages you want to compar
@doingweb
doingweb / .zshrc
Last active August 6, 2018 23:22
Git workflow shortcut functions for ZSH
extract-ticket-id-from-branch() {
echo $1 | grep -o -E '[A-Z]+-[0-9]+'
}
git-start-work() {
branch="$1"
ticket_id=$(extract-ticket-id-from-branch $branch)
if [[ "$#" == 0 || -z "$ticket_id" ]]; then
echo "Usage: git-start-work [branch with ticket ID]"
@doingweb
doingweb / iterm-random-background.py
Last active March 1, 2022 06:30
Have iTerm use a random background for each new window. See https://iterm2.com/python-api/ for details.
#!/usr/bin/env python3.7
# Be sure "Separate background images per pane" is unchecked.
import asyncio
import iterm2
import json
import os
import random
@doingweb
doingweb / .editorconfig
Last active February 6, 2023 00:45
A barebones TypeScript Node.js project
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true