Skip to content

Instantly share code, notes, and snippets.

View jareware's full-sized avatar

Jarno Rantanen jareware

View GitHub Profile
@jareware
jareware / example.png
Last active August 29, 2015 13:56
Userscript for maintaining a trackbar below your last seen message in a Flowdock chat, similar to what trackbar.pl does for irssi. Runnable both as a userscript (e.g. http://tampermonkey.net/) and bookmarklet (e.g. http://en.wikipedia.org/wiki/Bookmarklet). To enjoy automatic updates with Tampermonkey, put in https://gist.github.com/jareware/885…
example.png
@jareware
jareware / .bashrc
Created March 11, 2014 12:08
Personal dotfiles dump.
#!/bin/bash
# Enable "**/*.js" style globs:
shopt -s globstar
# Set PATH so it includes user's private bin if it exists:
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
@jareware
jareware / index.html
Last active August 29, 2015 14:00
A test document for spreading DOM manipulation workload across browser processes.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height" />
<title>parallel-thrash</title>
<style type="text/css">
iframe {
width: 250px;
height: 500px;
@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.

@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 / 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 / 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 / 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

Freaklies goes ES6

Classes

Classes are purely syntactic sugar:

class Animal {
  constructor(name) {
 this.name = name;
@jareware
jareware / gist:1084619
Created July 15, 2011 12:51
Waiting for a specific DOM event in Jasmine
/**
* Pauses the tests execution until the named event is notified on the given
* element, or a timeout is reached.
*
* @param event
* @param onElement
* @param timeout
*/
var waitsForEvent = function(event, onElement, timeout) {