Skip to content

Instantly share code, notes, and snippets.

View LeoMcA's full-sized avatar

Leo McArdle LeoMcA

View GitHub Profile
<!doctype>
<html>
<head>
<meta charset="utf8">
<title>Lotto!</title>
<style>
input {
width: 50px;
}
@LeoMcA
LeoMcA / app.js
Last active August 29, 2015 13:56
Code behind @severnbot on Twitter
var request = require('request');
var cheerio = require('cheerio');
var twit = require('twit');
var t = new twit({
consumer_key: ''
, consumer_secret: ''
, access_token: ''
, access_token_secret: ''
});

Keybase proof

I hereby claim:

  • I am leomca on github.
  • I am leomca (https://keybase.io/leomca) on keybase.
  • I have a public key whose fingerprint is 1B72 E53E D247 15CB 841C 0F36 8262 8336 20A6 4C3F

To claim this, I am signing this object:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIIQJUqmRuG802d3Y9Q8Vgyo++1cYy3dg1SmVY/j3KGEoYuCO16ZHesdkV0F051N2uO3H1LkgUr4yswk6vMEnLrujpqB5qYLHJZQeY6hNY0yo2XV/iA9i1BZ9VFUiUZFhyBAnfiPTjwLed6roELuZpTm9MwlRAW5FRhm3Stdzh9JMlZUwMjZ+XPV6VswLOHoouB41AM7c9NX5S88cVAuuQ6vZWy6pXUg3ifWOkBL7zLyoYOFsqg+b/1YrKNf3yUp7bOYaV7RLBPAzccyEH+txzsfWYZ8Slb/I8J1gsR8Rx29qVHtzIL5dKMXc0E/LKEzFZPEZrK4Bqun3MjrtdWOr9 Leo McArdle's Key
@LeoMcA
LeoMcA / testcase.js
Created April 29, 2015 19:12
Test Case to show node-webrtc failing to send large arraybuffers
var webrtc = require('wrtc');
var RTCPeerConnection = webrtc.RTCPeerConnection;
var RTCSessionDescription = webrtc.RTCSessionDescription;
var RTCIceCandidate = webrtc.RTCIceCandidate;
var pc1 = new RTCPeerConnection();
var pc2 = new RTCPeerConnection();
pc1.onicecandidate = function(candidate) {
This file has been truncated, but you can view the full file.
{
"ECIDsToParties": {
"INDPT": "Independent",
"PP85": "UK Independence Party (UKIP)",
"PP90": "Liberal Democrats",
"PP52": "Conservative Party",
"PP804": "Trade Unionist and Socialist Coalition",
"PP77": "Plaid Cymru - The Party of Wales",
"PP73": "Socialist Labour Party",
"PP53": "Labour Party",
@LeoMcA
LeoMcA / phpbb3.rb
Created May 22, 2015 20:24
AMO forum Discourse import script
require "mysql2"
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
class ImportScripts::PhpBB3 < ImportScripts::Base
ARCHIVE_ID = 0
INTRODUCTION_ID = 22
PHPBB_DB = "phpbb"
BATCH_SIZE = 1000
@LeoMcA
LeoMcA / gist:bc31922229cf39a7f9a6
Last active August 29, 2015 14:22
Hash/checksum generation in client side JS
function createHexHash (algo, arrayBuffer, callback) {
if (Object.prototype.toString.call(arrayBuffer) == '[object String]') {
var encoder = new TextEncoder('utf-8')
arrayBuffer = encoder.encode(arrayBuffer)
}
crypto.subtle.digest(algo, arrayBuffer).then(function (hash) {
var hex = ""
var array = new Uint8Array(hash)
for (var i = 0; i < array.byteLength; i++) {
var byte = array[i]
https://github.com/LeoMcA/namati-user-card-profile-theme
.category-mozillians-nda {
.d-header {
background: #5a166f;
.title:after {
content: 'NDA';
color: #fff;
font-weight: bold;
font-size: 28px;
position: relative;