Skip to content

Instantly share code, notes, and snippets.

View jjanusch's full-sized avatar

Josh Janusch jjanusch

  • Vincit
  • Phoenix, AZ
View GitHub Profile
@jjanusch
jjanusch / nhl-players-without-vowels.html
Created September 27, 2017 03:32
Finds NHL players without vowels in their last name
<html>
<body>
<ol id="players">
</ol>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
@jjanusch
jjanusch / google-music-exporter.js
Last active September 14, 2020 17:19
A script to scrape song data from Google Music. Inspired/based on this script from jimiserez https://gist.github.com/jmiserez/c9a9a0f41e867e5ebb75
/*
To run:
1. Go to playlist in Google Music such as https://play.google.com/music/listen#/all
2. Open the Developer Tools and paste the script below in
3. Run "GoogleMusicExporter.scrape()"
4. Once the script completes, songs can be viewed by:
1. Running "GoogleMusicExporter.songs", which will show the Javascript object
2. Running "GoogleMusicExporter.export('csv')" which will export all of the songs as a CSV to your clipboard
3. Running "GoogleMusicExporter.export('json')" which will export all of the songs as JSON to your clipboard
@jjanusch
jjanusch / slack-delete-old-files.php
Created August 28, 2015 16:26
A simple PHP script that uses the Slack API to automatically delete old files and outputs all errors it encounters.
<?php
// https://api.slack.com/methods/files.list
const SLACK_API_FILES_LIST = 'https://slack.com/api/files.list';
// https://api.slack.com/methods/files.delete
const SLACK_API_FILES_DELETE = 'https://slack.com/api/files.delete';
// retrieved from https://api.slack.com/web
// needs to be admin profile token
@jjanusch
jjanusch / capitalize.js
Last active August 29, 2015 14:03
Prototypes String to allow for any string to be capitalized. Can also take into account English articles by using the 'title' type. Warning: automatically lower cases the entire string, so words like "McDonald's" will be out put as "Mcdonald's". See bottom of Gist for usage examples
String.prototype.capitalize = function(type) {
var str = this.toLowerCase();
if (type) {
var nArr = [],
articles = ["a", "an", "and", "as", "at", "but", "by", "etc", "for", "in", "into", "is", "nor", "of", "off", "on", "onto", "or", "so", "the", "to", "unto", "via"],
arr = str.split(' '),
i = 0,
value;
for (i; i < arr.length; i++) {
@jjanusch
jjanusch / jquery.capitalize.js
Last active August 29, 2015 14:03
Extends jQuery via prototype to capitalize the first letter of each word in a sentence ('all'), just the first word in a sentence (default), or title text ('title' - capitalizes each word in the sentence minus words like "the", "and", "or", "but" etc. Usage included under code.
String.prototype.capitalize = function(type) {
var array, capitalized, doNotCapitalize;
// if type = all, capitalize first letter of each word
if(type === 'all'){
array = this.split(' '); // split on spaces
capitalized = '';
$.each(array, function( index, value ) {
capitalized += value.charAt(0).toUpperCase() + value.slice(1);