Skip to content

Instantly share code, notes, and snippets.

View marcelklehr's full-sized avatar

Marcel Klehr marcelklehr

View GitHub Profile
@marcelklehr
marcelklehr / index.js
Last active January 25, 2016 17:49
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var vdom = require('virtual-dom')
, h = vdom.h
var virtualize = createVNode
var vtree = h('div', null, [
h('button', {onclick: function() {
@marcelklehr
marcelklehr / index.js
Last active November 5, 2015 19:09
requirebin example of a virtual-dom UI hook
var ObservStruct = require('observ-struct')
, ObservArray = require('observ-array')
, Computed = require('observ/computed')
, vdom = require('virtual-dom')
, h = vdom.h
var state = ObservStruct({
users: ObservArray([
ObservStruct({id: 0, name: 'foo'})
, ObservStruct({id:1, name: 'bar'})
@marcelklehr
marcelklehr / index.js
Created June 16, 2015 21:21 — forked from Tuch/index.js
requirebin showing off vdom-virtualize's svf goodness
var dom = require('virtual-dom');
var fromHTML = require('vdom-virtualize').fromHTML;
var html = '<svg namespace = "http://www.w3.org/2000/svg" class="stats-aside__svg" height="160" width="160"> <circle namespace = "http://www.w3.org/2000/svg" class="stats-aside__svg-bg" cx="80" cy="80" r="78" stroke="#f2f2f2" stroke-width="4" fill="none" ></circle> <circle namespace = "http://www.w3.org/2000/svg" class="stats-aside__svg-progress" cx="80" cy="80" r="78" stroke="#f9c033" stroke-width="4" fill="none" stroke-dashoffset="228.92" stroke-dasharray="503, 999"></circle> </svg>'
var vsvg = fromHTML(html);
var node = dom.create(vsvg);
document.body.appendChild(node);
@marcelklehr
marcelklehr / checkPadDeltas.js
Last active August 29, 2015 14:01
check etherpad deltas
/*
This is a debug tool. It checks all revisions for data corruption
*/
if(process.argv.length != 3)
{
console.error("Use: node bin/checkPad.js $PADID");
process.exit(1);
}
//get the padID
@marcelklehr
marcelklehr / gist:8586848
Last active January 4, 2016 07:09
etherpad v1.4.0-rc1
* SECURITY FIX: PLugin manager: escape rendered npm package info
* FIX: PLugin manager: Update npm to fix fetching of plugins
* FIX: Import: Dont die on bad html
* FIX: Export: when exporting HTML include html and body
* FIX: Editor: Correct links with protocols that are not equal to http
* FIX: Finally, Update padList correctly
* FIX: Fix walking caret bug (#1766)
* FIX: Add input validation for html param in setHTML()
* FIX: Timeslider: Don't crash if CHANGESET_REQ fails
* FIX: Dont error when pressing del at pos(0,0)
/**
* Find a (minimal) path from a given revision to another revision,
* regardless of what changesets are available
* @param {number} from - The revision # from which to start.
* @param {number} to - The revision # which the path should try to reach.
* @param {number} max - The last revision #
* @returns {object} - A list of tuples (i.e. [10, 20]) which each describe an edge between two revisions.
*/
calcPath: function (from, to, max) {
var path = []
@marcelklehr
marcelklehr / birds
Created November 24, 2013 12:52
Silhouettes of birds
Birds: https://secure.flickr.com/photos/lightlypaintedpixels/50175328/
@marcelklehr
marcelklehr / gist:6949300
Created October 12, 2013 12:04
Etherpad changelog v.1.2.12
* NEW: Add explanations for more disconnect scenarios
* NEW: export sessioninfos so plugins can access it
* NEW: pass pad in postAceInit hook
* NEW: Add trustProxy setting. ALlows to make ep use X-forwarded-for as remoteAddress
* NEW: userLeave hook (UNDOCUMENTED)
* NEW: Plural macro for translations
* NEW: backlinks to main page in Admin pages
* NEW: New translations from translatewiki.net
* SECURITY FIX: Filter author data sent to clients
* FIX: Never keep processing a changeset if it's corrupted
# v1.2 release
To complete these great news, we also released v1.1.6 today, introducing new patches and some exciting new features:
* Customizable robots.txt
* Customizable app title (finally you can name your epl instance!)
* eejs render arguments are now passed on to eejs hooks through the newly introduced `renderContext` argument.
* Plugin-specific settings in settings.json (finally allowing for things like a google analytics plugin)
* Serve admin dashboard at /admin (still very limited, though)
* Modify your settings.json through the newly created UI at /admin/settings
* Fix: Import <ol>'s as <ol>'s and not as <ul>'s!
* Added solaris compatibility (bin/installDeps.sh was broken on solaris)
@marcelklehr
marcelklehr / gist:3885976
Created October 13, 2012 20:11
Test node's http.request
var http = require('http')
Number.prototype.times = function(fn) {
for(var i=1; i <= this; i++) process.nextTick(fn.bind(null, i))
return this
}
var finished=0;
function finish(i) {
finished++;