Skip to content

Instantly share code, notes, and snippets.

View simonds's full-sized avatar

Mark Simonds simonds

View GitHub Profile
@simonds
simonds / Custom.css
Created October 16, 2012 17:40 — forked from bentruyman/Custom.css
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@simonds
simonds / 0_reuse_code.js
Created June 24, 2014 19:07
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
@simonds
simonds / gist:5bd8e5081a4c7006beaa
Created July 14, 2014 18:32
Onename.io verification gist
Verifying myself: My Bitcoin username is +marksimonds. https://onename.io/marksimonds
# Easily extract all compressed file types
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
@simonds
simonds / style.css
Created August 27, 2015 20:42
Change breakpoint from xs to sm for Bootstrap mobile nav
@media (max-width: 991px) { // Change to 1199px for md sizes.
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
@simonds
simonds / dump_db.sh
Last active May 10, 2016 20:26 — forked from faceleg/dump_db.sh
Dump tables, triggers and routines to separate files
#!/bin/bash
# Source: https://gist.github.com/simonds/9abadf569a2f01707d3158f086e90442/raw
# Pull latest: curl https://gist.github.com/simonds/9abadf569a2f01707d3158f086e90442/raw > dump_db.sh
# MySQL executables
MYSQL="/usr/bin/mysql"
MYSQLDUMP="/usr/bin/mysqldump"
DO_TABLES=true;
@simonds
simonds / speedtest-ifttt.sh
Created May 23, 2016 20:13 — forked from aallan/speedtest-ifttt.sh
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
@simonds
simonds / pokestops.json
Last active July 18, 2016 21:51
Pokestops within 5km of Riverside and Howard in downtown Spokane, WA
{
"pokestops" : [
{
"distance": 18,
"name": "Salvation Army Dedication Plaque",
"bearing": 207,
"latitude": 47.657763,
"image": "http://lh3.ggpht.com/Cf46atmJRu3lhO0JVbGFA4AxKWq8uHFEBxcU-GgzB8U390uqAEE-G1X4pNqT8ccHeFMSe7t1WoVDAuSnyB9v",
"guid": "4aed3289f2ae4450964e0ab3cb5eb3d6.16",
"compass": "SW",
@simonds
simonds / uc_words.sql
Created August 24, 2016 18:17
Found this MySQL function in several places online, so I don't know who to credit. This works a treat outputting Uppercase first letters on multiple words within a string.
/*
Usage:
UPDATE Table_name SET column_name = UC_Words(column_name)
*/
DELIMITER ||
CREATE FUNCTION `UC_Words`( str VARCHAR(255) ) RETURNS VARCHAR(255) CHARSET utf8_general_ci
BEGIN
DECLARE c CHAR(1);
@simonds
simonds / character_fix.sql
Created October 7, 2016 21:19
Finds records in a MySQL database that have non-ascii values and fixes double-encoding errors. Accepts table and field name.
DELIMITER ;;
DROP PROCEDURE IF EXISTS character_fix;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `character_fix`(_table_name VARCHAR(50), _field_name VARCHAR(50))
BEGIN
DROP TEMPORARY TABLE IF EXISTS temp_cursor_table;
SET @temp_table_query='CREATE TEMPORARY TABLE temp_cursor_table AS ';
SET @temp_table_query=concat( @temp_table_query, 'SELECT id, ', _field_name, ' FROM ', _table_name, ' WHERE ', _field_name, ' <> convert(', _field_name, ' using ascii) ORDER BY id');
PREPARE temp_statement from @temp_table_query;
EXECUTE temp_statement;