Skip to content

Instantly share code, notes, and snippets.

View XOP's full-sized avatar

Evgeny Khoroshilov XOP

View GitHub Profile
function getDataUri(url, callback) {
var image = new Image();
image.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = this.naturalWidth; // or 'width' if you want a special/scaled size
canvas.height = this.naturalHeight; // or 'height' if you want a special/scaled size
canvas.getContext('2d').drawImage(this, 0, 0);
@XOP
XOP / iframify.js
Created April 14, 2016 11:22
Fake media queries with Iframe trick
(function (global) {
var metaViewport = document.querySelector('meta[name="viewport"]');
var metaViewportStr = metaViewport && metaViewport.outerHTML || '';
var metaCharset = document.querySelector('meta[charset]');
var metaCharsetStr = metaCharset && metaCharset.outerHTML || '';
var queryCache = {};
/**
* Get the styling nodes to inject in the head of the embedded document
*
@XOP
XOP / jsconfbp.md
Last active May 14, 2016 19:15
JSConf Budapest 12-13 of May notes

JSConf Budapest 12-13 May

official site

schedule

Read before Proceed!

This is the instant notes of the conference flow
Some details are missing (and so do Caps), others just dropped for the sake of brevity

@XOP
XOP / cssconfbp.md
Created May 15, 2016 13:59
CSSConf Budapest 11 of May notes
<div class="body">
<div class="dropdown">
<div class="dropdown__content">
<div class="content">
<div class="content__item">
<input type="checkbox" />
Item 1
</div>
@XOP
XOP / ft2014_review.md
Last active September 5, 2016 09:58
Front-Trends 2014 extended review with links and stuff

DISCLAIMER:
The whole content comes "as is".
All commentaries refer to author's impression.
Some inconsistency possible as well.
The few details (mainly useful links) were added while transcribing notes.


@XOP
XOP / npm-run.js
Created October 14, 2016 14:19
Node CLI runner
#!/usr/bin/env node
"use strict";
var log = require('log-util');
var exec = require('child_process').exec;
module.exports = function (cmd) {
var command = 'npm run ' + cmd;
exec(
@XOP
XOP / dotcss2016.md
Last active December 22, 2016 14:37
dotCSS 2016 notes
@XOP
XOP / dotjs2016.md
Last active December 22, 2016 14:38
dotJS 2016 notes
import { BROWSER } from '../constants/browser';
export function isWebPSupported (browser) {
// webp is supported in some browsers
// return true immediately
// todo: augment list, check versions etc
if (typeof browser !== 'undefined' && (
browser.browser === BROWSER.OPERA ||
browser.browser === BROWSER.CHROME