Skip to content

Instantly share code, notes, and snippets.

View StoneCypher's full-sized avatar

John Haugeland StoneCypher

View GitHub Profile
<?php
$wiki_line = array(
array(
'type' => 'http://schema.org/Person',
'data' => array(
'name' => 'John Doe',
'jobTitle' => 'graduate research assistant',
'affiliation' => 'University of Dreams',
<?php
// must already have cross-references resolved into a flat list
// see $wiki_line in exdata
function EncodeLine($line) {
$dump = '';
foreach ($line as $index => $row) {
$dump .= ($index === 0)? "Item\n" : "Item $index\n";
$dump .= " Type: " . $row['type'];
foreach ($row as $key => $val) { $dump .= " $key = $val\n"; }
<html>
<head>
<title>Now we have a title</title>
</head>
<body>
<h1>This is a header</h1>
<p>This is a paragraph</p>
</body>
@StoneCypher
StoneCypher / gist:9eabdd6b660ac13138a3
Created December 29, 2014 20:58
lol hand made maps because i have to make the renderer before the editor
var e = 385,
fl = 195,
fs = 340,
TR = 172,
df = 209,
wN = 141,
dN = 152;
var dungeon = [ [ e, e, e, e, e, e, e, e, e, e, e, e, e, e, df, e],
@StoneCypher
StoneCypher / gist:6beed7c6dcc91e1c4e9b
Created December 29, 2014 21:02
why those numbers? because they're the alphabetical order of the filenames in the Kenney tilesets
// it's four free asset sets from Kenney
// http://kenney.nl/assets/isometric-roads and three others i'm too lazy to dig up
var tiles = [
"assets/PNG/buildingTiles_000.png",
"assets/PNG/buildingTiles_001.png",
"assets/PNG/buildingTiles_002.png",
"assets/PNG/buildingTiles_003.png",
require("./global-leakage.js")
var glob = require('../')
var test = require('tap').test
test('test glob.sync', function(t) {
var matches = new glob.sync('./s*.js')
t.same(['./stat.js', './sync-cb-throw.js', './sync.js'].sort(), matches.sort())
t.end()
@StoneCypher
StoneCypher / gist:6b1727c75d4238d7c611
Created February 21, 2015 17:11
What actually is a library
// this is an example of a super lame library
// the things in here are stupid
function cap_string(X) {
return X.toString().toUpperCase();
}
function low_string(X) {
return X.toString().toLowerCase();
<script defer type="text/jsx">
// up button control
var Up = flocks.createClass({
inc: function() { this.fset('value', this.fctx['value'] + 1) },
render: function() { return <button onClick={this.inc}>▲</button>; }
});
// down button control
var Down = flocks.createClass({
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Example Spinner App</title>
<style type="text/css">
body { font-size: 600%; font-family: helvetica neue, sans-serif; }
1
2 3
4 5 I J
6 7 C D K L Q R
89 AB EF GH MN OP ST UV