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
#!/bin/bash | |
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash |
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
#!/bin/bash | |
tail -n 100 ~/.bash_history | mail -v -s "Shell history log of '$HOSTNAME'" [email protected] |
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
tr -d '\r' < /path/to/crappy/windows-eol.csv > /path/to/shiny/unix-eol.csv |
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
find . -type f -print0 | xargs -0 chmod 0644 | |
find . -type d -print0 | xargs -0 chmod 0755 |
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
find ~/Dev/www -flags +uchg -print0 | xargs -0 chflags nouchg |
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
db.jobseekers | |
// Find all documents with a string-typed date field | |
.find({date: {$type: 2}}) | |
// Convert each date field to a ISODate based on its "created_on" raw timestamp | |
.forEach(function(doc) { | |
// The JSON <date> representation that Mongo expects is a 64-bit signed | |
// integer representing milliseconds since the epoch. | |
// We need to multiply the unixtime seconds value by 1000. | |
// |
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 | |
/** | |
* Generates timestamp bounderies for the passed date range name. | |
* | |
* @param string $range Date range name. | |
* | |
* @return array | |
*/ | |
function get_daterange_timestamps($range) |
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 to the specified length. | |
* | |
* @param string $string String to truncate. | |
* @param integer $len Desired length. | |
* @param boolean $wordsafe Whether to truncate on word boundries or not. | |
* @param boolean $dots Whether to add dots or not. | |
* |
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 | |
/** | |
* Case-insensitive in_array() wrapper. | |
* | |
* @param mixed $needle Value to seek. | |
* @param array $haystack Array to seek in. | |
* | |
* @return bool | |
*/ |
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 | |
/** | |
* Calculates how many months is past between two timestamps. | |
* | |
* @param int $start Start timestamp. | |
* @param int $end Optional end timestamp. | |
* | |
* @return int | |
*/ |