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
// inspiration: https://stackoverflow.com/a/3943023/558780 | |
// wc3 approach | |
public static func favorsDarkForeground(_ bgColor: UIColor) -> Bool { | |
if let rgb = bgColor.rgb() { | |
var uicolors: Array<Float> = [Float(rgb.red) / 255, Float(rgb.green) / 255, Float(rgb.blue) / 255]; | |
var c = uicolors.map({ (uicolor) -> Float in | |
if (uicolor <= 0.03928) { |
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 Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model() { | |
// object with computed property | |
var Parent = Ember.Object.extend({ | |
fullName: Ember.computed('first', 'last', function() { | |
return `${this.get('first')} ${this.get('last')}`; | |
}) |
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
// blend in with background, less visually jarring than native | |
$scrollbar-size: 7px; | |
::-webkit-scrollbar { | |
background-color: $background-color; | |
width: $scrollbar-size; | |
height: $scrollbar-size; | |
} | |
::-webkit-scrollbar-thumb { | |
background:#999; |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
actions: { | |
greet: function(friend) { | |
window.alert(`Hello, ${friend}!`); | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model: function() { | |
return 'Sandwich'; | |
} | |
}); |
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
var recursiveReplaceKey = function(object, oldKey, newKey) { | |
for (var key in object) { | |
if (object.hasOwnProperty(key)) { | |
if ($.isPlainObject(object[key])) { | |
// recurse to sub-object | |
util.recursiveReplaceKey(object[key], oldKey, newKey); | |
} | |
if (key === oldKey) { |