Skip to content

Instantly share code, notes, and snippets.

View petele's full-sized avatar

Pete LePage petele

View GitHub Profile
@petele
petele / PromiseResolveAll.js
Last active June 13, 2017 20:53
Promise.every
Promise.resolveAll = function petepete(promises) {
function reflect(promise) {
if (Promise.resolve(promise) !== promise) {
return promise;
}
return promise.then((v) => {return v;}).catch((e) => {return e;});
}
return Promise.all(promises.map(reflect));
};
@petele
petele / uber.js
Last active March 9, 2018 17:29
Calculates the number of rides and amount you've spent with Uber.
// To use: Visit https://riders.uber.com/trips, open the Chrome DevTools and
// paste this script into the console, then click the > (next page) icon on the
// bottom of the page, and once the page has finished loading, run `calcPage()`
// again to add that page to your total. Keep going until you've finished all of
// the pages.
// Note: this script doesn't handle different currencies, everything will be
// treated as the same currency.
var total = 0.0;
var count = 0.0;
@petele
petele / seamless.js
Last active February 2, 2022 18:53
Want to know how much money you've spent on Seamless in your lifetime? Pop over to your Order History page (https://www.seamless.com/Food-Delivery/orderhistory.m), scroll all the way to the bottom so it stops loading any more results, then open the Console in the Chrome DevTools and paste this chunk of code in. Voila! The number of orders you've…
// This probably doesn't work anymore.
let lines = "";
var orders = $("tbody#OrderHistoryLikedItem tr");
var count = 0;
var amount = 0.0;
for (var i = 0; i < orders.length; i++) {
try {
var tr = $(orders[i]);
var d = tr.find("td.date strong")[0].innerText.trim();
var v = tr.find("td.vendor a")[0].innerText.trim();
[
{ "skipAll": true },
{
"url": "https://a810-bisweb.nyc.gov/bisweb/JobsQueryByLocationServlet?requestid=0&allbin=1090814",
"proxy": true,
"priority": 2,
"description": "DOB Jobs Overview",
"terms": [
{
"term": "DISAPPROVED",
@petele
petele / .aliases
Created October 4, 2017 14:32
My dotfiles
# Make ls in color
alias ls="command ls -G"