http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/GetStarted.html
phpMyAdmin
| Type | Protocol | Port Range | Destination |
|---|---|---|---|
| SSH | TCP | 22 | 0.0.0.0/0 |
| add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 ); | |
| function woocommerce_category_image() { | |
| if ( is_product_category() ){ | |
| global $wp_query; | |
| $cat = $wp_query->get_queried_object(); | |
| $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
| $image = wp_get_attachment_url( $thumbnail_id ); | |
| if ( $image ) { | |
| echo '<img src="' . $image . '" alt="" />'; | |
| } |
| $.slugify = function(text) { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/GetStarted.html
phpMyAdmin
| Type | Protocol | Port Range | Destination |
|---|---|---|---|
| SSH | TCP | 22 | 0.0.0.0/0 |
###Init
sudo apt-get updatesudo apt-get install nginx spawn-fcgi php5 php5-cli php5-common php5-suhosin php5-cgi php-pear php5-mysql htop gitsudo passwd root###Setup PHP
server {
| #!/bin/sh | |
| #Ravi Menon | |
| #20/Aug/2014 | |
| MYSQL_ROOT_PASSWD=~/.mysql_root | |
| install_dependencies() { | |
| #Refresh Ubuntu package list | |
| sudo apt-get update |
| <?php | |
| define('TRAKT_APIKEY', $argv[1]); | |
| define('TRAKT_USERNAME', $argv[2]); | |
| define('TRAKT_PASSWORD', $argv[3]); | |
| define('IMDB_EMAIL', $argv[4]); | |
| define('IMDB_PASSWORD', $argv[5]); | |
| define('IMDB_UID', $argv[6]); | |
| function curl_post($urlpre, $data, $urlpost = '') |
| // http://davidwalsh.name/javascript-clone | |
| function clone(src) { | |
| function mixin(dest, source, copyFunc) { | |
| var name, s, i, empty = {}; | |
| for(name in source){ | |
| // the (!(name in empty) || empty[name] !== s) condition avoids copying properties in "source" | |
| // inherited from Object.prototype. For example, if dest has a custom toString() method, | |
| // don't overwrite it with the toString() method that source inherited from Object.prototype | |
| s = source[name]; | |
| if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){ |
| // FROM http://stackoverflow.com/questions/728360/most-elegant-way-to-clone-a-javascript-object | |
| // When I had to implement general deep copying I ended up compromising by | |
| // assuming that I would only need to copy a plain Object, Array, Date, String, | |
| // Number, or Boolean. The last 3 types are immutable, so I could perform a | |
| // shallow copy and not worry about it changing. I further assumed that any | |
| // elements contained in Object or Array would also be one of the 6 simple | |
| // types in that list. This can be accomplished with code like the following: | |
| function clone(obj) { |
| [ | |
| // Basic drag select | |
| { | |
| "button": "button1", "count": 1, | |
| "press_command": "drag_select_callback" | |
| }, | |
| { | |
| // Select between selection and click location | |
| "button": "button1", "modifiers": ["shift"], | |
| "press_command": "drag_select_callback", |
| ############################################################################### | |
| # Helpful Docker commands and code snippets | |
| ############################################################################### | |
| ### CONTAINERS ### | |
| docker stop $(docker ps -a -q) #stop ALL containers | |
| docker rm -f $(docker ps -a -q) # remove ALL containers | |
| docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
| # helps with error: 'unexpected end of JSON input' |