View Heap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
View multithreadSorting.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View cracoCrawlerCSV.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instale o Node.js (baixe no site e use o instalador, facil facil) | |
// Instale o modulo do twitter (pode ser global: npm install twitter -g) | |
// Coloque isso no C:/ pra facilitar e digite no terminal node /cracocrawler.js | |
// Os resultados vao ser salvos num arquivo chamado tweets.json | |
var Twitter = require('twitter'); | |
var fs = require('fs'); | |
// Preencha os valores com as suas chaves da API do twitter | |
var client = new Twitter({ | |
consumer_key: '<PREENCHA_ISSO>', |
View cracoCrawler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instale o Node.js (baixe no site e use o instalador, facil facil) | |
// Instale o modulo do twitter (pode ser global: npm install twitter -g) | |
// Coloque isso no C:/ pra facilitar e digite no terminal node /cracocrawler.js | |
// Os resultados vao ser salvos num arquivo chamado tweets.json | |
var Twitter = require('twitter'); | |
var fs = require('fs'); | |
// Preencha os valores com as suas chaves da API do twitter | |
var client = new Twitter({ | |
consumer_key: '<PREENCHA_ISSO>', |
View HideMyTimeline.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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() { |
View separeLines.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
View findWithin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |