Skip to content

Instantly share code, notes, and snippets.

View danrovito's full-sized avatar

Dan Rovito danrovito

View GitHub Profile
@danrovito
danrovito / Gravatar Laravel 4
Last active August 29, 2015 14:12
Using Gravatar in Laravel 4
public function getGravatarAttribute()
{
$hash = md5(strtolower(trim($this->attributes['email'])));
return "https://secure.gravatar.com/avatar/$hash?d=mm";
}
{{ Auth::user()->gravatar }}
<img src="{{ Auth::user()->gravatar }}" alt="" width="100px" height="100px" class="img-circle">
@danrovito
danrovito / stateprovince.html
Created March 27, 2015 04:00
HTML State/Province Dropdown
<label for="state">State/Province</label><span style="color: red !important; display: inline; float: none;">*</span>
<select name="state" id="state" class="form-control">
<option> - Select Province/State - </option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
*
* Steps:
* 1. Set your AWS access_key
* 2. Set your AWS secret_key
* 3. Set your CloudFront Distribution ID
* 4. Define the batch of paths to invalidate
* 5. Run it on the command-line with: php cf-invalidate.php
@danrovito
danrovito / cf-locations.js
Created June 29, 2015 19:05
Cloudfront Edge Server Locations
var locations = [
//United States
['<h4>Atlanta, GA</h4>', 33.7677129,-84.420604],
['<h4>Ashburn, VA</h4>', 39.0299604,-77.4771231],
['<h4>Dallas, TX</h4>', 32.8206645,-96.7313396],
['<h4>Hayward, CA</h4>', 37.625644,-122.0413544],
['<h4>Jacksonville, FL</h4>', 30.34499,-81.720457],
['<h4>Los Angeles, CA</h4>', 34.0204989,-118.4117325],
['<h4>Miami, FL</h4>', 25.782324,-80.2310801],
['<h4>New York</h4>', 40.7033127,-73.979681],
<script>
// Define your locations: HTML content for the info window, latitude, longitude
var locations = [
['<h4>Seattle</h4>', 47.614848,-122.3359058],
['<h4>Los Angeles</h4>', 34.0204989,-118.4117325],
['<h4>Chicago</h4>', 41.8337329,-87.7321555],
['<h4>New York</h4>', 40.7033127,-73.979681],
['<h4>Virginia</h4>', 38.0033854,-79.4587861],
['<h4>Atlanta</h4>', 33.7677129,-84.420604],
['<h4>Dallas</h4>', 32.8206645,-96.7313396],
@danrovito
danrovito / progressive-ace.htm
Last active August 29, 2015 14:25 — forked from duncansmart/progressive-ace.htm
Integrating ACE Editor in a progressive way
<textarea name="my-xml-editor" data-editor="xml" rows="15"></textarea>
...
<textarea name="my-markdown-editor" data-editor="markdown" rows="15"></textarea>
...
<script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script>
// Hook up ACE editor to all textareas with data-editor attribute
$(function () {
@danrovito
danrovito / jquery-validate.js
Created August 20, 2015 20:05
Jquery Validate to work in IE compatibility mode
/*!
* jQuery Validation Plugin v1.13.1
*
* http://jqueryvalidation.org/
*
* Copyright (c) 2014 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {