Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
very busy

Derek derek-adair

🎯
very busy
View GitHub Profile
@derek-adair
derek-adair / fetch_2020_week1.py
Created Jul 4, 2020
Uses new NFL API to pull down 2020 week 1 schedule
View fetch_2020_week1.py
import json
import requests
url = "https://api.nfl.com/v1/reroute"
# TODO: resolve if DNT or x-domain-id are necessary. pulled them from chrome inspector
payload = 'grant_type=client_credentials'
headers = {
'DNT': '1',
'x-domain-id': '100',
View create-react-deps
This file has been truncated, but you can view the full file.
{
"name": "my-app",
"version": "0.1.0",
"problems": [
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1",
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1"
],
"dependencies": {
"@testing-library/jest-dom": {
View create-react-deps
This file has been truncated, but you can view the full file.
{
"name": "my-app",
"version": "0.1.0",
"problems": [
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1",
"peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1"
],
"dependencies": {
"@testing-library/jest-dom": {
@derek-adair
derek-adair / list-deps.py
Last active May 9, 2020
Python script to show how many dependencies each package has
View list-deps.py
import requests
import json
import lxml.html
from lxml.cssselect import CSSSelector
f = open('package.json')
packageJson = json.load(f)
for dep in packageJson['dependencies']:
response = requests.get('https://www.npmjs.com/package/{}?activeTab=dependencies'.format(dep)) tree = lxml.html.fromstring(response.text) sel = CSSSelector('#dependencies h2:first-child') results = sel(tree)
View gist:0ca684c495c9ef50e87ad7d240032095
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function t(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function n(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function o(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");0<=n;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var r={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,"⇪":20,",":188,".":190,"/":191,"`":192,"-":e?173:189,"=":e?61:187,";":e?59:186,"'":222,"[":219,"]":221,"\\":220},i={"⇧":16,shift:16,"⌥":18,
View new play by play feed
{
"gameSchedule":{
"season":2018,
"seasonType":"PRE",
"week":1,
"gameId":2018080951,
"gameKey":57504,
"gameDate":"08/09/2018",
"gameTimeEastern":"19:30:00",
"gameTimeLocal":"19:30:00",
View gist:79760c0435360c9523df0558769331ac
let
newState = Object.assign({}, state),
library_clips = newState.library[action.library_owner].clips,
clip_index = library_clips.indexOf(`${action.clip.user}/${action.clip.name}`)
;
library_clips.splice(clip_index, 1)
return newState
View gist:7b0d0598faf5f5dba574d453fd8ead32
//Object.keys returns an array like ['username/clipname': {name: clipname, mp3_file:<link_to_mp3>}]
userClips = Object.keys(clips)
// filter the array to only include those that start with the username
.filter(clip => !clip.indexOf(`${username}/`))
// reduces the original object key array using object explode syntax
.reduce((obj, key)=>{
return {
// obj is exploded, its the accumulation of the reduce
...obj,
// inserts the clip into the accumulator
View gist:ea454a846efa06e2a919640ba1b4a0e4
`
### WordPress Environment ###
Home URL: https://**********
Site URL: https://**********
WC Version: 3.5.2
Log Directory Writable: ✔
WP Version: ❌ 4.9.8 - There is a newer version of WordPress available (5.0.3)
WP Multisite: –
WP Memory Limit: 768 MB
@derek-adair
derek-adair / vim_with_python.sh
Last active Mar 25, 2020
Compile and install vim w/ YouCompleteMe
View vim_with_python.sh
#Install the deps
sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git
#Remove all the vims
sudo apt remove vim vim-runtime gvim vim-tiny vim-common
# Make sure they are alllll gone
You can’t perform that action at this time.