This file contains hidden or 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 | |
| // http://paulbutler.org/archives/n-queens-in-a-tweet/ | |
| $n=$argv[1];$s=range(1,$n);while($i<$n*10000){shuffle($s);$a=s($s,range(1,$n));$b=s(s($s,range($n,1)),2*$n);$c=array_merge($a,$b);if(count(array_unique($c))==2*$n){die(join(',',$s));}$i++;}function s($a,$b){if(!is_array($b))$b=array_fill(0,count($a),$b);foreach($a as $i=>$k)$r[$i]=$k+$b[$i];return $r;} |
This file contains hidden or 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
| # showa: to remind yourself of an alias (given some part of it) | |
| showa () { /usr/bin/grep -i -a1 $@ ~/.aliases.bash | grep -v '^\s*$' ; } | |
| # sourcea: to source this file (to make changes active after editing) | |
| alias sourcea='source ~/.aliases.bash' | |
| # Search current directory (and subdirectories) for files with "word" | |
| function rg(){ grep -rl --exclude=\*/.svn/\* --exclude=\*/.git/\* --exclude=\*.swp $1 * } | |
| # find_larger: find files larger than a certain size (in bytes) |
This file contains hidden or 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
| // http://www.darqbyte.com/2009/10/21/timing-out-php-soap-calls/ | |
| // Uses cURL instead of default SOAP request method to allow timeouts of problem requests | |
| class SoapClientTimeout extends SoapClient | |
| { | |
| private $timeout; | |
| public function __setTimeout($timeout) | |
| { | |
| if (!is_int($timeout) && !is_null($timeout)) |
This file contains hidden or 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
| [debug] | |
| ; Remote settings | |
| xdebug.remote_autostart=off | |
| xdebug.remote_enable=on | |
| xdebug.remote_handler=dbgp | |
| xdebug.remote_mode=req | |
| xdebug.remote_host=localhost | |
| xdebug.remote_port=9000 | |
| ; General |
This file contains hidden or 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 *almost* all blood and gore in Team Fortress 2 | |
| // Save the following in your autoexec.cfg file to apply | |
| cl_phys_props_enable "0" | |
| cl_phys_props_max "0" | |
| r_propsmaxdist "1" | |
| props_break_max_pieces "0" | |
| cl_playerspraydisable "1" | |
| violence_agibs "0" | |
| violence_hgibs "0" |
This file contains hidden or 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 | |
| require_once('/home/alix/_.php'); | |
| ph(); | |
| function Purify($html, $tags = null) | |
| { | |
| $html = preg_replace('~<(script|style)[^>]*>.*?(?:</\1>|\z)~is', '', $html); | |
| $html = strip_tags($html, '<' . implode('><', array_keys((array) $tags)) . '>'); |
This file contains hidden or 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
| /* | |
| Comprehensive List of Browser-Specific CSS Hacks | |
| http://paulirish.com/2009/browser-specific-css-hacks/ | |
| */ | |
| /***** Selector Hacks ******/ | |
| /* IE6 and below */ | |
| * html #uno { color: red } | |
This file contains hidden or 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
| var isDirty = false; | |
| $(document).ready(function() | |
| { | |
| // Alert user about unsaved changes! | |
| $(':input').change(function(){ | |
| if(!isDirty) isDirty = true; | |
| }); | |
| window.onbeforeunload = function(){ |
This file contains hidden or 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 php | |
| <?php | |
| $app = function($request) { | |
| $body = <<<EOS | |
| <!DOCTYPE html> | |
| <html> | |
| <meta charset=utf-8> | |
| <title>Hello World!</title> |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en-GB"> | |
| <head> | |
| <title>iTunes slider</title> | |
| <link rel="stylesheet" href="style.css" type="text/css" /> | |
| <script type="text/javascript" src="js/jquery.js"></script> | |
| <script type="text/javascript" src="js/slider.js"></script> | |
| </head> |