Skip to content

Instantly share code, notes, and snippets.

View rk's full-sized avatar
🤠
Wranglin' private repo's

Robert K rk

🤠
Wranglin' private repo's
View GitHub Profile
@rk
rk / bcrypt.php
Last active January 4, 2018 13:15
Simple bcrypt object to wrap crypt() with.
<?php
// Originally by Andrew Moore
// Src: http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php/6337021#6337021
//
// Heavily modified by Robert Kosek, from data at php.net/crypt
class Bcrypt {
private $rounds;
private $prefix;
@rk
rk / for-loops.scss
Created April 13, 2011 12:55
A simple example for a blog article someone wrote.
// An example for:
// http://blog.rebeltix.com/2011/04/css-sass-and-how-to-improve-the-mess/
@for $i from 1 through 6 {
h#{$i} {font-size: 12pt + (14 - $i*2);}
}
@for $i from 1 through 3 {
box-level-#{$i} {background-color: #333 + ($i * #333);}
}
@rk
rk / basic_transition.css
Created October 14, 2010 20:56
color transition on link state changing on a page
a {
-moz-transition: 0.2s color linear;
-webkit-transition: 0.2s color linear;
transition: 0.2s color linear;
color: #333;
}
a:hover {
color: #933;
}
# Ruby translation of: http://kaioa.com/node/53#comment-477
probabilities = [1, 1, 1, 1, 1, 1];
unrandomness = 1;
def cumsum(vector)
_dup = vector.dup
1.upto(_dup.length - 1) { |i| _dup[i] += _dup[i-1] }
_dup
end
@rk
rk / pcrypt.php
Created August 10, 2009 18:38
A variant upon crypt() and phpass that isn't interested in portability, so much as customized security for PHP 5.1.2 or higher implementations.
<?php
/*******************************************************************************
PHP Crypt 0.1
=============
Original Source: http://gist.github.com/165342
Designed for password protection. Provides some extent of customization over
@rk
rk / gist:127466
Created June 10, 2009 20:07
My AI for the ruby-warrior project by RyanB, solves first 3 intermediate puzzles.
# I had trouble with the player saving data from the previous turns, namely
# the escape route I was generating to escape from 2 or more enemies. So,
# I put the behavior into a Brain that is a finite state machine. It's not
# that great, but you can see what I've got.
#
# This guy ought to solve ruby-warrior puzzles:
# - intermediate-001
# - intermediate-002
# - intermediate-003