Skip to content

Instantly share code, notes, and snippets.

View gaboesquivel's full-sized avatar
👾
buidl

Gabo Esquivel gaboesquivel

👾
buidl
View GitHub Profile
@gaboesquivel
gaboesquivel / nginx_docker_redirect.conf
Created April 6, 2018 22:31 — forked from technolo-g/nginx_docker_redirect.conf
Redirect subdomain to port (nginx)
# This will redirect a numerical subdomain to a port.
# A use would be Docker contianers.
# This relies on the following DNS record:
# *.test.domain.com IN A 10.100.199.31
# and the fact that this container would run on the same Docker
# host as the backends.
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
const oauth = Npm.require('oauth');
const Agenda = Npm.require('agenda');
Meteor.startup(function(){
const mongoURL = process.env.MONGO_URL;
var agenda = new Agenda({db: {address: mongoURL}});
agenda.define('sync_inventory', Meteor.bindEnvironment(function(job, done) {
try {
syncInventory();
@gaboesquivel
gaboesquivel / standardJS-in-CRA.md
Created December 8, 2017 04:33 — forked from dreamorosi/standardJS-in-CRA.md
Add Standard JS to create-react-app project

Standard JS in create-react-app

I've been using create-react-app lately as I find it very useful to kick things off while starting a project. I almost always follow JavaScript Standard Style and I found myself googling it so I figured out I should write it down.

Get Standard JS

I really like keeping dependencies as local as possible but if you prefer you can install it globally.

yarn add standard --dev

or

@gaboesquivel
gaboesquivel / my-component.spec.js
Created November 6, 2017 21:20 — forked from thevangelist/my-component.spec.js
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@gaboesquivel
gaboesquivel / what-forces-layout.md
Created September 22, 2015 15:15 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@gaboesquivel
gaboesquivel / git-cheatsheet.md
Created September 12, 2016 20:57 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@gaboesquivel
gaboesquivel / keybase.md
Created September 30, 2017 00:29
Keybase.md

Keybase proof

I hereby claim:

  • I am gaboesquivel on github.
  • I am gaboesquivel (https://keybase.io/gaboesquivel) on keybase.
  • I have a public key ASDygR9c6uP0ptFi_geMIVHaWut8caJbrkpf3QcmSk1Tqwo

To claim this, I am signing this object:

@gaboesquivel
gaboesquivel / a2dp.py
Created August 21, 2017 19:15 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.5
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
@gaboesquivel
gaboesquivel / mongoose-connection-options.js
Created June 29, 2017 22:55
mLab recommended mongoose connection options. More supported connections for the underlying Node Native driver can be found here: http://mongodb.github.io/node-mongodb-native/
// mongoose 4.3.x
var mongoose = require('mongoose');
/*
* Mongoose by default sets the auto_reconnect option to true.
* We recommend setting socket options at both the server and replica set level.
* We recommend a 30 second connection timeout because it allows for
* plenty of time in most operating environments.
*/
var options = { server: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
@gaboesquivel
gaboesquivel / clean_sources_list.sh
Created June 21, 2017 00:19
clean your sources lists
cat /etc/apt/sources.list | uniq -u > /tmp/sources.list && sudo mv /tmp/sources.list /etc/apt/sources.list
cat /etc/apt/sources.list.d/sources.list | uniq -u > /tmp/sources.list && sudo mv /tmp/sources.list /etc/apt/sources.list.d/sources.list