I hereby claim:
- I am visualmotive on github.
- I am cmueller (https://keybase.io/cmueller) on keybase.
- I have a public key whose fingerprint is 7CCB B4B4 3A60 7BD5 49DF 72EA 580A 4F51 768E A27A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Sticky gravity is explained in depth here: http://tetrisconcept.net/wiki/Line_clear#Sticky
The playfield is divided into connected segments using flood fill. Any blocks that are adjacent horizontally or vertically are marked as one segment, that is, they are treated as having "stuck" together. Each segment falls independently until it meets the floor or another block. Additional line clears may result.
Sample input and expected output are included in this Gist.
.......... | |
.......... | |
.......... | |
.......... | |
.......... | |
.......... | |
.......... | |
.......... | |
.......... | |
.......... |
(function(){var f="data-form-local-storage-button-container";if(document.getElementById(f)){jQuery(f).show();return}var e=document.createElement("div"),c=document.getElementsByTagName("body")[0];e.id=f;e.style.position="fixed";e.style.top="0";e.style.right="0";e.style.padding="5px 10px";e.style.zIndex=1001;e.style.fontSize="12px";e.style.color="#222";e.style.backgroundColor="#eee";function a(h,j){var i=document.getElementsByTagName("head")[0],b=false,g=document.createElement("script");g.src=h;g.onload=g.onreadystatechange=function(){if(!b&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){b=true;j();g.onload=g.onreadystatechange=null;i.removeChild(g)}};i.appendChild(g)}if(typeof jQuery!="undefined"){return d()}else{if(typeof $=="function"){otherlib=true}}a("//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js",function(){if(typeof jQuery=="undefined"){alert("couldn't load jquery?")}return d()});function d(){e.innerHTML="<button data-local-storage-form-load>Load</button><button |
#! /usr/bin/env python | |
# | |
# Mixpanel, Inc. -- http://mixpanel.com/ | |
# | |
# Python API client library to consume mixpanel.com analytics data. | |
# | |
# Modified by Chris Mueller at Thumbtack for A/B tests | |
import hashlib | |
import urllib |
(function($) { | |
$.fn.slide = function strength(options) { | |
var defaults = { | |
'direction': 'left', // can also be 'right' | |
'duration': 500, | |
'callback': function() {} | |
}; | |
if (options === 'left' || options === 'right') { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css"> | |
#map { width: 640px; height: 480px; border: 1px solid #000; } | |
</style> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<script src="https://github.com/thumbtack/rotarymaps/raw/master/release/rotarymaps_min.0.2.js"></script> |
// Python equivalent: | |
// string[start:end] | |
function tt_str_slice($string, $start=NULL, $end=NULL) { | |
$length = strlen($string); | |
if ($start === NULL) { | |
$start = 0; | |
} else if ($start < 0) { | |
$start = $length + $start; | |
if ($start < 0) { |