Skip to content

Instantly share code, notes, and snippets.

View trevorah's full-sized avatar

Andy Trevorah trevorah

  • London
View GitHub Profile
@trevorah
trevorah / VagrantFile
Created June 28, 2014 15:24
SmartOS with Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "livinginthepast/smartos-base64-13.4.0"
config.vm.provider "virtualbox" do |v|
@trevorah
trevorah / gist:bfeb4ad69e4633dc76c5
Last active September 1, 2015 11:04
Enable logging for node-webkit / nw.js in windows
  1. Install Sawbuck. This tool will capture logs for all chrome-based applications.
  2. Add "Content Shell" to your list of Providers in Sawbuck by adding these registry entries to your machine (NOTE the optional Wow6432Node key for x64 machines):
  3. Find: HKLM\SOFTWARE\[Wow6432Node\]Google\Sawbuck\Providers
  4. Add a subkey with the name {6A3E50A4-7E15-4099-8413-EC94D8C2A4B6}
  5. Add these values: * Key: (Default), Type: REG_SZ, Value: Content Shell * Key: default_flags, Type: REG_DWORD, Value: 00000001 * Key: default_level, Type: REG_DWORD, Value 00000004

Alternatively, use this .reg file to do the above for you (in x86) (courtesy of @mydigitalself).

class MasterViewController: UITableViewController {
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if let indexPath = tableView.indexPathForSelectedRow {
let object = objects[indexPath.row] as! NSDate
let controller = (storyboard?.instantiateViewControllerWithIdentifier("DetailViewController"))! as! DetailViewController
controller.detailItem = object
controller.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
controller.navigationItem.leftItemsSupplementBackButton = true
class MasterViewController: UITableViewController {
let cache = NSCache()
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if let indexPath = tableView.indexPathForSelectedRow {
let object = objects[indexPath.row] as! NSDate
let controller = cache.objectForKey(object) as? DetailViewController ?? (storyboard?.instantiateViewControllerWithIdentifier("DetailViewController"))! as! DetailViewController
cache.setObject(controller, forKey: object)
controller.detailItem = object
class DetailViewController: UIViewController, NSDiscardableContent {
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func beginContentAccess() -> Bool {
return true
}
func endContentAccess() {}