Skip to content

Instantly share code, notes, and snippets.

View adrianorsouza's full-sized avatar
🏠
Working from home

Adriano Rosa adrianorsouza

🏠
Working from home
View GitHub Profile
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@adrianorsouza
adrianorsouza / Default (OSX).sublime-keymap
Last active April 24, 2017 07:53 — forked from uberbuilder/Default (OSX).sublime-keymap
Create a Date Time Stamp in Sublime Text 2 on a Mac
[
{"keys": ["alt+s"], "command": "add_date_time_stamp" },
{"keys": ["alt+d"], "command": "add_date_stamp" },
{"keys": ["alt+t"], "command": "add_time_stamp" }
]
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@adrianorsouza
adrianorsouza / bootstrapSwitch.js
Created December 2, 2015 19:18 — forked from bjcull/bootstrapSwitch.js
Angular directive for bootstrap-switch | http://www.bootstrap-switch.org/
.directive('bootstrapSwitch', [
function() {
return {
restrict: 'A',
require: '?ngModel',
link: function(scope, element, attrs, ngModel) {
element.bootstrapSwitch();
element.on('switchChange.bootstrapSwitch', function(event, state) {
if (ngModel) {
@adrianorsouza
adrianorsouza / nginx.conf
Created August 2, 2018 03:52 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@adrianorsouza
adrianorsouza / connect.js
Created July 23, 2019 01:57 — 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 (

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@adrianorsouza
adrianorsouza / docker-help.md
Created March 19, 2021 23:43 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@adrianorsouza
adrianorsouza / gist:5d4a7d210bd659920e8e5b1448b7f343
Created December 2, 2021 23:37 — forked from rmatil/gist:8d21620c11039a442964
Connect MySQL database in Vagrant VM from Host machine

Connecting to Vagrant VM MySQL database from host

This gist shows how to connect to your vagrant MySQL database from the host machine.

Change Address Binding from MySQL

  • Connect to vagrant using vagrant ssh
  • Edit file /etc/mysql/my.cnf:
    • Change parameter bind-address to 0.0.0.0 to allow all incoming connection attempts