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 | |
// This script filters the specified file over the specified regex pattern | |
// Each line that matches will be included in the new file | |
$source = fopen(__DIR__.'/sourcefile.csv', 'r'); | |
$target = fopen(__DIR__.'/targetfile.csv', 'w'); | |
while($line = fgets($source)) | |
{ |
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 | |
/** | |
* Detaches a process from apache so it can be invoked by a webpage but run | |
* under CLI context. Prevents apache from waiting for the process to | |
* finish before displaying output. All output is piped to null. | |
* | |
* @param string $process full path to executable / binary | |
* @param string $arguments arguments passed to the script | |
*/ |
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 | |
/** | |
* Truncates $string after $length characters, without splitting words. | |
* | |
* Inspired by http://stackoverflow.com/questions/250357 | |
* | |
* @param string $string | |
* @param integer $length | |
* @return string |
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 | |
// Based on info from: | |
// - http://www.sitepoint.com/forums/showthread.php?398020-terminal-colors-in-PHP | |
// - http://www.dzone.com/snippets/colorized-text-php-unix | |
$colors = array( | |
'light_red' => "[1;31m", | |
'light_green' => "[1;32m", | |
'yellow' => "[1;33m", |
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
rates = jQuery(".rate"); | |
for(i in rates) { | |
rate = rates[i].innerHTML; | |
if(rate){ | |
matches = rate.match(/\$([\d.]+) per hour/i); | |
if(matches instanceof Array) { | |
rates[i].innerHTML = "$"+ Math.ceil(parseFloat(matches[1])*100*(365/12)*24)/100 + " per month"; | |
} | |
} | |
} |
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
// Mac Lion using homebrew | |
{ | |
"cmd": ["/usr/local/opt/php54/bin/php", "/usr/local/bin/phpunit", "$file"] | |
} | |
// Ubuntu 12.04 with pear-installed PHPUnit | |
// Ctrl + B to run phpunit | |
// Ctrl + Shift + B to run the script |
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
{ | |
"tab_size": 4, | |
"translate_tabs_to_spaces": true | |
} |
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
[ | |
{ "keys": ["ctrl+shift+t"], "command": "open_terminal_project_folder" }, | |
{ "keys": ["ctrl+tab"], "command": "next_view" }, | |
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" } | |
] |
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 | |
$f = fopen('php://stdin', 'r'); | |
while ($line = fgets($f)) { | |
// do stuff | |
} | |
fclose($f); |
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> | |
<head> | |
<style type="text/css"> | |
body { | |
background-color: #333; | |
font: 60px 'Helvetica, Arial, Ubuntu, sans-serif'; | |
color: #111; | |
} | |
h1 { |
OlderNewer