Skip to content

Instantly share code, notes, and snippets.

View awesomephant's full-sized avatar
😤

Max Kohler awesomephant

😤
View GitHub Profile
@awesomephant
awesomephant / test.js
Created December 10, 2018 20:32
Test
console.log('Hello World 123')
@awesomephant
awesomephant / mousemove.js
Last active January 24, 2019 16:30
Mousemove Optimized
var last_known_scroll_position = 0;
var ticking = false;
function doSomething(scroll_pos) {
// do something with the scroll position
}
window.addEventListener('mousemove', function(e) {
last_known_position = {
@awesomephant
awesomephant / parseSwitchboard.js
Created April 22, 2018 16:46
Switchboard Parser
const fs = require('fs');
const path = require('path');
const parse = require('csv-parse/lib/sync');
const mkdirp = require('mkdirp');
const dataDir = './data/switchboard_conversations/';
const outputDir = './data/clean/';
let topics = fs.readdirSync(dataDir)
let data = [];
gm montage -tile 28x19 -background "black" -geometry 300x300+2+2 *.jpg grid.jpg
@awesomephant
awesomephant / wp-setup
Last active April 1, 2018 12:51
Install common WP plugins
cd ap ; wp core update ; wp plugin update --all; wp theme update --all ; wp plugin delete hello ; wp plugin delete akismet ; wp plugin install custom-post-type-ui --activate ; wp plugin install timber-library --activate ; wp plugin install woocommerce --activate ; cd .. ; cd aside ; wp core update ; wp plugin update --all; wp theme update --all ; wp plugin delete hello ; wp plugin delete akismet ; wp plugin install custom-post-type-ui --activate ; wp plugin install timber-library --activate ; cd .. ; cd zwicker ; wp core update ; wp plugin update --all; wp theme update --all ; wp plugin delete hello ; wp plugin delete akismet ; wp plugin install custom-post-type-ui --activate ; wp plugin install timber-library --activate ; cd .. ; cd humboldt ; wp core update ; wp plugin update --all; wp theme update --all ; wp plugin delete hello ; wp plugin delete akismet ; wp plugin install custom-post-type-ui --activate ; wp plugin install timber-library --activate ; cd .. ; cd particitype ; wp core update ; wp plugin upd
sudo apt-get install git
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
cd Documents/
https://github.com/awesomephant/sineMachine.git
const gra = function(min, max) {
return Math.random() * (max - min) + min;
}
const gri = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var mapRange = function(n, range, targetRange) {
var x =
(n - range[0]) / (range[1] - range[0]) * (targetRange[1] - targetRange[0]) +
targetRange[0];
return x;
};
@awesomephant
awesomephant / loadChessData.js
Created March 23, 2017 20:00
Casper.js script to load chess openings
var fs = require('fs')
var casper = require('casper').create();
casper.options.waitTimeout = 10000;
var games;
var count = 0;
var nextLink = 'http://www.chessgames.com/perl/chess.pl?tid=53788';
var parsePage = function () {
var rows = document.querySelectorAll('table[cellpadding="3"]:nth-of-type(2) tr');
var games = [];
@awesomephant
awesomephant / render.js
Last active August 29, 2015 14:16
Code for "Good Morning Twitter"
var fs = require('fs');
var moment = require('moment');
var width = 3000;
var height = 4000;
var scaleX = (width - 100 ) / (360 +20);
var scaleY = (height + 00) / (24 * 60);
var offsetTop = 0;
var calcX = function(n){