Skip to content

Instantly share code, notes, and snippets.

View borismus's full-sized avatar

Boris Smus borismus

View GitHub Profile
@borismus
borismus / pointer-events-spec
Created July 24, 2012 08:57
A proposal for the pointer events specification. Started based on http://goo.gl/i32Q9
Interfaces
==========
Jargon... "Persistent points" will be mouse, pen tablets, and other pointing devices that
leave a "cursor" even when it's not being used. "Volatile points" are input points in the
context of surface based input devices, or others that do not leave a cursor when
inactive. (i.e. Wiimotes) Surface input devices may or may not have proximity support,
and the event firing model should be different based on that.
TODO: The names "persistent" and "volatile" sound pretty bad. Personally would like to change it.
@borismus
borismus / gist:2918946
Created June 12, 2012 17:38
Pinch-zoom recognizer
/**
* Gesture recognizer for compound multi-touch transformations.
*
* 1. pinch/zoom/scale gesture.
* 2. rotate gesture.
*/
function TransformRecognizer(element) {
// Reference positions for the start of the transformation.
this.referencePair = null;
What is the variance in pixel sizes across devices? Compute it.
Since we have so many devices, pixels don't make sense anymore. Leave it
to somebody else.
I'd like to just say "this button is 5x5cm" and scale stuff
appropriately. CSS pixels suck since they aren't really pixels. Apple
guidelines say 44x44px as min size but this is fundamentally about the
real size of the display, not pixels. Actually double check iPad vs
iPhone.
content/posts/.../my-new-post/index.txt
My new post
===========
posted: 2012-03-01
Just **testing**
1. Hello
2. World
@borismus
borismus / gist:2165681
Created March 23, 2012 00:06
dynamic template loading
/*
* Loads a handlebars.js template at a given URL. Takes an optional name, in which case,
* the template is added and is reference-able via templateName.
*/
function loadTemplate(url, name, callback) {
var contents = $.get(url, function(templateText) {
var compiledTemplate = Ember.Handlebars.compile(templateText);
if (name) {
Ember.TEMPLATES[name] = compiledTemplate
} else {
@borismus
borismus / gist:1990752
Created March 7, 2012 03:35
Ember project setup
/static/sass/:
screen.scss: (common stylesheet)
phone.scss, tablet.scss, desktop.scss: (form factor-specific styles)
/static/js/:
libs/: (external libraries - DO NOT MODIFY)
ember-and-friends.js
jquery.js
formfactor.js
views/: (form-factor specific views)
positionView: function() {
console.log('positioning');
// TODO: Fix this nonsense.
// Check for the existence of this.element because when the transition
// value initially changes, the element doesn't actually exist!
if (this.get('element')) {
this.get('element').style.webkitTransform =
'translate(0, ' + this.get('transition') + 'px)';
}
p {
font-size: 110%;
}
#!/usr/bin/env python
import boto
AWS_ACCESS_KEY_ID = 'foo'
AWS_SECRET_ACCESS_KEY = 'bar'
bucket_name = 'baz'
conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket = conn.create_bucket(bucket_name,
@borismus
borismus / gist:1224416
Created September 17, 2011 22:01
Autobahn KeySocket
from twisted.internet import reactor
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol
from threading import Thread
class KeySocketProtocol(WebSocketServerProtocol):
def __init__(self, factory):
self.factory = factory
def onOpen(self):
self.factory.clients.append(self)