Skip to content

Instantly share code, notes, and snippets.

View matthewhartman's full-sized avatar

Matthew Hartman matthewhartman

View GitHub Profile
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@bradwestfall
bradwestfall / gist:f5a010e96fb0c4d18556
Last active November 20, 2022 14:40
Pull Instagram Images via JavaScript
@elliotbonneville
elliotbonneville / topkeywords.js
Last active August 23, 2022 10:26
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
for f in *.gz; do
STEM=$(basename "${f}" .gz)
gunzip -c "${f}" > /THERE/"${STEM}"
done
@gitaarik
gitaarik / git_submodules.md
Last active May 1, 2024 12:25
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@makenova
makenova / Difference between debounce and throttle.md
Last active February 22, 2023 03:09
Javascript function debounce and throttle

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@jimmynotjim
jimmynotjim / _instructions.md
Last active April 19, 2024 05:26
Setup macOS 12 Monterey

Leaving this for historical reasons, but with the latest iteration I set up proper dotfiles. Check em out

Setup macOS with a Clean Install

After too many years of tinkering my machine is a bit all over. With Mojave High Sierra Montery I wanted to start fresh

1. Run Software Update

Make sure everything is up to date.

@akdetrick
akdetrick / rvm-to-rbenv.md
Last active March 15, 2024 17:06
Guide to switching to rbenv bliss from RVM hell

RVM to rbenv

Why? @sstephenson explains it best here.


1) remove RVM from your system

This should get rid of the rvm dir and any installed rubies:

$ rvm implode
@TexRx
TexRx / vanilla-not-jquery.js
Created June 5, 2013 04:44
Pure JS alternatives to common CSS class jQuery functions
function hasClass(elem, className) {
return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
}
function addClass(elem, className) {
if (!hasClass(elem, className)) {
elem.className += ' ' + className;
}
}