Skip to content

Instantly share code, notes, and snippets.

View asakasinsky's full-sized avatar

Vasily Asakasinsky asakasinsky

View GitHub Profile
<?php
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks
* @return string The prettified output
* @author Jay Roberts
*/
@asakasinsky
asakasinsky / REST.md
Last active August 29, 2015 14:06 — forked from jstnjns/REST.md

Request

HTTP Methods

POST

  • Without ID will create a new item in a collection, and return that new item
  • Without ID, with reference_id in payload will create a new item in a collection with the same attributes as the item with a matching id as the reference_id (and use any other attributes in payload as overrides), and return that new item (cloning)
  • With an ID will return error code 405
@asakasinsky
asakasinsky / dnsdiff.py
Last active August 29, 2015 14:09 — forked from finnigja/dnsdiff.py
#!/usr/bin/env python
#
# DNS Result Comparison Utility
# Author: https://twitter.com/chair6
#
import argparse
import dns.resolver
import dns.rdatatype
from collections import defaultdict
function trim(c) {
var ctx = c.getContext('2d'),
copy = document.createElement('canvas').getContext('2d'),
pixels = ctx.getImageData(0, 0, c.width, c.height),
l = pixels.data.length,
i,
bound = {
top: null,
left: null,
right: null,
u.ease = {
quadratic: {
style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
fn: function (k) {
return k * ( 2 - k );
}
},
circular: {
style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
fn: function (k) {
u.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
var distance = current - start,
speed = Math.abs(distance) / time,
destination,
duration;
deceleration = deceleration === undefined ? 0.0006 : deceleration;
destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
duration = speed / deceleration;
.b-scroller {
position:absolute;
z-index: 200;
width: 100%;
height: 100%;
padding:0;
overflow: hidden;
background: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
/*global Scroller: true */
/*global utils: true */
/*global Touch: true */
(function(window, document, Math, Zepto)
{
"use strict";
var defaults =
{
@asakasinsky
asakasinsky / odin-ass-style-jquery.js
Last active August 29, 2015 14:13
odin-ass-style-jquery
window.$ = (function(window){
var document = window.document;
var $ = void(0);
var J = function (sel, ctx) {
var _this = this;
this.$el = document.querySelector(sel);
return _this;
};
@charset "UTF-8";
/**
* Based on:
*
* sass-mediaqueries
* https://github.com/paranoida/sass-mediaqueries/blob/master/_media-queries.scss
*
* BEM Grid