Skip to content

Instantly share code, notes, and snippets.

View andreabreu-me's full-sized avatar

André Abreu andreabreu-me

View GitHub Profile

BEM Cheatsheet

BLOCK

Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.

[alias]
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
incoming = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})
outgoing = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)
@andreabreu-me
andreabreu-me / ffmpeg_mov2webm_alpha.sh
Created May 26, 2019 16:50
Convert mov videos with alpha to webm, also with alpha channel
ffmpeg -i confettis1.mov -vf unpremultiply=inplace=1 -c:v libvpx-vp9 -b:v 0 -crf 31 -s 924x1008 confettis.webm
@andreabreu-me
andreabreu-me / docker_kill.sh
Created July 12, 2018 13:19 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@andreabreu-me
andreabreu-me / observer.ts
Created May 26, 2018 01:51 — forked from joelpalmer/observer.ts
TypeScript Observer Pattern - Observable
//we will use a push observer pattern
interface IObservable {
subscribe: Function;
unsubscribe: Function;
publish: Function;
}
class Observable implements IObservable {
private subscribers: any[] = new Array();
public subscribe(cb) {
//we could check to see if it is already subscribed
@andreabreu-me
andreabreu-me / kill_by_tcp_port.sh
Last active July 26, 2021 11:33
[Bash] kill process by tcp port
lsof -i tcp:8080 | tr -s " " | cut -d " " -f2 | tail -n 1 | xargs kill -9
@andreabreu-me
andreabreu-me / angular-get-service-console.js
Created October 9, 2017 16:51 — forked from justinobney/angular-get-service-console.js
Get a reference to some angular service in the console
// Get the injector
var injector = angular.element($0/*'[data-ng-app], [ng-app]'*/).injector();
// Get the service
var Service = injector.get('Service');
// Use it!
// Service.addNotification('Some Notification', 'info');
@andreabreu-me
andreabreu-me / setdnstarget.sh
Created September 21, 2017 23:28 — forked from rtucker/setdnstarget.sh
A one-liner to set a Linode DNS Manager target to your client's current public IP address
ssh you@yourlinode "wget -O - -q https://api.linode.com/?api_key=$LINODE_API_KEY\&api_action=domain.resource.update\&domainid=$DOMAINID\&resourceid=$RESOURCEID\&target=\`echo \$SSH_CLIENT | cut -d' ' -f1\`"
@andreabreu-me
andreabreu-me / install-comodo-ssl-cert-for-nginx.rst
Created January 22, 2017 23:53 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

import UIKit
func addViewAndButton() {
// iOS 9 availability coolness
guard #available(iOS 9, *) else {
return
}
// boilerplate view creation