Skip to content

Instantly share code, notes, and snippets.

@anttti
anttti / gist:a387fa2c87b34de5d9f8
Last active August 29, 2015 14:11
Basic Gulp config with livereload, sass, autoprefix, server
var gulp = require('gulp');
var sass = require('gulp-sass');
var webserver = require('gulp-webserver');
var livereload = require('gulp-livereload');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
gulp.task('clean', function (cb) {
del(['dist/**'], cb);
});
@anttti
anttti / gist:551f75d974c2521a09c2
Created January 28, 2015 12:26
Sublime Text 3 settings
{
"atomic_save": false,
"bold_folder_labels": true,
"color_scheme": "Packages/User/Bittersweet (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"file_exclude_patterns":
[
"*.map",
"*.pyc",
#!/bin/bash
# Encode a WAV to a finalized podcast MP3 with metadata, in the current directory
# Requires lame
# With Homebrew on Mac OS X: brew install lame
SHOW_AUTHOR="ATP"
EPISODE_NUMBER=104
EPISODE_TITLE="Minutiæ"
@anttti
anttti / gist:8ddeeefbb763300bc51b
Created June 14, 2015 09:52
Convert a directory of wav files to caf
#!/bin/bash
# This line required to prevent trying to convert a file named "*"
# if the directory passed in as the parameter is empty
shopt -s nullglob
for f in $*
do
echo "Converting $f"
cafFileName=$(echo $f | sed -e 's/wav/caf/g')
afconvert -d LEI16 -f 'caff' "$f" "$cafFileName"
@anttti
anttti / ensure_host_known.yml
Created September 17, 2015 07:41
Ansible: Ensure a host is known
- name: ensure github.com is a known host
lineinfile:
dest: /home/vagrant/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
@anttti
anttti / api.md
Last active November 4, 2015 19:08
RaceTime API draft

RaceTime API

All URLs prefixed with /v1

GET /track/

Retrieve all tracks.

{
@anttti
anttti / react-test.js
Created November 5, 2015 19:32
Testing React 0.14 components
import React from "react";
import ReactTestUtils from "react-addons-test-utils";
const { renderIntoDocument, scryRenderedDOMComponentsWithTag } = ReactTestUtils;
import { expect } from "chai";
const Test = React.createClass({
render() {
return (
<div>
<span>Foo</span>
$(function() {
$("#axios").on("click", function() {
axios.post("http://wordpress.dev/wp-json/wp/v2/movie", {
title: $("#title").val(),
status: "publish"
}, {
headers: {
"Authorization": "Basic YWRtaW46YWRtaW4="
}
}).then(function(res) {
@anttti
anttti / customkeys.json
Created October 4, 2016 05:49
My VS Code Custom Keybindings
[
{ "key": "cmd+shift+d", "command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus" },
{ "key": "cmd+alt+w", "command": "editor.action.toggleWordWrap",
"when": "editorTextFocus" },
{ "key": "cmd+shift-c", "command": "editor.action.commentLine",
"when": "editorTextFocus" },
{ "key": "shift+ctrl+down", "command": "cursorColumnSelectDown",
"when": "editorTextFocus" },
{ "key": "shift+ctrl+up", "command": "cursorColumnSelectUp",
@anttti
anttti / Dockerfile
Created October 26, 2016 14:52
WP-Docker
FROM wordpress
MAINTAINER Antti Mattila <me@rarelyneeded.com>
COPY ./wp-content /var/www/html/wp-content