Skip to content

Instantly share code, notes, and snippets.

View marczhermo's full-sized avatar

Marco Hermo marczhermo

  • New Zealand
View GitHub Profile
@marczhermo
marczhermo / json_decode.php
Created April 6, 2012 13:53
PHP: json_decode/encode
<?php
$data = array('description' => "TEST: quick brown fox",
'public' => true,
'files' => array('gistfile.php' => array('content' => "the quick brown fox jumps over the lazy dog.")));
$data_string = json_encode($data);
echo '<pre>'.$data_string.'<p>';
var_dump(json_decode('{
"description": "the description for this gist",
"public": true,
"files": {
@marczhermo
marczhermo / highlight.css
Created April 15, 2012 09:59
CSS: Form Input Highlights
input[type=text], textarea {
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
outline: none;
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid #DDDDDD;
}
@marczhermo
marczhermo / css
Created April 26, 2012 22:44
CSS: Hacks
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
/* IE7 */
*:first-child+html #dos { color: red }
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
@marczhermo
marczhermo / template.php
Created May 1, 2012 23:38
Joomla: Discover Template Fix in Admin
# libraries/joomla/installer/adapters/template.php
# line:543
public function discover_install()
{
$lang = JFactory::getLanguage();//fix for discover bug on new templates
...
}
@marczhermo
marczhermo / less.css
Created May 7, 2012 22:31
Bootstrap: Disable Responsive Layout
disable the following:
mixins.less
fluidgridsystem
inputgridsystem
grid.less
fluidgridsystem
forms.less
@marczhermo
marczhermo / css
Created May 10, 2012 23:29
CSS: Sample Font Faces
"Proxima Nova Regular", "Helvetica Neue", Arial, Helvetica, sans-serif;
"Myriad Pro", Arial, Helvetica, sans-serif;
"Fanwood Text"", Georgia, Times, "Times New Roman", serif;
"PT Sans", "Trebuchet MS", Arial, sans-serif;
@marczhermo
marczhermo / functions.php
Created May 20, 2012 12:41
Wordpress: Custom Logo
// Custom WordPress Login Logo
function login_css() {
wp_enqueue_style( 'login_css', get_template_directory_uri() . '/css/login.css' );
}
add_action('login_head', 'login_css');
// CSS File
#login h1 a {
background-image: url("address-of-logo.png") !important
}
@marczhermo
marczhermo / iframe.js
Created May 20, 2012 13:26
jQuery: iFrame
$(function() {
var $frame = $('<iframe style="width:200px; height:100px;">');
$('body').html( $frame );
setTimeout( function() {
var doc = $frame[0].contentWindow.document;
var $body = $('body',doc);
console.log($body);
$body.html('<h1>Test2</h1>');
}, 1 );
});​
@marczhermo
marczhermo / url
Created May 29, 2012 20:59
CSS: Google Font API
http://fonts.googleapis.com/css?family=PT+Sans:400,700
@marczhermo
marczhermo / index.php
Created June 5, 2012 04:48
Joomla: Session Handling (works on v.2.5)
When you want to save something in session please use:
$mainframe = &JFactory::getApplication();
$mainframe->setUserState('sessionname',$sessionvalue);
Where you want to get session value please use:
$mainframe = &JFactory::getApplication();
$value = $mainframe->getUserState('sessionname');