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
#!/bin/bash | |
# Cleanup product images | |
# | |
# This will convert images from JPG to PNG and replace the white | |
# background with transparent one. | |
# | |
# This is almost verbatim copy of the script from: | |
# http://tech.natemurray.com/2007/12/convert-white-to-transparent.html |
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 | |
// Sample data from data.csv | |
//line 1, product 1, feature 1 | |
//line 2, product 1, feature 2 | |
//line 3, product 1, feature 3 | |
//line 4, product 2, feature 1 | |
//line 5, product 3, feature 1 | |
class Product { | |
// Product lines until we save |
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
* -A in SSH enables agent forwarding. | |
* -p 2122 is not needed if you use the default port of 22. | |
* Replace SSH_USER and example.com with your own values. | |
* Example run: $ envoy run deploy_demo | |
* --no-scripts because Laravel composer.json's post-install-cmd includes optimize, which is already done by php artisan dump-autoload | |
@servers(['test' => '-A -p 2122 -l user test.example.com', 'prod' => '-A -p 2122 -l user example.com']) | |
@task('install_test', ['on' => ['test']]) | |
cd project |
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 | |
/** | |
* Replace middle of the string with given char, keeping length | |
* | |
* <code> | |
* print padString('1234567890123456', 0, 0, 'x'); | |
* </code> | |
* | |
* @param string $string String to process | |
* @param integer $start Characters to skip from start |
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
This is a test of Gist vim plugin. | |
Hopefully, this will end up in my gists. |
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 | |
/** | |
* Example of sprintf()/vsprintf() with gettext | |
*/ | |
/** | |
* String translation | |
* | |
* @param string $param String to translate | |
* @return string Translated string (surrounded by square brackets for visibility) |
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 | |
# | |
# Encoding URLs for XML, using regular expressions | |
# | |
# XML string | |
$string = '<page>some&page</page><page>some&otherpage</page><page>yet&anotherpage</page>'; | |
$result =preg_replace_callback( | |
'#(<page>(.*?)</page>)#', |
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
#!/bin/bash | |
/usr/sbin/ntpdate -s 0.fedora.pool.ntp.org | |
/usr/sbin/ntpdate -s 1.fedora.pool.ntp.org | |
/usr/sbin/ntpdate -s 2.fedora.pool.ntp.org | |
/sbin/hwclock -w |
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 type="text/javascript"> | |
<?php | |
define('DEFAULT_LANGUAGE', 'en'); | |
$lang = !empty($_REQUEST['lang']) ? $_REQUEST['lang'] : DEFAULT_LANGUAGE; | |
$translations = get_translations($lang); | |
if (!empty($translations)) { | |
foreach ($translations as $key => $value) { |
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 | |
$charts = array( | |
'live1-ajax-total-count' => array( | |
'type' => 'line', | |
'title' => 'LIVE1 Total Count (ajax)', | |
'sql' => 'select .... ', | |
'callback' => 'minute_counts', | |
), | |
'live2-ajax-total-count' => array( | |
'type' => 'line', |