This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$styler = true; | |
foreach($questions as $q) { | |
$color = ($styler) ? "#335533" : "#553355"; $styler = !$styler; | |
echo "<li style='background:$color;'>$q->text</li>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Disable sortable while target element fired | |
* - mouseover event AND | |
* - CTRL keydown | |
*/ | |
var jid_element = "#" + myElement; | |
var isCtrl = false; | |
var isOver = false; | |
$(jid_element).mouseover(function() {isOver = true}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* uri param to this "web script" | |
* q = tag values split by a semicol | |
* minscore = min score (int) | |
* | |
* it's a lil bit nasty, but can modify so easy, the same to turn into a shell script | |
*/ | |
$url = "http://api.stackoverflow.com/1.0/questions?tagged=".urlencode($_GET["q"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert a phrase to a SEO friendly uri (slug). | |
* | |
* @param string $title Phrase to convert | |
* @param string $separator Word separator | |
* @param boolean $ascii_only Transliterate to ASCII? | |
* @return string | |
*/ | |
function make_slug($title, $separator = '-', $ascii_only = true) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# TODO: input like "a'a'" | |
f = sys.argv[1].replace(" ","").lower() | |
o = f.find("'") | |
if o > 0: | |
r = (f[:o-1]+f[o-1:o+1][::-1]+f[o+1:]) | |
else: | |
r = f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/dir | |
- test.php | |
/lib | |
- fontparse.php | |
/ Font Parses | |
#test.php | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Pluck( ctx ) { | |
this.sr = ctx.sampleRate; | |
this.pro = ctx.createScriptProcessor( 512, 0, 1 ); | |
this.pro.connect( ctx.destination ); | |
} | |
Pluck.prototype.play = function( freq ) { | |
var N = Math.round( this.sr / freq ), | |
impulse = this.sr / 1000, | |
y = new Float32Array( N ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Does some fancy stuff | |
Usage: | |
{proc} [-h | --help] | |
{proc} [-v ...] INPUT OUTPUT | |
Options: | |
-h, --help Shows this help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let m=60000;let l="YYYY-MM-DDTHH:MM";let i=setInterval(() => console.log(parseInt(((new Date(l)) - (new Date)) / m)), m); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('ONE_WEEK', 604800); // 7 * 24 * 60 * 60 | |
function number_of_days($days, $start, $end) { | |
$w = array(date('w', $start), date('w', $end)); | |
$x = floor(($end-$start)/ONE_WEEK); | |
$sum = 0; | |
for ($day = 0;$day < 7;++$day) { | |
if ($days & pow(2, $day)) { |
OlderNewer