Skip to content

Instantly share code, notes, and snippets.

@codeincontext
codeincontext / page-element-watcher.rb
Created August 13, 2015 12:54
Check the contents of an element on a remote page and send an SMS if it has changed
# page-element-watcher
#
# Checks the contents of an element on a remote page and sends an SMS if it has changed
require 'nokogiri'
require 'open-uri'
require 'redis'
require 'twilio-ruby'
@codeincontext
codeincontext / fix-pg.sh
Created August 16, 2015 16:00
temporary hack to deal with an ever-changing pg port (should link instead)
postgresql_id=$(docker ps | grep jeffutter/postgresql:latest | awk '{print $1}')
postgresql_private_ip=$(docker inspect ${postgresql_id} | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
echo "pg ip: $postgresql_private_ip"
dokku config:set fun.with.co.de PG_HOST=$postgresql_private_ip
dokku config:set scotch.watch PG_HOST=$postgresql_private_ip
@codeincontext
codeincontext / gist:1979a8f13d1ef47a8b76
Created September 14, 2015 09:15
Page element watcher with scheduler and logging
# page-element-watcher
#
# Checks the contents of an element on a remote page and sends an SMS if it has changed
require 'nokogiri'
require 'open-uri'
require 'redis'
require 'twilio-ruby'
require 'rufus-scheduler'

Keybase proof

I hereby claim:

  • I am skattyadz on github.
  • I am adz (https://keybase.io/adz) on keybase.
  • I have a public key whose fingerprint is 5AE7 65BA 4634 6D42 A08A 77E8 E1D9 AC48 59B2 2D32

To claim this, I am signing this object:

@codeincontext
codeincontext / persistent_keychain_mock.js
Created November 26, 2015 16:17
An ngCordova mock for the keychain that persists values with localstorage
/**
* Overriding the keychain ngCordovaMock to use localStorage
**/
angular.module('ngCordovaMocks')
.factory('$cordovaKeychain', ['$q', function ($q) {
console.log('persistent keychain mock loaded')
return {
getForKey: function (key, serviceName) {
// note: this implementation doesn't fail on an invalid servicename

Kindle Son Status Board

An e-ink status board so my mum knows what's up

Stack

Node:

function renderSVG() {
services.fetchAll()
.done(function(results) {
const data = {};
results.forEach(r => data[r.name] = r);
const lastSeenDates = results.map(r => r.lastSeenDate);
data.lastSeenDate = Math.max.apply(Math, lastSeenDates);
// console.log(data)
@codeincontext
codeincontext / random_emoji.sh
Created August 29, 2016 22:09
Print a random star/success emoji (for my prompt)
#!/bin/bash
emojis=( ✨ ⚡️ 💫 🔑 )
num_emojis=${#emojis[*]}
echo "${emojis[$((RANDOM%num_emojis))]}"
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@codeincontext
codeincontext / machine.js
Last active June 19, 2020 11:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions