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);
@wtfaremyinitials
wtfaremyinitials / copy.js
Created Apr 23, 2015
Javascript copy to clipboard
View copy.js
function copytext(text) {
var textField = document.createElement('textarea');
textField.innerText = text;
document.body.appendChild(textField);
textField.select();
document.execCommand('copy');
textField.remove();
}
// credit to reddit.com/u/liamht
@wtfaremyinitials
wtfaremyinitials / notify.js
Created Apr 23, 2015
Desktop notifications in Javascript
View notify.js
function notify(message, iconUrl, onclick) {
if (!Notification) {
alert(message);
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
var notification = new Notification('', {
You can’t perform that action at this time.