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
from pkgutil import extend_path | |
__base_path__ = __path__ | |
__path__ = extend_path(__path__, __name__) |
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
from pkgutil import extend_path | |
__base_path__ = __path__ | |
__path__ = extend_path(__path__, __name__) |
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 | |
/** | |
* Create a random string $l characters in length. | |
* | |
* @link http://www.php.net/manual/en/ref.strings.php#84888 | |
* @param int $l number of characters (default: 10) | |
* @return string the random string | |
*/ | |
function random_string($l = 10) { |
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
$ brew instal -vd pyqt | |
==> Downloading http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.9.1.tar.gz | |
Already downloaded: /Users/dale/Library/Caches/Homebrew/pyqt-4.9.1.tar.gz | |
/usr/bin/tar xf /Users/dale/Library/Caches/Homebrew/pyqt-4.9.1.tar.gz | |
==> python ./configure.py --confirm-license --bindir=/usr/local/Cellar/pyqt/4.9.1/bin --destdir=/usr/local/Cellar/pyqt/4.9.1/lib/python2.7/site-packages --sipdir=/usr/local/Cellar/pyqt/4.9.1/share/sip | |
python ./configure.py --confirm-license --bindir=/usr/local/Cellar/pyqt/4.9.1/bin --destdir=/usr/local/Cellar/pyqt/4.9.1/lib/python2.7/site-packages --sipdir=/usr/local/Cellar/pyqt/4.9.1/share/sip | |
Determining the layout of your Qt installation... | |
This is the GPL version of PyQt 4.9.1 (licensed under the GNU General Public | |
License) for Python 2.7.3 on darwin. | |
Found the license file pyqt-gpl.sip. |
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
-- Limited to one default TIMESTAMP column per table | |
-- See http://stackoverflow.com/questions/4489548/why-there-can-be-only-one-timestamp-column-with-current-timestamp-in-default-cla | |
CREATE TABLE my_table ( | |
-- some columns | |
updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP | |
); |
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
-- From http://www.fakebeing.com/projects/remove-on-update-from-mysql-timestamp-column/ | |
ALTER TABLE mytable CHANGE columnName columnName TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP |
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
$dateInterval->format('%H:%I:%S'); |
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
start | |
= additive | |
additive | |
= left:dice "+" right:additive { return left + right; } | |
/ left:dice "-" right:additive { return left - right; } | |
/ dice | |
dice | |
= left:primary "d" right:primary { var s = 0; for(var i = 0; i < left; i++ ) { s += Math.floor(Math.random() * right) + 1; } return s; } |
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 compress_utf8_file(fullpath, delete_original = True): | |
"""Compress a UTF-8 encoded file using GZIP compression named *.gz. If `delete_original` is `True` [default: True], | |
the original file specified by `delete_original` is removed after compression.""" | |
with codecs.open(fullpath, 'r', 'utf-8') as fin: | |
with gzip.open(fullpath + '.gz', 'wb') as fout: | |
for line in fin: | |
fout.write(unicode(line).encode('utf-8')) | |
if delete_original: | |
os.remove(fullpath) |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
swdiceprob.py | |
Functions for calculating Savage Worlds dice probabilities. | |
Copyright (c) 2012-2013 Dale Davis. All rights reserved. | |
Redistribution and use in source and binary forms, with or without |
OlderNewer