Skip to content

Instantly share code, notes, and snippets.

View superhero's full-sized avatar
💭
oɹǝɥɹǝdns

Erik Landvall superhero

💭
oɹǝɥɹǝdns
View GitHub Profile
@alisspers
alisspers / mysql-alter-collation-on-all-tables.sql
Created May 21, 2014 13:37
Altering all tables in a database to change their collation can be a tedious task if needed on a large database. This nifty little trick based on a SO answer (http://stackoverflow.com/a/19462205) returns a list of all altercommands for the tables in a database, to make your life a bit easier.
/*
Get a list of all ALTER commands needed to change collation on all tables in the given database
Note: Remember to set your database name on line 7, and change utf8_swedish_ci to the collation of your choice
Props goes to this answer on StackOverflow: http://stackoverflow.com/a/19462205
*/
SELECT CONCAT("ALTER TABLE `", TABLE_NAME,"` CONVERT TO CHARACTER SET utf8 COLLATE utf8_swedish_ci;") AS mySQL
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="YOUR_DATABASE_NAME"
AND TABLE_TYPE="BASE TABLE"
@tacone
tacone / ubuntu-install-tidy-html5.sh
Last active December 11, 2016 01:26
Install html5 tidy on ubuntu as a deb package
#!/bin/bash
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install the software."
exit 1
fi
apt-get remove libtidy-0.99-0 tidy
apt-get install git-core automake libtool checkinstall
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"