Skip to content

Instantly share code, notes, and snippets.

View charrismatic's full-sized avatar
☝️
Life is Code

Matt Harris charrismatic

☝️
Life is Code
View GitHub Profile
@charrismatic
charrismatic / spotify_cli.sh
Last active July 7, 2017 00:02
Spotify API - Keep computer awake if currently playing
# Machine currently playing goes into sleep mode during playback
# A simple curl request to see if this machine is currently active
# If true reset wake timer and set timer to run again at t-1 wake timer
# Hooks: Run script at spotify application launch and run at machine wake
# https://developer.spotify.com/web-api/endpoint-reference/
# ref: https://developer.spotify.com/web-api/console/get-user-player/
# example:
curl -X GET "https://api.spotify.com/v1/me/player" -H "Accept: application/json" -H "Authorization: Bearer <API-KEY>"
@charrismatic
charrismatic / vanilla_data.js
Last active July 19, 2017 02:39
Vanilla Tools Js
/***************************************************************************/
// Vanilla Javascript Data Gathering
// Used to collect data without using a framework or library tools
// TODO: Get all X on a page (img url, a href, script src etc)
// REF: https://drafts.csswg.org/cssom/
// GET ALL IDS ON PAGE
function getAllIds() {
@charrismatic
charrismatic / regex_list.js
Last active August 4, 2023 07:11
Useful Regex String List
regexLib = {
multiLineCComments: a("/\\*.*?\\*/", "gs"),
singleLineCComments: /\/\/.*$/gm,
singleLinePerlComments: /#.*$/gm,
doubleQuotedString: /"([^\\"\n]|\\.)*"/g,
singleQuotedString: /'([^\\'\n]|\\.)*'/g,
multiLineDoubleQuotedString: a('"([^\\\\"]|\\\\.)*"', "gs"),
multiLineSingleQuotedString: a("'([^\\\\']|\\\\.)*'", "gs"),
xmlComments: a("(&lt;|<)!--f.*?--(&gt;|>)", "gs"),
url: /\w+:\/\/[\w-.\/?%&=:@;#]*/g,
@charrismatic
charrismatic / .editorconfig
Last active April 1, 2020 09:11
Atom Sync Settings [Master]
# .editorconfig (not found)
# COUNT FILES IN SUB DIRECTORIES
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do
printf "%-25.25s : " "$dir"
find "$dir" -type f | wc -l
done
@charrismatic
charrismatic / atom.md
Last active July 14, 2017 04:04
Atom Notes

Atom Features and Todo Items:

Atom Toolbar Requirements

  • run terminal commands from atom
  • vagrant actions [ db snapshot, db import, magento debug on/off]
  • open key folders (BOOKMARKS)
  • dropdown terminal
  • open current in file exploer
  • manage projects config
  • beautify - formatting
@charrismatic
charrismatic / README.md
Last active July 19, 2017 01:31 — forked from JoelBesada/README.md
Backtick Example Command

Backtick is a customizable command command pallete for chrome letting you run your own javascript snippets easily in a live browsing session.

Backtick

To createa a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

@charrismatic
charrismatic / css_stats
Created July 29, 2017 19:19
CSS Specificity Statisctics
// A SCRIPT TO SUMMARIZE DATA ABOUT CSS BEING GENERATED BY NPM SPECIFICITY GRAPH
// https://www.npmjs.com/package/specificity-graph
// arry stats helpers.
//https://gist.github.com/Daniel-Hug/7273430
var arr = {
max: function(array) {
return Math.max.apply(null, array);
},
@charrismatic
charrismatic / cycle.html
Created August 9, 2017 15:44
Cycle things with javascript
<i>1</i>
<i>2</i>
<i>3</i>
<i>4</i>
<i>5</i>
<i>6</i>
@charrismatic
charrismatic / README.md
Created April 3, 2018 23:51 — forked from hofmannsven/README.md
Using a dynamic admin body class within WordPress to distinguish between light or dark admin interface.