Skip to content

Instantly share code, notes, and snippets.

const shadow = myElement.createShadowRoot();
const style = document.createElement('style');
style.innerHTML = '@import url(PATH_TO_MY_CSS)';
shadow.appendChild(style);
<amp-ad width="300" height="250"
type="adman"
data-ws="17342"
data-s="300x250"
data-host="talos.adman.gr">
</amp-ad>
@phaistonian
phaistonian / esnextbin.md
Created April 22, 2016 14:59
esnextbin sketch
@phaistonian
phaistonian / reveal_side_bar_st.json
Created January 27, 2016 14:16
Shortcut to reveal in sublime side_bar
{ "keys": ["alt+s"], "command": "reveal_in_side_bar"}
var Webpack = require('webpack');
var path = require('path');
var entry = require('./webpack-entry');
// Prepend local dev server
for (var i in entry) {
entry[i] = ['webpack-dev-server/client?http://local.bestprice.gr:3000', 'webpack/hot/dev-server']
.concat(entry[i]);
}
@phaistonian
phaistonian / MatrixRounder.js
Last active October 12, 2015 11:17
Deal with sub-pixels the JS way
function attachRounder (element) {
window.addEventListener('resize', () => makeRound(element));
makeRound(element);
}
function makeRound (element) {
let transform = window.getComputedStyle(element, null).getPropertyValue('transform');
if (transform.indexOf('matrix') !== -1) {
element.style.transform = transform.replace(/[\d\.]+/gi, function (match) { return Math.round(match);});
}
hello = () => {
var lala = 1;
something();
}
@phaistonian
phaistonian / php.ini
Created August 18, 2015 08:37
php.ini
short_open_tag=On
error_reporting = E_ALL & ~E_NOTICE;
@phaistonian
phaistonian / .gitignore
Created August 17, 2015 19:44
.gitignore file
# Misc related to npm and webpack
node_modules
build
dist
webpack-stats.json
npm-debug.log
# Sublime related - just in case
###################
sublime-*
@phaistonian
phaistonian / firesync.js
Last active November 10, 2015 08:17
A Redux middleware to broadcast state (actions + data) using Firebase (http://d.pr/v/13oMK)
import Rebase from 're-base';
const endPoint = 'actions';
const firebaseUrl = 'https://firesync.firebaseio.com';
const client = String(Date.now() + Math.random() * 100);
const data = [];
let initiated = false;
const base = Rebase.createClass(firebaseUrl);
function firesync (store) {