Skip to content

Instantly share code, notes, and snippets.

View tommymarshall's full-sized avatar

Tommy Marshall tommymarshall

View GitHub Profile
@tommymarshall
tommymarshall / gist:2659957
Created May 11, 2012 14:18
Stripe starter template
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
@tommymarshall
tommymarshall / gist:2660194
Created May 11, 2012 14:44
CSS: hide-text
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@tommymarshall
tommymarshall / gist:2661495
Created May 11, 2012 18:22 — forked from boucher/gist:1750375
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@tommymarshall
tommymarshall / gist:2702941
Created May 15, 2012 16:10
Javascript: jQuery Plugin Starter Template
/*
* 'Highly configurable' mutable plugin boilerplate
* Author: @markdalgleish
* Further changes, comments: @addyosmani
* Licensed under the MIT license
*/
// Note that with this pattern, as per Alex Sexton's, the plugin logic
// hasn't been nested in a jQuery plugin. Instead, we just use
// jQuery for its instantiation.
@tommymarshall
tommymarshall / uri.js
Created May 25, 2012 18:04 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@tommymarshall
tommymarshall / gist:2845462
Created May 31, 2012 19:02
htaccess sql, gitignore, example.
# secure .htaccess file
<Files ~ ".htaccess|README|\.(sql)|.gitignore|Capfile|Gemfile|Guardfile|Rakefile$">
order allow,deny
deny from all
</Files>
@tommymarshall
tommymarshall / DateFormat.php
Created June 3, 2012 13:06 — forked from cviebrock/DateFormat.php
DateFormat class for Laravel (or anyone)
<?php
class DateFormat {
const DATE_SHORT = 'Y-m-d';
const DATE_LONG = 'F j, Y';
const DATETIME_SHORT = 'Y-m-d H:i';
const DATETIME_LONG = 'F j, Y, g:i a';
update: function() {
this.target.image.attr('src', this.photo);
this.target.name.text(this.name);
this.target.url.attr('href', this.url);
this.target.title.text(this.title);
// Check if image loaded
var profile = this.target.image.imagesLoaded();
profile.fail(function(){
public function put_files_new($id)
{
$filename = Input::file('file.name');
$temp_name = Input::file('file.tmp_name');
if ( S3::put_object($temp_name, 'laravel-test', $filename, S3::ACL_PUBLIC_READ) )
{
$new_file = array(
'name' => Input::get('name'),
@tommymarshall
tommymarshall / gist:3353506
Created August 14, 2012 22:17 — forked from greypants/gist:3185028
SCSS: keyframe mixins
// ======================================================================
// Animation.scss
// - Contains helpers for keyframes animation in css3
// - Only functionally with Sass 3.2.0 Alpha and Compass 0.13.alpha
// ======================================================================
@mixin animation-name($name) {
-webkit-animation-name: $name;
-moz-animation-name: $name;
-ms-animation-name: $name;