Skip to content

Instantly share code, notes, and snippets.

View aa21's full-sized avatar

Alex Arul aa21

  • Hatcher, Blk 71
  • singapore
View GitHub Profile
@aa21
aa21 / HTML - Mobile - Prevent page scaling
Last active August 29, 2015 14:19
Meta, Tell Mobile Browser: don't scale this page!
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0 maximum-scale=1.0" />
//source: http://www.toao.net/48-replacing-smart-quotes-and-em-dashes-in-mysql
//By Mango, March 5th, 2009
//clean charset
function c($text){
// First, replace UTF-8 characters.
$text = str_replace(
array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"),
array("'", "'", '"', '"', '-', '--', '...'),
$text
@aa21
aa21 / MySql - Index all columns
Last active August 29, 2015 14:10
Bruteforce. Index all the columns in all tables of a db.
-- Bruteforce. Index all the columns in all tables of a db.
-- Find the data types
-- select distinct data_type from information_schema.columns where table_schema="DATABASE";
select
concat( "ALTER TABLE `DATABASE`.`", table_name , "` ADD INDEX ( `",column_name ,"` );" )
from information_schema.columns where table_schema='DATABASE' and
data_type not in ('text', 'longtext', 'mediumtext','tinytext' );