Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Igor Vieira IgorVieira

🏠
Working from home
Block or report user

Report or block IgorVieira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker-compose.yml
postgres:
image: postgres:9.6-alpine
ports:
- '5432:5432'
environment:
POSTGRES_USER: 'user'
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: 'database'
volumes:
- ./init:/docker-entrypoint-initdb.d/
@IgorVieira
IgorVieira / gist:5c1041fcff865dd54f48ab9924644596
Created Jun 7, 2018 — forked from bergus/gist:1387854
Correct easiest way to find duplicate values in a JavaScript array - Native unique function implementation
View gist:5c1041fcff865dd54f48ab9924644596
/*
* I saw this thread: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array
* The solutions from gist:1305056 were elegant, but wrong. So here's mine:
*/
Array.prototype.unique = function(test) {
/* returns a new, sorted Array without duplicates */
if (!Array.isArray(this))
throw new TypeError("Array.prototype.unique must be called on an Array");
return this.slice(0).sort().filter( typeof test == "function"
? function(v, i, a) { return !i || !test(v, a[i-1]); }
View settings.json
{
"workbench.startupEditor": "newUntitledFile",
"editor.tabSize": 2,
"editor.renderWhitespace": "all",
"workbench.iconTheme": "vscode-icons",
"editor.detectIndentation": false,
"workbench.colorTheme": "Nord",
"workbench.editor.enablePreview": false,
"emmet.includeLanguages": {
"erb":"html",
@IgorVieira
IgorVieira / README.md
Last active Oct 22, 2017
Set path for rbenv in your zsh on Ubuntu
View README.md

zsh + Ruby(rbenv) on Ubuntu

If yout have problems for check ruby versions on your ubuntu + zsh, just put this in your terminal and set path for your rbenv

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
@IgorVieira
IgorVieira / convert.js
Last active Sep 25, 2017
Convert files html.slim for html.erb
View convert.js
const { exec } = require('child_process')
const fs = require('fs')
const rl = require('readline')
const i = rl.createInterface(
process.stdin,
process.stdout,
null
);
View upbutton.min.js
$(document).ready(function(){var b=700;$(window).scroll(function(){$(this).scrollTop()>220?$(".topo").fadeIn(b):$(".topo").fadeOut(b)}),$(".topo").click(function(a){return a.preventDefault(),jQuery("html, body").animate({scrollTop:0},b),!1})});
View upbutton.js
$(document).ready(function(){
var offset = 220;
var duration = 700;
$(window).scroll(function() {
if ($(this).scrollTop() > offset) {
$('.topo').fadeIn(duration);
} else {
$('.topo').fadeOut(duration);
}
});
@IgorVieira
IgorVieira / topkeywords.js
Created Oct 5, 2016 — forked from elliotbonneville/topkeywords.js
Find top keywords associated with a Google search with this Node.js application.
View topkeywords.js
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@IgorVieira
IgorVieira / introrx.md
Created Nov 22, 2015 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
You can’t perform that action at this time.