Skip to content

Instantly share code, notes, and snippets.

View kapooostin's full-sized avatar

Vladimir Kapustin kapooostin

View GitHub Profile
@jonphipps
jonphipps / Handler.php
Last active February 7, 2016 21:24
app/Exceptions/Handler.php
<?php
...
if ($request->ajax()) {
$whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler());
} else {
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
}
@jonphipps
jonphipps / Handler.php
Last active February 7, 2016 21:23
Modified app/Exceptions/Handler.php
<?php
...
if ($request->ajax() || $request->wantsJson()) {
$whoops->pushHandler(new JsonResponseHandler());
} else {
$handler = new PrettyPageHandler();
//$handler->setEditor('phpstorm');
$handler->setEditor(
function ($file, $line) {
@jonphipps
jonphipps / .env
Last active February 7, 2016 21:23
Modified .env
LOCAL_HOME=/Users/joeblough
SERVER_HOME=/home/vagrant
...
DB_CONNECTION=mysql
...
@jonphipps
jonphipps / whoops.base.css
Created January 30, 2016 22:38
Small fix to whoops 2.0 css
.frame-file .editor-link {
color: #67B3FF;
text-decoration: underline;
}
@jonathantneal
jonathantneal / README.md
Last active December 13, 2024 20:50
CSS Modules in PHP

CSS Modules lets you write and use simple class names rather than remembering and maintaining long unique class names for every component. CSS Modules mutates all of your classnames from each partials into new, completely unique classnames that will not conflict when they are bundled together into your main CSS file. Then, a JSON file is generated that maps the happy classnames from each file to the unique classname in the combined file. You load this map in PHP, and begin using the easy-to-remember classnames as you wish.

@Shutik
Shutik / gist:908b8ce4ce432540e14bd8927e2edeb1
Created October 26, 2016 03:34
Cумма прописью, js
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();
@i-am-tom
i-am-tom / Main.elm
Created December 11, 2016 12:36
The Orrery
-- ## An Elm-entary visualisation
-- by _Tom Harding_
module Main exposing (..)
-- This project uses a few dependencies. To anyone who's written any
-- amount of Elm before, the only stranger is `AnimationFrame`, from
-- the `elm-lang/animation-frame` package. This lets us subscribe to
-- the browser's RAF API. Everything else should be fairly obvious:
-- `Html` / `Svg` for our view, `Http` / `Json.Decode` for the AJAX
@adleroliveira
adleroliveira / recur.js
Created January 19, 2017 20:45 — forked from CreaturePhil/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) => {
@AgentOak
AgentOak / youtube_formats.md
Last active April 18, 2026 16:04
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4

Challenge

Write a function of type String -> Integer. The input may or may not be a valid JSON string. If it is valid, the resulting JavaScript value is expected to be an object, but may not be. If it is an object, it is expected to have a foo property whose value is expected to be an object, but may not be. This value is expected to have a bar property which is expected to be an object with a baz property whose value is expected to be an array of strings. Each of these strings is expected to be a hex representation of an integer (e.g. 0xFF). If every element of the array meets this expectation, the