This file contains 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
angular.module('myApp', ['ngPluralizeHtml']) | |
function AppController() { | |
var vm = this; | |
vm.count = 10; | |
} | |
.controller('AppController', AppController); |
This file contains 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
// Let's define a basic Swift class. | |
class Fruit { | |
var type=1 | |
var name="Apple" | |
var delicious=true | |
} | |
// We can get at some info about an instance of an object using reflect(), which returns a Mirror. | |
reflect(Fruit()).count | |
reflect(Fruit())[1].0 |
This file contains 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 Cocoa | |
// Only needed until we have class variables | |
var __SwizzleSayHello = { (who:String) -> String in | |
return "Hello, \(who)" | |
} | |
class Swizzle { | |
//Only needed until we have class variables | |
class var _sayHello : (String)->String { get{ return __SwizzleSayHello } set (swizzle) {__SwizzleSayHello = swizzle} } |
This file contains 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 Container { | |
typealias Resolver = () -> AnyObject | |
private var _resolvers: [String: Resolver] = [:] | |
func register<T: AnyObject>(resolver: @autoclosure () -> T) { | |
let name = NSStringFromClass(T.self) | |
_resolvers[name] = resolver | |
} | |
func get<T: AnyObject>() -> T { |
This file contains 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
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { | |
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as UITableViewCell | |
if cell == nil { | |
cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: kCellIdentifier) | |
} | |
var rowData: NSDictionary = self.tableData[indexPath.row] as NSDictionary | |
// Add a check to make sure this exists |
This file contains 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
xcode-select --help | |
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer |
This file contains 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
describe.skip('handler only', function() { | |
// this suite of tests will show database mocking. if you don't want to mock the database, you will have to | |
// use mf-test-helpers to setup the data you want before running the test (what we've always done) | |
it('calls the route handler directly with mocked data', function(done) { | |
// stub dependencies | |
// stub mfData.query | |
var queryStub = sinon.stub(mfData.db, 'query'); | |
// removeSnapshotForCoursesNoLongerInSeries |
This file contains 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
// Phone | |
func application(application: UIApplication, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]?, reply: (([NSObject : AnyObject]!) -> Void)!) { | |
if let request = userInfo!["request"] as? String { | |
if request == "refreshData" { | |
reply(["fromPhone": NSKeyedArchiver.archivedDataWithRootObject("iPhone data")]) | |
return | |
} | |
} | |
This file contains 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
<div class="span8 offset2"> | |
<div class="row-fluid" ng-repeat="graph in graphsModel track by $index" ng-if="$index%2==0"> | |
<div class="span6"> | |
<img width="500px" ng-src="{{graphsModel[$index].url}}"> | |
</div> | |
<div class="span6"> | |
<img width="500px" ng-src="{{graphsModel[$index + 1].url}}"> | |
</div> | |
</div> | |
</div> |
This file contains 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
(function () { | |
"use strict"; | |
angular.module('utils.htmlPartialScriptLoader', []) | |
.factory('htmlPartialScriptLoader', htmlPartialScriptLoader); | |
function htmlPartialScriptLoader($q, scriptsForPartial) { | |
return { | |
response: response |