Skip to content

Instantly share code, notes, and snippets.

@sigma
sigma / ipy_profile_gae.py
Created August 29, 2010 09:39
#published GAE #ipython configuration
import IPython.ipapi
from getpass import getpass
from netrc import netrc
from optparse import OptionParser
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.tools.appcfg import AppCfgApp, StatusUpdate
from google.appengine.tools.bulkloader import RequestManager
@vmihailenco
vmihailenco / assets.py
Created October 23, 2011 16:00
AppEngineBundle for WebAssets
"""
This gist adds url expiration functionality to flask-webassets on App Engine.
Few hints how to use it:
- Disable updater: ASSETS_UPDATER = False.
- Use AppEngineBundle instead of standard webassets Bundle.
- Rebuild assets manually:
* manage.py assets watch for development.
* manage.py assets rebuild for deployment.
@Seldaek
Seldaek / Default.sublime-theme
Created January 13, 2012 09:40
Patch for Sublime Text 2 "highlight_modified_tabs" (missing in b2165)
/* Path: Packages/Theme - Default/Default.sublime-theme, add add the end before the ']' */
/* Patch for highlight_modified_tabs */
,{
"class": "tab_control", "attributes": ["dirty"],
"tint_modifier": [255, 255, 0, 230],
"layer0.texture": "Theme - Default/dark_tab_mask3.png",
"layer2.texture": "Theme - Default/dark_unselected_tab_bg2.png",
"layer2.opacity": 1.0
},
@aschreyer
aschreyer / blueprint-converter.py
Created July 9, 2012 19:43
Adding custom URL map converters to Flask Blueprint objects
from flask import Blueprint
import converters # module containing the custom converter classes
def add_app_url_map_converter(self, func, name=None):
"""
Register a custom URL map converters, available application wide.
:param name: the optional name of the filter, otherwise the function name
will be used.
"""

An interesting challenge for centralized state

I build distributed frontends using components ([preact] components, but that's not important). Components are a great unit of composition when the structure of a system cannot be statically determined.

Prerequisites

In the following examples, I'm going to pretend there exists a common definition for a <SplitPoint> component:

SplitPoint invokes an async load() function (passed as a prop), then renders result as its child.

@developit
developit / unistore.js
Last active September 8, 2020 15:13
Update: the newer & better version of this is published: https://github.com/developit/unistore
import { h, Component } from 'preact';
/** Creates a new store, which is a tiny evented state container.
* @example
* let store = createStore();
* store.subscribe( state => console.log(state) );
* store.setState({ a: 'b' }); // logs { a: 'b' }
* store.setState({ c: 'd' }); // logs { c: 'd' }
*/