Skip to content

Instantly share code, notes, and snippets.

@toioski
toioski / script.applescript
Last active June 5, 2023 01:30
Automatically Open Safari Dev Tools for iOS Simulator
-- `menu_click`, by Jacob Rus, September 2006.
-- Ref: https://stackoverflow.com/questions/14669542/automatically-open-the-safari-debugger-when-the-iphone-simulator-is-launched
on menu_click(mList)
local appName, topMenu, r
-- Validate our input
if mList's length < 3 then error "Menu list is not long enough"
-- Set these variables for clarity and brevity later on
@thomassnielsen
thomassnielsen / example.swift
Created November 2, 2014 12:48
Loadingbar component for WKWebView
import UIKit
import WebKit
import LoadingBarKit
class ViewController: UIViewController {
@IBOutlet var loadingBar: LoadingBar!
var webView: WKWebView?
override func viewDidLoad() {
super.viewDidLoad()
self.webView?.addObserver(self, forKeyPath: "estimatedProgress", options: NSKeyValueObservingOptions.New, context: nil)
@FireyFly
FireyFly / example.js
Last active October 6, 2015 03:38
Using `extend` for "subclassing"
var Person = Base.inherit({
// missing: name
// A person can tell you its name.
talk: function() {
return "Hello, I'm " + this.name
}
})
var WorkingPerson = Person.inherit({
@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {