Skip to content

Instantly share code, notes, and snippets.

View kapooostin's full-sized avatar

Vladimir Kapustin kapooostin

View GitHub Profile
@kapooostin
kapooostin / recur.js
Created January 7, 2019 10:30 — forked from adleroliveira/recur.js
A Million Ways to Fold in JS Notes
// 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();
@kapooostin
kapooostin / -README.md
Created May 1, 2017 08:10 — forked from jirutka/-README.md
How to use terminal on Windows and don’t go crazy…

How to use terminal on Windows without going crazy…

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.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
  • [✘] Checkout as-is, commit Unix-style line endings
/**
* Thanks to @philsturgeon for pointing this package
* and Filipe Dobreira "https://github.com/filp" for creating it ^^
* Github : https://github.com/filp/whoops
* How to:
* Step 1 : Setup composer for Laravel 3
* Step 2 : Add this code to your application/start.php or anywhere u like
* as long its after laravel registers its own error handlers
* so NOT in : index.php, paths.php or laravel/**
*
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
@kapooostin
kapooostin / gist:88db03d0d09553e66f40
Created October 21, 2015 05:00 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
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
@kapooostin
kapooostin / dabblet.css
Created March 24, 2012 06:15 — forked from anonymous/dabblet.css
Flexible multiline form with generated line breaks
/**
* Flexible multiline form with generated line breaks
*/
form {
width: 290px;
padding: 5px 218px 5px 5px;
border: 3px #ccc double;
text-align: right;
line-height: 2;
@kapooostin
kapooostin / dabblet.css
Created January 4, 2012 19:54 — forked from kizu/dabblet.css
Centered heading with rules
/* Centered heading with rules */
h1 {
position: relative;
overflow: hidden;
white-space: nowrap;
text-align: center;
text-overflow: ellipsis;
font: 2.6em/1.1 Georgia;
padding: .2em 0;
@kapooostin
kapooostin / gist:1252970297db2d8ccf50
Last active August 29, 2015 14:27 — forked from taylorotwell/gist:db67dd369b00022850b4
Mac Yosemite Dev Machine Setup

XCode

  • Install XCode from App Store.
  • Open XCode and agree to terms and conditions.

XCode CLI Tools

  • xcode-select --install

Install Homebrew

The Laracasts PHPStorm theme - modified.

This is a slightly modified version of the great Laracasts PHPStorm theme. I've added some styles for Verions Control (add, modified, deleted line...) and fixed some missing things like warnings.

Download

image

Mac: Add to ~/Library/Preferences/WebIde80/colors