Skip to content

Instantly share code, notes, and snippets.

View paranoidxc's full-sized avatar
💭
换工作中 (FUCKING THE ALL WORLD)

paranoidxc

💭
换工作中 (FUCKING THE ALL WORLD)
  • 五四北 福州 福建
View GitHub Profile
@paranoidxc
paranoidxc / jquery ajax
Created September 3, 2010 07:29
jQuery fn
jQuery.fn.center_v = function () {
this.css("position","absolute");
this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
return this;
}
jQuery.fn.center_h = function () {
this.css("position","absolute");
this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
return this;
@paranoidxc
paranoidxc / php版 个人成分分析
Created December 3, 2010 02:12
php版 个人成分分析
<?php
class FW_Tools_Component {
//成份列表
//重複出現的東西,出現率會比較高。總長度建議不要超過255。
static $elements = array(
'屍毒',
'御宅氣',
'高手高手高高手',
'雜魚',
'高頻雜訊',
@paranoidxc
paranoidxc / Db_Album.rb
Last active December 14, 2015 03:19
下载豆瓣相册中得图片,如果有原始图片则下载原始图片,没有则下载普通大小图片
#encoding: UTF-8
# Author: XiaochuanHuang
# Email : emohuang [at] gmail [dot] com
require 'open-uri'
require "net/http"
require "uri"
require 'hpricot'
class Db_Album
@paranoidxc
paranoidxc / Helper.php
Created February 25, 2013 01:37
Yii srbac Helper.php file add a static method called isAccess check is allow the current user to access the particual method return true if allow
<?php
public static function isAccess($access) {
Yii::import("srbac.components.Helper");
$allows = Helper::findModule('srbac')->getAlwaysAllowed();
if (in_array( strtolower($access) ,array_map('strtolower', $allows ) ) ) {
return true;
}
return user()->checkAccess($access,Yii::app()->getUser()->id);
//return user()->checkAccess($access,user()->id);
@paranoidxc
paranoidxc / V2EX.user.js
Last active December 14, 2015 09:28
固定 V2EX 的导航栏, 双击导航栏页面回到顶部,每日自动签到。
// ==UserScript==
// @author iParanoid
// @name V2EX_User_Script
// @namespace https://zone-huangxc.rhcloud.com
// @description Position fixed the navigation , Scroll to top when double click navigation bar or Page Footer
// @include *
// @updateURL https://gist.github.com/paranoidxc/5065236/raw/10bc3ee7501b86f2e579657ef64348e642cc2a70/V2EX.user.js
// ==/UserScript==
function iparanoid_wrapper() {
@paranoidxc
paranoidxc / angular.help.js
Created June 4, 2013 15:46
angularjs snippet
var app = angular.module("app",[]);
app.config(function($logProvider){
$logProvider.debugEnabled(false);
});
app.run(function($rootScope,$log){
$rootScope.$log = $log;
});
@paranoidxc
paranoidxc / BD_album.rb
Created June 27, 2013 08:57
爬 百度个人空间 相册 , 未完
#encoding: UTF-8
# Author: XiaochuanHuang
# Email : emohuang [at] gmail [dot] com
require 'open-uri'
require "net/http"
require "uri"
require 'hpricot'
class Db_Album
@paranoidxc
paranoidxc / 2014 阅读列表
Last active August 29, 2015 13:57
2014 阅读列表
# 2014 阅读列表
### 技艺
- ~~<del>软件开发者路线图﹕从学徒到高手</del>~~ EOF 03.12
- ~~<del>结网</del>~~ EOF 03.24
- ~~<del>C程序设计语言 (The C Programming Language)</del>~~ EOF 03.28
- ~~<del>Node.js开发指南</del>~~ EOF 02.28
- 算法: C 语言实现 1-4 部分
- ~~ iOS Programming : The Big Nerd Ranch Guide (4th) ~~ EOF 07.01
- ~~ 深入理解计算机系统 ~~ EOF 08.14
#define N 32
#include <iostream>
//#include <stdio.h>
//using namespace std;
main() {
int i, j, a[N];
for ( i = 2; i < N; i++ ) {
a[i] = 1;
}
#include <stdlib.h> // malloc
#include <iostream>
main( int argc, char *argv[] ) {
long int i, j, N = atol(argv[1]);
int *a = malloc(N*sizeof(int));
if ( a == NULL ) {
printf("Insufficient memory.\n");
return 1;