Skip to content

Instantly share code, notes, and snippets.

View dmamills's full-sized avatar
💭
ya yr smart but you'll never b dolphin smart

dmamills

💭
ya yr smart but you'll never b dolphin smart
View GitHub Profile
@dmamills
dmamills / ImageGenerator.java
Created December 5, 2012 01:56
Randomly generated minecraft esque textures using a simple noise method
package wee;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
@dmamills
dmamills / MinesweepField.java
Created December 7, 2012 03:44
Minesweeper revisions, generate a minesweeper board of any size, and number of mines
/*
Challenge #108
http://www.reddit.com/r/dailyprogrammer/comments/126905/10272012_challenge_108_intermediate_minesweeper/
Daniel Mills
Create a 15x15, 20 Mine Minesweeper Field
Revision: updated to be able to increase boardsize and mines
*/
import java.util.Random;
@dmamills
dmamills / .vimrc
Created January 8, 2013 03:00
basic vimrc
syntax on
set shiftwidth=2
set tabstop=2
set softtabstop=4
set showmatch
set showcmd
set ruler
set autoindent smartindent
set smarttab
set number
@dmamills
dmamills / Program.cs
Last active December 11, 2015 08:38
Daily programmer #117 easy
//http://www.reddit.com/r/dailyprogrammer/comments/16jiuq/011413_challenge_117_easy_hexdump_to_ascii/
// Usage: programname.exe textfile.txt
using System;
using System.Linq;
using System.IO;
namespace DailyProgrammer117
{
class Program
@dmamills
dmamills / elo.js
Last active December 17, 2015 01:19
Elo rating system in javascript, revealing module pattern.
var elo = (function(){
var k = 32;
function setKFactor(n){
k = n;
};
function getExpected(ratingA, ratingB){
return 1/ (1+Math.pow(10, ((ratingB-ratingA)/400)));

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
var crypto = require('crypto'),
http = require('http'),
qs = require('querystring'),
fs = require('fs'),
path = require('path'),
through = require('through'),
markdown = require('markdown').markdown,
util = require('util');
var server = http.createServer(function(req,res) {
@dmamills
dmamills / crypto.js
Created December 19, 2013 14:26
nodeschool stream-adventure
var tar = require('tar'),
through = require('through'),
zlib = require('zlib'),
crypto = require('crypto');
var parser = tar.Parse();
parser.on('entry',function(e) {
if(e.type ==='File') {
var md = crypto.createHash('md5',{encoding:'hex'});
@dmamills
dmamills / export_func.js
Created February 5, 2014 23:40
JS library exports for node/amd/browser
(function(root) {
function exportFunctions () {
if (typeof define === 'function' && define.amd) {
define(function () {
return functions;
});
} else if (typeof module !== 'undefined' && module !== null) {
module.exports = functions;
} else {
root.vagueTime = functions;
@dmamills
dmamills / gist:9262671
Created February 28, 2014 00:23
heroku hipchat errr
2014-02-28T00:07:04.807171+00:00 app[web.1]: [Fri Feb 28 2014 00:07:04 GMT+0000 (UTC)] INFO Disconnected from hipchat.com
2014-02-28T00:07:04.809473+00:00 app[web.1]: [Fri Feb 28 2014 00:07:04 GMT+0000 (UTC)] ERROR 'plan-change', '0', { name: 'stream:error',
2014-02-28T00:07:04.809473+00:00 app[web.1]: parent: [Circular],
2014-02-28T00:07:04.809473+00:00 app[web.1]: attrs: { xmlns: 'urn:ietf:params:xml:ns:xmpp-streams' },
2014-02-28T00:07:04.809473+00:00 app[web.1]: children:
2014-02-28T00:07:04.809473+00:00 app[web.1]: attrs: { 'xmlns:stream': 'http://etherx.jabber.org/streams' },
2014-02-28T00:07:04.809473+00:00 app[web.1]: { name: 'text',
2014-02-28T00:07:04.809473+00:00 app[web.1]: parent: null,
2014-02-28T00:07:04.809473+00:00 app[web.1]: [ { name: 'plan-change',
2014-02-28T00:07:04.809473+00:00 app[web.1]: children: [] },