Skip to content

Instantly share code, notes, and snippets.


Ciaran Jessup ciaranj

View GitHub Profile
ciaranj / calculate-contains-window.js
Created Jan 24, 2019
Gist to calculate the properties of an image that has been scaled/positioned through the CSS object-fit and object-position properties
View calculate-contains-window.js
function calculateContainsWindow(image) {
var imageComputedStyle = window.getComputedStyle(image);
var imageObjectFit = imageComputedStyle.getPropertyValue("object-fit");
var coordinates = {};
var imagePositions = imageComputedStyle.getPropertyValue("object-position").split(" ");
var naturalWidth = image.naturalWidth;
var naturalHeight= image.naturalHeight;
if( image.tagName === "VIDEO" ) {
naturalWidth= image.videoWidth;
View gist:956438a0a0e663c5b1f5ae525d32eaf9
Verifying my Blockstack ID is secured with the address 1FKAVZYEV9TbLRm77y4t4Kv5KjAirKeK46

Keybase proof

I hereby claim:

  • I am ciaranj on github.
  • I am ciaranj ( on keybase.
  • I have a public key whose fingerprint is 78D2 F339 7EEA 212A 6A2E E69B EC67 0DBF AAB2 1C44

To claim this, I am signing this object:

ciaranj / SampleCeresStatsdConfig
Created Feb 23, 2014
Sample ceres statsd config for woody.
View SampleCeresStatsdConfig
Required Variables:
port: StatsD listening port [default: 8125]
Graphite Required Variables:
(Leave these unset to avoid sending stats to Graphite.
Set debug flag and leave these unset to run in 'dry' debug mode -
ciaranj / gist:9056285
Created Feb 17, 2014
A *working* (on Windows) UDP Multicast client & server with Node.Js v0.10.25 (I spent a *LOT* of time getting EINVAL and I still don't quite know why :/)
View gist:9056285
For my own sanity ;) Scraped from a variety of places, including:
var news = [
"Borussia Dortmund wins German championship",
"Tornado warning for the Bay Area",
"More rain for the weekend",
"Android tablets take over the world",
"iPad2 sold out",
ciaranj / .bashrc
Created Feb 14, 2013
A .bashrc suitable for use with msysgit to utilise ssh-agent to avoid repeated passphrase addition, taken verbatim from:
View .bashrc
#! /bin/bash
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
ciaranj / gist:2991314
Created Jun 25, 2012
View gist:2991314
cd "$(dirname "$0")" && . ../common/
ciaranj / gist:1308792
Created Oct 24, 2011 — forked from juamei/gist:1308791
View gist:1308792
Suspicious log entries:
2011-10-24 10:42:39.203 -> Entered ChatPollerHandler with queryString : ajax_timeout=-1&pollSeqId=10&poll=true&sessionId=86ee4d9b-a696-4d92-b1ce-d73dcb27616c&chatWindowId=35ac44a9-fb2f-434b-bae8-4fda524cb491&handle=null&participantId=ca1e9956-b419-411f-b306-10d2d20e3ff6&seq=1, EVT_RSC: 26961876
2011-10-24 10:42:39.203 -> Entered ChatPollerHandler with queryString : ajax_timeout=-1&pollSeqId=10&poll=true&sessionId=e87ede08-b7c2-4b47-8332-7050f1e3944a&chatWindowId=d3e35f7b-11ca-463a-836b-aa7e918aac59&handle=null&participantId=7b8bd5ba-bc8a-4a3a-b310-8cd97f94d933&seq=1, EVT_RSC: 26961876
Relevant code:
public void onRequest(AtmosphereResource<HttpServletRequest, HttpServletResponse> resource) throws IOException {
ciaranj / gist:1234827
Created Sep 22, 2011
Seemingly working HTTP(s) userstream connection.
View gist:1234827
var sys= require('sys');
var OAuth= require('oauth').OAuth;
oa= new OAuth("",
yourConsumerKey, yourConsumerSecret,
"1.0A", "http://localhost:3000/oauth/callback", "HMAC-SHA1");
var request= oa.get("", yourAccessToken, yourTokenSecret );
request.addListener('response', function (response) {
ciaranj / gist:1193637
Created Sep 4, 2011
Example connect-auth using scopes to allow con-current strategy authentications.
View gist:1193637
var express= require('express')
, auth= require('./.node_modules/connect-auth')
, url= require('url');
var app = express.createServer()
, yourTwitterConsumerKey= "xxx"
, yourTwitterConsumerSecret= "yyyy"
, fbId= "asdsd"
, fbSecret= "asdsdsds"
, fbCallbackAddress= "";