Skip to content

Instantly share code, notes, and snippets.

@ikawka
ikawka / config.inc.php
Created October 4, 2013 02:04 — forked from nodesocket/config.inc.php
phpMyAdmin Mod
<?php
$cfg['ShowPhpInfo'] = true;
$cfg['TitleTable'] = '@SERVER@ - @DATABASE@ - @TABLE@';
$cfg['TitleDatabase'] = '@SERVER@ - @DATABASE@';
$cfg['TitleServer'] = '@SERVER@';
$cfg['TitleDefault'] = '@SERVER@';
// 2 Hours Till Auto-Logout
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
@ikawka
ikawka / jquerymobile loader overlay
Created November 5, 2013 02:12
Add overlay to JQueryMobile Loader and disable functions below the loader.
Add this style
<style type="text/css">
.ui-loader-background {
background: rgba(0, 0, 0, 0.5);
width:100%;
height:100%;
top:0;
margin: 0;
display:none;
position: fixed;
#!/bin/bash
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
brew tap homebrew/dupes
# install nginx + mysql + php 5.4 + php-fpm + apc + xdebug
brew install nginx mysql
@ikawka
ikawka / Install nginx, php-fpm & mysql OS X
Last active January 4, 2016 19:09
Install nginx, php-fpm & mysql OS X
#Xcode Command line tools
xcode-select --install
#install the brewery before brewing
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
@ikawka
ikawka / ajax-no-cache
Created January 28, 2014 16:20
Prevent IE from caching your ajax urls
function randomString(len){
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = len;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
return randomstring;
}
@ikawka
ikawka / html
Created January 30, 2014 04:57
JQuery list search
<div><input type="text" id="search" placeholder="Search" /></div>
<div>
<ul id="item-container">
<li class="items">Apple</li>
<li class="items">Orange</li>
<li class="items">Grapes</li>
<li class="items">Banana</li>
</ul>
</div>
@ikawka
ikawka / loca-timezone
Last active August 29, 2015 13:56
Change local timezone in CentOS
#make sure that you have updated tzdata
yum update tzdata
#check list of timezone
ls /usr/share/zoneinfo/
#replace the localtime with the new one
ZONEINFO=Asia/Manila
ln -sf /usr/share/zoneinfo/$ZONEINFO /etc/localtime
@ikawka
ikawka / file_str_replace
Created February 21, 2014 09:33
Search and Replace a string in files
//replace string in files
grep -rlw 'old-word' * | xargs -i@ sed -i 's/old-word/new-word/g' @
@ikawka
ikawka / humanize
Created March 6, 2014 02:30
Human readable filesize
<?php
function human_filesize($bytes, $decimals = 2) {
$sz = 'BKMGTP';
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}