Skip to content

Instantly share code, notes, and snippets.

<?php
$s="<%cphp%c%cs=%c%s%c;%cprintf(%cs,63,10,36,34,%cs,34,10,36,36,10,63);%c%c>";
printf($s,63,10,36,34,$s,34,10,36,36,10,63);
?>
@OpenGrid
OpenGrid / ferrante.js
Created August 3, 2011 21:07
Shortest code possible
var alfabet="abcdefghjpz679";
var convertToLetters = function(n){for(var a=alfabet,c='',l=a.length;c=a[n%l]+c,n=n/l|0,n--;);return c};
var convertToNumber = function(s,i,v){with(alfabet)for(i=v=0;s[i];v=v*length-~indexOf(s[i++]));return~-v};
@OpenGrid
OpenGrid / gist:1123868
Created August 3, 2011 21:46
HEXdump in HTML conversion to binary from Grooveshark about:cache?device=memory cache file
cat inputFileName | grep -e '[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:'| \
sed -u 's/<pre>0000/0000/' | sed -u 's/ / /g' | \
sed -u 's/\([0-9a-f][0-9a-f]\) \([0-9a-f][0-9a-f]\)/\1\2/g' | \
xxd -r > mp3
@OpenGrid
OpenGrid / binArrSearch.js
Created August 30, 2011 15:37
Count all occurences of a number in ascending array of integers
var binarysearch = function(number, ascendingIntegers) {
var current, end = ascendingIntegers.length, middle, count = 0;
for(current = 0; current < end; current++) {
middle = (current + end) / 2 | 0;
if(ascendingIntegers[middle] < number)
current = middle;
else if(ascendingIntegers[middle] > number)
end = middle;
if(ascendingIntegers[current] === number)
count++;
@OpenGrid
OpenGrid / vcenter.css
Created September 5, 2011 14:53
Vertical content centering template
* {margin:0;padding:0}
html,body{height:100%}
#wrapper{height:100%;width:100%;display:table;vertical-align:middle;}
#container{display:table-cell;vertical-align:middle;}
#inner{position:relative;left:50%;float:left;}
#content {position:relative; text-align:right;left:-50%;}
<!--[if lt IE 8]>
#inner {top:50%}
<![endif]-->
<!--[if IE 7]>
@OpenGrid
OpenGrid / factorial-100
Created October 22, 2011 19:21
cache array for factorials up to 100
<?php
$factorials = [
1=>1,2=>2,3=>6,4=>24,5=>120,6=>720,7=>5040,8=>40320,9=>362880,
10=>3628800,11=>39916800,12=>479001600,13=>6227020800,14=>87178291200,15=>1307674368000,16=>20922789888000,17=>355687428096000,18=>6402373705728000,19=>121645100408832000,
20=>2432902008176640000,21=>51090942171709440000,22=>1124000727777607680000,23=>25852016738884976640000,24=>620448401733239439360000,25=>15511210043330985984000000,26=>403291461126605635584000000,27=>10888869450418352160768000000,28=>304888344611713860501504000000,29=>8841761993739701954543616000000,
30=>265252859812191058636308480000000,31=>8222838654177922817725562880000000,32=>263130836933693530167218012160000000,33=>8683317618811886495518194401280000000,34=>295232799039604140847618609643520000000,35=>10333147966386144929666651337523200000000,36=>371993326789901217467999448150835200000000,37=>13763753091226345046315979581580902400000000,38=>523022617466601111760007224100074291200000000,39=>20397882081197443358640281739902897356800000000,
40=>815915283247
@OpenGrid
OpenGrid / ie-drop-shadow.html
Created November 4, 2011 12:21
A better text-shadow in IE8 and IE9
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-nocompat.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
@OpenGrid
OpenGrid / gist:1620783
Created January 16, 2012 13:07
Impress.js mouse wheel event for changing slides
document.addEventListener("mousewheel", function( event ) {
next = steps.indexOf( active ) - event.wheelDelta / Math.abs(event.wheelDelta);
next = next >= 0 ? steps[ next ] : steps[ steps.length-1 ];
select(next);
}, false);
@OpenGrid
OpenGrid / dabblet.html
Created February 14, 2012 21:14 — forked from anonymous/dabblet.html
Untitled
<div style="width:800px;align:center;" width="800">
<h2 style="font-family:'Palatino Linotype', 'Book Antiqua', 'Palatino', 'Serif';text-align:center;font-weight:normal;">Bezpłatne spotkanie z ekspertem-projektantem DEKORADNIKA</h2>
<p style="font-family:'Palatino Linotype', 'Book Antiqua', 'Palatino', 'Serif';text-align:center;">
<strong>"Grafika w domu. Fotografia, mapy i inne druki w aranżacji wnętrza”</strong>
</p>
<p style="font-family:'Palatino Linotype', 'Book Antiqua', 'Palatino', 'Serif';text-align:justify;">
Jak ciekawie wyeksponować ukochaną fotografię?
Jak zaprezentować mapę lub inną zabytkową
grafikę?
@OpenGrid
OpenGrid / dabblet.html
Created February 14, 2012 23:11 — forked from anonymous/dabblet.html
Untitled
<div style="width:800px;align:center;" width="800">
<h2 style="font-family:'Palatino Linotype', 'Book Antiqua', 'Palatino', 'Serif';text-align:center;font-weight:normal;">Bezpłatne spotkanie z ekspertem-projektantem DEKORADNIKA</h2>
<p style="font-family:'Palatino Linotype', 'Book Antiqua', 'Palatino', 'Serif';text-align:center;">
<strong>"Grafika w domu. Fotografia, mapy i inne druki w aranżacji wnętrza”</strong>
</p>
<p style="font-family:'Palatino Linotype', 'Book Antiqua', 'Palatino', 'Serif';text-align:justify;">
Jak ciekawie wyeksponować ukochaną fotografię?
Jak zaprezentować mapę lub inną zabytkową
grafikę?