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
# ~/.osx — http://mths.be/osx | |
############################################################################### | |
# General UI/UX # | |
############################################################################### | |
# Menu bar: disable transparency | |
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false | |
# Always show scrollbars |
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 | |
/** | |
* Trait to get rid of naive getter/setter boilerplate | |
*/ | |
trait GetSet | |
{ | |
/** | |
* Dynamically create getters/setters |
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 | |
/** | |
* Function to run on script shutdown | |
* -used to catch most fatal errors, and | |
* display them cleanly | |
* | |
* @return void | |
*/ | |
function shutdown() |
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 | |
function do_curl($url, $options=array()) | |
{ | |
$cookie = tempnam ("/tmp", "CURLCOOKIE"); | |
$ch = curl_init($url); | |
//Use the user's User Agent and Cookies | |
$opts= array( | |
CURLOPT_USERAGENT => "Tim's List Image Updater", | |
CURLOPT_COOKIEJAR => $cookie, |
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 | |
// Normal foreach loop | |
foreach($foo as $bar) | |
{ | |
... | |
} | |
// Foreach with reference | |
foreach($foo as &$bar) |
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
javascript:(function(doc){ | |
"use strict"; | |
var $ = function(id){ | |
return doc.getElementById(id); | |
}; | |
var html = '<div id="tc_form_wrapper"> \ | |
<input type="number" id="tch1" size="3" /> : <input type="number" id="tcm1" size="3" /> \ | |
<button id="tc_plus">+</button> \ |
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 | |
/** | |
* Creates directories based on the array given | |
* | |
* @param array $structure | |
* @param string $path | |
* @return void | |
*/ | |
function make_dir_tree($structure, $path=__DIR__) |
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/mac) | |
./configure --prefix=/opt/php-embed/ --exec-prefix=/opt/php-embed/ --enable-embed=static --disable-cgi --with-curl --disable-dom --enable-ftp --enable-mbstring --with-pdo-mysql=mysqlnd --with-pdo-pgsql --with-pgsql --enable-zip --with-interbase=/Library/Frameworks/Firebird.framework/Libraries/ --enable-phar --enable-debug | |
(php/linux) | |
./configure --prefix=/opt/php-embed/ --exec-prefix=/opt/php-embed/ --enable-embed=static --disable-cgi --disable-dom --enable-ftp --enable-mbstring --with-pdo-mysql=mysqlnd --with-pdo-pgsql --with-pgsql --enable-zip --with-interbase --enable-phar --enable-debug | |
(wxphp) | |
./configure --prefix=/opt/php-embed/ --exec-prefix=/opt/php-embed/ --with-wxwidgets=/opt/wxWidgets-svn --with-php-config=/opt/php-embed/bin/php-config |
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 | |
set_time_limit(-1); | |
$primes = json_decode(file_get_contents("prime.json")); | |
while (TRUE) | |
{ | |
$i = $primes[count($primes) -1] + 1; | |
$ip = $i + 999; |