Skip to content

Instantly share code, notes, and snippets.

Avatar
🥕
Upgrading Your Health

Dave Arel davearel

🥕
Upgrading Your Health
View GitHub Profile
View swiftui.swift
import Combine
import CoreFoundation
import CoreGraphics
import CoreText
import Darwin
import Foundation
import SwiftUI
import UIKit
import os.log
import os
View Bindable.swift
/// Similar to a `Binding`, but this is also observable/dynamic.
@propertyDelegate
@dynamicMemberLookup
final class Derived<A>: BindableObject {
let didChange = PassthroughSubject<A, Never>()
fileprivate var cancellables: [AnyCancellable] = []
private let get: () -> (A)
private let mutate: ((inout A) -> ()) -> ()
init(get: @escaping () -> A, mutate: @escaping ((inout A) -> ()) -> ()) {
self.get = get
View jquery_usage.js
// Use an AMD package here to gain access to nested internal modules.
require.config({
packages: [{
name: "jquery",
location: "vendor/jquery/src",
main: "index.js"
}]
});
// If we are using AMD, we don't care about core.
View jquery_amd.js
define([
// jquery core is always required
'jquery/core',
// jquery utilities
'jquery/ajax',
'jquery/data'
], function(jq, ajax, data) {
View gist:8924778
if (!HTMLVideoElement.prototype.canPlayType) {
HTMLVideoElement.prototype.canPlayType = function(type) {
return [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
@tbranyen
tbranyen / canvas.js
Created Feb 2, 2012
Lightweight canvas wrapper.
View canvas.js
// Basic Usage:
//
// var main = new Canvas({ elem: "canvas" }, function(options) {
// // Instantiate anything specific here...
// // Main draw loop
// this.draw = function() {
//
// };
// });
//