Skip to content

Instantly share code, notes, and snippets.

@joseph
joseph / klass3.js
Created March 25, 2014 21:18
JS class pattern [3]
// AMD module definition:
define(function (require) {
// An instantiable class:
var ClassName = function () {
// All private instance data is stored in this._
this._ = {};
this._initialize();
};
@joseph
joseph / klass4.js
Last active August 29, 2015 13:57
JS class pattern [4]
// AMD module definition:
define(function (require) {
// An instantiable class:
var ClassName = function () {
// All private instance data is stored in this._
this._ = {};
this._initialize();
}, PROTO = ClassName.prototype;
@joseph
joseph / touch_hound.js
Created October 13, 2014 16:41
TouchHound translates touch events back into iframes, for iOS8 home screen app workaround
define(function (require) {
var Gala = require('gala');
var C = require('common');
var TouchHound = function (element) {
this._ = {};
this._.element = element;
var handle = this._handleEvent.bind(this);
this._.handler = new Gala.ContactHandler(
@joseph
joseph / WKWebViews+keyboardRequiresUserInteraction.swift
Last active October 23, 2017 16:03 — forked from Pranit-Harekar/WKWebViews+keyboardRequiresUserInteraction.swift
Add keyboardRequiresUserInteraction to WKWebViews
import WebKit
// This swizzle allows JavaScript to set the focus on an input, not just when a user is interacting.
//
extension WKWebView {
private typealias StartAssistingNodeMethodType = @convention(c) (Any, Selector, UnsafeRawPointer, Bool, Bool, Any) -> Void
private typealias StartAssistingNodeClosureType = @convention(block) (Any, UnsafeRawPointer, Bool, Bool, Any) -> Void
func focusInputsWithoutUserInteraction() {
an experiment in strategizing semantle-like puzzles
(adjective, value)
good
(bad)
(adverb, value)
yes
(no)