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 DOCUMENT_EVENTS = [ | |
'mousemove', 'mousedown', 'click', | |
'touchmove', 'touchstart', 'touchend', | |
'keydown', 'keypress' | |
]; | |
export class IdleTimer { | |
constructor(onIdleTimeout, timeout) { | |
this.onIdleTimeout = onIdleTimeout; | |
this.timeout = timeout; |
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
import aiometer | |
from aiocsv.readers import AsyncDictReader | |
from aiohttp import ClientSession as Session, ClientTimeout | |
from aiofiles import open | |
from yarl import URL | |
HOST = "http://d1wwra234reihl.cloudfront.net" | |
DEFAULT_HEADERS = {"Referer": "https://www.neonmob.com/"} | |
DEFAULT_SESSION_KWARGS = dict( | |
headers=DEFAULT_HEADERS, |
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
#!/bin/bash | |
function actual_path() { | |
if [ [ -z "$1" ] -a [ -d $1 ] ]; then | |
echo $(cd $1 && test `pwd` = `pwd -P`) | |
return 0 | |
else | |
return 1 | |
fi | |
} |
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 { performance } = require("perf_hooks"); | |
const { setTimeout } = require("timers/promises"); | |
function timeit(start, end) { | |
console.log(`Execution time: ${start - end} ms.`); | |
} | |
async function parallelPromises(promiseA, promiseB, promiseC) { | |
const start = performance.now(); | |
const results = [await promiseA, await promiseB, await promiseC]; |
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
$('#coverinner').on( | |
{ | |
'focus': function(event) { | |
$(this).autocomplete({ | |
minLength: 3, | |
source: function(req, res){ | |
$.ajax({ | |
url: 'https://maps.googleapis.com/maps/api/place/autocomplete/json', | |
data: { | |
input: req.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
from socketserver import TCPServer, StreamRequestHandler | |
ADDRESS = "", 3000 | |
class EchoHandler(StreamRequestHandler): | |
"""Responde requisições repetindo o que foi recebido.""" | |
def handle(self): | |
# Usar b'' cria strings binárias, já codificadas como ASCII |
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
import React from 'react'; | |
const handleChange = (handler) => ({target: {files}}) => | |
handler(files.length ? {file: files[0], name: files[0].name} : {}); | |
export default ({ | |
input: {onChange, onBlur, value: omitValue, ...inputProps}, | |
meta: omitMeta, | |
...props | |
}) => ( |
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
version: "3.7" | |
services: | |
db: | |
environment: | |
POSTGRES_PASSWORD: postgres | |
image: postgres:alpine | |
ports: | |
- "5432:5432" | |
volumes: | |
- ./docker/db/pgdata:/var/lib/postgresql/data |
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
/* eslint-env node, mocha */ | |
const { expect } = require('chai') | |
const LinkedList = require('../src/linked-list'); | |
describe('Linked List', () => { | |
it('Creates empty Linked Lists', () => { | |
const list = new LinkedList(); | |
expect(list).to.be.instanceOf(LinkedList); | |
expect(list.head).to.be.null; | |
}); |
NewerOlder