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-export) ➜ () ➜ npm i express | |
npm ERR! Darwin 14.5.0 | |
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "express" | |
npm ERR! node v7.0.0 | |
npm ERR! npm v3.10.8 | |
npm ERR! code MODULE_NOT_FOUND | |
npm ERR! Cannot find module 'internal/fs' | |
npm ERR! | |
npm ERR! If you need help, you may report this error at: |
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 React = require('react'), | |
DOM = React.DOM, div = DOM.div, button = DOM.button, ul = DOM.ul, li = DOM.li | |
// This is just a simple example of a component that can be rendered on both | |
// the server and browser | |
module.exports = React.createClass({ | |
// We initialise its state by using the `props` that were passed in when it | |
// was first rendered. We also want the button to be disabled until the |
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 config = { | |
method: 'POST', | |
body: JSON.stringify({ cat: 'grumpy' }), | |
cache: 'no-cache', | |
mode: 'no-cors', | |
} | |
fetch('http://localhost:8080/cats?categ=10&type=5', config) | |
.then(response => { | |
if(response.ok) { |
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
module.exports = (distribuicao) => { | |
const pulaLinha = (linha, coluna) => [linha+1, coluna] | |
const pulaLinhaIniciaColuna = (linha, coluna) => [linha+1, 0] | |
const pulaLinhaColuna = (linha, coluna) => [linha+1, coluna+1] | |
const pulaLinhaDiminuiColuna = (linha, coluna) => [linha+1, coluna-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
const Models = require('../../models/') | |
const MODEL_NAME = __dirname.split('modules')[1].slice(1) | |
const PREFIX = 'us_' | |
const PRIMARY_KEY = PREFIX + 'cod' | |
const ACTIONS_PATH = '../../actions/' | |
let offset = 0 | |
let limit = 10 | |
let attributes = [ | |
PRIMARY_KEY, |
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
module.exports = (Models, MODEL_NAME) => (req,res,next) => { | |
Models[MODEL_NAME].create(req.body) | |
.then((data) => { | |
res.json(data) | |
}) | |
.catch((error) => { | |
console.log('error: ',error) | |
}) | |
} |
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 tag = (name, children)=> ({ | |
name, | |
children: children.map ? children: [children] | |
}); | |
const div = tag.bind(null, 'div'); | |
const span = tag.bind(null, 'span'); | |
const p = tag.bind(null, 'p'); | |
const b = tag.bind(null, 'b'); | |
const a = tag.bind(null, 'a'); |
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 http = require('http') | |
const cpf = process.argv[2] | |
const url = 'http://dabsistemas.saude.gov.br/sistemas/sadab/js/buscar_cpf_dbpessoa.json.php?cpf=' | |
const consult = `${url}${cpf}` | |
let body = '' | |
http.get(consult, (res) => | |
res | |
.on('data', data => body += 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
const fieldsLower = JSON.stringify(json).replace(/"([\w]+)":/g,function($0,$1){return ('"'+$1.toLowerCase()+'":');}) |
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 Calibracao = require('../modules/calibracao/organism') | |
module.exports = (Organism) => | |
(req, res) => { | |
const query = {'calibracoes.0': {$exists: true}} | |
const success = (data) => res.json(data) | |
const error = (err) => res.json(err) | |
const sendValidacoes = (pendentes) => { | |
const testIfIsPendente = (cal) => |