Skip to content

Instantly share code, notes, and snippets.

View keithics's full-sized avatar

Keith Levi Lumanog keithics

View GitHub Profile
@keithics
keithics / gist:4462455
Last active December 10, 2015 16:38
Class Plugin for Wordpress
<?php
/*
Plugin Name: Plugin for Wordpress
Plugin URI:
Description: A Sample Class Plugin for Wordpress
@keithics
keithics / gist:4482228
Last active December 10, 2015 19:38
Serialize by input - jQuery
/* @projectDescription jQuery Serialize Anything - Serialize anything (and not just forms!)
* @author Bramus! (Bram Van Damme)
* @version 1.0
* @website: http://www.bram.us/
* @license : BSD
* original file : http://www.bram.us/2008/10/27/jqueryserializeanything-serialize-anything-and-not-just-forms/
* modified by Keithics : keith@webninjamobile.com
* usage jQuery('.class_input').serializeAnything()
*/
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array('logo' => 'image');
$input = Input::file('logo');
$validation = Validator::make($input, $rules);
//file not valid
@keithics
keithics / gist:4617986
Created January 24, 2013 05:45
Easy toggle check to All checkboxes
<table>
<tr>
<td>I Lead: <input type="checkbox" id="toggle_select" /></td>
</tr>
<tr>
<td>We Follow :<input type="checkbox" class="toggle_type" /></td>
</tr>
<tr>
<td>We Follow :<input type="checkbox" class="toggle_type" /></td>
</tr>
@keithics
keithics / .htaccess
Last active January 26, 2016 16:44
Laravel and Shared hosting - Hostgator and without virtual host
AddHandler application/x-httpd-php53 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /public_html/DOMAIN.COM/public
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@keithics
keithics / gist:5398349
Created April 16, 2013 18:32
Get post by Slug - Wordpress
function get_post_by_slug($post_name) {
global $wpdb;
$post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $post_name));
return $post ? get_post($post) : NULL;
}
@keithics
keithics / gist:5557439
Last active December 17, 2015 05:19
Simple Theme Customizer
<?php
function wpcebu_customize_register( $wp_customize ){
// Full Name
$wp_customize->add_section( 'content',
array(
'title' => __( 'Full Name', 'wpcebu2' ), //Visible title of section
)
);
@keithics
keithics / gist:5557604
Created May 10, 2013 21:33
Theme options with other samples
<?php
function wpcebu_customize_register( $wp_customize ){
// Full Name
$wp_customize->add_section( 'content',
array(
'title' => __( 'Full Name', 'wpcebu2' ), //Visible title of section
)
);
use Assetic\AssetManager;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\Asset\GlobAsset;
use Assetic\Filter\Yui;
use Assetic\AssetWriter;
$am = new AssetManager();
@keithics
keithics / gist:6005606
Created July 16, 2013 03:48
Serialize text inputs using Titanium - works with inputs and textarea for now
_.mixin({
serialize:function(el){
var url = [];
_.map(el.getChildren(),function(value,key,el){
if(!_.isUndefined(value.name)){
url.push(value.name+ '=' + value.getValue());
}
});
return '?'+url.join('&');