Lorem markdownum; Sic corporis vixque et haesit caudas verborum iactu deo contemptuque frangit hederae gemini. Iuncta at amens abrepti te traherent ille ponunt capitisque galeaque quidem ire. Cum non valuisse ignare promunturiumque feraxque: sors sub ver neque et scilicet veniensque quae. Avulsumque ducunt imas praestans, sua ego admovet castos.
This file contains 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 execFile = require('child_process').execFile; | |
var portSet = function(port, fn) { | |
var net = require('net') | |
var tester = net.createServer() | |
.once('error', function (err) { if (err.code != 'EADDRINUSE') return fn(err); fn(null, true) }) | |
.once('listening', function() { | |
tester.once('close', function() { fn(null, false) }) | |
.close() | |
}) |
This file contains 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 express = require('express'); | |
const app = express(); | |
app.get('*', function(req, res){ | |
res.sendFile(__dirname + '/index.html'); | |
}); | |
app.listen(3000); |
This file contains 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 fs = require('fs'); | |
let last = 0; | |
const p = () => { | |
const n = last + 1; | |
for (let i = 2; i < n; i++) { | |
if (n % i === 0) { | |
return; |
This file contains 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 toArray = array => { | |
if (array instanceof Array) return array; | |
if (array === null || array === undefined) return []; | |
return [array]; | |
}; |
This file contains 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 app = require('express')(); | |
const fetch = require('node-fetch'); | |
const cache = require('memory-cache'); | |
const request = require('request'); | |
app.get('/', (req, res) => { | |
res.status(404); | |
res.json({ body: `gifs.tobihrbr.com // Get a random gif: gifs.tobihrbr.com/random // Search for a gif: // gifs.tobihrbr.com/_TERM_` }); | |
}); |
This file contains 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
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
const fetch = require('isomorphic-fetch'); | |
fetch('https://offline-news-api.herokuapp.com/stories') | |
.then(function(response) { | |
if (response.status >= 400) { | |
throw new Error("Bad response from server"); |
This file contains 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 crypto = require('crypto'); | |
module.exports = (str, algorithm, out) => { | |
algorithm = algorithm || 'md5'; | |
out = out || 'hex'; | |
const hash = crypto.createHash(algorithm); | |
hash.update(str); | |
return hash.digest(out); |
This file contains 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 main | |
import ( | |
"fmt" | |
"strings" | |
"io/ioutil" | |
"log" | |
"os" | |
"path/filepath" | |
"strconv" |
This file contains 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 bubbleSort = (arr) => { | |
for (let i = arr.length - 1; i >= 0; i--){ | |
for(let j = 1; j <= i; j++){ | |
if(arr[j - 1] > arr[j]){ | |
const temp = arr[j - 1]; | |
arr[j - 1] = arr[j]; | |
arr[j] = temp; | |
} | |
} | |
} |
OlderNewer