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
| // simple function | |
| function funcao(){ | |
| console.log("Função"); | |
| } | |
| funcao(); | |
| // self-invoking function | |
| // função que já é chamada assim que definida. E cria um escopo separado do global ou de onde ela esta contida. | |
| // ideal para isolar e não misturar com o contexto global. | |
| (function(){ |
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
| Lembrar de trocar o "asdf" pelo mesmo valor que você colocou no index.php | |
| Lembre-se isso não tira a responsabilidade de verificar se o id existe, se há permissão de acesso e etc. É só uma forma de reduzir um pouco da força bruta e do consumo de recursos desnecessários que isso pode gerar. | |
| <?php | |
| $id = $_GET["id"]; | |
| if($_GET["check"]!=sha1($id."asdf")){ | |
| echo "id não bate"; | |
| 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
| import React, { Component } from 'react' | |
| import ReactDOM from 'react-dom' | |
| class Componente extends Component { | |
| render(){ | |
| return(<p>Olá devPleno!</p>) | |
| } | |
| } | |
| ReactDOM.render( |
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
| import React, { Component } from 'react' | |
| import './App.css' | |
| import NewMessage from './NewMessage' | |
| import Messages from './Messages' | |
| class App extends Component { | |
| constructor(props){ | |
| super(props) | |
| this.addNewMessage = this.addNewMessage.bind(this) |
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
| // Veja mais em: https://www.youtube.com/watch?v=voV5OBCqlVs | |
| function cycleLen(n){ | |
| let steps = 1 | |
| while(n !== 1){ | |
| if ( n % 2 === 0){ | |
| n = n / 2 | |
| }else{ | |
| n = 3 * n + 1 | |
| } |
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 findExemplo(){ | |
| new Promise(function(reject, resolve){ | |
| UserDataF.find({percent:0.1}, {_id:0, dmpp120:1}, function (err, data){ | |
| if(err){ | |
| reject(err) | |
| }else{ | |
| resolve(data) | |
| } | |
| }) | |
| }) |
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
| // teste |
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
| {"series":[{"name":"how i met your mother","id":"1504912239"}],"genres":[]} |
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 crypto = require('crypto') | |
| const alg = 'aes-256-ctr' | |
| const pwd = 'abcdabcd' | |
| function crypt(text){ | |
| const cipher = crypto.createCipher(alg, pwd) | |
| const crypted = cipher.update(text, 'utf8', 'hex') | |
| return crypted | |
| } | |
| function decrypt(text){ |
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 fs = require('fs') | |
| const crypto = require('crypto') | |
| const alg = 'aes-256-ctr' | |
| const passwd = 'abcdabcd' | |
| const read = fs.createReadStream('input.txt') | |
| const write = fs.createWriteStream('output.txt') | |
| const cipher = crypto.createCipher(alg, passwd) |