This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reincarnation for classes | |
class Class | |
def reincarnate | |
buried = Object.__send__(:remove_const, self.name) | |
Object.const_set(self.name, Class.new(buried)) | |
end | |
end | |
class Abc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( | |
:adapter => "mysql", | |
:host => "localhost", | |
:database => "myapp", | |
:username => "root", | |
:password => "root", | |
:encoding => "utf8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame]; | |
campFireView.animationImages = [NSArray arrayWithObjects: | |
[UIImage imageNamed:@"campFire01.gif"], | |
[UIImage imageNamed:@"campFire02.gif"], | |
[UIImage imageNamed:@"campFire03.gif"], | |
[UIImage imageNamed:@"campFire04.gif"], | |
[UIImage imageNamed:@"campFire05.gif"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require "json" | |
USER = 'marshluca@163.com' | |
PASS = '123456' | |
API_URL = "http://api.renren.com/restserver.do" | |
def base_params | |
{ | |
"api_key" => "f2570a570d56439784bfb69dbda699d1", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "PostViewController.h" | |
#import "WoyiAppDelegate.h" | |
#import "ImagePickerController.h" | |
@implementation PostViewController | |
#pragma mark - | |
#pragma mark Initialization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby | |
def compute(current,remain) | |
result = 0 | |
if remain == 0 | |
result = current == 'a' ? 1 : 0 | |
else | |
for n in ['a','b','c','d'] | |
result += compute(n,remain-1) if n != current | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading development environment (Rails 2.3.8) | |
>> Rails.env | |
=> "development" | |
>> RAILS_ENV | |
=> "development" | |
>> RUBY_VERSION | |
=> "1.8.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby developer packages | |
sudo apt-get install ruby1.8 ri1.8 rdoc1.8 irb1.8 | |
sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby | |
# hpricot requirements | |
sudo apt-get install ruby1.8-dev | |
sudo gem install hpricot | |
# nokogiri requirements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MySQL Log 的配置 | |
MySQL内置4种Log: | |
Error Log, General Query Log, Binary Log, Slow Query Log | |
1. Error Log | |
错误日志, 记录MySQL启动、运行、停止过程中出现的错误信息 | |
2. General Query Log | |
记录MySQL客户端连接、查询的细节, 调试的时候很有用, 正式运行的时候最好关闭否则会带来大量磁盘IO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
更换mysql的数据库目录,需要将原来的db数据copy到目标目录,然后做如下更改: | |
/etc/mysql/my.cnf | |
# * Basic Settings | |
# | |
# | |
# * IMPORTANT | |
# If you make changes to these settings and your system uses apparmor, you may |
OlderNewer