Skip to content

Instantly share code, notes, and snippets.

View henriquemenezes's full-sized avatar

Henrique Menezes henriquemenezes

  • Recife, Brazil
View GitHub Profile
@henriquemenezes
henriquemenezes / array-diff.js
Created March 17, 2016 20:08
JS array diff
function arrayDiff(a1, a2) {
var diff = {};
for (var i = 0; i < a1.length; i++) {
diff[a1[i]] = true;
}
for (var i = 0; i < a2.length; i++) {
if (diff[a2[i]]) {
delete diff[a2[i]];
@henriquemenezes
henriquemenezes / simple-browser-benchmark.md
Last active March 19, 2016 14:41
Simple Browser Benchmark

Simple Browser Benchmark

Methodology

Open the same 26 tabs in all browsers with different urls

Results

Browser Version Processes Threads Memory Usage Memory Compressed by OSX
@henriquemenezes
henriquemenezes / nerd-tree-mappings.txt
Last active January 13, 2020 05:23
NERD tree Mappings
------------------------------------------------------------------------------
2.3. NERD tree Mappings *NERDTreeMappings*
Default Description~ help-tag~
Key~
o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
@henriquemenezes
henriquemenezes / vim.md
Last active February 18, 2020 04:22
Vim

Vimtutor:

Tips & Tricks

	:source $MYVIMRC	Reload .vimrc without restart vim, after reload run :e
	:e 			Reload buffer and trigger FileType event

Modes:

@henriquemenezes
henriquemenezes / postgresql-set-id-seq.sql
Created March 31, 2016 12:23
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@henriquemenezes
henriquemenezes / ip-default-gw.rb
Created April 1, 2016 14:32
Get default gateway IP in Ruby
gw = `ip route show`[/default.*/][/\d+\.\d+\.\d+\.\d+/]
@henriquemenezes
henriquemenezes / syncing-a-fork.md
Last active April 29, 2016 00:43
Syncing a fork

Syncing a fork

Sync a fork of a repository to keep it up-to-date with the upstream repository.

1. Configuring a remote for a fork

List the current configured remote repository for your fork.

git remote -v
@henriquemenezes
henriquemenezes / fixing-problems.md
Last active March 24, 2017 15:44
Fixing problems

Fixing problems

  1. Offending ECDSA key in /Users/Username/.ssh/known_hosts:38
sed -i .bak '38d' ~/.ssh/known_hosts
@henriquemenezes
henriquemenezes / postgresql-dump-without-scheme.sh
Created May 22, 2016 20:55
PostgreSQL dump without specific Scheme
# Dump all postgres database without specific scheme (-N topology)
pg_dump -N topology -U $DATABASE_USERNAME -h $DATABASE_HOST -f /path/to/output.sql $DATABASE_NAME
@henriquemenezes
henriquemenezes / android-publish.md
Last active May 31, 2016 01:03
Android Publish

Android - Publish Your App

Preparing Your Application for Release

Configuring your application for release

  • At a minimum you need to remove Log calls and remove the android:debuggable attribute from your manifest file.
  • You should also provide values for the android:versionCode and android:versionName attributes, which are located in the <manifest> element.
  • Building and signing a release version of your application.
  • Testing the release version of your application.