Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| SET FOREIGN_KEY_CHECKS = 0; | |
| TRUNCATE TABLE `catalog_category_entity`; | |
| TRUNCATE TABLE `catalog_category_entity_datetime`; | |
| TRUNCATE TABLE `catalog_category_entity_decimal`; | |
| TRUNCATE TABLE `catalog_category_entity_int`; | |
| TRUNCATE TABLE `catalog_category_entity_text`; | |
| TRUNCATE TABLE `catalog_category_entity_varchar`; | |
| TRUNCATE TABLE `catalog_category_product`; | |
| TRUNCATE TABLE `catalog_category_product_index`; | |
| <?php | |
| /** | |
| * Join a string with a natural language conjunction at the end. | |
| */ | |
| function natural_language_join(array $list, $conjunction = 'and') { | |
| $last = array_pop($list); | |
| if ($list) { | |
| return implode(', ', $list) . ' ' . $conjunction . ' ' . $last; | |
| } | |
| return $last; |
| /** | |
| * Mass (bulk) insert or update on duplicate for Laravel 4/5 | |
| * | |
| * insertOrUpdate([ | |
| * ['id'=>1,'value'=>10], | |
| * ['id'=>2,'value'=>60] | |
| * ]); | |
| * | |
| * | |
| * @param array $rows |
| DB_HOST=mysql | |
| DB_DATABASE=homestead | |
| DB_USERNAME=homestead | |
| DB_PASSWORD=secret |
| # This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2... | |
| # This also works perfectly for all static file content in all projects | |
| # This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config. | |
| # Example: | |
| # http://example.com - Main Laravel site as usual | |
| # http://example.com/about - Main Laravel site about page as usual | |
| # http://example.com/robots.txt - Main Laravel site static content as usual | |
| # http://example.com/api/v1 - Lumen v1 api default / route | |
| # http://example.com/api/v1/ - Lumen v1 api default / route |
* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.
Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.
Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.
That's the theory, let's get to the work.
| title | React Hook prompting the user to "Add to homescreen" |
|---|---|
| slug | react-hook-prompting-the-user-to-add |
| createdAt | 2018-11-29T20:35:02Z |
| language | en |
| preview | Simple React Hook for showing the user a custom "Add to homescreen" prompt. |