Skip to content

Instantly share code, notes, and snippets.

@GeorgeTzellis
GeorgeTzellis / dabblet.css
Created August 10, 2012 09:27
retina borders
/* retina borders*/
button {
margin: 3em;
padding: 0 9px;
border: solid 1px;
border-color: #2978B0 #266FA5 #1C557D;
border-radius: 3px;
font: bold 13px/36px sans-serif;
color: #fff;
background: linear-gradient( top, #50A9E7, #307CB3);
@sandywu
sandywu / gist:3071570
Created July 8, 2012 16:14
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@amdgigabyte
amdgigabyte / compress.sh
Created April 20, 2012 13:49
YUIcompressor Shell Script
#! /bin/bash
# YUI Compressor Bash Script
# @author [email protected]
# @version 0.1 2012-04-20
# 安装 #
# 1. 设置好你的JAVA_HOME环境变量
# 2. 在自己的家目录下面创建一个bin文件夹 ~/bin
# 2. 复制这个 compress.sh 以及 yuicompressor.jar 到 ~/bin,并执行
# chmod +x compress.sh(以保证compress.sh可执行)
@miohtama
miohtama / parse-hash-bang-arguments-in-javascript.js
Created January 6, 2012 12:08
Parse hash bang HTTP GET query style arguments from an URL using Javascript
/**
* Parse hash bang parameters from a URL as key value object.
*
* For repeated parameters the last parameter is effective.
*
* If = syntax is not used the value is set to null.
*
* #x&y=3 -> { x:null, y:3 }
*
* @param aURL URL to parse or null if window.location is used
@voidfiles
voidfiles / gist:1394631
Created November 25, 2011 23:09
Flickr actionQueue fav handler
F.actionQueue.register('button-bar-fave', {
interim: function(id) {
var fave_button = document.getElementById(id);
if (fave_button.className.search(/fave/) === -1) {
fave_button.className = 'Butt ywa-track fave-button fave';
} else {
fave_button.className = 'Butt ywa-track fave-button';
}
},
cleanup: function(id) {
@rauschma
rauschma / static_super.js
Last active April 8, 2018 02:25
Static super references in JavaScript
// Simulated static super references (as proposed by the current draft of the ECMAScript 6 specification)
//------------------ Library
function inherits(subC, superC) {
var subProto = Object.create(superC.prototype);
// At the very least, we keep the "constructor" property
// At most, we preserve additions that have already been made
copyOwnFrom(subProto, subC.prototype);
setUpHomeObjects(subProto);
@sandywu
sandywu / gist:1347739
Created November 8, 2011 13:30 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@sandywu
sandywu / es6proxy.htm
Created September 14, 2011 03:24 — forked from nzakas/es6proxy.htm
Example of ES6 Proxy
<!DOCTYPE html>
<!--
This is a simple experiment relying on ECMAScript 6 Proxies. To try this out,
use Aurora (http://www.mozilla.org/en-US/firefox/channel/).
The goal was to create a HTML writer where the method names were really just
the HTML tags names, but without manually creating each method. This uses
a Proxy to create a shell to an underlying writer object that checks each
method name to see if it's in a list of known tags.
@agnellvj
agnellvj / friendly_urls.markdown
Created September 11, 2011 15:52 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt