Skip to content

Instantly share code, notes, and snippets.

View oskarols's full-sized avatar

Oskar Olsson oskarols

  • BackMarket
  • Germany
View GitHub Profile
var get = Ember.get, set = Ember.set, doc = document;
var FastSelectComponent = Ember.Component.extend({
items: null,
valuePath: 'value',
labelPath: 'label',
value: null,
selected: null,
tagName: 'select',
Ember.StyleBinding = Ember.Mixin.create({
concatenatedProperties: ['styleBindings'],
styleBindings: [],
_attachStyleBindings: function() {
var properties = this.get('styleBindings');
// initialize getting properties so the observers start firing
this.getProperties(properties);
@MyGGaN
MyGGaN / Problem
Last active August 29, 2015 13:57
Code golf card position probability
By simulating one milion times you should determine the probability that two cards
of the same value lies directly next to each other one or more times in a shuffled
deck. You may only use standard libraries of the language of your choise. The
result should be printed, eg. "0.95", and then the program should end. You're not
allowed to start your program with any parameters. Eg. if you're using JavaScript
you may start your program like so:
> node mySolution.js
0.95
@slindberg
slindberg / if-all-exists.js
Last active August 29, 2015 13:57
Bound conditional Handlebars helpers for Ember
import ifConditionHelper from 'myapp/helpers/if-condition';
/**
* Logical AND Existence Conditional Block
*
* Usage: {{#if-all-exists field1 field2}}Either field1 or field2 is truthy{{/if-all-exists}}
*
* Executes the given block if all arguments are defined
*/
export default function() {
@dagda1
dagda1 / union.js
Last active August 29, 2015 13:58
App.computed.union = function() {
var args, options, properties;
properties = a_slice.call(arguments);
args = properties.map((function(_this) {
return function(prop) {
return "" + prop;
};
})(this));