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
| # http://postgresapp.com | |
| # http://big-elephants.com/2012-12/tuning-postgres-on-macos | |
| # import sql file | |
| ## In the command promt, not the postgres promt. | |
| ## Same why you would import mysql db. | |
| # create | |
| $ createdb database_name |
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
| var = x ? y : z | |
| // means | |
| if $x is set, use $y, if not use $z |
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
| # to keep letters & numbers | |
| $s = preg_replace('/[^a-z0-9]+/i', '_', $s); # or... | |
| $s = preg_replace('/[^a-z\d]+/i', '_', $s); | |
| # to keep letters only | |
| $s = preg_replace('/[^a-z]+/i', '_', $s); | |
| # to keep letters, numbers & underscore | |
| $s = preg_replace('/[^\w]+/', '_', $s); |
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
| # Cheatsheet | |
| # https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet | |
| # brew install zsh-completions | |
| # To activate these completions, add the following to your .zshrc: | |
| $ fpath=(/usr/local/share/zsh-completions $fpath) | |
| # You may also need to force rebuild `zcompdump`: |
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
| ### MySQL ### | |
| ######################### | |
| # MySQL commands: | |
| http://www.pantz.org/software/mysql/mysqlcommands.html | |
| # Add database: | |
| mysql> create database DATABASENAME; | |
| # Delete database: |
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://stackoverflow.com/a/20854048 | |
| # Avoid the WARNING message using the mysql_config_editor tools: | |
| $ mysql_config_editor set --login-path=local --host=localhost --user=username --password | |
| # Now type this: | |
| $ mysql --login-path=local |
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
| // Adjust value of a HEX color | |
| // jsfiddle.net/y2mgW | |
| function colorLuminance(hex, lum) { | |
| // validate hex string | |
| hex = String(hex).replace(/[^0-9a-f]/gi, ''); | |
| if (hex.length < 6) { | |
| hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; | |
| } | |
| lum = lum || 0; | |
| // convert to decimal and change luminosity |
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
| # install python | |
| $ brew install python@2 | |
| # upgrade pip tools | |
| $ pip install --upgrade pip setuptools | |
| # insatll fabric version 1 | |
| # version 2 will not work with python 2 | |
| $ pip install 'fabric<2.0' |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Untitled</title> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <meta name="description" content=""> | |
| <!-- favicon --> | |
| <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> |