bootstrap snippets
browser referesh
color highlighter(buggy)
indent xml
| /** | |
| * detect mutiple resets in order to trigger events using resets or power cycles alone | |
| * reset board within resettimeout(5000ms) after boot and do so resetcnt(4) times | |
| * has led indicator of reset window and serial output for better clarity | |
| * | |
| * This is blocking using a delay for timeout, can easily be changed to use a timer | |
| * This is not wear leveled, but you could replace with spiffs(slower), or use a ring counter to level it | |
| * You could also add a smaller window for reset by adding a pre-delay, to prevent reduce flash writes during glitchy or fast power cycles | |
| * either way USE WITH CAUTION as you are writing twice every time your reset or repower the board, soft resets and wdt should not trigger this however. | |
| * |
| <?php | |
| /* ---------------------------------------------------------------------- | |
| This code fragment and addition to the GetSimple config file is designed to provide the capability to use SMTP mail when sending from | |
| the GetSimple core application, not from plugins. For example, when sending a mail generated by a user request to "Reset Password" | |
| GetSimple uses the built in PHP Mail() function only. Many hosting environments are now requiring that PHP scripts only use SMTP for | |
| security reasons and thus this suggested change... | |
| ------------------------------------------------------------------------- | |
| STEP #1 - | |
| Add the following 2 lines to GSConfig.php: |
| <?php | |
| // This plugin is licensed under the GNU GPLv3 license | |
| if(!defined("IN_MYBB")) | |
| { | |
| die("Direct initialization of this file is not allowed."); | |
| } | |
| $plugins->add_hook("parse_message_end", "AddNoFollow_hook"); | |
| function AddNoFollow_info() |
| Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(4, 4, PIN, | |
| NEO_MATRIX_TOP + NEO_MATRIX_LEFT + | |
| NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, | |
| NEO_GRB + NEO_KHZ800); |
| // .h | |
| #ifdef whatnot | |
| std::unique_ptr<classA> theclass; | |
| #else | |
| std::unique_ptr<classB> theclass; | |
| #endif | |
| // .cpp | |
| // How can I avoid using the actual classnames here | |
| #ifdef whatnot |
| #include "WiFiManager.h" //https://github.com/tzapu/WiFiManager | |
| #if defined(ESP32) | |
| #include <WebServer.h> | |
| using my_WebServer = WebServer; | |
| #else | |
| #include <ESP8266WebServer.h> | |
| using my_WebServer = ESP8266WebServer; | |
| #endif |
| #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager | |
| // select which pin will trigger the configuration portal when set to LOW | |
| // ESP-01 users please note: the only pins available (0 and 2), are shared | |
| // with the bootloader, so always set them HIGH at power-up | |
| #define TRIGGER_PIN 0 | |
| const char* modes[] = { "NULL", "STA", "AP", "STA+AP" }; | |
| // WiFiManager wifiManager; |
| <?php | |
| // why does print_r($xmlobj->node) only print the first node ? | |
| $string = <<<XML | |
| <breakfast_menu> | |
| <food> | |
| <name>Belgian Waffles</name> | |
| <price>$5.95</price> | |
| <description> | |
| Two of our famous Belgian Waffles with plenty of real maple syrup |
| <script> | |
| // https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery | |
| escaped = new Option(unescaped).innerHTML; | |
| var entityMap = { | |
| '&': '&', | |
| '<': '<', | |
| '>': '>', |