Skip to content

Instantly share code, notes, and snippets.

View jubalm's full-sized avatar

Jubal Mabaquiao jubalm

  • Iloilo, Philippines
View GitHub Profile
@jubalm
jubalm / latest-posts.php
Created May 22, 2012 08:02
wordpress - latest posts plugin
<?php
/*
Plugin Name: Latest Posts
Description: An extension of Wordpress' Recent Posts Widget
Author: Jubal Mabaquiao
Version: 1.0
Author URI: http://behance.net/jubal
*/
class WP_Widget_Latest_Posts extends WP_Widget {
@jubalm
jubalm / functions.php
Created June 11, 2012 12:18
Wordpress - disable admin bar
<?php
// Disable admin bar from non administrators
add_filter( 'show_admin_bar' , 'disable_admin_bar');
function disable_admin_bar($content) {
return ( current_user_can("administrator") ) ? $content : false;
}
?>
@jubalm
jubalm / functions.php
Created June 25, 2012 09:28
Gravity Forms - activate password field
<?php
add_action('gform_enable_password_field', '__return_true');
?>
@jubalm
jubalm / functions.php
Created August 20, 2012 04:40
wordpress - enqueue script with SSL
<?php
// google fonts with ssl support
wp_enqueue_style( 'lato', (is_ssl() ? 'https://' : 'http://') . 'fonts.googleapis.com/css?family=Lato:300,400,700','', '1.0' );
?>
@jubalm
jubalm / ssl.php
Created August 24, 2012 08:30
PHP - check if SSL is enabled
<?php
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
@jubalm
jubalm / console.js
Created August 24, 2012 08:47
Javascript
if (!(window.console && console.log)) {
(function() {
var noop = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
var length = methods.length;
var console = window.console = {};
while (length--) {
console[methods[length]] = noop;
}
}());
@jubalm
jubalm / layout.xml
Created September 19, 2012 03:55
magento - external javascript in cms
<reference name="head">
<block type="core/text" name="google.cdn.jquery">
<action method="setText">
<text>
<![CDATA[
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">jQuery.noConflict()</script>
]]>
</text>
</action>
@jubalm
jubalm / script.js
Created October 23, 2012 05:21
magento - console.log fix
// drop this line on the browser's console (developer tools)
delete window['console'];
@jubalm
jubalm / Guardfile
Created August 15, 2013 18:13
Guard-Livereload-Magento
# watch only modules you handle
guard 'livereload' do
watch(%r{.modman/.+\.(css|js|jpg|png|gif|php|phtml|xml|csv)})
end
@jubalm
jubalm / README.md
Last active December 23, 2015 07:49
markdown editor in browser

Disclaimer

First thing I learned out of roaming around Coderwall. Original post here. Don't miss out the fun experiments on the comments!

Usage

Simply copy and paste the contents of editor.html on your browser's address bar.

Have fun experimenting!