Skip to content

Instantly share code, notes, and snippets.

View QETHAN's full-sized avatar
🎯
Focusing

QETHAN QETHAN

🎯
Focusing
View GitHub Profile
@QETHAN
QETHAN / ip.js
Created August 14, 2013 13:40 — forked from qiao/ip.js
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address
function getClientIp(req) {
var ipAddress;
// The request may be forwarded from local web server.
var forwardedIpsStr = req.header('x-forwarded-for');
if (forwardedIpsStr) {
// 'x-forwarded-for' header may return multiple IP addresses in
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the
// the first one
var forwardedIps = forwardedIpsStr.split(',');
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
/*
* 校验器
*/
/*
* 用例
* //修改信息
;(function() {
var save = $('#updateGestInfo_save');
save.on('click', function() {

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@QETHAN
QETHAN / lazy_load
Created September 21, 2013 14:49
图片懒加载
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>lazy_load 1.2 图片延迟加载</title>
<style>
.lazyimg{
width:150px;
height:150px;
background:url('imgs/loading.gif') 50% 50% no-repeat transparent;
@pimaxx There is a problem. You have not expanded the zip into the ~/Library/Application\ Support/TideSDK as the instructions indicate. You should be see a structure like the following:
├── modules
│ └── osx
│ ├── app
│ ├── codec
│ ├── database
│ ├── filesystem
│ ├── media
│ ├── monkey
function Event(name) {
var handlers = [];
this.getName = function () {
return name;
};
this.addHandler = function (handler) {
handlers.push(handler);
};
function questionCreator(spec, my) {
var that = {};
my = my || {};
my.label = spec.label;
my.renderInput = function() {
throw "not implemented";
};
input{
border: 1px solid red;
}
.btn-file {
position: relative;
margin-left: 100px;
overflow: hidden;
}
.btn {
display: inline-block;
;(function ($, window, undefined) {
'use strict'; //jshint :)
//arrow animation
$("#info-activator").on({
click : function(e) {
e.preventDefault();