Skip to content

Instantly share code, notes, and snippets.

View andrewk's full-sized avatar

Andrew Krespanis andrewk

View GitHub Profile

Keybase proof

I hereby claim:

  • I am andrewk on github.
  • I am andrew (https://keybase.io/andrew) on keybase.
  • I have a public key whose fingerprint is E618 A31B 9576 26C4 428B 4274 AEA5 8AC2 20E7 E99C

To claim this, I am signing this object:

@andrewk
andrewk / gist:8909787
Created February 10, 2014 03:16
Notes on emergency.vic.gov.au/map performance for country users

Firstly thank you. FireReady and the emergency.vic site are an incredible resource, especially yesterday sitting here in the Macedon Ranges watching events unfold in Gisborne and considering when and where we might evacuate. So to everyone involved, thank you and congratulations on delivering a rock-solid resource.

A couple of notes on the site and why I pointed people to the text version...

Cold Cache Tests

While the server response has remained fast, that's only the start of the loading as the JS fires and brings in all the map tiles etc. Right now over my iinet ADSL1 connection 1.2km from the centre of Kyneton (Telstra infastructure), the page response has finished in 786ms, but the page takes 15.07 seconds to finish loading resources, the last of which are all the map tiles. Most of these map tiles are pre-loads by Google, with all the tiles in view finishing within 7 seconds. 90 requests in total. The memory heap for this page was 43.8mb (Chrome 32, OSX)

@andrewk
andrewk / skynet.js
Last active January 3, 2016 20:58
Current state of the API for the scheduling and compensation client of a distributed, open source home automation platform I'm developing. Requesting early feedback as this is the code users will most often interact with and one of the areas in greatest need of flexibility.
// scheduling supports all formats offered by later.js (http://bunkat.github.io/later/)
// Scheduled device event
schedule('blinds', 'open').at('10:00am').execute();
schedule('blinds', 'closed').at('5:00pm').execute();
// Scheduled compensation triggers
every('5 minutes')
.if(env.tooHot
.respond(turnOnFans)
@andrewk
andrewk / gist:7460371
Last active December 28, 2015 06:49
Rails doesn't expect {{, }}, or encoded versions to be an XSS vulnerability, so doesn't do anything about them in user input. If your page has AngularJS sections (ngApp) which have user input, you need to protect yourself from the attack vector added by AngularJS. This is a VERY basic, alpha implementation. It works as advertised, but has room f…
# =========== lib file ===================
class XssScrubber
def angular_xss_filter(unknown)
case unknown
when Hash
angular_xss_filter_hash(unknown)
when Array
angular_xss_filter_array(unknown)
when String
@andrewk
andrewk / gist:4129315
Created November 22, 2012 03:30
snapshot of the formatting section of Flippa's SASS styleguide

= Flippa CSS Styleguide =

== CRITICAL: Regenerating Stylesheets for deployment ==

If you edit any stylesheets in app/stylesheets, you must run the following command from the project's root:

$> bundle exec compass compile

== Basic Formatting ==