(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| <?php | |
| // recursive search by pattern | |
| function rsearch($folder, $pattern) { | |
| $dir = new RecursiveDirectoryIterator($folder); | |
| $ite = new RecursiveIteratorIterator($dir); | |
| $files = new RegexIterator($ite, $pattern, RegexIterator::GET_MATCH); | |
| $fileList = array(); | |
| foreach($files as $file) { | |
| $fileList = array_merge($fileList, $file); | |
| } |
| .mt-1 { | |
| margin-top: 1rem; } | |
| .pt-1 { | |
| padding-top: 1rem; } | |
| @media (min-width: 768px) { | |
| .mt-sm-4 { | |
| margin-top: 4rem; } |
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
| RewriteEngine On | |
| RewriteBase / | |
| # %{ENV:BASE} is now subdirectory, ex. /folder/subfolder/ | |
| RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$ | |
| RewriteRule ^(.*)$ - [E=BASE:%1] | |
| RewriteCond %{REQUEST_METHOD} !POST | |
| RewriteCond %{THE_REQUEST} /(.+?)\.html[\s?] [NC] | |
| RewriteRule ^ %1 [R=302,L,NE] |
| ssh-copy-id "user@server -p 1111" |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| function _transliterate_to_ascii($str, $case = 0) | |
| { | |
| static $UTF8_LOWER_ACCENTS = NULL; | |
| static $UTF8_UPPER_ACCENTS = NULL; | |
| if ($case <= 0) | |
| { | |
| if ($UTF8_LOWER_ACCENTS === NULL) | |
| { | |
| $UTF8_LOWER_ACCENTS = array( | |
| 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', |
| get_attachment_id( $att_url ) { | |
| global $wpdb; | |
| $attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE guid='%s';", $att_url ) ); | |
| return $attachment[0]; | |
| } |
| <?php | |
| /* | |
| Plugin Name: json2csv | |
| Description: Converts json to csv. If json is multidimensional - serializing it | |
| Usage: Example is below code | |
| Version: 0.1 | |
| Author: Lomboboo | |
| */ | |
| class JSON2CSV { |
| $url = 'http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |