Skip to content

Instantly share code, notes, and snippets.

View AshKyd's full-sized avatar
🐳
a frood who really knows where his towel is

Ash Kyd AshKyd

🐳
a frood who really knows where his towel is
View GitHub Profile
var arbitraryHeight = 100000; // number of pixels of screen to load
var previousHeight, previousArticles;
document.body.style.opacity = 0;
var scrollTimeout;
var loadLoop = setInterval(() => {
var articles = Array.from(document.querySelectorAll('article'));
// how many pixels of screen have we loaded?
var loadedHeight = parseInt(window.getComputedStyle(document.querySelector('section')).height);
// If we've hit our targeted amount, stop looping & sort our images.
@AshKyd
AshKyd / southport-line.json
Last active May 25, 2016 11:29
Rough path of the old Southport railway line. Queensland, Australia
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// npm install wait-until --save-dev
waitUntil()
.interval(10)
.times(1000)
.condition(function(){
})
.done(function(){
});
@AshKyd
AshKyd / README.md
Last active September 22, 2015 19:39
NPM-based project workflow

Had enough of Grunt and Gulp because they're difficult to configure and especially difficult to debug.

After a discussion with some BrisJS peers last month I've come up with a bunch of NPM scripts to do a bunch of common browserify+uglify+misc stuff. This is based around my own workflow and doesn't cover all the bases so ymmv, but it's been working for me for a while now so I figured I'd share.

Getting started

@AshKyd
AshKyd / random.js
Created August 17, 2015 23:03
Tiny seeded pseudorandom number generator.
function random(seed) {
var x = Math.sin(seed) * 10000;
return x - Math.floor(x);
}
var mySeed = 1234;
for(var i=0; i<10; i++){
console.log(random(mySeed++));
}
@AshKyd
AshKyd / diff.py
Last active August 29, 2015 14:22
Nathan Hoad's git diff with meld script.
#!/usr/bin/python
# https://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
@AshKyd
AshKyd / go.sh
Last active August 29, 2015 14:15
Silverstripe with sqlite3 dev environment on Fedora (PHP 5.4+)
# Fedora-specific PHP environment setup
yum install php php-mbstring php-mysql php-gd
# Manually install composer via https://getcomposer.org/download/
# Install Silverstripe & sqlite driver
composer create-project silverstripe/installer ./ 3.1.10
composer require silverstripe/sqlite3 1.3.*@dev
# Launch the dev PHP server
@AshKyd
AshKyd / makelanguagelist.js
Created July 26, 2014 15:01
Create a list of countries and languages spoken from the "List of official languages by state" page on Wikipedia https://en.wikipedia.org/wiki/List_of_official_languages_by_state
var countries = [];
// These states have no official languages, so override them with these ones.
var override = {
"United Kingdom": ['English'],
"United States": ['English'],
"Australia": ['English'],
"Mexico": ['Spanish'],
"Chile": ['Spanish'],
}
@AshKyd
AshKyd / makelgbtlst.js
Last active August 29, 2015 14:04
Compile a dataset from the "LGBT rights by country or territory" wikipedia page. https://en.wikipedia.org/wiki/LGBT_rights_by_country_or_territory
var dataset = [];
/**
* Get an overall yes or no value for the cell. A no trumps a yes.
*/
function imgVal(cell){
var val;
$('img',cell).each(function(){
var alt = $(this).attr('alt');
if(alt === 'No'){