Skip to content

Instantly share code, notes, and snippets.

>>> class F(object):
... __class__ = list
...
>>> f = F()
>>> f.__class__
<type 'list'>
>>> isinstance(f, F)
True
>>> isinstance(f, list)
True
{
"Type" : "Notification",
"MessageId" : "d9217124-7fde-5ce1-9382-3d9cd955c2f8",
"TopicArn" : "arn:aws:sns:us-west-2:262456549263:NotificationDeliveryFailure-play",
"Subject" : "DeliveryFailure event for app com.cureatr.messenger.play (MPNS)",
"Message" : "{\"DeliveryAttempts\":1,\"EndpointArn\":\"arn:aws:sns:us-west-2:262456549263:endpoint/MPNS/com.cureatr.messenger.play/23d917f8-25ba-36ff-bf08-b5da28402d83\",\"EventType\":\"DeliveryFailure\",\"FailureMessage\":\"mpns behaved in an unexpected way\",\"FailureType\":\"DeliveryFailedPerm\",\"MessageId\":\"258d8a40-1e8c-553b-b3d5-c6f8b807e695\",\"Resource\":\"arn:aws:sns:us-west-2:262456549263:app/MPNS/com.cureatr.messenger.play\",\"Service\":\"SNS\",\"Time\":\"2014-10-15T16:43:55.894Z\"}",
"Timestamp" : "2014-10-15T16:43:55.945Z",
"SignatureVersion" : "1",
"Signature" : "a5jaug9K3/H6DTps492z9SUXHPKMtm1oGI43aKBoykI2ikR8y7SZXPAfcsqWROAnWz3EJxRlXUklLXWBx2AFMH8Twiroi8thjrXhB2HQpAaMC7Z/zkg8yYcFrHS79UcIVhjIOAptIgC6Pdpele+Y/moiU8vETI2TKtsRfYgrvyCnQ89fW
@rectalogic
rectalogic / KeyValueObserver.swift
Last active January 19, 2018 10:25
Key Value Observing (KVO) in Swift using closures
import Foundation
typealias KVObserver = (source: NSObject, keyPath: String, change: [NSObject : AnyObject]) -> Void
class KVOContext {
private let source: NSObject
private let keyPath: String
private let observer: KVObserver
func __conversion() -> UnsafeMutablePointer<KVOContext> {
import httplib
import filedata
def post_multipart(host, selector, files):
"""
Post files to an http host as multipart/form-data.
files is a sequence of (name, filename, value) elements for data to be uploaded as files
Return the server's response page.
"""
@rectalogic
rectalogic / LumaWipe.glsl
Created June 17, 2014 02:11 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
uniform sampler2D lumaTex;
uniform bool invertLuma;
uniform float softness;
import uuid
from pylons import response
@login_required_json
@jsonify2
def test_stream(self):
for i in range(10000):
response.body_file.write(u"{0} {1}\n".format(i, str(uuid.uuid4())))
import zipfile
import sys
class StreamFile(object):
def __init__(self, fileobj):
self.fileobj = fileobj
self.pos = 0
def write(self, str):
@rectalogic
rectalogic / CrossZoom.glsl
Last active March 25, 2022 05:10 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
// Converted from https://github.com/rectalogic/rendermix-basic-effects/blob/master/assets/com/rendermix/CrossZoom/CrossZoom.frag
// Which is based on https://github.com/evanw/glfx.js/blob/master/src/filters/blur/zoomblur.js
// With additional easing functions from https://github.com/rectalogic/rendermix-basic-effects/blob/master/assets/com/rendermix/Easing/Easing.glsllib
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
@rectalogic
rectalogic / Slide.glsl
Last active March 17, 2016 22:31 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
// Converted from https://github.com/rectalogic/rendermix-basic-effects/blob/master/assets/com/rendermix/Slide/Slide.frag
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
// Slide Down: translateX = 0, translateY = -1
title = self.wait_for_visible_element(By.NAME, 'Title')
self.driver.execute_script("mobile: tap", {"element": title.id, "x": 0.5, "y": 0.5})