Skip to content

Instantly share code, notes, and snippets.

View dsebao's full-sized avatar
🏠
Working from home

Sebastian Ortiz dsebao

🏠
Working from home
View GitHub Profile
@mathiasbynens
mathiasbynens / jquery.email-antispam.js
Created January 26, 2010 13:10
Simple spam protection for email addresses using jQuery
/* Simple spam protection for email addresses using jQuery.
* Well, the protection isn’t jQuery-based, but you get the idea.
* This snippet allows you to slightly ‘obfuscate’ email addresses to make it harder for spambots to harvest them, while still offering a readable address to your visitors.
* E.g.
* <a href="mailto:foo(at)example(dot)com">foo at example dot com</a>
* →
* <a href="mailto:foo@example.com">foo@example.com</a>
*/
$(function() {
@nu7hatch
nu7hatch / example.html
Created September 7, 2010 14:20
Simple banner rotator with jQuery
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<link href="rotate.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="rotate.js"></script>
<script type="text/javascript">
$(window).load(function() {
startRotator("#rotator");
})
</script>
@mfields
mfields / mfields.org-post-loader.php
Created December 6, 2010 16:16
jQuery Post Loader for WordPress Home Page
<?php
/*
Plugin Name: mfields.org - Ajax Append Posts
Plugin URI:
Description:
Version: 0.1.2
Author: Michael Fields
Author URI: http://mfields.org/
Copyright 2010 Michael Fields michael@mfields.org
License GPLv2
@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@retgef
retgef / wordpress_post_expirator.php
Created September 6, 2011 15:38
Wordpress Post Expirator
<?php
/*
This function assumes a custom field named 'expiration' with a human friendly date/time.
*/
function is_post_expired($post_ID = null){
if(!$post_ID) global $post;
@davemo
davemo / footer.css
Created January 20, 2012 01:56
Want a basic sticky footer in iOS (4/5) and Android Devices?
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@RaVbaker
RaVbaker / readme.md
Created March 30, 2012 20:12
[HOWTO] Rewrite all urls to one index.php in Apache

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

@christophercochran
christophercochran / Add WordPress Menu Item Description
Created May 31, 2012 16:20
Adds Menu Description to Wordpress Menu with the walker_nav_menu_start_el filter.
add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4);
function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
$desc = __( $item->post_content );
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<small class=\"nav-desc\">{$desc}</small><", $item_output);
}