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 | |
| class Event { | |
| private static $events = []; | |
| public static function Regist($eventName, Callable $callback) { | |
| if(!is_callable($callback)) return false; | |
| if(!array_key_exists($eventName, self::$events)) { | |
| self::$events[$eventName] = []; | |
| } | |
| self::$events[$eventName][] = $callback; | |
| return true; |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>com.user.time-machine-exclude-node-modules-job</string> | |
| <key>RunAtLoad</key> | |
| <false/> | |
| <key>KeepAlive</key> | |
| <false/> |
- Edit the file at
/Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml. - Add these rules inside the
bzexclusionstag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
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 | |
| class SimpleXMLExtended extends SimpleXMLElement | |
| { | |
| // Inspired by: https://stackoverflow.com/questions/6260224/how-to-write-cdata-using-simplexmlelement/6260295 | |
| public function addCDATA($string) | |
| { | |
| $node = dom_import_simplexml($this); | |
| $nodeOwner = $node->ownerDocument; |
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 | |
| const NATOAlphabet = array( | |
| "A" => "Alfa", | |
| "B" => "Bravo", | |
| "C" => "Charlie", | |
| "D" => "Delta", | |
| "E" => "Echo", | |
| "F" => "Foxtrot", | |
| "G" => "Golf", |
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 | |
| namespace App\Models\Traits; | |
| use Carbon\Carbon; | |
| use Cron\CronExpression; | |
| use InvalidArgumentException; | |
| /** | |
| * @property CronExpression|null $cron_expression |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
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
| #! /usr/bin/env python3 | |
| # ~*~ utf-8 ~*~ | |
| import mailbox | |
| import bs4 | |
| def get_html_text(html): | |
| try: | |
| return bs4.BeautifulSoup(html, 'lxml').body.get_text(' ', strip=True) | |
| except AttributeError: # message contents empty |