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 | |
class Auth | |
{ | |
private $hasher; | |
private $session; | |
function __construct() | |
{ | |
$this->hasher = new PasswordHash(8, false); |
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 | |
#------------------------------------------------------------------------------ | |
# SETTINGS | |
#------------------------------------------------------------------------------ | |
MYSQL_ROOT_PASSWORD=password | |
MYSQL_GITORIOUS_PASSWORD=password | |
GITORIOUS_HOST=gitorious | |
SYSADMIN=sysadmin |
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 | |
android update project --path ./ | |
if [ $? -ne 0 ] | |
then | |
exit | |
fi | |
ant debug install | |
if [ $? -ne 0 ] |
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 | |
# Usage: install_node 0.6.16 | |
DIR=~/.node | |
TARGET=/Volumes/Macintosh\ HD | |
VER=$* | |
if [ ! -f ~/.node/$VER.pkg ]; then | |
curl --create-dirs -o $DIR/$VER.pkg http://nodejs.org/dist/v$VER/node-v$VER.pkg | |
fi |
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 | |
function uploadImage { | |
curl -s -F "image=@$1" -F "key=486690f872c678126a2c09a9e196ce1b" https://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.imgur.com/[^<]*" | |
} | |
import shot.png | |
url=`uploadImage "shot.png"` | |
echo $url | |
echo $url | xclip -selection c |
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 | |
$x = $y = 0; | |
$image = new Imagick('orig.jpg'); | |
//get_smallest_dimension | |
if ($image->getImageWidth() < $image->getImageHeight()) { | |
$x = 612; | |
} else { | |
$y = 612; | |
} |
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 | |
if [ !-d 'logs' ] | |
then | |
echo "No logs!" | |
exit 1 | |
fi | |
i=0 | |
count=$(ls logs | grep log | wc -l) | |
perc=$((100/$count)) |
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 | |
function base_26($num) | |
{ | |
$alpha = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); | |
// Get the character | |
$i = $num%26; | |
// Get the rest of the characters "power/base" math | |
$num = ($num - $i)/26; |
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
var WebCam = { | |
capturing: false, | |
callbacks: [], | |
capture: function(cb) { | |
addCallback(cb); | |
_takePic(); | |
}, | |
addCallback(cb) { |
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
def get_cruise_type_ticket_type_price_id_by_cruise_type_id_and_ticket_type_id(cruise_type_id, ticket_type_id): | |
with session_scope() as session: | |
result = session.execute(''' | |
SELECT id | |
FROM cruise_type_ticket_type | |
WHERE cruise_type_id = :cruise_type_id | |
AND ticket_type_id = :ticket_type_id | |
''', { | |
'cruise_type_id': cruise_type_id, | |
'ticket_type_id': ticket_type_id |
OlderNewer