Skip to content

Instantly share code, notes, and snippets.

View twhite96's full-sized avatar
☢️
Cookin

tiff twhite96

☢️
Cookin
View GitHub Profile
@twhite96
twhite96 / data-structures.md
Last active March 22, 2019 01:38 — forked from alyssaq/data-structures.md
Data Structure descriptions: Dictionaries, priority queues, sets, graphs, trees

Dictionaries

A set of n records, each identified by one or more key fields.

Problem: Efficiently locate, insert and delete the record associated with any query key q.

Data structures include hash tables, skip lists and balanced/unbalanced binary search trees.

Representations

@twhite96
twhite96 / Timer fallback.js
Created November 15, 2018 07:25 — forked from swyxio/Timer fallback.js
Timer component for use as a Suspense fallback
function Timer() {
const startTime = React.useRef(performance.now());
const [time, setTime] = React.useState(performance.now());
React.useEffect(() => {
const id = setTimeout(() => {
ReactDOM.flushSync(() => {
setTime(performance.now());
});
}, 2);
@twhite96
twhite96 / making-javascript-faster.md
Created November 4, 2018 22:19
Making Javascript faster

Making Javascript faster

This is a list of guidelines to make your Javascript faster, often associated with jsPerf benchmarks.

Profile before optimizing

If you have an existing codebase, don't get carried away with premature optimizations. Profile to find the slow bits and pick the low hanging fruit.

Some of the latter lessons in Code School's Chrome DevTools course will teach you how to profile your code.

@twhite96
twhite96 / bs4.py
Created October 18, 2018 06:02 — forked from fffaraz/bs4.py
Python YouTube Playlist Link Collector
from bs4 import BeautifulSoup
import requests
def getPlaylistLinks(url):
sourceCode = requests.get(url).text
soup = BeautifulSoup(sourceCode, 'html.parser')
domain = 'https://www.youtube.com'
for link in soup.find_all("a", {"dir": "ltr"}):
href = link.get('href')
if href.startswith('/watch?'):
@twhite96
twhite96 / gist:69687ae11ea997abb29f93a6bf8718bc
Created October 15, 2018 04:25 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@twhite96
twhite96 / github_gpg_key.md
Created August 4, 2018 03:37 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# Mac
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
@twhite96
twhite96 / Eyeballing-This.md
Created June 9, 2018 02:25 — forked from zcaceres/Eyeballing-This.md
Understanding Binding and 'this' in Javascript

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

To understand this, we need to see where it is invoked. Nothing else matters, with one exception which we'll cover in a moment.

@twhite96
twhite96 / nokogiri_install
Created March 21, 2018 01:38 — forked from sobstel/nokogiri_install
nokogiri -> ERROR: cannot discover where libxml2 is located on your system
# `ERROR: Error installing nokogiri:
# ERROR: Failed to build gem native extension.
#
# current directory: /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.7.0/ext/nokogiri
# /usr/local/var/rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170103-68488-r71c9j.rb extconf.rb --with-xml=/usr/local/Cellar/libxml2/ --use-system-libraries
# checking if the C compiler accepts ... yes
# checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
# Building nokogiri using system libraries.
# ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
# *** extconf.rb failed ***
@twhite96
twhite96 / README.md
Created February 27, 2018 23:05 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})