Skip to content

Instantly share code, notes, and snippets.

Battery about to die

Okke Timm okket

Battery about to die
Block or report user

Report or block okket

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
okket / AVAudioEngine.swift
Last active Dec 27, 2017
AVAudioEngine in Playground
View AVAudioEngine.swift
// AVAudioEngine Playground - requires OS X 10.10
import Cocoa
import AVFoundation
// Keep playground running
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)
// Setup engine and node instances
var engine = AVAudioEngine()
View Reflections.swift
import Foundation
func typestring(x : Any) -> String
if let obj = x as? NSObject {
return NSStringFromClass((x as NSObject).dynamicType)
// Native Swift
switch x {
View QuickLook.swift
// Custom QuickLook objects in Playground, see
import UIKit
@objc class BezierCircle {
var color : UIColor
var path : UIBezierPath
var radius : Double
init (_ radius : Double, _ color : UIColor = UIColor.redColor()) {
View WebKit.swift
// WebKit Window in 30 lines of Swift code
// see
import Cocoa
import WebKit
let application = NSApplication.sharedApplication()
let window = NSWindow(contentRect: NSMakeRect(0, 0, 800, 600), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask, backing: .Buffered, defer: false)
window.title = "Minimal Swift WebKit Browser"
View TableView.swift
import UIKit
class PlainTableViewController: UITableViewController {
var dataSource = String[]()
override func viewDidLoad() {
dataSource = ["one","two","three"]
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
View Dockerfile
FROM iojs:1.5.0
RUN npm install -g bower
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY bower.json /usr/src/app/
RUN bower install --allow-root
okket / gist:fca8983296c031ea4eb6
Last active Aug 29, 2015
libvirt get ip address
View gist:fca8983296c031ea4eb6
# Method 1:
arp -an | grep $(virsh dumpxml $VIRTUAL_MACHINE_NAME | grep '<mac' | grep -o '\([0-9a-f][0-9a-f]:\)\+[0-9a-f][0-9a-f]') | grep -o '\([0-9]\{1,3\}\.\)\+[0-9]\{1,3\}'
# Method 2: (needs guest-agent)
okket / Links
Last active Jan 27, 2016
WWDC 2015 HD Videos Download Links
View Links
View application.controller.js
import Ember from 'ember';
var counter=1;
export default Ember.Controller.extend({
model: [{id: 2, mark: 'blue'},{id: 1, mark: 'red'}],
appName: 'Ember Twiddle',
count: counter,
shipmentType: 'regularDelivery',
actions: {
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
You can’t perform that action at this time.