Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mathewbyrne's full-sized avatar

Mathew Byrne mathewbyrne

View GitHub Profile
@mathewbyrne
mathewbyrne / README.mdown
Created May 22, 2010 05:30
An asynchronous method for embedding gists in an HTML document using jQuery.

A quick jQuery plugin for asynchronously embedding a gist in an HTML document.

There are a couple of ways to use it. First is the direct method that will insert it into the current position in the document:

<script>$.gist(409808)</script>

Secondly, there is a more jQuery oriented method:

<div id="placeholder"></div>
@mathewbyrne
mathewbyrne / code-block.html
Created July 30, 2010 02:47
A fun little experiment playing with CSS box shadows. I think it roughly works in Safari, Chrome and Firefox. No guarantees though.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Shadows Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style>
* {
import sys
import random
all_stats = ['HP', 'Attack', 'Defense', 'Special Attack', 'Special Defense', 'Speed']
def catch_ditto():
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@mathewbyrne
mathewbyrne / lowercase.zsh
Created January 10, 2013 03:44
A quick way to rename all files in the current folder to lowercase.
#!/bin/zsh
# Requires zsh with zmv loaded
# autoload -U zmv
zmv '(*)' '${(L)1}'
@mathewbyrne
mathewbyrne / CsvResponse.php
Created March 21, 2013 22:54
A small Symfony 2 class for returning a response as a CSV file. Based on the Symfony JsonResponse class.
<?php
namespace Jb\AdminBundle\Http;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
{
protected $data;
@mathewbyrne
mathewbyrne / location.html
Created March 3, 2015 04:14
A small, single-page tool for getting your current geolocation.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Navigation Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script>
var isTouchDevice = 'ontouchstart' in document.documentElement;
window.onload = function () {
var where = document.getElementById('where');
interface User {
name: string,
id: number,
avatar?: string,
}
const user: User = {
name: 'Testing',
id: 1234,

Keybase proof

I hereby claim:

  • I am mathewbyrne on github.
  • I am mathewbyrne (https://keybase.io/mathewbyrne) on keybase.
  • I have a public key ASBeAW00p8JRympIF3NMKEWZ-7jWHQ14pnYiDQ-YO-aI9wo

To claim this, I am signing this object: