Skip to content

Instantly share code, notes, and snippets.

View JamieMason's full-sized avatar

Jamie Mason JamieMason

View GitHub Profile
@jimeh
jimeh / hasOwnProperty.js
Created March 15, 2010 00:02
Cross-browser hasOwnProperty solution
/*
Cross-browser hasOwnProperty solution, based on answers from:
http://stackoverflow.com/questions/135448/how-do-i-check-to-see-if-an-object-has-an-attribute-in-javascript
*/
if ( !Object.prototype.hasOwnProperty ) {
Object.prototype.hasOwnProperty = function(prop) {
var proto = obj.__proto__ || obj.constructor.prototype;
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
};
}
@remy
remy / gist:350433
Created March 31, 2010 14:58
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();

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

@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@polotek
polotek / pipeaccept.js
Created May 18, 2011 01:16 — forked from heapwolf/pipeaccept.js
accepting input from a pipe, nodejs
var data;
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
data += chunk;
});
process.stdin.on('end', function() {
.background_clip
// Seriously, why isn't this just the
// freakin' default in all browsers?
+background-clip(padding-box)
// Not sure what this does? Have a looksie...
// http://compass-style.org/examples/compass/css3/background-clip
// Crucial, if you have rounded corners on something with
// both background color and a border. Without, background
// #suite is a helper method to more concisely list
// #describe groups. Example usage:
//
// suite("Examples", {
//
// "before" : function(){
// // ... setup
// },
//
// "should one" : function(){
@unscriptable
unscriptable / HttpError.js
Created January 5, 2012 15:39
Example "subclass" of Error object
// AMD module wrapper.
define(function () {
function HttpError (msg, code) {
var ex;
msg = msg || 'Unknown HTTP error';
ex = new Error(msg); // not all browsers let us inherit, so we do it this way
ex.code = code;
ex.name = 'HttpError'; // thx @cjno! (http://twitter.com/cjno/status/154959746582056960)
require 'rubygems'
require 'redcarpet'
require 'pathname'
path = Pathname.new(ARGV.shift)
raise "Input path must be absolute." unless path.absolute?
raise "Input path must point to a file that exists" unless path.exist?
raise "Input path must point to a file that is readable" unless path.readable?
@aemkei
aemkei / LICENSE.txt
Last active June 4, 2024 07:51 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE