Skip to content

Instantly share code, notes, and snippets.

@amurrell
amurrell / mouse-position.js
Created August 26, 2015 21:27
Check Mouse Position on Element
// Alter the logic for bounds to detect :after or :before pseudo elements.
var checkMousePosition = function(element, e) {
var h = element.outerHeight(),
w = element.outerWidth(),
top = element.offset().top,
left = element.offset().left,
inY = e.pageY !== undefined && ( e.pageY >= top && e.pageY <= (top + h) ),
inX = e.pageX !== undefined && ( e.pageX >= left && e.pageY <= (left + w) );
if (inY && inX) {
@amurrell
amurrell / stateFaceSass
Last active August 29, 2015 14:22
StateFace SASS
/*
* SASS for http://propublica.github.io/stateface/ icon set.
* author: amurrell
*/
@font-face {
font-family: 'icons-usa';
src: url('../fonts/icons-usa.eot');
src: url('../fonts/icons-usa.eot?#iefix') format('embedded-opentype'),
url('../fonts/icons-usa.woff') format('woff'),
@amurrell
amurrell / Debug jQuery Events
Last active September 18, 2015 18:19
Used to debug jQuery events
// Use to debug - Find out events on a jQuery object. Might not work for 1.8+ jQuery.
// Run this in your console, for example, just alter the get_events call.
function get_events(selector) {
var element = $(selector);
if (element.length > 1)
return 'too many matched elements. make it unique';
if (element.length < 1)
@amurrell
amurrell / mysql-user-database
Last active April 20, 2016 00:46
MySQL - Create user and database!
mysql -u root -p
CREATE DATABASE database_name;
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'%' IDENTIFIED BY 'database_user_pass';
// ==UserScript==
// @name remove ads - pixlr.com
// @namespace remove-ads
// @description remove adds on pixlr.com
// @include https://pixlr.com/editor/
// @version 1
// @grant none
// ==/UserScript==
$('.ad-wrap').remove();
// ==UserScript==
// @name Pixlr Editor - Remove AD
// @namespace http://your.homepage/
// @version 0.1
// @description Remove div wrapper for the AD, remove body padding right
// @author You
// @match https://pixlr.com/editor/
// @grant none
// ==/UserScript==
@amurrell
amurrell / mysqldump create database max allowed packet
Created January 3, 2017 21:04
mysqldump with create database and max allowed packet switches
mysqldump -u user -ppassword database_name --max-allowed-packet=500M -B --add-drop-database > dump.sql
@amurrell
amurrell / Alphabetized List
Last active May 23, 2017 19:16
Alphabetize list of items (cities)
var alphabetCities = {
init: function(regions, startLetter) {
this.addLetters(regions);
this.addLetterPicker(regions);
this.selectLetter(startLetter, regions)();
},
letters: [
'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j',
@amurrell
amurrell / installing-nodejs-from-binaries.md
Last active May 25, 2017 17:34
Installing nodejs from Linux Binaries
@amurrell
amurrell / init-server.sh
Last active July 17, 2017 02:27
Bash Script for PHP-7.0, nginx, git, etc on Ubuntu 14.04 LTS Server
#!/bin/bash
# Run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
apt-get update && \
apt-get install -y nano && \