Skip to content

Instantly share code, notes, and snippets.

View tomalec's full-sized avatar

Tomek Wytrębowicz tomalec

View GitHub Profile
@tomalec
tomalec / example.html
Last active August 29, 2015 14:13 — forked from ebidel/example.html
<!-- http://jsbin.com/rageqilava/1/edit?html,output -->
<script src="http://www.polymer-project.org/webcomponents.min.js"></script>
<script src="http://www.polymer-project.org/polymer.min.js"></script>
<link rel="import" href="templates.html" id="templates">
<polymer-element name="foo-bar">
<template>
@tomalec
tomalec / gist:af93bb87241d9d3abd5b
Last active September 9, 2021 12:50
PuppetJS and JSON-Patch Operational Transformations

Why do we need PuppetJS versioning and Operational Transformations?

Optional Version control and JSON-Patch Transformations

Because of the asynchronous nature of bidirectional web communication (caused by network latency, server side push, etc), it can be assumed that client and the server are for most of the time out of sync.

In fact it is not necessarily client and server, all following applies as well to server-server, client-client, or any peer-to-peer collaborating on JSON document.

To improve mutual view-model consistency, we introduce optional features:

  1. Versioning,
  2. Operational Transformations.
@tomalec
tomalec / gist:0e8d9f547a39a7797e45
Last active August 29, 2015 14:07
Puppets OT. Many users removes the same row

Scenario

 - Alice: add apple
 - Server: apple added
 - Alice: remove oranges
 * Alice message gets delayed *
 - Bob: remove oranges
 - Server: oranges removed
 * Alice message finally comes to the server*
@tomalec
tomalec / TestingJuicy
Last active August 29, 2015 14:03 — forked from kingflurkel/TestingJuicy
An example of `<juicy-tile-list>` wrapped inside another custom element containing `<template repeat>` and some custom-element inside
<!-- <link rel="import" href="../../../polymer/polymer.html"> -->
<link rel="import" href="../../src/juicy-tile-list.html">
<polymer-element name="custom-juicy-tile-list">
<template>
<style>
juicy-tile-list{
width: 100%;
}

Web Components

Set of new technologies

Web Components is an umbrella term for the set of upcoming standards for web development (see the W3C Web Components page). Each on its own, they are a useful contribution to the current toolset of a web developer. But together they form a completely new paradigm of how web applications are created.

Web Components consist of 4 standards proposals:

@tomalec
tomalec / gist:9060879
Created February 17, 2014 22:53
/quotes.css file used in Starcounter "Getting Started" wiki (https://github.com/Starcounter/Starcounter/wiki/Responding-to-a-request)
body{
color: #D3D3D3;
font: 24px Helvetica, Arial, sans-serif;
background-color: #161616;
margin: 65px 40px;
padding: 0;
}
#Says{
width: 13em;
margin-top: 25px;
<polymer-element name="x-foo" extends="body">
<template><content></content></template>
<script>
Polymer('x-foo',{
attached: function(){
this.async(function() {
console.log("Hello!, my name is" + this.tagName, this.children );
});
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://www.polymer-project.org/platform.js"></script>
<script src=" http://www.polymer-project.org/polymer.js"></script>
<link rel="import" href="/hiquh/3/quiet">
</head>
<polymer-element name="x-foo">
<template><content></content></template>
<script>
Polymer('x-foo',{
attached: function(){
this.async(function() {
debugger;
console.log(this.childElementCount + "/" + this.shadowRoot.querySelector('content').getDistributedNodes().length );
});
@tomalec
tomalec / graph.js.patch
Created December 4, 2013 00:20
my.Sleepbot.com Add rating to pattern graph
--- their.js 2013-12-04 01:11:12.592533200 +0100
+++ mine.js 2013-12-04 01:11:30.869533200 +0100
@@ -405,6 +405,7 @@
graph_RangePatternDate: function(css_id,times){
"use strict";
var values=[];
+ var ratings=[];
var end,start;
if(times.length>0){
end=times[0]['e']*1000;