Skip to content

Instantly share code, notes, and snippets.

View jareware's full-sized avatar

Jarno Rantanen jareware

View GitHub Profile
@jareware
jareware / PromiseQueue.js
Created December 2, 2014 09:05
A simple PromiseQueue w/ ES6
function PromiseQueue() {
var tail = Promise.resolve();
return {
enqueueOperation(op) {
return tail = tail.then(op, op);
}
};
}
@jareware
jareware / android-wear-browser.md
Last active August 29, 2015 14:08
Results of the first round of fiddling around with the Android Wear Browser

Android Wear Browser notes

  • Needs a 3rd party app (there's no platform browser, that is)
  • Renders fully on the watch
    • Even if connection to phone is lost (e.g. the watch is on its own), browser app still works
      • Though annoyingly the browser app disallows launching the browser again if closed
    • Uses the phone for network communications (over BTLE)
    • HTML5 AppCache works
      • Confirmed with all network access (except Bluetooth) shut off from the phone
  • Seems to be cached on the watch, as AppCache'd resources are available even without connection to phone
@jareware
jareware / Dockerfile
Created September 28, 2014 21:32
Portable Docker work-environment for https://github.com/opqdonut/haskell-exercises
FROM ubuntu:latest
# Install Haskell Platform
RUN apt-get update && \
apt-get install -y make haskell-platform
# Install Haskell dependencies
RUN cabal update && cabal install quickcheck
# Place us in the host-mounted working directory
@jareware
jareware / README.md
Last active April 15, 2024 02:23
Server-Sent Events Demo

Server-Sent Events Demo

Server-Sent events is a specification for implementing server-side-push for web frontend applications, through plain-old HTTP.

It is best contrasted with WebSockets, which offer a full-duplex messaging channel over a custom protocol, operating within a single TCP connection (with an HTTP-compatible handshake).

Trying out the demo

  1. Clone this gist
  2. node server.js
@jareware
jareware / Vagrantfile
Created September 20, 2014 10:53
If you do IE-testing in your project, drop this Vagrantfile in there somewhere, to automate downloading & setting up your test box.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# This is kinda ghetto, but the simplest way to print a message to the user
puts "\nNOTE: After the box boots, your app will be available at e.g. http://192.168.50.1:8080"
@jareware
jareware / parseWGS84String.js
Last active August 29, 2015 14:05
Converts the given string representation of WGS84 coordinates into a standard lat/lng object.
/**
* Converts the given string representation of WGS84 coordinates into a standard lat/lng object.
*
* @example 60 deg 08.2151' N, 24 deg 25.6136' E
* @example 43°38'19.39"N,116°14'28.86"W
* @example +43.6387194°, -116.2413500°
*
* For convenience (and to avoid "Cannot read property 'lat' of undefined" errors), always returns an
* object with the aforementioned keys. For invalid input, the VALUES of the keys will be undefined.
*
@jareware
jareware / el.js
Last active August 29, 2015 14:04
Utility function for generating HTML/XML DOM trees in the browser.
/**
* Utility function for generating HTML/XML DOM trees in the browser.
*
* Returns a node with the given name. The rest are var-args, so that:
*
* - an object sets attributes as key/value-pairs
* - a string/number/boolean sets the text content of the node
* - a node is treated as a child node
* - an array is treated as a list of child nodes
*
@jareware
jareware / intellij-grunt-nvm.md
Created July 30, 2014 08:16
Getting the Grunt plugin to work on an IntelliJ IDE with nvm

IntelliJ Grunt plugin with nvm

This is a relatively hacky solution, but simplest one that works, so writing it down for my own reference. If the Grunt plugin was aware of nvm (or configurable to use a custom environment before launching the "grunt" command) this would be a LOT easier, but if such config options exist I'm unaware of them. Also note that this will NOT switch your node version dynamically between projects as nvm would.

To link your current node as the global one:

$ sudo ln -s $(which node) /usr/bin/node
$ sudo ln -s $(which npm) /usr/bin/npm
@jareware
jareware / README.md
Last active March 21, 2024 15:14
Conversion script between the TTML & SRT subtitle formats

premiere-subtitle-convert

Conversion script between the TTML & SRT subtitle formats. This is particularly useful with Adobe Premiere, as it doesn't understand the SRT format (which is joyously simple and interoperable). TTML-XML is probably the most straightforward subtitle format it does understand, hence this tool.

Note that due to the simplicity of the SRT format, this conversion is extremely lossy for all the bells and whistles supported by TTML. Not like you'd want fixed-pixel font sizes etc in your subtitles anyway, but you've been warned.

@jareware
jareware / README.md
Last active August 29, 2015 14:02
A small bash-script for geotagging videos. Generates an SRT subtitle file with a running timestamp and GPS coordinates, indicating when and where the footage was shot. As the metadata's in a separate track (not burned onto the footage for example), you can hide it when it's not needed.

geodata-subtitle

A small bash-script for geotagging videos. Generates an SRT subtitle file with a running timestamp and GPS coordinates, indicating when and where the footage was shot. As the metadata's in a separate track (not burned onto the footage for example), you can hide it when it's not needed.

Dependencies

exiftool >= 9.52 is needed for reading video file metadata, and performing GPS interpolation.