Skip to content

Instantly share code, notes, and snippets.

View ryarwood's full-sized avatar

Russell Yarwood ryarwood

View GitHub Profile
@ryarwood
ryarwood / change-dom.js
Last active February 3, 2016 17:31 — forked from anonymous/file1.ab
Change DOM elements with jquery on screen re-size
(function( $ ){
$.fn.resize = function(max_size)
{
return this.each(function()
{
//Wait until the image is loaded
$(this).load(function()
{
//Create a container div
var div_container = $("<div></div>");
@ryarwood
ryarwood / example.php
Last active January 31, 2023 19:25 — forked from drewjoh/example.php
A Simple Postmark PHP Class with Attachments
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
$result = $postmark->to("reciver@example.com")
->subject("Email Subject")
->plain_message("This is a plain text message.")
->attachment('File.pdf', $file_as_string, 'application/pdf')
@ryarwood
ryarwood / gist:4021997
Created November 6, 2012 01:54
Simple XML Example
<?php
$rss = file_get_contents( "http://feeds.feedburner.com/aliasmx?format=xml" );
$xml = new SimpleXMLElement( $rss );
if( $count = 8 ):
?>
@ryarwood
ryarwood / if-ie.html
Last active February 11, 2016 19:28
If internet explorer full conditional list.
<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
@ryarwood
ryarwood / GoogleMap-API-v3.js
Created November 6, 2012 01:58
Google Map API v3 Ghetto Example
function initialize() {
var myOptions = {
zoom: 11,
center: new google.maps.LatLng(37.392391,-122.059822),
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
@ryarwood
ryarwood / category-channel.php
Created November 14, 2012 02:15
EE Category Channel Example
{exp:channel:categories show_empty="yes" channel="blog" style="linear"}
<li>{if last_segment == 'fr'}<a href="{path='blog/category'}/fr/">{category_name}</a>{if:else}<a href="{path='blog/category'}">{category_name}</a>{/if}</li>
{/exp:channel:categories}
@ryarwood
ryarwood / extract-youtube.php
Created November 14, 2012 02:45
Extract YouTube ID from url
$link = "http://www.youtube.com/watch?v=oHg5SJYRHA0&lololo";
$video_id = explode("?v=", $link); // For videos like http://www.youtube.com/watch?v=...
if (empty($video_id[1]))
$video_id = explode("/v/", $link); // For videos like http://www.youtube.com/watch/v/..
$video_id = explode("&", $video_id[1]); // Deleting any other params
$video_id = $video_id[0];
@ryarwood
ryarwood / form.html
Created November 26, 2012 23:43
Simple HTML Form
<style type="text/css">
/********************************************************
INTEREST LIST
********************************************************/
#interestLeft {
width: 490px;
float: left;
padding-left: 30px;
@ryarwood
ryarwood / jqueryHTMLReplace.js
Created December 17, 2012 18:38
jQuery HTML Replace
content = "<h1>HTML CONTENT HERE</h1>";
$("#contentDiv").html(content);
@ryarwood
ryarwood / robots.txt
Created December 17, 2012 18:39
Simple Robots.txt
User-agent: *
Disallow: /
Disallow: /directory/
Disallow: /directory/file.html