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
const stream = require('stream'); | |
const fs = require('fs'); | |
class EchoStream extends stream.Writable { | |
_write(chunk, enc, next) { | |
console.log(chunk.toString()); | |
next(); | |
} | |
} |
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 fibonacci($n) { | |
if (is_int($n)) { | |
return round(pow((sqrt(5)+1)/2, $n) / sqrt(5)); | |
} else { | |
throw new Exception('Value should be an integer'); | |
} | |
} |
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 fs = require('fs'); | |
var files = ['foo.txt', 'bar.txt', 'baz.txt']; | |
var promises = []; | |
for (var i = 0; i < files.length; i++) { | |
promises.push(readFile(files[i])); | |
} |
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
/** | |
* This is module to test. | |
*/ | |
module.exports = { | |
camelCase: function(string) { | |
return string.replace(/-[a-z]/g, function(match) { | |
return match[1].toUpperCase() + match.slice(2); | |
}); | |
}, | |
dashSeparated: function(string) { |
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
describe('findByNavigator()', function() { | |
var geolocator, fnDone, fnFail; | |
beforeEach(function() { | |
geolocator = new Geolocator({language: 'fi'}); | |
}); | |
it('can find user location', function() { | |
var location, address, components; |
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
/** | |
* Jasmine RequestAnimationFrame: a set of helpers for testing funcionality | |
* that uses requestAnimationFrame under the Jasmine BDD framework for JavaScript. | |
*/ | |
;(function() { | |
var index = 0, | |
callbacks = {}; | |
function MockRAF(global) { |
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
describe('run()', function() { | |
var realNextFrame, realCancelFrame; | |
beforeEach(function() { | |
jasmine.clock().install(); | |
jasmine.RequestAnimationFrame.install(); | |
realNextFrame = window.nextFrame; | |
realCancelFrame = window.cancelFrame; | |
window.nextFrame = window.requestAnimationFrame; |
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(window) { | |
'use strict'; | |
/** | |
* AsyncQueue allows you to create a queue of function to be executed via | |
* setTimout that guaranteed to run in order. This can enable to run | |
* process-intensive operations without locking up UI. | |
* | |
* @constructor |
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
/** | |
* JSON response from controller's action. | |
*/ | |
public function run( ) | |
{ | |
JFactory::getDocument()->setMimeEncoding( 'application/json' ); | |
JResponse::setHeader('Content-Disposition','attachment;filename="progress-report-results.json"'); | |
$data = array( | |
'foo' => 'bar' |
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
<!DOCTYPE html> | |
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]--> | |
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]--> | |
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]--> | |
<!--[if IE 9 ]> <html class="ie9" lang="en"> <![endif]--> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]--> | |
<body></body> | |
</html> |
NewerOlder