Skip to content

Instantly share code, notes, and snippets.

View IgorDePaula's full-sized avatar
😆

Igor C. de Paula IgorDePaula

😆
View GitHub Profile
@IgorDePaula
IgorDePaula / 1-loadolympics.cql
Created August 25, 2016 17:00 — forked from rvanbruggen/1-loadolympics.cql
Olympic Medallists
create index on :Country(name);
create index on :City(name);
create index on :Sport(name);
create index on :Discipline(name);
create index on :Athlete(name);
create index on :Event(name);
create index on :Year(name);
create index on :Gender(name);
create constraint on (c:Country) assert c.noc is unique;
generatePagesArray: function(currentPage, collectionLength, rowsPerPage, paginationRange)
{
var pages = [];
var totalPages = Math.ceil(collectionLength / rowsPerPage);
var halfWay = Math.ceil(paginationRange / 2);
var position;
if (currentPage <= halfWay) {
position = 'start';
} else if (totalPages - halfWay < currentPage) {
@IgorDePaula
IgorDePaula / README.md
Created September 26, 2016 19:49 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@IgorDePaula
IgorDePaula / GitHub curl.sh
Created October 28, 2016 20:00 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@IgorDePaula
IgorDePaula / git-update-fork.sh
Created December 7, 2016 12:03 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
@IgorDePaula
IgorDePaula / uniqid.js
Created January 27, 2017 16:40 — forked from wilcorrea/uniqid.js
Função do PHP uniqid em SQL e JS
// http://locutus.io/php/misc/uniqid/
function uniqid (prefix, moreEntropy) => {
if (typeof prefix === 'undefined') {
prefix = '';
}
let retId;
const _formatSeed = function (seed, reqWidth) {
seed = parseInt(seed, 10).toString(16); // to hex str
if (reqWidth < seed.length) {
@IgorDePaula
IgorDePaula / problema.md
Created February 17, 2017 16:33 — forked from vinicius73/problema.md
Um exercício simples com js

Default true

Existem 3 entradas possiveis

  • true
  • false
  • undefined

as saídas serão:

  • undefinded => true
import { deburr, sortBy } from 'lodash'
const sanitizeAndLower = value => deburr(value).toLowerCase()
//
const sortByString = (list, key) => sortBy(list, x => sanitizeAndLower(x[key]))
const sortByName = list => sortByString(list, 'name')