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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>SNAKE GAME</title> | |
<style> | |
body { | |
margin: 0; |
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 transparentize = (r, g, b, alpha) => { | |
const a = (1 - alpha) * 255; | |
const calc = x => Math.round((x - a)/alpha); | |
return `rgba(${calc(r)}, ${calc(g)}, ${calc(b)}, ${alpha})`; | |
} |
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
window.cache = (function () { | |
var _data = {}; | |
var _db = openDatabase( | |
'cache.db', | |
'1.0', | |
'app cache database', | |
5 * 1024 * 1024 | |
) |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Memo Puzzle</title> | |
<style> | |
body { | |
text-align: center; | |
} |
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 sleepSort = async arr => { | |
var res = []; | |
await Promise.all(arr.map(n => new Promise(resolve => setTimeout(_ => resolve(res.push(n)), n)))); | |
console.log(res); | |
}; |
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
[ | |
{ordernation: 2, category : 'A'}, {ordernation: 2, category : 'B'}, | |
{ordernation: 1, category : 'A'}, {ordernation: 1, category : 'B'}, | |
{ordernation: 3, category : 'C'} | |
] | |
.reduce(function (acc, it) { | |
let tuple = acc.find(tuple => tuple[0] === it.category); | |
if (tuple) { | |
let list = tuple[1]; | |
list.splice(_.sortedIndexBy(list, it, 'ordernation'), 0, it) |
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 lookNsay (n) { | |
const o = { | |
last : null, | |
count : 0, | |
_res : '', | |
get res () { | |
return this._res + this.count + this.last | |
} | |
} |
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 assert = require ('assert'), | |
translatePhoneLetters = require('./escrevendo-celular').translatePhoneLetters; | |
describe('translatePhoneLetters', function() { | |
it('chamada vazia', function () { | |
assert.equal(translatePhoneLetters(), '') | |
}) | |
it('vazio', function () { | |
var str = '' |
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 mapa =[ | |
[1000, { capital : 'M', condition : gt, transform : repeat }], | |
[900, { capital :'CM', condition : gt, transform : difference }], | |
[500, { capital : 'D', condition : gt, transform : difference }], | |
[400, { capital : 'CD', condition : gt, transform : difference }], | |
[100, { capital : 'C', condition : gt, transform : repeat }], | |
[90, { capital : 'XC', condition : gt, transform : difference }], | |
[50, { capital : 'L', condition : gt, transform : difference }], | |
[40, { capital : 'XL', condition : gt, transform : difference }], | |
[10, { capital : 'X', condition : gt, transform : repeat }], |
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
Verifying that +leobetosouza is my blockchain ID. https://onename.com/leobetosouza |
NewerOlder