Skip to content

Instantly share code, notes, and snippets.

@randylien
randylien / gist:889095
Created March 27, 2011 09:52
程式設計師懺情錄(上)

發信人: xeon.bbs@bbs.tnfsh.tn.edu.tw ()
日期: Fri Mar 29 12:05:03 2002
標題: [轉貼] [轉錄]程式設計師懺情錄(上)

作者: erictsai (連備取都沒有的白痴!) 站內: TFcis
標題: [轉錄]程式設計師懺情錄(上) --eric要我轉的
時間: Thu Mar 28 20:54:12 2002

※ 本文轉錄自 [erictsai] 信箱

@randylien
randylien / LICENSE.txt
Created May 24, 2011 10:11 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
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
@randylien
randylien / pubsub.md
Created November 11, 2011 22:31 — forked from addyosmani/pubsub.md
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery 1.7 and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

require "rubygems"
require "rbosa"
require "cgi"
require "htmlentities"
require 'iconv'
OSA.utf8_strings = true
evernote = OSA.app('Evernote')
coder = HTMLEntities.new
@randylien
randylien / jquery.placeholder.js
Created March 9, 2012 08:00 — forked from jakebellacera/jquery.placeholder.js
jQuery Placeholder Plugin - Fixes the placeholder attribute on non-supported browsers.
/*
* Placeholder plugin for jQuery
* @author Daniel Stocks (http://webcloud.se)
*/
(function($) {
function Placeholder(input) {
this.input = input;
if (input.attr('type') == 'password') {
this.handlePassword();
}
@randylien
randylien / README.md
Created March 25, 2012 18:57 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

Template Components

Used to provide structural templates.

Pattern

t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name
@randylien
randylien / awesome_router.coffee
Created May 21, 2012 18:04 — forked from juliocesar/awesome_router.coffee
AwesomeRouter: a cool Backbone.js router class
# AwesomeRouter: A class that I've been using throughout a few Backbone.js apps I've built.
#
# It adds 2 features: an event that gets fired when one calls `navigate` (aptly named
# "navigate"), so you can bind things to when a URL gets triggered. And a "before filter"
# method `before`, which you can use to run things before every a route gets triggered.
#
# This could easily be extended to have after filters too, or to only trigger a route
# upon @before returning something that's not false.
class AwesomeRouter extends Backbone.Router
@randylien
randylien / gist:3103470
Created July 13, 2012 07:54 — forked from rmurphey/gist:3086328
What's wrong with Netmag's "Optimize your JavaScript" post

What's wrong with Netmag's "Optimize your JavaScript" post

Update: The original post on Netmag has been updated since this was written.

I tweeted earlier that this should be retracted. Generally, these performance-related articles are essentially little more than linkbait -- there are perhaps an infinite number of things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- but this post went further than most in this genre: it offered patently inaccurate and misleading advice.

Here are a few examples, assembled by some people who actually know what they're talking about (largely Rick Waldron and Ben Alman, with some help from myself and several others from the place that shall be unnamed).

Things that are just plain wrong