Skip to content

Instantly share code, notes, and snippets.

View tarunbod's full-sized avatar

Tarun Boddupalli tarunbod

View GitHub Profile
@deanveloper
deanveloper / Tests.java
Created April 12, 2015 14:36
2 Tests involving the speeds of Streams, Parallel Streams, with and without lambdas, and comparing it to doing it the normal way (without streams). It's also worth noting that this only compares .filter() and .map() operations. TL;DR Streams w/o lambdas are fastest on a smaller scale, Streams w/ lambdas are faster on a large scale, doing it the …
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class Tests{
static Random rand = new Random();
@danharper
danharper / background.js
Last active May 22, 2024 11:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';