Skip to content

Instantly share code, notes, and snippets.

@davist11
davist11 / Fancy File Inputs.js
Created October 25, 2010 21:32
Fancy File Inputs
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {
@abackstrom
abackstrom / Makefile
Created November 2, 2010 09:45
CSS and JavaScript Minification/Compression Makefile
#
# css/js minification/compression makefile
#
#
# JS_TARGETS -- js files to minify/gzip
# CSS_TARGETS -- css files to minify/gzip
# CLEANUP -- additional files to delete during "make clean"
#
@cowboy
cowboy / HEY-YOU.md
Last active July 16, 2025 03:49
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@max-mapper
max-mapper / blocksdotorg.js
Created November 19, 2010 01:34
experiment in trying to implement @mbostock's bl.ocks.org in pure html + js
<!DOCTYPE html>
<html>
<head>
<title>gist bl.ocks</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="http://jquery.com/src/jquery-latest.js"></script>
<script src="https://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<script>
var gist = {}, id = 582915, source;
$(function(){
@AD7six
AD7six / pablo.php
Created January 21, 2011 17:50
standalone i18n slug function
<?php
function cleanstring($input = '', $seperator = '-') {
$pattern = '\x00-\x1f\x26\x3c\x7f-\x9f\x{d800}-\x{dfff}\x{fffe}-\x{ffff}';
$pattern .= preg_quote(' \'"/?!<>.$/:;?@=+&%\#', '@');
$return = preg_replace('@[' . $pattern . ']@Su', $seperator, $input);
return trim(mb_strtolower(preg_replace('/' . $seperator. '+/', $seperator, $return), 'UTF-8'), $seperator);
}
@cowboy
cowboy / jquery-cdn-fallback.html
Created February 1, 2011 00:22
Google CDN -> jQuery CDN fallback
<!--
See JSFiddle:
http://jsfiddle.net/cowboy/6asBw/
-->
<!-- unminified -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
var dickbar = function() {
var opts = {
"symbol" : "&#10026;",
"font-size": "64px",
"color": "#eee",
"time": 3000
};
if(window.dickbar && window.dickbarOptions) {
var d = window.dickbarOptions;
if(d["font-size"]) opts["font-size"] = d["font-size"];
(function() {
var cache = {};
this.tmpl2 = function tmpl(str, data) {
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :
(function() {
this.tmpl3 = function tmpl(str, data) {
var value = "var out = ''; out+=" + "'" +
str.replace(/[\r\t\n]/g, " ")
.replace(/'(?=[^%]*%>)/g,"\t")
.split("'").join("\\'")
.split("\t").join("'")
.replace(/<%=(.+?)%>/g, "'; out += $1; out += '")
.split("<%").join("';")