Ruby的source_location

Ruby可以通过source_location定位方法的定义位置 [7] pry(main)> require "open-uri" => false [8] pry(main)> URI.method(:join).source_location => ["C:/Ruby193/lib/ruby/1.9.1/uri/common.rb", 784] [9] pry(main)>
Ruby | 2012-12-29 00:04 | 阅读 3456 次 | 评论 0 条

[PHP]返回所有包含的文件get_included_files

还是谷歌聪明,输入php show all included files,第一个搜索结果就是 get_included_files
PHP开发 | 2012-12-28 23:51 | 阅读 2909 次 | 评论 0 条

Firebug无法嵌入到firefox里面的解决办法

无意中在新窗口中打开了firebug,却怎么也无法把它放回firefox底部了,设置Firebug界面位置也不管用。重置firebug设置以后终于把它请回了firefox底部。 解决办法: 点击Firebug窗口左上角的小瓢虫 选项 - 重置所有 Firebug 选项 跳出个确认窗口,点“确定” 关闭Firebug,然后按F12重开Firebug,已经恢复在firefox底部了
默认分类 | 2012-12-27 22:20 | 阅读 3805 次 | 评论 0 条

为已存在的controller添加rspec测试

rails g rspec:controller ControllerName 比如 rails g rspec:controller users 出自:http://stackoverflow.com/questions/4235763/how-do-i-generate-specs-for-existing-controllers
Ruby | 2012-12-25 01:03 | 阅读 3981 次 | 评论 0 条

gnome-terminal的键绑定设置

vi .inputrc set convert-meta on '\M-h': backward-char '\M-l': forward-char '\M-j': next-history '\M-k': previous-history '\M-l': forward-char '\C-h': beginning-of-line '\C-l': end-of-line ipython中ctrl+L默认是clear-screen,需要专门绑定为end-of-line: ipython profile create vi .conf...
Linux | 2012-12-22 22:55 | 阅读 2278 次 | 评论 0 条

Bash readline 使用技巧

很多人会用 Bash,但是很少有人知道 readline 是怎么回事。readline 是一个强大的库,只要使用了它的程序,都可以用同一个配置文件配置,而且用同样的方法操作命令行,让你可以方便的编辑命令行。 使用 readline 的程序现在主要有 Bash, GDB,ftp 等。readline 付予这些程序强大的 Emacs 似的命令行编辑方式,你可以随意绑定你的键盘。 术语解释 在下文中,我们经常提到 'C-x r' 这类键操作。'C-x r' 其实就是按Ctrl-x,然后按 r。同理 'C-M-@' 就是按 ctrl-alt-@(M表...
Linux | 2012-12-22 22:37 | 阅读 2035 次 | 评论 0 条

一段去除pyqt examples版权信息的ruby脚本

如果发布程序,不能去掉,要尊重作者的版权,这里所说的去掉仅仅是为了自己阅读examples代码的时候方便,ruby字符串处理比较方便,就用ruby了 #coding: utf-8 require 'find' Find.find('/home/111/pyfiles/pyqt4_examples').to_a.keep_if{ |f| f.end_with?'.py' or f.end_with?'.pyw' }.each do |path| str = File.read(path) rstr = <<EOF #####...
Ruby | 2012-12-21 01:47 | 阅读 3152 次 | 评论 0 条

ubuntu下安装pyqt4

apt-get安装(快) sudo apt-get install libxext6 libxext-dev libqt4-dev libqt4-gui libqt4-sql qt4-dev-tools qt4-doc qt4-designer qt4-qtconfig "python-qt4-*" python-qt4 编译安装(慢) 安装SIP 从 http://www.riverbankcomputing.co.u...
Python | 2012-12-20 20:34 | 阅读 11216 次 | 评论 0 条

我的AutoHotkey配置文件

;!h::Send {Left} ;!l::Send {Right} !j::Send {Down} !k::Send {Up} ;^h::Send {Home} ;^l::Send {End} ;!c:: ;Send +{End} ;Send {Delete} ;return ;!s:: ;Send {Home} ;Send +{End} ;Send {Delete} ;return ;!i:: ;Send ^{Left} ;Send ^+{Right} ;Send {Delete} ;Send {Space} ;Send {Left...
Windows | 2012-12-19 17:32 | 阅读 3919 次 | 评论 1 条

用快捷键在右下角呼出Terminal

System - Preferences - Keyboard Shortcuts 点击下面的Add添加一个自定义快捷键,Command设置为: gnome-terminal --geometry=76x11-33-24 --working-directory=~
Linux | 2012-12-17 16:11 | 阅读 3353 次 | 评论 0 条

debian安装redis及PHP扩展应用

安装Redis wget http://redis.googlecode.com/files/redis-2.6.7.tar.gz tar zxvf redis-.* cd redis-* make make PREFIX=/usr/local/redis install mkdir /etc/redis cp redis.conf /etc/redis/redis.conf mkdir /var/lib/redis vi /etc/redi...
PHP开发 | 2012-12-15 21:41 | 阅读 6339 次 | 评论 0 条

操蛋的php语法约定

array_filter、array_map,两个array函数,一个是数组参数在前,callback参数在后,一个是callback参数在前,数组参数在后。每次用它们都得查手册。php这是在故意让人记混吗?混乱的语法,在php中随处可见
PHP开发 | 2012-12-15 15:51 | 阅读 2657 次 | 评论 0 条

nginx 出现 too many open files 错误的解决办法

第一步 vi /etc/security/limits.conf #加入下面四行 root soft nofile 655360 root hard nofile 655360 * soft nofile 655360 * hard nofile 655360 第二步 vi /etc/nginx/nginx.conf # 设置 worker_rlimit_nofile 10240; events { worker_connections 10240; } #重启服务器
Linux | 2012-12-14 18:17 | 阅读 2608 次 | 评论 0 条

PHP用get_defined_vars()函数获取所有变量

前几天还在为php没有类似python的locals()发愁,原来php也有相应的办法:get_defined_vars()
PHP开发 | 2012-12-09 17:16 | 阅读 4081 次 | 评论 0 条

golang(go语言)用reflect.TypeOf获取数据类型

示例代码: https://www.bccn.net/paste/405/
golang | 2012-12-08 23:11 | 阅读 21456 次 | 评论 0 条

用godoc查看golang文档

godoc fmt Println PACKAGE package fmt import "fmt" FUNCTIONS func Println(a ...interface{}) (n int, err error) Println formats using the default formats for its operands and writes to standard output. Spaces are always added between operands and a newline is append...
golang | 2012-12-08 22:05 | 阅读 8892 次 | 评论 0 条

.vimrc备份,以作以后参考

runtime! debian.vim call pathogen#infect() if has("syntax") syntax on endif set nu set ts=4 set softtabstop=4 set shiftwidth=4 set expandtab set autoindent set hlsearch colorscheme molokai au BufNewFile,BufRead *.rb,*.html,*.htm,*.erb,*.yaml,*.yml,*.sass,*.scss set softtabs...
Vim | 2012-12-08 18:59 | 阅读 2954 次 | 评论 0 条

cookie 和session 的区别详解

这些都是基础知识,不过有必要做深入了解。先简单介绍一下。 二者的定义: 当你在浏览网站的时候,WEB 服务器会先送一小小资料放在你的计算机上,Cookie 会帮你在网站上所打的文字或是一些选择, 都纪录下来。当下次你再光临同一个网站,WEB 服务器会先看看有没有它上次留下的 Cookie 资料,有的话,就会依据 Cookie 里的内容来判断使用者,送出特定的网页内容给你。 Cookie 的使用很普遍,许多有提供个人化服务的网站,都是利用 Cookie 来辨认使用者,以方便送出使用者量身...
WEB开发 | 2012-12-01 00:02 | 阅读 2622 次 | 评论 0 条

php删除所有cookies

<?php foreach($_COOKIE as $k => $v){ setcookie($k, null); //setcookie($k, ''); //这样也可以 } print_r($_COOKIE);
PHP开发 | 2012-11-30 23:45 | 阅读 6669 次 | 评论 0 条

$site->route('/xxxxx/')的思路

<?php include 'object.php'; $site->route('/good/:id')->run(function ($request){ return '返回给template的变量们'; })->template('/index.html'); php貌似不支持用locals()返回函数内部的变量,也不支持闭包,一些想法会受限制
ObjectPHP | 2012-11-27 22:27 | 阅读 2146 次 | 评论 0 条
浏览2794640次
文章归档