The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| // from http://forwardjs.com/university/a-million-ways-to-fold-in-js | |
| 'use strict' | |
| const first = (xs) => xs[0] | |
| const rest = (xs) => xs.slice(1) | |
| const concat = (xs1, xs2) => xs1.concat(xs2) | |
| // recursion | |
| const sum = (xs) => { |
| Number.prototype.toPhrase=function(c) | |
| // сумма прописью для чисел от 0 до 999 триллионов | |
| // можно передать параметр "валюта": RUB,USD,EUR (по умолчанию RUB) | |
| { | |
| var x=this.roundTo(2); | |
| if (x<0 || x>999999999999999.99) return false; | |
| var currency='RUB'; | |
| if (typeof(c)=='string') | |
| currency=c.trimAll().toUpperCase(); |
Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.
| Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if | |
| a form sits there for a while (like a login form, but any the same) the csrf token in the form will | |
| expire & throw a strange error. | |
| Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner. | |
| In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T! | |
| Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function. | |
| All of your exceptions go through here, unless you have excluded them in the $dontReport array at the |
| var _vent = require('./vent.js').shared(); | |
| _vent.trigger('blah'); |
| <?php | |
| namespace Codeception\Module; | |
| use Codeception\Util\Framework; | |
| use Codeception\TestCase; | |
| use Codeception\Util\Connector\Universal; | |
| use Codeception\Configuration; | |
| use Symfony\Component\BrowserKit\Response; | |
| use Laravel\Routing\Router; |
| var MyApp = angular.module('MyApp'); | |
| MyApp.factory('msgBus', ['$rootScope', function($rootScope) { | |
| var msgBus = {}; | |
| msgBus.emitMsg = function(msg, data) { | |
| data = data || {}; | |
| $rootScope.$emit(msg, data); | |
| }; | |
| msgBus.onMsg = function(msg, func, scope) { | |
| var unbind = $rootScope.$on(msg, func); | |
| if (scope) { |