- HTTP Server
- Websocket Server
- TCP Client/Server
- Async Redis/HTTP/Websocket Client
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
| interface Observable { | |
| subscribe: (fn?) => any; | |
| } | |
| class Subscription { | |
| constructor( | |
| private emitter: EventEmitter<any>, | |
| private index: number) {} | |
| unsubscribe() { |
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
| #!/usr/bin/python3 | |
| import pygame | |
| from pygame.locals import * | |
| from random import randint | |
| def on_grid_random(): | |
| x = randint(0, 290) | |
| y = randint(0, 290) | |
| return (x//10 * 10, y//10 * 10) |
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
| #!/bin/bash | |
| set_dot_env_value() { | |
| ENV=$1 | |
| KEY=$2 | |
| VALUE=$3 | |
| PATH=$(dirname $ENV) | |
| if [[ ${#@} -ne 3 ]]; then | |
| echo -e "É necessário informar 3 argumentos:\n\t[1: endereço do .env],\n\t[2: variavel],\n\t[3: valor]" | |
| exit |
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 movieCategories = [ | |
| { | |
| name: "Thrillers", | |
| videos : [ | |
| { | |
| "id": 70111470, | |
| "title": "Die Hard", | |
| "boxarts": [ | |
| { width: 150, height: 200, url: "http://cdn-0.nflximg.com/images/2891/DieHard150.jpg" }, | |
| { width: 200, height: 200, url: "http://cdn-0.nflximg.com/images/2891/DieHard200.jpg" } |
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
| #!/bin/bash | |
| loading() { | |
| echo -n "Aguarde" | |
| for i in {1..5}; do echo -n "." && sleep 0.5; done | |
| } | |
| backup_vscode() { | |
| file="install-vscode-extensions.sh" |
Dividir tela verticalmente CTRL+B SHIFT+5 (%)
Dividir Horizontalmente CTRL+B SHIFT+' (")
Navegar entre janelas CTRL+B Arrowkeys
Matar tmux
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
| #!/bin/bash | |
| install_nvm_npm_and_node() { | |
| which curl | |
| if [ $? -eq 1 ]; then | |
| echo "curl is required to install nvm" | |
| exit 1 | |
| fi | |
| local SHELLRC="$HOME/.${0}rc" |
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
| <h1>Socket.io</h1> | |
| <div id="msgs"></div> | |
| <input type="text"> | |
| <script src="/socket.io/socket.io.js"></script> | |
| <script src="/socket.io-client.js"></script> |
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
| Array.prototype.pluck = function(...keys) { | |
| return this.map(item => keys.reduce((acc, key) => | |
| (key in item) && (acc[key] = item[key]) ? acc : acc, {})); | |
| } | |
| Array.prototype.pluck = function(...keys) { | |
| return this.map(item => JSON.parse(JSON.stringify(item, [...keys]))); | |
| } |