This file contains hidden or 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'; | |
const images = ["jarjan", "aio___", "kushsolitary", "kolage", "idiot", "gt"]; | |
const models = [...Array(5).fill().map(() => `https://s3.amazonaws.com/uifaces/faces/twitter/${images[(Math.random() * images.length) | 0]}/128.jpg`)]; | |
const otherModels = [...Array(10).fill().map(() => `https://s3.amazonaws.com/uifaces/faces/twitter/${images[(Math.random() * images.length) | 0]}/73.jpg`)]; | |
This file contains hidden or 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'; | |
let i = 0; | |
export default Ember.Component.extend({ | |
classNames: ['mouse-leave'], | |
classNameBindings: ['isOpened:is-opened'], | |
left: [], | |
click() { | |
set(this, 'isOpened', true); |
This file contains hidden or 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
/* global Node */ | |
import { assert } from 'ember-debug'; | |
import { fireEvent, focus, matches } from '../system/synthetic-events'; | |
export default class NodeQuery { | |
static query(selector, context = document) { | |
assert(`Invalid second parameter to NodeQuery.query`, context && context instanceof Node); | |
return new NodeQuery(toArray(context.querySelectorAll(selector))); | |
} |
This file contains hidden or 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 dummyRouter(owner, routeMapFunction) { | |
let customRouter = Router.extend(); | |
customRouter.map(routeMapFunction); | |
owner.register('router:main', customRouter.extend()); | |
owner.lookup('router:main').setupRouter(); | |
} | |
``` | |
``` |
This file contains hidden or 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
/** | |
* determine if existing elements for a given `root` || viewportDescriptor have the same observerOptions | |
* We need to test this because two elements may be using the same `root` but have different observerOptions | |
* i.e. viewportTolerance bottom: 500px vs. bottom: 0px | |
* We only compare primitive types and objects; not arrays or functions | |
* | |
* @method _hasSimilarElement | |
*/ | |
_hasSimilarElement(observerOptions, elements) { | |
return elements.some((testElement) => { |
This file contains hidden or 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.Component.extend({ | |
tagName: '' | |
}); |
This file contains hidden or 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 (global, factory) { | |
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | |
typeof define === 'function' && define.amd ? define(factory) : | |
(global.intersectionObserverAdmin = factory()); | |
}(this, (function () { 'use strict'; | |
function unwrapExports (x) { | |
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x; | |
} |
This file contains hidden or 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
defmodule Closest do | |
def closest(""), do: [{}, {}] | |
def closest(s) do | |
s | |
|> String.split | |
|> Enum.map(&String.to_integer/1) | |
|> Enum.with_index | |
|> Enum.map(&weight/1) | |
|> Enum.sort(&sort/2) |
This file contains hidden or 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 arrayOfApps = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]; | |
const N = [0, -1]; | |
const E = [1, 0]; | |
const S = [0, 1]; | |
const W = [-1, 0]; | |
const EMPTY = `~EMPTY_SIGIL~` | |
let directions = { N, E, S, W }; | |
let r_directions = { 'N': 'E', 'E': 'S', 'S': 'W', 'W': 'N' }; |
This file contains hidden or 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
defmodule Easydiagonal do | |
def diagonal(n, p) do | |
{sum, _acc} = build_triangle(n, p) | |
sum | |
end | |
defp build_triangle(n, p) do | |
# [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], ...] | |
Stream.iterate({0, [1]}, fn {sum, last} -> |