Skip to content

Instantly share code, notes, and snippets.

@pstjvn
pstjvn / app.min.js
Created Dec 7, 2016
Web worker, raf and nexTick
View app.min.js
function aa(a, b) {
function c() {
}
c.prototype = b.prototype;
a.prototype = new c;
a.prototype.constructor = a;
for (var d in b) {
if (Object.defineProperties) {
var e = Object.getOwnPropertyDescriptor(b, d);
e && Object.defineProperty(a, d, e);
View debug log
[1:35:22 PM]: ==> {"id":"1","method":"server.setSubscriptions","params":{"subscriptions":["STATUS"]}}
[1:35:22 PM]: ==> {"id":"2","method":"analysis.setAnalysisRoots","params":{"included":["/home/pstj/Documents/Projects/dart/svg-animation"],"excluded":[]}}
[1:35:22 PM]: ==> {"id":"3","method":"analysis.updateContent","params":{"files":{"/home/pstj/Documents/Projects/dart/svg-animation/lib/svg_animation.dart":{"type":"add","content":"library svg_animation;\n\nimport 'dart:html' as html;\nimport 'dart:svg' show PathElement, SvgElement;\nimport 'dart:async';\n\n/// Helper class to store information about a path element in the SVG element.\n///\n/// The class handles nuances of the SVG displaying, for example some paths\n/// do not report correctly the length and cannot be ainmated or report length\n/// of 0 but resetting the dash offset is not hiding them, so we abstract that\n/// and hide it in this implementation.\nclass PathInfo {\n final PathElement element;\n final int length;\n bool _isVisible = true;\n
@pstjvn
pstjvn / env-brebuilt.sh
Last active Nov 28, 2016
Provides closure compatible environment but instead of compiling from source uses pre-built binaries
View env-brebuilt.sh
#!/bin/bash
# Allows the usage of prebuilt binaries to be used.
APPSDIR=apps/
SRCDIR=src/
LIBDIR=library/
GCCDIR=compiler/
SOYDIR=templates/
GSSDIR=stylesheets/
@pstjvn
pstjvn / l4.html
Last active Mar 17, 2016
Question for l4
View l4.html
<!DOCTYPE html>
<html>
<head>
<title>Test scenario.</title>
</head>
<body>
<script>
var jobs = [], jobn = 0, result = '', i = 1;
var body = "<script>top.result += '3'</scr" +
"ipt><body></body>";
@pstjvn
pstjvn / env.sh
Last active Nov 28, 2016
Sample script to bootstrap closure based development environment
View env.sh
#!/bin/bash
APPSDIR=apps/
SRCDIR=src/
LIBDIR=library/
GCCDIR=compiler/
SOYDIR=templates/
GSSDIR=stylesheets/
PSTJLIBDIR=pstj/
SMJSLIBDIR=smjs/
View fileafterclang.js
'use strict';
goog.provide('pstj.ds.autogen.IconParser');
goog.require('goog.array');
goog.require('pstj.ds.autogen.IconRenderer');
goog.require('pstj.ds.template');
goog.scope(function() {
var auto = pstj.ds.autogen;
@pstjvn
pstjvn / 32bit.txt
Created Nov 12, 2015
Compiler generated filelist
View 32bit.txt
../../library/closure/goog/base.js
../../library/closure/goog/promise/resolver.js
../../library/closure/goog/promise/thenable.js
../../library/closure/goog/math/size.js
../../library/closure/goog/string/typedstring.js
../../library/closure/goog/string/stringbuffer.js
../../library/closure/goog/string/string.js
../../library/closure/goog/i18n/bidi.js
../../library/closure/goog/i18n/datetimesymbols.js
../../library/closure/goog/async/freelist.js
@pstjvn
pstjvn / element.js
Created Oct 30, 2015
Custom elements / es6
View element.js
(function() {
'use strict';
/**
* Class in es6
* @constructor
* @extends {HTMLElement}
*/
wc.element.Test = class extends HTMLElement {
constructor() {
View mode.js
goog.scope(function() {
var ngmodel = pstj.ds.ngmodel;
/**
* @define {number} Defins the maximum number of NG cache instances to be
* used in the application. Attempts touse more cache instances (i.e. more
* bound elements/roots) will result in error. When defining the limit take into
* account the fact that using large number might result in slower response
* times and overwhole application lags.
@pstjvn
pstjvn / README.md
Last active Sep 28, 2015
Control delegation pattern
View README.md

Main idea: separate the business logic from the underlying dom structure and bind execution to structure separately.

Benefits:

  • changes to DOM structure can be logically separated and execute from business logic changes
  • business logic changes do not rely on DOM strcuture (stability of business logic)
  • binding can be executed in any technology or mix of technologies
  • tests can be implemented for important business logic more easily as it is not bound to DOM.
You can’t perform that action at this time.