Skip to content

Instantly share code, notes, and snippets.

View blixt's full-sized avatar
🚧
???

Blixt blixt

🚧
???
View GitHub Profile
@blixt
blixt / Math.random.txt
Created June 29, 2015 12:41
Dieharder output
#=============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#=============================================================================#
rng_name | filename |rands/second|
file_input| dieharder.txt| 4.11e+06 |
#=============================================================================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#=============================================================================#
diehard_birthdays| 0| 100| 100|0.37793720| PASSED
diehard_operm5| 0| 1000000| 100|0.25454738| PASSED
@blixt
blixt / gist:9416b03b33ed7e3fbe6c
Created June 29, 2015 04:06
Dieharder output
#=============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#=============================================================================#
rng_name | filename |rands/second|
file_input| dieharder.txt| 4.17e+06 |
#=============================================================================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#=============================================================================#
diehard_birthdays| 0| 100| 100|0.80634484| PASSED
diehard_operm5| 0| 1000000| 100|0.02613178| PASSED
@blixt
blixt / getPath.js
Created April 23, 2015 21:13
getPath+
/*
The MIT License (MIT)
Copyright (c) 2010 Blixt
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
@blixt
blixt / workers.go
Last active August 29, 2015 14:17
Stoppable workers with reporting
// Playground: http://play.golang.org/p/G9-_EtwPRg
package main
import (
"fmt"
"math/rand"
"time"
)
type WorkerId int
- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)recognizer {
if (recognizer != self.panGestureRecognizer) {
if ([super respondsToSelector:@selector(gestureRecognizerShouldBegin:)]) {
return [super gestureRecognizerShouldBegin:recognizer];
} else {
return YES;
}
}
CGPoint translation = [recognizer translationInView:self];
// Observed bug(?): When adding a button after creating UIAlertView, the firstOtherButtonIndex value
// is stuck as -1 instead of the correct value, 1, even though the documentation states that the two
// invocations below should be equivalent.
NSString *closeText = @"Cancel";
NSString *actionText = @"OK";
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:self
@blixt
blixt / Usage.m
Last active August 29, 2015 14:14
- (void)alertWithTitle:(NSString *)title
message:(NSString *)message
close:(NSString *)closeText
action:(NSString *)actionText
then:(void (^)(void))block
{
if ([UIAlertController class]) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
@interface AlertViewCallback : NSObject <UIAlertViewDelegate>
@property (copy, nonatomic) void (^callback)(void);
@end
@implementation AlertViewCallback
+ (instancetype)callback:(void (^)(void))callback {
return [[self alloc] initWithCallback:callback];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.x > 0) {
scrollView.contentOffset = CGPointZero;
}
self.buttonsView.frame = CGRectMake(scrollView.contentOffset.x, 0, 160, self.buttonsView.frame.size.height);
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.x > 0) {
scrollView.contentOffset = CGPointZero;
}
}