Skip to content

Instantly share code, notes, and snippets.

Tristan Wiley TristanWiley

View GitHub Profile
@TristanWiley
TristanWiley / se-chat-trash.js
Last active Mar 12, 2019
Add "move to trash" to the StackOverflow/StackExchange chat rooms. Only works for room owners.
View se-chat-trash.js
const trashBinId = '23262'
function moveToTrash(el) {
const messageId = el.parentElement.parentElement.id.split('-')[1]
const formData = new FormData();
formData.append('ids', messageId);
formData.append('to', trashBinId);
formData.append('fkey', fkey().fkey);
@TristanWiley
TristanWiley / music-slack.js
Last active Mar 9, 2019
Script that updates Slack status with what you're currently listening to on Google Play Music
View music-slack.js
let currentSongTitle = ""
let currentSongPart = 0
let songLength = ''
const token = ""
const target = document.querySelector('#player')
const observer = new WebKitMutationObserver(() => {
const currentlyPlayingTitle = document.getElementById('currently-playing-title')
if (!currentlyPlayingTitle) return
const newSongTitle = currentlyPlayingTitle.innerText
View keybase.md

Keybase proof

I hereby claim:

  • I am tristanwiley on github.
  • I am sirhype (https://keybase.io/sirhype) on keybase.
  • I have a public key ASCXog3JMrr_gOZles8EndqR5yJf4l4WW6-C-JoYGSHkpgo

To claim this, I am signing this object:

View scrapequestions.js
var newButton = document.querySelector("._3-8_._4jy0._4jy4._517h._51sy._42ft");
var questions = [];
for(var i = 0; i<=1000; i++){
var text = document.querySelector("._64n_._3-8y").innerHTML;
if(!questions.includes(text)){
questions.push(text);
}
newButton.click();
}
@TristanWiley
TristanWiley / meals.js
Last active Nov 16, 2017
A script to tell me how much Moes/Guac and Roll I've eaten. Run on CBord's GET summary page. Select "meals". https://get.cbord.com/myubcard/full/history.php
View meals.js
var resturants = [];
var totals = {};
$('.scrollContent tr').each(function( index ) {
var resturant = $(this).find(".activity_details").text();
if(resturant == "XML Interface - Meal Plan Sele") return;
if(totals[resturant]){
totals[resturant]++;
}else{
totals[resturant] = 1;
View friend_export.js
var friendsElems = document.querySelectorAll('[data-sigil=undoable-action]');
var friends = []
for(var i = 0; i<friendsElems.length; i++){
var elem = friendsElems[i];
var innerElem = elem.children[1].children[0];
var name = innerElem.children[0].children[0].innerText
var json = innerElem.children[innerElem.children.length-1].children[0].children[0].dataset.store
var id = JSON.parse(json).id;
View trump_tweet_letter_frequency.txt
494530
265871 e
207377 a
201480 t
193465 o
170579 n
164532 r
155420 i
134537 s
116982 l
View SO
"MessagePosted": 1,
"MessageEdited": 2,
"UserEntered": 3,
"UserLeft": 4,
"RoomNameChanged": 5,
"MessageStarred": 6,
"DebugMessage": 7,
"UserMentioned": 8,
"MessageFlagged": 9,
"MessageDeleted": 10,
View gist:a6367c6eb2afb0769f406aca52e7e054
.................................................. ............................... .......,-~~'''''''~~--,,_
.................................................. ..................................,-~''-,:::::::::::::::::::''-,
.................................................. .............................,~''::::::::',::::::: :::::::::::::|',
.................................................. .............................|::::::,-~'''___''''~~--~''':}
.................................................. .............................'|:::::|: : : : : : : : : : : : : : :|
.................................................. .............................|:::::|: : :-~~---: : : -----: |
.................................................. ............................(_''~-': : : :o: : :|: :o: : : :|
.................................................. .............................'''~-,|: : : : : : ~---': : : :,'--NEVA GAHN
.................................................. .................................|,: : : : : :-~
View derivative-scraper.js
//A scraper I wrote for the site - http://www.bluffton.edu/homepages/facstaff/nesterd/java/derivs.html
//I added some extra bits, like copying it straight to your clipboard because yeah.
var elements = [];
for (var i = 0; i < 5; i++) {
var object = {
"html": document.getElementById("display").getElementsByClassName("base")[0].outerHTML,
"text": document.getElementById("display").textContent.split("Enter as: ")[1]
}
elements.push(object);
You can’t perform that action at this time.