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
# To batch process a whole folder of images you just copy them to a thumbnail folder and use ImageMagick to crop them to the size you want. | |
cd /home/user/photos/holidays | |
mkdir thumbs | |
cp /home/user/photos/holidays/* /home/user/photos/holidays/thumbs/ | |
cd thumbs | |
# To cut out a section of the image (not resizing it) widthXheight+xoffset+yoffset | |
mogrify -crop 940x300+0+50 * |
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
function decode( string ) { | |
var output = []; | |
string.split('').forEach( function ( v ) { output.push( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf( v ) ); } ); | |
return output; | |
} | |
function encode( array ) { |
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 | |
echo '<pre>'; | |
$w = 1000; | |
$h = 1000; | |
// generate multidimensional array | |
$multi = array(); | |
for ($i = 0; $i < $w; ++$i) { |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
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 | |
//...your silex bootstrap. | |
//Configure Swiftmail to use SMTP. | |
$app->register(new SwiftmailerExtension(), array( | |
'swiftmailer.options' => array( | |
'host' => 'smtp.gmail.com', | |
'port' => 465, | |
'username' => '[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
(function (reqwest, Backbone) { | |
var methodMap, getUrl; | |
methodMap = { | |
'create': 'POST', | |
'update': 'PUT', | |
'delete': 'DELETE', | |
'read' : 'GET' | |
}; | |
getUrl = function(object) { |
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
git archive --format zip --output /full/path/to/zipfile.zip master |
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
{ | |
"cmd": ["java", "-jar", "${packages}/Google Closure/compiler.jar", "--js", "$file", "--js_output_file", "/dev/null", "--compilation_level", "WHITESPACE_ONLY"], | |
"file_regex": "^(.*):([0-9]+):() ERROR - (.*)", | |
"selector": "source.js" | |
} |
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
/** | |
* Home mande method to do array_diff ~10x faster that PHP built-in. | |
* | |
* @param The array to compare from | |
* @param An array to compare against | |
* | |
* @return an array containing all the entries from array1 that are not present in array2. | |
*/ | |
function nuno_array_diff($array1, $array2) { | |
$diff = array(); |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
OlderNewer