Skip to content

Instantly share code, notes, and snippets.

@petermac-
petermac- / 1-debounce.js
Last active September 12, 2015 19:38
debounce.js
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
@petermac-
petermac- / SassMeister-input.scss
Created March 18, 2015 19:31
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// Breakpoint (v2.5.0)
// Modular Scale (v2.0.6)
// ----
@import "modular-scale";
@import "breakpoint";
@petermac-
petermac- / 1-anidb_year_filter.js
Last active September 12, 2015 19:38
anidb_year_filter.js
// ==UserScript==
// @name AniDB Year Filter
// @namespace http://techexplored.io
// @version 0.1
// @description Removes rows from the anime show lists based on year.
// @match http://anidb.net/perl-bin/animedb.pl?type.web=1*
// @copyright 2014+, Peter MacDonald
// @run-at document-start
// ==/UserScript==
@petermac-
petermac- / 1-flushdns-yosemite.sh
Last active September 12, 2015 19:38
flushdns-yosemite.sh
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed
@petermac-
petermac- / 1-nginx.conf
Last active September 12, 2015 19:38
nginx.conf
# nginx
 
description "nginx http daemon"
author "George Shammas <[email protected]>"
 
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
 
env DAEMON=/usr/sbin/nginx
env PID=/var/run/nginx.pid
@petermac-
petermac- / 1-youtube_likes.js
Last active September 12, 2015 19:38
youtube_likes.js
// ==UserScript==
// @name YouTube Likes
// @description Displays number of likes and dislikes of YouTube videos.
// @namespace http://turplepurtle.com
// @author TurplePurtle
// @version 2.0.1
// @include http://www.youtube.com/*
// @include https://www.youtube.com/*
// ==/UserScript==
@petermac-
petermac- / 1-unix_commands.sh
Last active September 12, 2015 19:38
unix_commands.sh
# Return to the directory you were in before executing your last cd command.
cd -
# Run your last entered command as sudo.
sudo !!
# Shows who’s currently logged in to your system.
w
# Attaches line numbers to text.
@petermac-
petermac- / 1-flushdns-mavericks.sh
Last active September 12, 2015 19:38
flushdns-mavericks.sh
#!/bin/bash
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
@petermac-
petermac- / 1-drop_db_tables.sh
Last active September 12, 2015 19:38
drop_db_tables.sh
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@petermac-
petermac- / 0_reuse_code.js
Created May 31, 2014 14:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console