Skip to content

Instantly share code, notes, and snippets.

@phaistonian
phaistonian / Select Similar.sketchplugin
Last active August 29, 2015 14:06
Sketch: Select similar layers or groups based on a number of properties (and guesses)
// Select Similar (ctrl shift a)
// https://gist.githubusercontent.com/phaistonian/b3737cf05c1b6a61dbb7/raw/1f1ca90f1c72e395cb4d2abfc23315c47dc5c25d/Select%20Similar.sketchplugin
/* Based on initial work by Ale Muñoz */
(function(){
var sel = selection[0], all_layers = [[doc currentPage] children];
if (sel) {
var query = getIdForElement(sel), type = [sel className], found = 0;
var hash = {};
[1,2,3,3,5,1].filter(function (item) { if (hash[item]) return true; hash[item] = false; return true; });
{
"bold_folder_labels": true,
"build_on_save": false,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"default": "Default.sublime-theme",
"detect_indentation": false,
"draw_indent_guides": true,
"draw_minimap_border": true,
@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 / php.ini
Created August 18, 2015 08:37
php.ini
short_open_tag=On
error_reporting = E_ALL & ~E_NOTICE;
hello = () => {
var lala = 1;
something();
}
@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);});
}
@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) {
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]);
}
subClass = function (source, prototype) {
var dummy = new source.constructor;
for (var key in prototype) {
dummy[key] = prototype[key];
}
source.__proto__ = dummy;
}