This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run any SwiftUI view as a Mac app. | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack { | |
Text("Hello, World") | |
.padding() | |
.background(Capsule().fill(Color.blue)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gist explains how to setup scalable Parse LiveQuery server on Heroku | |
// Because there is one and only 'web' process on Heroku, it will divide into two Heroku apps: Main and LiveQuery. | |
// A: Main app - All features except for LiveQuery server | |
// Step A1. Setup a Parse app on Heroku | |
// Step A2. Add a Heroku Redis (free plan is enough for testing) | |
// Step A3. Configure Parse app, add redisURL for liveQuery | |
var api = new ParseServer({ | |
... | |
liveQuery: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import urllib | |
import requests | |
import json | |
import random | |
""" | |
here is a wrapper for the *unreleased* electric objects API | |
Built by Harper Reed (harper@nata2.org) - @harper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension NSDate { | |
var calendar: NSCalendar { | |
return NSCalendar(identifier: NSGregorianCalendar)! | |
} | |
func after(value: Int, calendarUnit:NSCalendarUnit) -> NSDate{ | |
return calendar.dateByAddingUnit(calendarUnit, value: value, toDate: self, options: NSCalendarOptions(0))! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for family in UIFont.familyNames() { | |
let sName: String = family as String | |
println("family: \(sName)") | |
for name in UIFont.fontNamesForFamilyName(sName) { | |
println("name: \(name as String)") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sound : NSObject { | |
/// The player. | |
var avPlayer:AVAudioPlayer! | |
/** | |
Uses AvAudioPlayer to play a sound file. | |
The player instance needs to be an instance variable. Otherwise it will disappear before playing. | |
*/ | |
func readFileIntoAVPlayer() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIColor+RGB.swift | |
// Copyright (c) 2014 Massimiliano Bigatti. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
/** | |
UIColor extension that add a whole bunch of utility functions like: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import Webkit | |
class BasicChildBrowser:UIViewController, WKNavigationDelegate { | |
let web = WKWebView() | |
let toolbar = UIToolbar() | |
let progressSpinner = UIActivityIndicatorView(activityIndicatorStyle: .White) | |
let progressBar = UIProgressView(progressViewStyle: .Bar) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// (string) $message - message to be passed to Slack | |
// (string) $room - room in which to write the message, too | |
// (string) $icon - You can set up custom emoji icons to use with each message | |
public static function slack($message, $room = "engineering", $icon = ":longbox:") { | |
$room = ($room) ? $room : "engineering"; | |
$data = "payload=" . json_encode(array( | |
"channel" => "#{$room}", | |
"text" => $message, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application:open-your-keymap | |
application:open-your-stylesheet | |
autocomplete:attach | |
autoflow:reflow-paragraph | |
bookmarks:clear-bookmarks | |
bookmarks:jump-to-next-bookmark | |
bookmarks:jump-to-previous-bookmark | |
bookmarks:toggle-bookmark | |
bookmarks:view-all | |
check:correct-misspelling |
NewerOlder