Skip to content

Instantly share code, notes, and snippets.

View Cfeusier's full-sized avatar

Clark Feusier Cfeusier

View GitHub Profile
var count = 0,
btnCount = document.getElementById('clicker'),
btnEnd = document.getElementById('ender'),
endO = Rx.Observable.fromEvent(btnEnd, 'click');
function counter() {
console.log(++count);
}
function resultLogger() {
alert(
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.0/rx.all.min.js"></script>
</head>
<body>
<h1>RxJs Click Counter</h1>
<button id="clicker">Increase Count</button>
<button id="ender">Unsubscribe from Click Stream</button>
<script>
var count = 0,
app.on('ready', this.startMainWindow.bind(this));
var BrowsersManager = {
bindMtds: function() {
bindAll(this,
'setupReporters',
'setConfigs',
'setBrowsers',
'startMainWindow',
'loadClientApp',
'displayMainWindow',
'registerEvents',
@Cfeusier
Cfeusier / bind_bindAll.js
Last active September 19, 2015 00:40
Replacement for underscore's .bindAll function
function bindAll(obj) {
for (var key, i = 1, length = arguments.length; i < length; i++) {
key = arguments[i];
obj[key] = bind(obj[key], obj);
}
return obj;
}
function bind(func, ctx) {
var ctxArgs = Array.prototype.slice.call(arguments, 2);
@Cfeusier
Cfeusier / underramdash.js
Last active January 31, 2016 11:07
2kb unminified/unzipped drop-in for the usual utility functions
var underramdash = {
each: each,
map: map,
reduce: reduce,
filter: filter,
flatten: flatten,
uniq: uniq,
extend: extend,
every: every,
identity: identity
# command
grep -n console.log example.js
# output
1: console.log(hey there);
8: console.log(msg);
# command
sed -n '/console.log/{=;p;}' example.js | sed '{N;s/\n/ /}'
# output
1 console.log(hey there);
8 console.log(msg);
# command
sed -n '/console.log/{=;p;}' example.js
# output
1
console.log(hey there);
8
console.log(msg);
# command
sed -n '/console.log/'p example.js
# output
console.log(hey there);
console.log(msg);