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
| Maybe the closest analogue to this is the PHP "debate": | |
| (http://www.codinghorror.com/blog/2012/06/the-php-singularity.html) | |
| (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) | |
| Basically, MySQL works and you can definitely use it to build and run successful applications. Facebook uses it. But the point is that Postgres..... is better. That's the point. How and why? There are numerous articles out there for you to google up but [here's one] (http://www.youtube.com/watch?v=1PoFIohBSM4) that gives you a resaonable breakdown, by example. | |
| So if you're currently a still running MySQL why not give Postgres a go, especially if you're starting a new project. Hell, why not use it even on existing projects which are using MySQL? Maybe because you have existing MySQL databases full of data and tables that you'd need to convert over to PostgreSQL? True this is a barrier, but it's by no means insurmountable. Which is what this post is about: easy conversion of your existing MySQL databases (schema and dat |
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
| https://gist.github.com/6337805 |
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
| Hostname ec2-46-137-246-145.ap-southeast-1.compute.amazonaws.com |
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
| def toggle_new_relic_availability_monitoring(host_tag, action): | |
| """Given a valid action and a host tagname in env dictionary (shared among all tasks) | |
| make an API call to newrelic to toggle availability monitoring on or off.""" | |
| valid_actions = ['enable', 'disable',] | |
| if action.lower() not in valid_actions: | |
| raise Exception('You must specify a valid action. Valid actions '\ | |
| 'are: {valid_actions}'.format(valid_actions=valid_actions})) | |
| try: | |
| app_id = NEW_RELIC_APPS[host_tag] | |
| except KeyError: |
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
| def known_sortable(size): | |
| try: | |
| return int(size) | |
| return float(size) | |
| except ValueError: | |
| if size.isalpha() | |
| return size | |
| return False | |
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
| def scale_size(size, scale=None): | |
| ''' | |
| This function receives size form choices. i.e. 'XXS' or 10 or A or whatever, | |
| and an optional scale. If not scale is passed, returns the value of size in any of the default scales. | |
| If scale is passed, then it returns the value of size in such scale. | |
| ''' | |
| #default scales for certain type of products. | |
| default_sizes = {'XXXXXS':-6, 'XXXXS':-5, 'XXXS':-4, 'XXS':-3, 'XS':-2, 'S':-1, 'M':0, 'L':1, 'XL':2, 'XXL':3, 'XXXL':4, 'XXXXL':5, 'XXXXXS':6} | |
| baby_sizes = {"NEWBORN":0, "0-3M":1, "3-6M":2, "6-12M":3, "6-18M":4, "6-12M":5, "6-18M":6, "12-18M":7, "18-24M":8, "18-36M":9 } |
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
| def scale_size(size, scale=None): | |
| ''' | |
| This function receives size form choices. i.e. 'XXS' or 10 or A or whatever, | |
| and an optional scale. If not scale is passed, returns the value of size in any of the default scales. | |
| If scale is passed, then it returns the value of size in such scale. | |
| ''' | |
| #default scales for certain type of products. | |
| default_sizes = {'XXXXXS':-6, 'XXXXS':-5, 'XXXS':-4, 'XXS':-3, 'XS':-2, 'S':-1, 'M':0, 'L':1, 'XL':2, 'XXL':3, 'XXXL':4, 'XXXXL':5, 'XXXXXS':6} | |
| baby_sizes = {"NEWBORN":0, "0-3M":1, "3-6M":2, "6-12M":3, "6-18M":4, "6-12M":5, "6-18M":6, "12-18M":7, "18-24M":8, "18-36M":9 } |
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
| things = ('one',) | |
| otherthings = ('one') | |
| print 'things:' | |
| for t in things: | |
| print t | |
| print 'otherthings:' | |
| for ot in otherthings: |
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
| mydict = {'mykey': 'foo', } | |
| class MyObj(object): | |
| thing = 'whatever' | |
| myobj = MyObj() | |
| val = None | |
| try: |
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
| mydict = {'mykey': 'foo', } | |
| class MyObj(object): | |
| thing = 'whatever' | |
| myobj = MyObj() | |
| val = None | |
| try: |