Skip to content

Instantly share code, notes, and snippets.

@BehindTheMath
BehindTheMath / firebase-auth-backend.js
Last active October 17, 2018 04:58
Sample code for Firebase Auth
import {auth, credential, initializeApp} from "firebase-admin";
// Call this before starting the server
export function init() {
const serviceAccount = {
clientEmail: process.env.FIREBASE_SERVICE_ACCOUNT_CLIENT_EMAIL,
privateKey: process.env.FIREBASE_SERVICE_ACCOUNT_PRIVATE_KEY,
projectId: process.env.FIREBASE_SERVICE_ACCOUNT_PROJECT_ID
};
import Vue from 'vue';
Vue.component('v-alert', {});
Vue.component('v-app', {});
Vue.component('v-autocomplete', {});
Vue.component('v-avatar', {});
Vue.component('v-badge', {});
Vue.component('v-bottom-nav', {});
Vue.component('v-bottom-sheet', {});
Vue.component('v-breadcrumbs', {});
@BehindTheMath
BehindTheMath / BrowseAtLastCommit.userscript.js
Created October 4, 2017 20:34
Userscript that adds a button on Github to browse the current file on the tree of the last commit
// ==UserScript==
// @name Github Browse At Last Commit
// @namespace behindthemath.io
// @version 0.1
// @description Adds a button to browse the current file on the tree of the last commit
// @author BehindTheMath
// @match http*://*github.com/*/*/blob/*
// @grant none
// ==/UserScript==
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
// utils.ts
export module MathUtils {
export function degreesToRadians(degrees: number): number {
return degrees * Math.PI / 180;
}
export function radiansToDegrees(radians: number): number {
return radians * 180 / Math.PI;
}
};
@BehindTheMath
BehindTheMath / QuerySelectorASAP.ts
Last active August 27, 2017 19:06
QuerySelectorASAP
/**
* Wraps <code>document.querySelector()</code> and <code>document.querySelectorAll()</code> to either:
*
* a) return the matching {@link Element} or {@link NodeListOf<Element>} as soon as possible: immediately if it's already
* available in the DOM, or as soon as it's ready, by using <code>setInterval()</code>.
*
* or
*
* b) resolve when the specified element(s) are no longer present in the DOM.
*
@BehindTheMath
BehindTheMath / show_RetailMeNot_codes.user.js
Created May 8, 2017 23:56
Show coupon codes directly on RetailMeNot without having to click or navigate to another page
// ==UserScript==
// @name Show Retailmenot codes
// @namespace behindthemath.io
// @include /.*retailmenot.com\/view\/[^\?]*$/
// @version 1
// @grant none
// ==/UserScript==
(function () {
var dataNewTab = document.querySelectorAll('a.button-show-code')[0].getAttribute('data-new-tab');
@BehindTheMath
BehindTheMath / Remove_wap2_from_DDF_links_in_Google_search_results.user.js
Created April 5, 2017 22:07
A Greasemonkey / Tampermonkey user script to remove ";wap2" from the end of links in Google search results
@BehindTheMath
BehindTheMath / Download Youtube playlist as MP3s.user.js
Created November 24, 2016 14:40
Download Youtube playlist as MP3s
// ==UserScript==
// @name Download Youtube playlist as MP3s
// @namespace behindthemath.io
// @include http://www.youtubecomtomp3.com/YouTube-Playlist-Downloader.php
// @version 1
// @grant none
// ==/UserScript==
(function () {
console.log("Running...");
@BehindTheMath
BehindTheMath / KohlsCashFwd.js
Last active September 11, 2016 02:31
Google App Script to forward all emails with Kohl's Cash matching specific criteria
function KohlsCashFwd() {
//Define the variables
//The From field must include the entire text of the From field, including the name
var fromEmail = "Kohl's <Kohls@t.kohls.com>";
var subject = "Nice work! Here's your Kohl's Cash.";
//Date format is yyyy/mm/dd
var afterDate = "2016/05/21";
var forwardEmail = "test@gmail.com";