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
| # SETUP # | |
| DOMAIN=example.com | |
| PROJECT_REPO="git@github.com:example.com/app.git" | |
| AMOUNT_KEEP_RELEASES=5 | |
| RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S) | |
| RELEASES_DIRECTORY=~/$DOMAIN/releases | |
| DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME | |
| # stop script on error signal (-e) and undefined variables (-u) |
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
| #!/bin/sh | |
| print_usage() { | |
| echo "usage: compress_video <input_file>" | |
| echo "supported formats: mp4, webm, mkv, mov, avi, flv" | |
| } | |
| get_extension() { | |
| f="${1##*/}" | |
| case "$f" in |
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
| <IfModule mod_rewrite.c> | |
| <IfModule mod_negotiation.c> | |
| Options -MultiViews | |
| </IfModule> | |
| RewriteEngine On | |
| RewriteCond %{REQUEST_FILENAME} -d [OR] | |
| RewriteCond %{REQUEST_FILENAME} -f | |
| RewriteRule ^ ^$1 [N] |
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
| <?php | |
| /** | |
| * Calculate how much a profile is completed | |
| * | |
| * @param $profile | |
| * @return float|int | |
| */ | |
| function calculate_profile($profile) | |
| { | |
| if ( ! $profile) { |
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
| <?php | |
| function get_combinations($arrays) { | |
| $result = array(array()); | |
| foreach ($arrays as $property => $property_values) { | |
| $tmp = array(); | |
| foreach ($result as $result_item) { | |
| foreach ($property_values as $property_value) { | |
| $tmp[] = array_merge($result_item, array($property => $property_value)); | |
| } |
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
| // NOTE: only escapes a " if it's not already escaped | |
| function escapeDoubleQuotes(str) { | |
| return str.replace(/\\([\s\S])|(")/g,"\\$1$2"); // thanks @slevithan! | |
| } | |
| escapeDoubleQuotes(`ab`); // ab => ab (nothing escaped) | |
| escapeDoubleQuotes(`a"b`); // a"b => a\"b | |
| escapeDoubleQuotes(`a\\"b`); // a\"b => a\"b (nothing escaped) | |
| escapeDoubleQuotes(`a\\\\"b`); // a\\"b => a\\\"b | |
| escapeDoubleQuotes(`a\\\\\\"b`); // a\\\"b => a\\\"b (nothing escaped) |