Skip to content

Instantly share code, notes, and snippets.

@wmarbut
wmarbut / displayres.swift
Created June 16, 2015 05:47
Get all available display resolutions on your machine
//
// main.swift
// Created by grep-awesome on 6/15/15.
//
import Foundation
import CoreGraphics
var displayConfig: CGDisplayConfigRef = nil
let mainDisplayID = CGMainDisplayID()
@wmarbut
wmarbut / keybase.md
Last active March 23, 2017 13:22
keybase.md

Keybase proof

I hereby claim:

  • I am wmarbut on github.
  • I am wmarbut (https://keybase.io/wmarbut) on keybase.
  • I have a public key whose fingerprint is 8D7A B6CE 58DF 1DB3 2BB4 1209 BA30 3A5B 8DF5 69DA

To claim this, I am signing this object:

console.log('Without do')
for i in [1..10]
if !n?
n = 5
n = n * 5
console.log(n)
console.log('With do')
@wmarbut
wmarbut / ember_computed_property_coffeescript.coffee
Created April 22, 2013 19:58
Ember computed properties in coffeescript
Ember.Object.extend
other_property: 2
computed_property: (->
@get('other_property')*5
).property('other_property')
@wmarbut
wmarbut / Ember-Runtime-Map.js
Last active December 16, 2015 08:29
Allow adding routes at runtime by using `App.MapRoutes` instead of `App.Router.map`
App.map_routes = [];
App.MapRoutes = function(routes) {
App.map_routes.push(routes);
return App.Router.map(function() {
var route_lamda, _i, _len, _ref;
_ref = App.map_routes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
route_lamda = _ref[_i];
route_lamda.call(this);
Parent view didInsertElement app.js:615
after render called app.js:617
2 Child view didInsertElement app.js:590
@wmarbut
wmarbut / gist:5078059
Created March 3, 2013 20:10
Correctly set url hash in ember rc1 when not using ember data. Referring to SO question http://stackoverflow.com/questions/15182690/ember-js-rc1-model-hook-on-route-not-called
/* SO http://stackoverflow.com/questions/15182690/ember-js-rc1-model-hook-on-route-not-called */
serialize: function(model, params) {
if ((model != null) && model.get('id')) {
return { id: model.get('id') };
} else {
return this._super(model, params);
}
}