Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mna on github.
  • I am puerkitobio (https://keybase.io/puerkitobio) on keybase.
  • I have a public key ASBQI8bPLBlTqqWPMzLKY9Kqdb7wK_f0r2J4NJiLWYn27wo

To claim this, I am signing this object:

@mna
mna / Makefile
Created August 22, 2017 18:49
Code coverage for Swift Package Manager-based projects
# Using https://github.com/nakiostudio/xcov
.PHONY: test-cov
test-cov:
@swift package generate-xcodeproj
@xcodebuild -scheme MYSCHEME -derivedDataPath .build/xcode -enableCodeCoverage YES test
@xcov --scheme MYSCHEME --configuration Debug --derived_data_path .build/xcode --skip_slack --markdown_report
@rm -rf .build/xcode
@open xcov_report/index.html
@mna
mna / Backbone.ComputedPropertiesModel.js
Created April 12, 2012 23:48
This gist shows one way to implement read- and write-enabled computed properties on a Backbone Model, without polluting the attributes hash of the Backbone Model. It works with Backbone.ModelBinding, so computed properties may be bound to form elements.
/*global _, Backbone*/
// By Martin Angers (PuerkitoBio)
// This should be inside a module pattern. Defines a base Model class, could/should be merged with your
// own base Model.
// Dependencies: underscore (_) and Backbone.
var ComputedProperties = function(model) {
this.model = model;
this.properties = {};