Skip to content

Instantly share code, notes, and snippets.

View jibone's full-sized avatar
🧑‍💻
Locked In

J Shamsul Bahri jibone

🧑‍💻
Locked In
View GitHub Profile
@jibone
jibone / exp.php
Last active December 12, 2015 05:18
// I don't think this works...
echo "<td><div class='days'><span>". ($v.if(isset($arr[$v])) { echo $arr[$v]; }) . "</span></div></td>"
// Try this instead....
if(isset($arr[$v])) {
echo "<td><div class='days'><span>". $v.$arr[$v]; . "</span></div></td>"
} else {
@jibone
jibone / gist:4466010
Created January 6, 2013 08:15
rvm the latest Ruby on MacOSX
rvm install ruby-1.9.3-p362 --with-gcc=clang
@jibone
jibone / daytime.php
Created January 2, 2013 04:29
count the number of days form today's date
<?php
$now = time() + 26888; // or your date as well
//$now2 = $now + 26888;
$your_date = strtotime("2013-01-14");
$datediff = $your_date - $now;
echo ceil($datediff/(60*60*24));
?>
@jibone
jibone / Find and repace
Created December 22, 2012 16:28
Just the mysql statement for find and replace.
UPDATE wp_posts set post_body = replace(post_body, 'needle', 'chocolate');
@jibone
jibone / functions.php
Created October 29, 2012 10:00
Get first paragraph from post.
if(!function_exists('get_the_content_first_paragraph')) :
function get_the_content_first_paragraph() {
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
$content_explode = explode("</p>", $content);
$c = 0; $p = count($content_explode); $return_data = "";
while($c < $p) {
$test = strip_tags($content_explode[$c]);
@jibone
jibone / gist:3915933
Created October 19, 2012 02:32
Login to EC2 with .pem
ssh -l USERNAME_HERE -i .ssh/yourkey.pem public-ec2-host
@jibone
jibone / .htaccess
Created October 5, 2012 04:14
My typical .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^css/(.*) public/css/$1 [L]
RewriteRule ^js/(.*) public/js/$1 [L]
RewriteRule ^img/(.*) public/img/$1 [L]
RewriteRule ^font/(.*) public/font/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ bootstrap.php [QSA,L]
</IfModule>
@jibone
jibone / .gitignore
Created September 4, 2012 05:39
My typical .gitignore file
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@jibone
jibone / .vimrc
Created April 23, 2012 14:58
My .vimrc for gvim on windows.
set number
colorscheme desert
set tabstop=4
set softtabstop=4
set shiftwidth=4
set listchars=tab:>\ ,eol:¬
@jibone
jibone / 1) create sample init script
Created March 13, 2012 09:49
Creating a Debian init script
#! /bin/sh
# /etc/init.d/blah
#
# Some things that run always
touch /var/lock/blah
# Carry out specific functions when asked to by the system
case "$1" in
start)