Skip to content

Instantly share code, notes, and snippets.

View jasonwilliams's full-sized avatar

Jason Williams jasonwilliams

View GitHub Profile
@jasonwilliams
jasonwilliams / gist:41364a7734eee0ff3b231c530725bc08
Created February 16, 2017 15:58
[Put in omnibar] Simple script which which updates a number in a <p> on each requestAnimationFrame call - http://codepen.io/jayflux/pen/xgeLjW
data:text/html,<!doctype html><p class="test">0</p><script>var test = document.querySelector('.test'); var count = 0; requestAnimationFrame(function increment() { console.log('test'); test.textContent = ++count; requestAnimationFrame(increment); }); increment();</script>
@jasonwilliams
jasonwilliams / findDomNodeById.js
Last active January 4, 2017 21:41
My attempt to find a DOM node using a recursive technique, you have to use a recursive pattern
function findDomNodeById(root, id, result) {
var result = result || [];
// set base case
if (root.id === id) {
result.push(root);
}
if (root.childNodes.length) {
for (let i = 0; i < root.childNodes.length; i++) {
findDomNodeById(root.childNodes[i], id, result);
@jasonwilliams
jasonwilliams / servers
Last active December 12, 2016 10:47
~/.subversion/servers
142 [global]
143 ssl-client-cert-file = /Users/willij87/workspace/certs/dev.bbc.co.uk.p12
144 ssl-client-cert-password = [PASS HERE]
MC-S104347:servo willij87$ ./mach build --dev
Compiling rustc-demangle v0.1.1
Compiling open v1.1.1
Compiling webrender v0.11.0 (https://github.com/servo/webrender#c4a0c01f)
Compiling string_cache_shared v0.3.0
Compiling fnv v1.0.5
Compiling gcc v0.3.35
Compiling bitflags v0.4.0
Compiling sig v0.1.1
Compiling webrender_traits v0.11.0 (https://github.com/servo/webrender#c4a0c01f)
"mod_php70u",
"php70u-cli",
"php70u-common",
"php70u-devel",
"php70u-fpm-httpd",
"php70u-fpm-nginx",
"php70u-fpm",
"php70u-gd",
"php70u-intl",
"php70u-json",
@jasonwilliams
jasonwilliams / quicksort.js
Created December 5, 2016 11:58
Easier, faster quicksort in javascript
// var arr = [1,3,5,2,80,3,71,12];
function sort(arr) {
// base case
if (arr.length <= 1) return arr;
var swapPos = Math.floor((arr.length - 1) / 2),
swapVal = arr[swapPos], less = [], more = [];
arr = arr.slice(0, swapPos).concat(arr.slice(swapPos + 1));
@jasonwilliams
jasonwilliams / test_output
Created November 19, 2016 17:01
syntax_test_rust.rs failures
Packages/sublime-rust/syntax_test_rust.rs:842:31: [source.rust meta.function.rust meta.function.parameters.rust comment.block.rust] does not match scope [source.rust meta.function.rust meta.function.parameters.rust]
Packages/sublime-rust/syntax_test_rust.rs:842:32: [source.rust meta.function.rust meta.function.parameters.rust comment.block.rust] does not match scope [source.rust meta.function.rust meta.function.parameters.rust]
Packages/sublime-rust/syntax_test_rust.rs:842:33: [source.rust meta.function.rust meta.function.parameters.rust comment.block.rust] does not match scope [source.rust meta.function.rust meta.function.parameters.rust]
Packages/sublime-rust/syntax_test_rust.rs:842:34: [source.rust meta.function.rust meta.function.parameters.rust comment.block.rust] does not match scope [source.rust meta.function.rust meta.function.parameters.rust]
Packages/sublime-rust/syntax_test_rust.rs:842:35: [source.rust meta.function.rust meta.function.parameters.rust comment.block.rust] does not match scope [source
G:\workspace2\sandbox-6-vagrant>vagrant up --debug
INFO global: Vagrant version: 1.8.7
INFO global: Ruby version: 2.2.5
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_EXECUTABLE="C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.8.7\\bin\\vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="C:\\HashiCorp\\Vagrant\\embedded"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_LOG="debug"
@jasonwilliams
jasonwilliams / Node.sublime-build
Created October 31, 2016 12:07
add this file to /Users/***/Library/Application Support/Sublime Text 3/Packages/User
{
"cmd": ["/usr/local/bin/node", "$file"],
"selector": "source.js"
}
$ ./mach run -r -- -b -w --pref dom.mozbrowser.enabled http://localhost:6060
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\quad.vs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\quad.fs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\blit.vs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\blit.fs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\border.vs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\border.fs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\blend.vs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\blend.fs.glsl"
compile "\\\\?\\C:\\msys64\\home\\Jason\\servo\\resources\\shaders\\filter.vs.glsl"