Skip to content

Instantly share code, notes, and snippets.

View MatthewCallis's full-sized avatar
🍖
Hungry Goriya

Matthew Callis MatthewCallis

🍖
Hungry Goriya
View GitHub Profile
@MatthewCallis
MatthewCallis / Simple .htaccess Tempalte
Created May 31, 2011 20:50
A simple .htaccess template for simple sites. By no means perfect, but a good starting point.
# Set some defaults and don't show server type
AddDefaultCharset UTF-8
DefaultLanguage en-US
ServerSignature Off
# Don't show directory indexes and follow links
Options -Indexes
Options +FollowSymLinks
# Missing File Types and allow PHP in .htm files
@MatthewCallis
MatthewCallis / jquery.equalHeights.js
Created April 9, 2013 22:21
jQuery Equal Heights
// Equal Heights
(function($){
$.fn.equalHeights = function(minHeight, maxHeight){
var tallest = (minHeight) ? minHeight : 0;
this.each(function(){
if($(this).height() > tallest){
tallest = $(this).height();
}
});
if((maxHeight) && tallest > maxHeight){
@MatthewCallis
MatthewCallis / bs.as
Last active December 16, 2015 06:28
Detect and record the actual version of Adobe Flash of a visitor.
package com.hark
{
import flash.system.*;
import flash.display.MovieClip;
import flash.external.ExternalInterface;
import flash.events.Event;
import flash.events.SecurityErrorEvent;
public class bs extends MovieClip {
// Allow insecure access so anyone can embed it.
@MatthewCallis
MatthewCallis / iframed.js
Last active December 16, 2015 09:49
Am I in an iFrame? Am I Visible?
var _gaq = _gaq || [];
(function(win, depth){
var iframe = false;
if(win){
if(
win.location !== win.parent.location ||
win.self !== win.top ||
(win.self.frameElement && (win.self.frameElement+"").indexOf("HTMLIFrameElement") > -1)
){
@MatthewCallis
MatthewCallis / jquery.gravatar.js
Last active December 29, 2015 09:49
jQuery Gravatar URL Generator - Return a valid gravatar URL from an email address. Needs and md5 hash function, [see here](http://jsperf.com/fastmd5/7).
// http://en.gravatar.com/site/implement/images/
$.gravatar = function (email_or_hash, options) {
var defaults = {
'hash': '00000000000000000000000000000000',
'email': null,
'size': 80,
'default': 'mm',
'rating': 'x',
'forcedefault': false
};
!function(){function t(t){return function(e,i){e=d3.hsl(e),i=d3.hsl(i);var r=(e.h+120)*a,h=(i.h+120)*a-r,s=e.s,l=i.s-s,o=e.l,u=i.l-o;return isNaN(l)&&(l=0,s=isNaN(s)?i.s:s),isNaN(h)&&(h=0,r=isNaN(r)?i.h:r),function(a){var e=r+h*a,i=Math.pow(o+u*a,t),c=(s+l*a)*i*(1-i);return"#"+n(i+c*(-.14861*Math.cos(e)+1.78277*Math.sin(e)))+n(i+c*(-.29227*Math.cos(e)-.90649*Math.sin(e)))+n(i+c*1.97294*Math.cos(e))}}}function n(t){var n=(t=0>=t?0:t>=1?255:0|255*t).toString(16);return 16>t?"0"+n:n}var a=Math.PI/180;d3.scale.cubehelix=function(){return d3.scale.linear().range([d3.hsl(300,.5,0),d3.hsl(-240,.5,1)]).interpolate(d3.interpolateCubehelix)},d3.interpolateCubehelix=t(1),d3.interpolateCubehelix.gamma=t}();
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #000;
}
</style>
<body>
@MatthewCallis
MatthewCallis / locale_codes.coffee
Last active December 6, 2023 09:25
Country / Language / Locale Code List / Hash / Array
getLanguage: (language_code) ->
key = language_code.toLowerCase().replace(/-/, '_')
isoLangs = [
{ code:"aa", name:"Afar" },
{ code:"ab", name:"Abkhaz" },
{ code:"ae", name:"Avestan" },
{ code:"af", name:"Afrikaans" },
{ code:"ak", name:"Akan" },
{ code:"am", name:"Amharic" },
{ code:"an", name:"Aragonese" },
@MatthewCallis
MatthewCallis / coffeelint.json
Created June 12, 2015 00:19
JavaScript Style Guide
{
"coffeescript_error": {
"level": "error"
},
"arrow_spacing": {
"name": "arrow_spacing",
"level": "warn"
},
"no_tabs": {
"name": "no_tabs",