Skip to content

Instantly share code, notes, and snippets.

View monecchi's full-sized avatar

Adriano Monecchi monecchi

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() {
@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@jaredwilli
jaredwilli / Recent Custom Posts Widget
Created February 2, 2011 06:27
Extends the WordPress Recent Posts widget to support custom post types
<?php
/*
define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', home_url() . '/' ) );
define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', site_url() . '/' ) );
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define('PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );
*/
define( 'WPH_FUNC_PATH', get_template_directory() . '/functions' );
define( 'WPH_FUNC_URL', get_bloginfo('template_directory' ).'/functions' );
@markupboy
markupboy / html5video.sh
Created February 8, 2011 15:43
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
####################################
# Output file for HTML5 video #
# Requirements: #
# - handbrakecli #
# - ffmpeg #
# - ffmpeg2theora #
# #
# usage: #
@somic
somic / category_plugin.rb
Created March 2, 2011 23:37
How I organize posts in Jekyll (code snippets for blog post - see comments)
module Jekyll
Page.class_eval {
def clone
Page.new(@site, @base, @dir, @name)
end
}
@jonathonbyrdziak
jonathonbyrdziak / identifyCredCardType.php
Created April 6, 2011 18:01
Identify a Credit Card by its number
/**
* function is responsible for returning card data, based off of the
* credit card number alone.
*
* @param unknown_type $cc_no
* @return unknown
*/
function identifyCard ($cc_no)
{ // Get card type based on prefix and length of card number
// I am sure there are smarter ways of implementing this, however due to lack of experience with regexp...
@yene
yene / index.php
Created June 3, 2011 14:39
simple language detection in php
<?php
define(DEBUG, 0);
$supported_languages = array("en", "de");
$default_language = "en";
$language = $default_language;
if (isset($_POST['lang']) && in_array($_POST['lang'], $supported_languages)) { // Detecting if param was set
$language = $_POST['lang'];
setcookie("language", $language, time()+ (3600 * 24 * 30)); // cache 30 days
if (DEBUG) echo "found parameter lang " .$language;
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@jonathonbyrdziak
jonathonbyrdziak / CustomWidgetFile.php
Last active September 29, 2022 22:00
EMPTY WIDGET Plugin code to create a single widget in wordpress.
<?php
/**
* Duplicate this file as many times as you would like, just be sure to change the
* Empty_Widget class name to a custom name of your choice. Have fun! redrokk.com
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Contact_RedRokk_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@billerickson
billerickson / gist:1238281
Last active March 28, 2019 19:59
Customize Event Query using Post Meta
<?php
/**
* Customize Event Query using Post Meta
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/