Skip to content

Instantly share code, notes, and snippets.

View bryanveloso's full-sized avatar

Bryan Veloso bryanveloso

View GitHub Profile
$.noConflict();
jQuery(document).ready(function($){
$('.audio').each(function(){
var match = $(this).find('script').html().match(/audio_file=(.*)\\x26/);
$(this).find('span').html('<audio src="'+match[1]+'?plead=please-dont-download-this-or-our-lawyers-wont-let-us-host-audio" controls="controls">Your browser does not support the audio element.</audio>').remove();
$(this).find('script').remove();
});
});
@rcrowley
rcrowley / deps.pp
Created November 8, 2010 22:33
Ruby dependency management with Puppet
stage { "pre": before => Stage["main"] }
class pre {
package {
"build-essential": ensure => latest;
"ruby": ensure => "4.5"; # Ruby 1.8.7
"ruby-dev": ensure => "4.5"; # Ruby 1.8.7
"rubygems": ensure => "1.3.7-2";
}
}
class { "pre": stage => "pre" }
@ericflo
ericflo / json_session_messages.py
Created November 15, 2010 05:18
Message backend which spits out dictionaries able to be json encoded/decoded, for those session backends which do not pickle.
from django.contrib.messages.storage.base import Message, BaseStorage
class JSONSessionStorage(BaseStorage):
"""
Stores messages in JSON-compatible format
"""
session_key = '_messages'
def _to_dict(self, message):
return {
#some_style
@media (max-width: 320px) &
display: none
Senator Schumer,
I am one of your constituents, and I'm writing you to express my extreme
disapproval of the COICA bill you recently voted for in the Senate Judiciary
committee.
This bill is harmful (and even offensive). It frightens me both as a citizen
and a web developer.
As a human being, it irks me to see the US attempting to regulate access to
@ericflo
ericflo / re_parts.py
Created November 20, 2010 23:18
An iterator which operates like re.split, except it takes a list of regexes, and lets you know which regex is responsible for each split (or whether that part of the split was the result of not matching any regex)
# Extracted from django-oembed, because I keep having a need for this snippet
import re
from heapq import heappush, heappop
def re_parts(regex_list, text):
"""
An iterator that returns the entire text, but split by which regex it
matched, or none at all. If it did, the first value of the returned tuple
is the index into the regex list, otherwise -1.
@nathansmith
nathansmith / crash_old_ie.html
Last active September 24, 2015 09:08
This should crash IE6 & IE7.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Crash IE6 + IE7</title>
<!--[if IE 6]>
<script>
@chriseppstein
chriseppstein / 1_sprites.scss
Created December 20, 2010 03:29
Spriting is so freaking easy now.
@import "flag/*.png";
@import "emblem/*.png";
.flag-sprite {
width: image-width("flag/us.png");
height: image-height("flag/us.png");
padding: 0;
}
.emblem-sprite {
@trey
trey / mixins.sass
Created December 28, 2010 22:53
Clever Sass Mixins
// @include rounded(25px)
@mixin rounded($radius)
-webkit-border-radius: $radius
-moz-border-radius: $radius
border-radius: $radius
@mixin rounded-tl($radius)
-moz-border-radius-topleft: $radius
-webkit-border-top-left-radius: $radius
border-top-left-radius: $radius
@caged
caged / stale.rb
Created January 4, 2011 20:11
Quick script to help you find and deal with old watched repos, forks and owned repos.
#!/usr/bin/env ruby
#
# Quick hack to help you find and deal with old watched repos, forks and owned repos.
#
# It will ask you to confirm once if you want to unwatch a repo.
#
# You can't unwatch your own repos, so they will need to be deleted.
# THIS SCRIPT WILL ASK YOU FOR CONFIRMATION TWICE BEFORE IT DELETES A REPO.
#
require 'rubygems'