Skip to content

Instantly share code, notes, and snippets.

@cesarhdz
cesarhdz / test.php
Created March 18, 2012 23:24
PHP:WP:current_time
function current_time( $type, $gmt = 0 ) {
switch ( $type ) {
case 'mysql':
return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
break;
case 'timestamp':
return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * 3600 );
break;
}
}
@cesarhdz
cesarhdz / gist:2085584
Created March 18, 2012 23:42
PHP:WP 404 error page
<div id="content-full" class="grid col-940">
<div id="post-0" class="error404">
<div class="post-entry">
<h1 class="title-404"><?php _e('404 &#8212; Fancy meeting you here!', 'responsive'); ?></h1>
<p><?php _e('Don&#39;t panic, we&#39;ll get through this together. Let&#39;s explore our options here.', 'responsive'); ?></p>
<h6><?php _e( 'You can return', 'responsive' ); ?> <a href="<?php echo home_url(); ?>/" title="<?php esc_attr_e( 'Home', 'responsive' ); ?>"><?php _e( '&larr; Home', 'responsive' ); ?></a> <?php _e( 'or search for the page you were looking for', 'responsive' ); ?></h6>
<?php get_search_form(); ?>
</div><!-- end of .post-entry -->
</div><!-- end of #post-0 -->
</div><!-- end of #content-full -->
RewriteEngine On
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*/
public function index()
{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cross-browser kerning-pairs & ligatures</title>
<style>
body { font-family: sans-serif; background: #f4f3f3; color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; }
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px 1px 0px; -webkit-transition: background 1s ease; }
a:hover { background: rgba(0, 220, 220, 0.2); }
p, li { line-height: 1.5; padding: 0em 1em 0em 0em; margin: 0em 0em 0.5em; }
@cesarhdz
cesarhdz / gist:2429845
Created April 20, 2012 15:50 — forked from tbonemalone/gist:2233199
css: normalize.css
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects block display not defined in IE6/7/8/9 & FF3
*/
@cesarhdz
cesarhdz / template.jquery.js
Created May 15, 2012 17:44
JQUERY: Plugin Template
/**
* myPluginName jQuery plugin
* @author
* @version
* @date
*/
(function($){
//Default options
$.myPluginName = {
<?php /**
* Create a nav menu with very basic markup.
* Based on Thomas Scholz http://toscho.de, T5_Nav_Menu_Walker_Simple
*
* @author César Hernández [cesarhdz.com]
* @version 1.0
*/
class Mi_menu_walker extends Walker_Nav_Menu
{
/**
@cesarhdz
cesarhdz / get-sprite.sass
Created September 6, 2012 20:59 — forked from antonkor/get-sprite.sass
A SASS mixin for generating a sprite declaration block that will work with media queries. UPDATE: Having offset-x & -y are very nice ;)
// http://compass-style.org/reference/compass/helpers/sprites/
@mixin get-sprite($map, $sprite, $offset-x: 0, $offset-y: 0, $repeat: no-repeat, $height: true, $width: true)
//http://compass-style.org/reference/compass/helpers/sprites/#sprite-file
$sprite-image: sprite-file($map, $sprite)
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-url
$sprite-map: sprite-url($map)
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-position
@cesarhdz
cesarhdz / get-sprite.scss
Created September 6, 2012 21:01 — forked from dfadler/get-sprite.sass
A SASS mixin for generating a sprite declaration block that will work with media queries, in SCSS
// http://compass-style.org/reference/compass/helpers/sprites/
@mixin get-sprite($map, $sprite, $repeat: no-repeat, $height: true, $width: true)
{
//http://compass-style.org/reference/compass/helpers/sprites/#sprite-file
$sprite-image: sprite-file($map, $sprite);
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-url
$sprite-map: sprite-url($map);