Skip to content

Instantly share code, notes, and snippets.

View andymason's full-sized avatar
🙂

Andrew Mason andymason

🙂
View GitHub Profile
@andymason
andymason / local.conf
Created November 13, 2017 15:26 — forked from luizmello/local.conf
local.conf for better font rendering on linux
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match>
<edit mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>
<match target="pattern">
<test qual="any" name="family"><string>serif</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
</match>
@andymason
andymason / GiantBomb HLS Video player.js
Last active March 9, 2017 12:21
Lower CPU usage than Flash player with the benefits of bitrate stream switching.
// How to use:
// 1. Save the bookmarklet
// 2. Go to a Giantbomb video page and click the Bookmarklet
// Bonus. Works on CBSi player so Gamespot video's work too
// ## Bookmarklet
javascript:(function(){var%20videoStream;var%20videoEl;var%20el;var%20vidWrapper=document.querySelector('.av-video-player');if(!vidWrapper||!vidWrapper.dataset.video){console.log('No%20video%20player%20element%20or%20dataset');}var%20videoData=JSON.parse(vidWrapper.dataset.video);videoStream=videoData.videoStreams.adaptive_stream;console.log(videoStream);videoEl=document.createElement('video');videoEl.controls=true;videoEl.style='width:100%;height:100%;position:relative;z-index:999;';vidWrapper.parentNode.replaceChild(videoEl,vidWrapper);el=document.createElement('script');el.addEventListener('load',function(){if(Hls.isSupported()){var%20hls=new%20Hls();hls.loadSource(videoStream);hls.attachMedia(videoEl);hls.on(Hls.Events.MANIFEST_PARSED,function(){videoEl.play();});}},false);el.src='https://cdn.rawgit.com/dailymotion/hls.js/mast
@andymason
andymason / tumblr_image_download.js
Created March 10, 2016 15:54
Grab large image SRC URLs using dev tools.
var imgs = Array.prototype.map.call(document.images, function(img){ return img.src; }).filter(function(src) { return src && /tumblr_/.test(src); });
var bigImgs = imgs.map(function( img ) { return img.replace(/_\d{3,4}/, '_1280',i); });
copy(bigImgs.join('\n'));
@andymason
andymason / https_localhost_composer_preview.md
Last active March 1, 2016 12:10
How to preview localhost content in Composer

Using localhost in composer was an extremely useful way to develop locally while seeing what interactives look like within guardian pages. Unfortunately composer only accepts HTTPS links now, which is a good thing but makes local dev'ing a bit more difficult.

Now to test from localhost you'll need to serve content over a secure connection which means self-signed certs. Here's a quick and dirty way to do that

1# Create a folder to store the keys

  mkdir ~/ssl

2# Generate SSL keys. Enter a password for now, we'll get rid of it next then just skip over all the other questions

This file has been truncated, but you can view the full file.
/**
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
/*!
* jQuery JavaScript Library v1.11.2
* http://jquery.com/
*
This file has been truncated, but you can view the full file.
(function e(b, g, d) {
function c(n, k) {
if (!g[n]) {
if (!b[n]) {
var j = typeof require == "function" && require;
if (!k && j) {
return j(n, !0)
}
if (a) {
return a(n, !0)
// This is a port of the NTSC encode/decode shader pair in MAME and MESS, modified to use only
// one pass rather than an encode pass and a decode pass. It accurately emulates the sort of
// signal decimation one would see when viewing a composite signal, though it could benefit from a
// pre-pass to re-size the input content to more accurately reflect the actual size that would
// be incoming from a composite signal source.
//
// To encode the composite signal, I convert the RGB value to YIQ, then subsequently evaluate
// the standard NTSC composite equation. Four composite samples per RGB pixel are generated from
// the incoming linearly-interpolated texels.
//
@andymason
andymason / running.js
Created June 13, 2015 12:16
Steam sale game 2015 - mini-game towerattack /towerattack/running.js
// <script>
"use strict";
window.k_ETowerAttackAbility_Invalid = 0;
window.k_ETowerAttackAbility_Attack = 1;
window.k_ETowerAttackAbility_ChangeLane = 2;
window.k_ETowerAttackAbility_Respawn = 3;
window.k_ETowerAttackAbility_ChangeTarget = 4;
window.k_ETowerAttackElement_Invalid = 0;
@andymason
andymason / towerattack.js
Created June 13, 2015 12:10
Steam sale game 2015 - mini-game towerattack
// http://steamcommunity-a.akamaihd.net/public/javascript/minigame/towerattack.js
// <script>
"use strict"
window.k_ScreenWidth = 1280;
window.k_ScreenHeight = 720;
var g_JSCacheKey = 'as8wg42t0w';
var g_rgTextureCache = {
@andymason
andymason / steam-game.html
Created June 13, 2015 12:06
Steam sale game 2015
<!DOCTYPE html>
<html class="wf-pressstart2p-n4-active wf-active">
<head>
<meta charset="UTF-8">
<title>Steam Community :: Monster Summer Sale</title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link href="http://steamcommunity-a.akamaihd.net/public/shared/css/motiva_sans.css?v=F3z3QpekjE2f" rel="stylesheet" type="text/css">
<link href="http://steamcommunity-a.akamaihd.net/public/shared/css/buttons.css?v=4iAytERcUqWU" rel="stylesheet" type="text/css">
<link href="http://steamcommunity-a.akamaihd.net/public/shared/css/shared_global.css?v=XXN4vhirCNMy" rel="stylesheet" type="text/css">