Skip to content

Instantly share code, notes, and snippets.

@rantastic
rantastic / GA_event_track.js
Last active October 2, 2015 09:08
JS: Google Analytics Javascript Trigger
_gaq.push(['_trackEvent', 'RootCat', 'Cat2', 'Cat3']);
@rantastic
rantastic / mail.php
Created April 16, 2012 22:17
PHP: Send email using amazon SES
<?php
//class docs: http://www.orderingdisorder.com/aws/ses/
require_once('ses.php');
//get credentials at http://aws.amazon.com My Account / Console > Security Credentials
$ses = new SimpleEmailService('ACCESSkeyID', 'SECRETaccessKEY');
$m = new SimpleEmailServiceMessage();
@rantastic
rantastic / index.html
Created April 28, 2012 18:22
HTML: Start Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
@rantastic
rantastic / crontab
Last active October 4, 2015 15:28
UNIX: Php Script Cron Job
wget -O - -q http://THEURL >/dev/null 2>&1
@rantastic
rantastic / vimeo_thumbnail.php
Last active October 3, 2017 11:32
PHP: Get Vimeo Thumbnail From Link
function video_image($url){
$image_url = parse_url($url);
$ch = curl_init('http://vimeo.com/api/v2/video/'.substr($image_url['path'], 1).'.php');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$a = curl_exec($ch);
$hash = unserialize($a);
return $hash[0]["thumbnail_medium"];
}
@rantastic
rantastic / getStringBetween.php
Last active October 6, 2015 15:28
PHP: Gets the string between two other strings
function getStringBetween($before,$after,$haystack){
$start=strpos($haystack,$before)+strlen($before);
$finish=strpos($haystack,$after,$start);
$length = $finish - $start;
return substr($haystack, $start, $length);
}
@rantastic
rantastic / pdo_connect.php
Created March 21, 2013 16:40
PHP: PDO mysql connection
$db = new PDO("mysql:host=HOST;port=3306;dbname=DATABASENAME;", "USERNAME", "PASSWORD" );
@rantastic
rantastic / reveal_modal.html
Created March 21, 2013 16:44
HTML: Foundation 4 reveal modal
<div id="MODAL_NAME" class="reveal-modal">
<h1>MODAL_TITLE</h1>
<p>MODAL_BODY</p>
<a class="close-reveal-modal">&#215;</a>
</div>
@rantastic
rantastic / reveal_confirm_modal.html
Created March 21, 2013 16:56
HTML: Foundation 4 reveal confirm modal
<div id="confirmModal" class="reveal-modal">
<h1>Are you sure?</h1>
<!--<p>Remove "<span></span>" search profile</p>
<input type="hidden" name="spID" id="spID" value="">-->
<button class="small-3 button alert" trigger-remove="WHATEVER-ID">Remove</button>
<button class="small-3 button secondary" trigger-cancel>Cancel</button>
<a class="close-reveal-modal">&#215;</a>
</div>
@rantastic
rantastic / lorem.html
Created March 21, 2013 17:15
HTML: Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent nibh nisi, facilisis vitae scelerisque nec, adipiscing sed ante. Pellentesque iaculis porttitor scelerisque. Nullam blandit urna vel diam vestibulum eu pellentesque metus euismod. Cras hendrerit leo ac quam pellentesque non placerat enim posuere. Donec non sem dolor, in lacinia nulla. Quisque aliquet orci in risus volutpat malesuada. Praesent sagittis dapibus augue at ultrices.
Vivamus euismod arcu vel urna faucibus ut mollis est adipiscing. Mauris a consequat metus. Morbi mollis cursus felis. In rutrum magna vitae odio posuere id auctor odio cursus. Morbi condimentum pellentesque neque eu euismod. Nulla nisl enim, fringilla non blandit sit amet, sollicitudin eu sapien. Donec luctus magna quis libero consequat semper imperdiet nulla mollis. Mauris a dolor feugiat leo sagittis hendrerit. Cras placerat sollicitudin urna, eget blandit elit pellentesque a. Ut sit amet scelerisque mauris.