Skip to content

Instantly share code, notes, and snippets.

View lucasfcosta's full-sized avatar
Building @briefercloud

Lucas da Costa lucasfcosta

Building @briefercloud
View GitHub Profile
## Contributor License Agreement
The following terms are used throughout this agreement:
- You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
- Project - is an umbrella term that refers to any and all ERGOMAKE DESENVOLVIMENTO DE SOFTWARE LTDA. (d.b.a Briefer) open source projects.
- Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
- Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with ERGOMAKE DESENVOLVIMENTO DE SOFTWARE LTDA. (d.b.a Briefer), contributors or maintainers.
## 1. Grant of Copyright License.
import java.util.Arrays;
import java.lang.Math;
class Heap {
public int[] data;
public int lastIndex;
Heap(int size) {
this.data = new int[size];
this.lastIndex = -1;
@lucasfcosta
lucasfcosta / multithreadSorting.js
Last active September 14, 2015 18:42
Multithread array sorting in Node. It uses this module: https://www.npmjs.com/package/sugar-sorting
var Sorter = require('sugar-sorting');
var cluster = require('cluster');
// Number of threads we're going to create
var numThreads = 5;
// How many arrays you want to create
var totalArrays = 1000;
// The process will only get inside this if it isn't a worker
@lucasfcosta
lucasfcosta / HideMyTimeline.js
Created October 10, 2014 01:41
HideMyTimeline Script
// ==UserScript==
// @name HideMyTimeline
// @namespace http://github.com/lucasfcosta
// @description Hides Facebook timeline so you can focus on what really matters
// @include https://www.facebook.com/*
// @version 1
// @grant none
// ==/UserScript==
$(document).ready(function() {
@lucasfcosta
lucasfcosta / separeLines.js
Last active August 29, 2015 14:06
Separes Lines of an Array Containing Table Cells' Contents
function separeLines(table, tableCol) {
var lines = [];
var divisionNumber = table.length/tableCol;
var startPos = 0;
var endPos = 0 + tableCol;
for(var i = 0; i < divisionNumber; i++) {
lines.push(table.slice(startPos, endPos));
startPos += tableCol;
@lucasfcosta
lucasfcosta / findWithin.js
Last active August 29, 2015 14:04
Finds all occurrences of a String between two other Strings
function findWithin(text, first, last, caseSensitive) {
if (!caseSensitive) {
text = text.toLowerCase();
first = first.toLowerCase();
last = last.toLowerCase();
}
var rex = new RegExp(first + '(.*?)' + last, 'gm'),
results = text.match(rex);
for (var i in results) {
results[i] = results[i].slice(first.length, results[i].indexOf(last));