Skip to content

Instantly share code, notes, and snippets.

function Grid(w, h, minSize) {
if(w === undefined) w = 16384;
if(h === undefined) h = w;
if(minSize === undefined) minSize = Math.max(1, Math.max(w, h) / 1024);
this.root = {x:0,y:0,w:w,h:h};
this.minSize = minSize;
}
Grid.prototype.get = function(at) {
@sciolist
sciolist / build.sh
Created March 17, 2013 00:21
Sectcreate
gcc -Os main.c -sectcreate __TEXT example example.txt
@sciolist
sciolist / bookmarklet
Created September 3, 2012 08:45
Damn..
javascript:Array.prototype.slice.call(document.getElementsByTagName("*")).forEach(function(x)%20{for(var%20i=0;%20i<x.childNodes.length;%20++i)%20{var%20v%20=%20x.childNodes[i];%20if(v.nodeType%20!=%203)%20continue;%20if(!v.textContent.match(/[^\s]/))%20continue;v.textContent%20=%20v.textContent.replace(/[\w%C3%A5%C3%A4%C3%B6%C3%85%C3%84%C3%96]+/g,%20function(t)%20{var%20up%20=%20t[0].toUpperCase()%20==%20t[0];%20var%20vals%20=%20["fuck",%20"shit",%20"damn",%20"hell",%20"cock",%20"cunt",%20"ass"];%20var%20sel%20=%20vals[Math.floor(Math.random()%20*%20vals.length)];if(up)%20sel%20=%20sel[0].toUpperCase()%20+%20sel.substring(1);return%20sel});}});
@sciolist
sciolist / example.rb
Created August 16, 2012 20:46
Use some simple ngrams to figure out what method you wanted to call!
require './oh_god_why'
class Object
include FigureItOut
end
str = "hello, world."
puts str.make_upper_case # HELLO, WORLD.
this = "this be some text"
@sciolist
sciolist / main.c
Created August 5, 2012 14:09
A little method builder
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/mman.h>
#include <limits.h>
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
@sciolist
sciolist / waffles.html
Created March 15, 2012 16:05
Waffles tests
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
<base href="https://raw.github.com/sciolist/waffles.js/master/www/">
<script type="text/javascript" src="coffee-script.js"></script>
<script type="text/javascript" src="../out/waffles.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="scrolls.js"></script>
<script type="text/javascript" src="tableview.js"></script>
@sciolist
sciolist / class.js
Created May 10, 2011 23:57
Minimal JavaScript inheritance
function Class() { }
Class.extend = function(data) {
var cls = data.init || function(){};
cls.base = data.__proto__ = this.prototype;
cls.extend = arguments.callee;
cls.prototype = data;
return cls;
};
@sciolist
sciolist / karusell.css
Created April 5, 2011 16:48
Simple jQuery element carousel.
.karusell {
position: relative;
overflow: hidden;
}
.karusell .page.next { z-index: 3; }
.karusell .page.current { z-index: 2; }
.karusell .page {
position: absolute;
background: black;
import flash.events.TimerEvent;
class TimerInfo
{
public function new(toInvoke, block)
{
invoke = toInvoke;
blocking = block;
}