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
// flow-typed signature: 41c26b1157e954a0cd4ce3efa2131537 | |
// flow-typed version: <<STUB>>/tessel_v^2.0.0/flow_v0.75.0 | |
/** | |
* This is an autogenerated libdef stub for: | |
* | |
* 'tessel' | |
* | |
* Fill this stub out by replacing all the `any` types. | |
* |
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 Event(name){ | |
this.name = name; | |
this.callbacks = []; | |
} | |
Event.prototype.registerCallback = function(callback){ | |
this.callbacks.push(callback); | |
} | |
function Reactor(){ | |
this.events = {}; |
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
export function scrolledToBottom(window, marginFromBottom = 0) { | |
const documentBody = window.document.body; | |
const documentElement = window.document.documentElement; | |
const scrollTop = | |
(documentElement && documentElement.scrollTop) || documentBody.scrollTop; | |
const scrollHeight = | |
(documentElement && documentElement.scrollHeight) || | |
documentBody.scrollHeight; |
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
module.exports = (start, tag) => { | |
if (start) { | |
let endTime = process.hrtime(start) | |
let duration = parseInt((endTime[0] * 1000) + (endTime[1] / 1000000)) | |
console.log(`Duration for ${tag}: ${duration} msec`) | |
} else { | |
return process.hrtime() | |
} | |
} |
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
{ | |
"BDD Unit Test": { | |
"prefix": "bdd", | |
"body": [ | |
"describe('Given $1', () => {", | |
" afterEach(() => {", | |
" jest.resetAllMocks();", | |
" });", | |
" describe('when $2', () => {", | |
" test('then $3', async () => {", |
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 axios = require('axios').default; | |
function getAPIClient() { | |
const axiosConfig = { | |
baseURL: 'https://csrng.net/csrng/csrng.php', | |
timeout: 5000, | |
}; | |
return axios.create(axiosConfig); | |
} |
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
/* | |
* Package statuschecker checks the status of a given url and prints the online status | |
* to the console. | |
*/ | |
package main | |
import ( | |
"fmt" | |
"net/http" |
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
func TestUserFail(t *testing.T) { | |
func() { | |
defer func() { | |
if r := recover(); r == nil { | |
t.Errorf("TestUserFail should have panicked!") | |
} | |
}() | |
// This function should cause a panic | |
CreateUser(12, "hello") |
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
export GO111MODULE=on | |
env GOOS=linux go build -ldflags="-s -w" -o main | |
zip main.zip main |
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
declare module BABYLON { | |
export class Engine { | |
constructor(canvas:HTMLElement, antialias:boolean); | |
runRenderLoop(it:any); | |
resize(); | |
} | |
export class Scene { | |
constructor(engine:Engine); | |
render(); | |
} |