Skip to content

Instantly share code, notes, and snippets.

View peterwallhead's full-sized avatar
👨‍💻
coding all the things

Peter Wallhead peterwallhead

👨‍💻
coding all the things
View GitHub Profile
@peterwallhead
peterwallhead / 0_reuse_code.js
Created October 1, 2015 23:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
var json = {
data: ['a','bunch','of','things']
};
var otherData = {
things: [],
madness: {}
};
json.data.forEach(function(data,index,array){
@peterwallhead
peterwallhead / k-means-clustering.php
Last active December 29, 2015 21:08
K-Means Clustering with PHP. Original source http://phpir.com/clustering and downloadable via http://phpir.com/user/files/cluster.zip
<?php
$data = array(
array(0.05, 0.95),
array(0.1, 0.9),
array(0.2, 0.8),
array(0.25, 0.75),
array(0.45, 0.55),
array(0.5, 0.5),
array(0.55, 0.45),
@peterwallhead
peterwallhead / UUID.php
Last active December 23, 2015 04:09 — forked from dahnielson/UUID.php
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4211 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.