Skip to content

Instantly share code, notes, and snippets.

@matfish2
matfish2 / gist:1991670
Created March 7, 2012 07:44 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@matfish2
matfish2 / gist:1991700
Created March 7, 2012 07:47
HTML: Starting Template
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.5.3/modernizr.min.js">
</head>
@matfish2
matfish2 / form.html
Created March 7, 2012 07:54
PHP: Paypal IPN
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input name="amount" type="hidden" value="COMBIEN_CA_COUTE" />
<input name="currency_code" type="hidden" value="EUR" />
<input name="shipping" type="hidden" value="0.00" />
<input name="tax" type="hidden" value="0.00" />
<input name="return" type="hidden" value="URL_DE_SUCCES" />
<input name="cancel_return" type="hidden" value="URL_ANNULATION" />
<input name="notify_url" type="hidden" value="URL_NOTIFICATION_PAIEMENT" />
<input name="cmd" type="hidden" value="_xclick" />
<input name="business" type="hidden" value="IDENTIFIANT_VENDEUR" />
@matfish2
matfish2 / WordPress RSS.php
Created March 7, 2012 13:05
WP: Embedding RSS links
<ul>
<?php
include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
$feed = fetch_rss('http://feeds.feedburner.com/blogowicz'); // specify feed url
$items = array_slice($feed->items, 0, 10);
?>
<?php if (!empty($items)) : ?>
<?php foreach ($items as $item) : ?>
<li><a href="<?php echo $item['link']; ?>" rel="nofollow"><?php echo $item['title']; ?></a></li>
@matfish2
matfish2 / copyToClipboard.js
Created April 14, 2012 17:39 — forked from 0xnbk/copyToClipboard.js
JavaScript: Copy to clipboard
function copyToClipboard(meintext) {
if (window.clipboardData)
window.clipboardData.setData("Text", meintext);
else if (window.netscape) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
if (!clip)
return false;
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
if (!trans)
@matfish2
matfish2 / custom-posts-helper.php
Created October 9, 2012 21:54 — forked from GreenGeorge/custom-posts-helper.php
WP: Custom Post Types and Custom Taxonomies
<?php
// ***** Declare function that buids the post type
function add_post_type($name, $args = array() ) {
add_action('init',function() use($name, $args) {
// make post type name capitalized
$upper = ucwords($name);
// make name acceptable
@matfish2
matfish2 / wp-upload-handle.html
Created October 9, 2012 21:57 — forked from paulschreiber/wp-upload-handle.html
WP: upload handling (PHP)
<div class="submit-photos padding-top">
<h2>Photos</h2>
<label for="upload-image-photo">
<input id="upload-image-photo" type="text" size="36" name="upload-image-photo" value="" />
<input id="upload-image-button-photo" class="upload-image-button" type="button" value="Upload Image" />
<br />Upload a picture of yourself
</label>
</div>
@matfish2
matfish2 / ValidateEmail.php
Created February 10, 2013 10:22
PHP Email Validation
/**
Validate an email address.
Provide email address (raw input)
Returns true if the email address has the email
address format and the domain exists.
*/
<?php
function validEmail($email)
{
@matfish2
matfish2 / boilerplate.html
Last active December 14, 2015 03:59
HTML: Starting boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>HTML5 boilerplate—all you really need…</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
@matfish2
matfish2 / index.html
Last active October 16, 2016 21:29
Animated Pacman Using Pure CSS (https://jsbin.com/yolufa/edit?html,css,output)
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Animated Pacman Using Pure CSS">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Anmiated Pacman - Pure CSS</title>
<style>
body {
height:100%;