Skip to content

Instantly share code, notes, and snippets.

View viniciusCamargo's full-sized avatar
🧙‍♂️

Vinicius de Sousa Camargo viniciusCamargo

🧙‍♂️
View GitHub Profile
@viniciusCamargo
viniciusCamargo / gist:16e3af93e4e5601366a34e98db23d362
Last active January 6, 2018 21:17 — forked from mikeal/gist:1840641
get a new/clean port with node.js
const net = require('net')
let portRange = 3000
const getPort = (cb) => {
const port = portRange
portRange += 1
const server = net.createServer()
@viniciusCamargo
viniciusCamargo / connect.js
Created December 25, 2017 18:52 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@viniciusCamargo
viniciusCamargo / mta.js
Created August 2, 2017 13:44
MTA GTFS Real Time Proto Decoder
const Proto = require('protobufjs');
const Req = require('request');
var GtfsRealtimeBindings = require('gtfs-realtime-bindings');
const MTA_API_ENDPOINT = "http://datamine.mta.info/mta_esi.php?key=148133e77dd93f66b37d6c5054684401&feed_id=1"
Req({
method: 'GET',
url: MTA_API_ENDPOINT,
encoding: null