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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
// jquery error checking plugin | |
(function($) { | |
errors = { | |
test: function() { | |
var args = $.makeArray(arguments); | |
var msg, test = args.shift(); | |
if ( msg = errors.tests[test].apply(this, args) ) throw msg; | |
}, |
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
// checks every few secs to see if any source file is updated and reloads if needed | |
// reloadr.php should check mtimes of files you want to track and return max(mtimes). | |
// like this: | |
/* | |
<?php | |
$files = array_merge( | |
glob('*.php'), | |
glob('tests/*.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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<script> | |
$.extend($.expr[':'], { | |
childless: function(a) { | |
return !$(a).children().not('a').size(); | |
} | |
}); | |
$(function() { | |
console.log($('.value:childless').get()); |
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
// Here is how to get less parsing of <style> tags for quick development | |
// I made this with less.js 1.0.17, not sure how far back it works | |
// change this to wherever your less.js is stored | |
<script src="http://dkb.local/js/lessjs/less.js"></script> | |
// then do this somewhere | |
<script> | |
var styleEls = document.getElementsByTagName('style'); | |
for (var i in styleEls) |
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
<style> | |
body { font: 13px arial; } | |
p { position: relative; } | |
p.fixed { background: white; } | |
object { | |
float: left; | |
border: 1px solid red; | |
margin: 0 10px 10px 0; | |
width: 200px; | |
height: 50px; |
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 | |
function a() { | |
echo "Called A.\n"; | |
return false; | |
} | |
function b() { | |
echo "Called B.\n"; | |
return 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
#!/usr/bin/env bash | |
# | |
# url : https://gist.github.com/672684 | |
# version : 2.0.2 | |
# name : appify | |
# description : Create the simplest possible mac app from a shell script. | |
# usage : cat my-script.sh | appify MyApp | |
# platform : Mac OS X | |
# author : Thomas Aylott <[email protected]> |
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<select multiple> | |
<option value="4" selected>four</option> | |
<option value="5">five</option> | |
</select> | |
<div id="result"></div> | |
<script> | |
$('#result').html( String($('select').val()) ); |
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
// Math.sum.apply(null, [3, 4, 5, 6]) => 18 | |
Math.sum = function() { | |
var total = 0, x = 0; | |
while (x < arguments.length) total += arguments[x++]; | |
return total; | |
}; | |
// Math.avg.apply(null, [3, 4, 5, 6]) => 4.5 | |
Math.avg = function() { | |
return Math.sum.apply(null, arguments) / arguments.length; |
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
document.body.innerHTML += '<style style="display: none;">@-webkit-keyframes spinner { 0%, 45%, 100% { -webkit-transform: rotate(0deg); } 50%, 95% { -webkit-transform: rotate(180deg); } } body { -webkit-animation: spinner 300s infinite; }</style>'; |
OlderNewer