made with esnextbin
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
// Micro-app Code | |
io.press(() => { | |
print('sending alert'); | |
cloud.enqueue('alert', {}); | |
sync.now(); | |
}); | |
function turnOnLED(){ | |
io.led(true); | |
timers.single(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
#!/usr/bin/env node | |
/* eslint-disable no-console */ | |
const superagent = require('superagent'); | |
const stream = require('stream'); | |
// Tests if the server is not vulnerable for this issue | |
// https://github.com/expressjs/body-parser/blob/master/README.md#request-aborted | |
const main = async () => { | |
const request = superagent.post('http://localhost:8001/v1/rexio') | |
.set('Content-Type', 'application/octet-stream'); |
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
javascript:(() => { const identifierRegex = /(\/beacons|v3\/devices)\/(\w{16,32})(\/settings)?/; const match = identifierRegex.exec(window.location); if (!match) { return; } const isProd = /cloud\.estimote\.com/.exec(window.location); if (isProd && !window.confirm('This is production, are you sure?')) { return; } const identifier = match[2]; fetch(`/v3/devices/${identifier}`, { credentials: 'same-origin' }) .then(response => response.json()) .then(body => { if (body.data.pending_settings) { return fetch(`/v2/devices/${identifier}`, { body: JSON.stringify({ identifier: identifier, settings: body.data.pending_settings, }), method: 'POST', headers: { 'content-type': 'application/json', }, credentials: 'same-origin', }).then(response => response.json()) .then((body) => { if (window.confirm('Reload?\n\n' + JSON.stringify(body, null, 2))) { location.reload(); } }); } alert('No pending settings'); }); })(); |
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
var board = [ | |
['-', '-', '-', '-', '-', '-', '-'], | |
['-', '-', '-', '-', '-', '-', '-'], | |
['-', '-', '-', 'R', 'R', 'R', 'R'], | |
['-', '-', '-', 'Y', 'Y', 'R', 'Y'], | |
['-', '-', '-', 'Y', 'R', 'Y', 'Y'], | |
['-', '-', 'Y', 'Y', 'R', 'R', 'R']]; | |
function* getTraverses(matrix) { | |
const horizontalSize = matrix[0].length; |
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 { cloneDeep } = require('lodash'); | |
class Solver { | |
constructor() { | |
this.fields = {}; | |
this.avaliableValues = {}; | |
this.queue = []; | |
this.result = 0; | |
} |
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 powerSet = (array) => { | |
const results = []; | |
const maximum = 1 << array.length; | |
let reference = 0; | |
while (reference < maximum) { | |
results.push(array.filter((element, index) => reference & 1 << index)); | |
reference++; | |
} |
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
#!/usr/bin/env node | |
const url = require('url'); | |
const parse = (connectionString) => { | |
if (!connectionString) { | |
return 'Connection string is needed'; | |
} | |
const parsed = url.parse(connectionString); |
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
function * dawejPadding(str, len, ch=' '){ | |
let current = str.length; | |
while(current < len){ | |
yield ch; | |
current++; | |
} | |
yield str; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<style> | |
.box { | |
height: 20px; | |
width: 20px; |
NewerOlder