Skip to content

Instantly share code, notes, and snippets.

View oxUnd's full-sized avatar
🔑
多写代码少说话

秋_ oxUnd

🔑
多写代码少说话
  • Harbin Institute of Technology
  • China
View GitHub Profile
@oxUnd
oxUnd / gist:8455441
Created January 16, 2014 13:59
rgb to hex
- (NSString *) rgbToHex: (NSColor*) color {
NSString *hexColor = [NSString stringWithFormat:@"#%02X%02X%02X",
(int) ([color redComponent] * 0xFF),
(int) ([color greenComponent] * 0xFF),
(int) ([color blueComponent] * 0xFF)
];
return hexColor;
}
var queue = function(funcs, scope) { 
    (function next() { 
          if(funcs.length > 0) { 
              funcs.shift().apply(scope || {}, [next].concat(Array.prototype.slice.call(arguments, 0))); 
          } 
    })(); 
}; 
 
var obj = { 
    value: null 
function getOffset( el ) {
var _x = 0;
var _y = 0;
while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
_x += el.offsetLeft - el.scrollLeft;
_y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: _y, left: _x };
}
@oxUnd
oxUnd / install-php.md
Last active October 6, 2022 12:24
Mac下安装php-cgi

Mac下安装php-cgi

mac下安装php-cgi有多种方法,这里只介绍比较简单的两个方法;

  • 用brew安装
  • 直接下载安装XAMPP

用brew安装

如果安装了xcode,那么推荐使用brew来安装php。详细使用方法见官网,这里只说明如何装php-cgi;

@oxUnd
oxUnd / is_numeric.js
Created March 5, 2014 07:48
code snippet
isNumeric: function( obj ) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
}
@oxUnd
oxUnd / smarty.md
Created March 17, 2014 03:53
使用fis-plus后线上smarty的配置

使用fis-plus后线上smarty的配置

上线时跟源码目录没多大关系了,具体配置是相对于产出目录的;fis-plus产出目录如下

.
├── config
├── plugin
├── static
└── template
var Class = function (base, extend) {
var parent = null;
if (Object.prototype.toString.apply(base) == '[object Function]') {
parent = base;
} else {
extend = base;
}
var fn = function () {
this.initialize.apply(this, arguments);
@oxUnd
oxUnd / FIS.md
Last active August 29, 2015 13:57

FIS vs FIS+

FIS和FIS+的争议诞生之初就开始了,用FIS的同学一上来就会问“FIS和FIS+有什么区别呀?”。鉴于此,大概说一下FIS及FIS+的历史及其区别。

FIS产生之初定位就是做一个内核,提供一套编译体系以及一套静态资源管理的设计思路及其本地调试。编译体系可以简单通过配置+插件的方式任意扩展。FIS+就通过扩展实现了一套适合于后端是PHP+Smarty3的编译体系,然后在后端实现了静态资源管理,提出了诸如quicklingi18nfis-plus(default)之类的解决方案。这块值得说明以下的是解决方案fis-plus其实它和编译体系的命令包取了相同的名字。下面详细说明编译体系、静态资源管理及本地调试。

编译体系

整个编译体系还有很大一块内容是目录规范,还有一块是以文件类型为基础的插件体系。

@oxUnd
oxUnd / err.md
Created May 19, 2014 14:40
`go get github.com/mattn/go-sqlite3` get something error
➜  go-sqlite3 git:(master) ✗ go build -compiler gc
# github.com/mattn/go-sqlite3
gcc did not produce error at completed:1
on input:
#line 3 "/Users/shouding/dev/go/fis/src/github.com/mattn/go-sqlite3/sqlite3.go"
#include <sqlite3.h>
#include <stdlib.h>
#include <string.h>
@oxUnd
oxUnd / slide-sample.js
Created May 30, 2014 06:07
like `asyncMap`
var asyncMap = require('slide').asyncMap;
var http = require('http');
asyncMap(
[
"http://www.baidu.com",
"http://zhidao.baidu.com"
] ,
function (url, cb) {