Skip to content

Instantly share code, notes, and snippets.

Will Franzen wtfaremyinitials

Block or report user

Report or block wtfaremyinitials

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wtfaremyinitials
wtfaremyinitials / maze.js
Created Jun 5, 2014
Maze solver in NodeJS for /r/dailyprogrammer challenge
View maze.js
// My solution to this /r/dailyprogrammer challenge on reddit (http://redd.it/278ptv)
process.stdin.resume();
process.stdin.setEncoding('utf8');
var width = 0;
var height = 0;
var maze = [];
function getStartPoint() {
for(var x = 0; x < maze.length; x++) {
View KarelPlusPlus.java
package xyz.will.karelplusplus;
import stanford.karel.SuperKarel;
public class KarelPlusPlus extends SuperKarel {
private static final long serialVersionUID = 1L;
// Turn Right
public void turnRight() {
View timeago.js
/*
* Meteor timeAgo helper
* by
* MIT License
*/
UI.registerHelper('formatTimeAgo', function(timestamp, options) {
var minute = 60;
var hour = minute * 60;
var day = hour * 24;
var week = day * 7;
View KarelIconSwitcher.java
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import javax.imageio.ImageIO;
@wtfaremyinitials
wtfaremyinitials / regex
Last active Aug 29, 2015
iPhone Model Regex
View regex
/^(4s?|5(c|s)?|6\+?)$/i
@wtfaremyinitials
wtfaremyinitials / test.js
Created Apr 2, 2015
Generator function tasks
View test.js
var MiningTask = function* MiningTask() {
for(var i=0; i<5; i++) {
yield breakBlock();
}
}
var tasks = [];
tasks.push(MiningTask());
@wtfaremyinitials
wtfaremyinitials / example.js
Last active Aug 29, 2015
Example of my "Duties" API
View example.js
var Duties = require('./index.js');
var main = new Duties();
var bot = new Bot(); // stub for other bot related code
var MiningTask = function* MiningTask(d, config) {
while(true) {
var block = bot.findBlockToBreak();
d.add(NavigateTask, block.location);
d.add(BreakBlockTask, block);
View wbot.js
var mineflayer = require('mineflayer');
var navigatePlugin = require('mineflayer-navigate')(mineflayer);
var blockfinderPlugin = require('mineflayer-blockfinder')(mineflayer);
var scaffoldPlugin = require('mineflayer-scaffold')(mineflayer);
var Duties = require('duties');
var BaseTask = function* BaseTask($) {
while(true) {
setTimeout($.resume, 500);
View gen.js
var printAllNumbers = function() {
for(var i=0; i<Math.pow(36, 6); i++) {
var str = "";
for(var j=0; j<7; j++) {
var char = Math.floor(i / Math.pow(10, j)) % 36;
if(char >= 26)
char += 22;
else
char += 97;
str += String.fromCharCode(char);
@wtfaremyinitials
wtfaremyinitials / play.jxa
Created Jul 7, 2015
Play any song in your iTunes library from the CLI
View play.jxa
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
if(argv.length == 0) {
console.log('Usage: play [ track ]');
} else {
Application('iTunes').playlists[0].tracks.whose({ name: { _contains: argv.join(' ') } })[0].play();
}
ObjC.import("stdlib")
$.exit(0)
}
You can’t perform that action at this time.