merge
[s1] ----a-----b--c---->
[s2] o----------------->
s3 = s1.merge(s2)
[s3] o---a-----b--c---->
startsWith, merge
merge
[s1] ----a-----b--c---->
[s2] o----------------->
s3 = s1.merge(s2)
[s3] o---a-----b--c---->
startsWith, merge
| // Drag n Drop, using streaming paradigm | |
| const fromEvent = Rx.Observable.fromEvent | |
| const widget = document.getElementById('widget') | |
| const container = document.getElementById('container') | |
| // streams | |
| const mouseDowns = fromEvent(widget, 'mousedown') | |
| const mouseUps = fromEvent(container, 'mouseup') | |
| const mouseMoves = fromEvent(container, 'mousemove') |
| abstract class AngularShim extends React.Component<Props, State> { | |
| private _div | |
| public state = { | |
| scope: null | |
| } | |
| componentWillMount() { | |
| const scope = Object.assign($rootScope.$new(true), { props: this.props }, this.getScopeMethods()) | |
| this.setState({scope}) | |
| } |
| // quicksort sorting algorithm, in 2 lines of code | |
| let quicksort = ([a, ...as]) => { | |
| if (a == null) return as | |
| return quicksort(as.filter(x => x <= a)) | |
| .concat([a]) | |
| .concat(quicksort(as.filter(x => x > a))) | |
| } | |
| let test1 = [5,1,2,3,5,6]; |
| module.exports = (robot) -> | |
| robot.hear /^(.+)$/i, (res) -> | |
| logToRedshift | |
| message: res.match[1] | |
| user: res.message.user.name.toLowerCase() |
| trues = (n) -> [1..n].map Boolean | |
| # array of functions to be speed tested | |
| tests = [ | |
| [ | |
| ( | |
| (bools) -> _.every bools # .097ms | |
| ) | |
| trues(1000) |
| /* returns an array of unique classes in the DOM */ | |
| var getUniqueClasses = function() { | |
| var elementArray = [].slice.call(document.querySelectorAll('*')); | |
| return _(elementArray) | |
| .pluck('classList') | |
| .map(_.toArray) | |
| .flatten() | |
| .unique() |
| <!-- Does this make sense for our component APIs? --> | |
| <smartlist-details | |
| smartlist-id="smartlistId" | |
| ></smartlist-details> | |
| <ipad-subscriptions | |
| smartlist-id="smartlistId" | |
| user-id="userId" | |
| fund-id="fundId" |
| <h1>Screen Details</h1> | |
| <ul ng-if="smartlist"> | |
| <li> | |
| <span>Created By</span> | |
| <span>{{ smartlist.createdBy | userShortName }}, {{ smartlist.createdOn | date: "shortDate" }}</span> | |
| </li> | |
| <li> |