Skip to content

Instantly share code, notes, and snippets.

View lanqy's full-sized avatar
🎯
Focusing

Lan Qingyong lanqy

🎯
Focusing
  • Shenzhen,China
View GitHub Profile
//
// UIView+frameAdjust.h
// fenbi
//
// Created by Tang Qiao on 12-5-31.
// Copyright (c) 2012年 Fenbi.com . All rights reserved.
//
#import <Foundation/Foundation.h>
//
// CoreTextLabel.h
// Frost
//
// Created by David Kasper on 10/1/12.
//
#import <UIKit/UIKit.h>
#import <CoreText/CoreText.h>
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
@interface UILabel (dynamicSizeMe)
-(float)resizeToFit;
-(float)expectedHeight;
@end
@lanqy
lanqy / api.js
Created October 19, 2013 05:06 — forked from fwielstra/api.js
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
// from http://qiita.com/Oakbow/items/3374175d76d82792134d
(function () {
if (!("indexOf" in Array.prototype)) {
Array.prototype.indexOf = function (find, i) {
var n;
if (i === undefined) i = 0;
if (i < 0) i += this.length;
if (i < 0) i = 0;
n = this.length;
@lanqy
lanqy / gist:6067881
Created July 24, 2013 03:31
Lazy Function Definition Pattern
//Lazy Function Definition Pattern
// form http://michaux.ca/articles/lazy-function-definition-pattern
var getScrollY = function () {
if (typeof window.pageYOffset == 'number') {
getScrollY = function () {
return window.pageYOffset;
};
} else if ((typeof document.compatMode == 'string') && (document.compatMode.indexOf('CSS') >= 0) && (document.documentElement) && (typeof document.documentElement.scrollTop == 'number')) {
getScrollY = function () {
@lanqy
lanqy / gist:5982869
Created July 12, 2013 08:42
判断浏览器及版本
// form http://stackoverflow.com/questions/5916900/detect-version-of-browser
navigator.userBrowser = (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
return M;
})();
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh