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
using System; | |
using System.IO; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using System.Xml; | |
using System.Xml.Serialization; | |
namespace ConsoleApplication1 | |
{ | |
class Program |
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 fTable = | |
let rec factorial prev pos = seq { | |
let current = prev * pos | |
yield current | |
yield! factorial current (pos + 1) | |
} | |
factorial 1 1 |
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
var Q = require( 'q' ); | |
var xyz = { x : 5, y : 6, z : 7 }; | |
Q.all([ | |
// simulates a time consuming io operation | |
Q.delay( 200 ).then( function (){ | |
console.log( 'first task ---------------' ); | |
console.log( 'x : ' + xyz.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
var Q = require( 'q' ); | |
var overwrite_array = function ( source, array ){ | |
var result = source.slice( 0 ); | |
Array.prototype.splice.apply( result, [ 0, array.length ].concat( array )); | |
return result; | |
}; | |
var xyz = [ 5, 6, 7 ]; |
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
build_assets : function ( config, promise, type, tmp_dir ){ | |
var self = this; | |
var path = config.path[ type ]; | |
var assets = config[ type ]; | |
return promise.all( Object.keys( assets ).map( function ( group ){ | |
var input = assets[ group ].site ? assets[ group ].site.map( function ( asset ){ | |
return self.pub_dir + path + '/' + asset + '.' + type; | |
}) : []; | |
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
find_all_user_emails : function ( count, next ){ | |
var i = Math.ceil( count / 10000 ); | |
var skip = 0; | |
var promises = []; | |
for( ; i-- ; ){ | |
promises.push( User. | |
find({ is_verified : true }) | |
lean(). | |
select( 'email' ). |
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
var gestureObservable = Rx.Observable.createWithDisposable(function (observer) { | |
var gesture = new MSGesture(); | |
gesture.target = gestureTarget; | |
var pointerSub = Rx.Observable.fromEvent(gestureTarget, "pointerdown") | |
.subscribe((ev: any) => gesture.addPointer(ev.pointerId)); | |
var gestureSub = Rx.Observable.fromEvent(gestureTarget, "MSGestureTap") | |
.subscribe((ev: MSGestureEvent) => observer.onNext(ev)); | |
return new Rx.CompositeDisposable( | |
pointerSub, |
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 imageSizeGetter(image: HTMLImageElement, callback: (size:[number, number]) => any): void { | |
if (image.width > 0 && image.height > 0) { | |
callback([image.width, image.height]); | |
} else { | |
var observer = new MutationObserver(function (record) { | |
observer.disconnect(); | |
callback([image.width, image.height]); | |
}); | |
observer.observe(image, { | |
attributes: 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
import Cycle, {Rx, h} from 'cyclejs'; | |
Cycle.registerCustomElement('x-element', function (rootElem$, props) { | |
let vtree$ = props.get('list$').map((list) => | |
h('div', null, [ | |
h('ol', list.map((value) => h('li', null, value))) | |
])); | |
rootElem$.inject(vtree$); | |
}); |
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 Cycle, {Rx, h} from 'cyclejs'; | |
Cycle.registerCustomElement('TodoList', (rootElem$, props) => { | |
let vtree$ = props.get('items$').map(items => | |
h('div', h('ul', items.map((itemText, index) => | |
h('li', { key: index + itemText }, itemText))))); | |
rootElem$.inject(vtree$); | |
}); | |
let vtree$ = Cycle.createStream(function (interaction$) { |