Skip to content

Instantly share code, notes, and snippets.

View jarek-foksa's full-sized avatar

Jarek Foksa jarek-foksa

View GitHub Profile
let extractBitmapSize = (bitmap, callback) => {
let imageElement = new Image();
imageElement.onload = () => {
callback(imageElement.naturalWidth, imageElement.naturalHeight);
};
imageElement.src = bitmap;
};
// @info
// Slider widget heavily inspired by sliders from Blender and Expression Design.
import {Stepper} from './Stepper';
import {HTML} from '../utils/dom';
import {getKeysForEvent} from '../utils/event';
import {normalize, round, log, exp} from '../utils/math';
import {mergeOptions} from '../utils/object';
import {makeSelectionFromNodeContent, getSelection} from '../utils/text';
var traceur = require('traceur');
traceur.options.blockBinding = true;
traceur.options.sourceMaps = true;
//traceur.options.strictSemicolons = true; // @bug: does not work with classes currently
traceur.options.deferredFunctions = true;
traceur.options.modules = true; // 'nodejs'
//
// Compile the content from ES6 to ES5
export class AlignPanel {
constructor() {
commandsManager.register({
id: 'alignPanel',
shortcut: ['A'],
getState: () => {
return (panelsDock.openedPanelID === this.id);
},
getLabel: () => {
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var traceur = require('./traceur-compiler');
traceur.options.sourceMaps = true;
traceur.options.deferredFunctions = true;
traceur.options.blockBinding = true;
traceur.options.modules = true; // 'nodejs'
# @copyright
# © 2012-2013 Jarosław Foksa
#
# @info
# Prototype object representing CSS color, based on http://www.w3.org/TR/css3-color/ and
# https://developer.mozilla.org/en/CSS/color_value
#
# rgb - 'rgb(255, 255, 255)'
# rgba - 'rgba(255, 255, 255, 1)'
# @copyright
# © 2012-2013 Jarosław Foksa
{createSVGMatrix} = imports 'utils/dom'
{createSVGTransform} = imports 'utils/transform'
{sin, cos, tan, sqrt, atan2, radToDeg, degToRad, abs, pow, signum} = imports 'utils/math'
# https://github.com/WebKit/webkit/blob/master/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp
# https://dvcs.w3.org/hg/FXTF/raw-file/tip/matrix/index.html
lettersSchema =
qwerty: [
["f", "j"],
["d", "k"],
["f", "j", "d", "k"],
["s", "l"],
["f", "j", "d", "k", "s", "l"],
["a", "g", "h"],
["f", "j", "d", "k", "s", "l", "a", "g", "h"],
["r", "u"],
window.global = window
global.modules = {}
imports = (moduleName) ->
if not modules[moduleName]
console.error "imports '#{moduleName}': module not found."
return null
else if modules[moduleName].exports
return modules[moduleName].exports
Object.prototype.listen = (eventName, callback) ->
if @addEventListener
@addEventListener eventName, callback
else
if @hasOwnProperty('__events__') == false
setDescriptor @, '__events__',
value: {}
enumerable: false
if @__events__[eventName] == undefined