Skip to content

Instantly share code, notes, and snippets.

View blixt's full-sized avatar
🗺️
Exploring

Blixt blixt

🗺️
Exploring
View GitHub Profile
import json
import re
with open('hashtag-shares.json') as f:
rows = f.readlines()
hashtags = dict()
for row in rows:
share = json.loads(row)
@blixt
blixt / index.js
Created July 24, 2014 21:01
requirebin sketch
var fnv = require('fnv-plus');
for (var i = 0; i < 100; i++)
console.log(fnv.hash(i.toString(), 32).value);
@blixt
blixt / asm.js
Created August 2, 2014 15:50
Slow asm.js?
function murmurhash3(stdlib, foreign, heap) {
"use asm";
var int32 = new stdlib.Int32Array(heap);
function murmurhash3_32(idx, len, seed) {
idx = idx | 0;
len = len | 0;
seed = seed | 0;
var h = 0, k = 0, i = 0;
@blixt
blixt / Alea
Created August 2, 2014 18:05
Results of running Dieharder on procedural PRNGs
#=============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#=============================================================================#
rng_name | filename |rands/second|
file_input| alea.txt| 3.72e+06 |
#=============================================================================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#=============================================================================#
# The file file_input was rewound 1 times
diehard_birthdays| 0| 100| 100|0.91201959| PASSED
@blixt
blixt / testasm.html
Created August 2, 2014 21:00
Slow asm.js procedure
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>asm.js</title></head>
<body>
<script>
function murmurhash3(stdlib, foreign, heap) {
"use asm";
var int32 = new stdlib.Int32Array(heap);
@blixt
blixt / Alea(2)
Created August 3, 2014 07:31
Dieharder run on procedural Alea with two seeds (500,000,000 values)
./randout.js --prng Procedural --count 500000000 > proc-alea2.txt && dieharder -g 202 -f proc-alea2.txt -a
#=============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#=============================================================================#
rng_name | filename |rands/second|
file_input| proc-alea2.txt| 3.77e+06 |
#=============================================================================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#=============================================================================#
diehard_birthdays| 0| 100| 100|0.09460678| PASSED
var pocket = require('pocket');
// Traits just need to implement an interface and can be instances or singletons (see anonymous trait below for
// interface).
var controller = require('./traits/controller');
var health = require('./traits/health');
var score = require('./traits/score');
var verlet = require('./traits/verlet');
var player = pocket.entity({name: 'Blixt'});
@blixt
blixt / Twinder.md
Last active August 29, 2015 14:11
Twinder

Twinder

Optimize your Twitter feed.

Basic idea

  1. Authenticate to access a user's Twitter feed
  2. Display the feed as Twitter does
  3. Allow the user to swipe left or right on any tweet
    Left = indicate that you dislike the tweet
@interface SwipeableTableViewCell : UITableViewCell <UIScrollViewDelegate>
// Create the scroll view which enables the horizontal swiping.
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
scrollView.contentSize = self.bounds.size;
scrollView.contentInset = UIEdgeInsetsMake(0, 160, 0, 0);
scrollView.delegate = self;
scrollView.scrollsToTop = NO;
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
[self.contentView addSubview:scrollView];