Skip to content

Instantly share code, notes, and snippets.

View simlegate's full-sized avatar
🎯
Focusing

Devin Zhang simlegate

🎯
Focusing
View GitHub Profile
@simlegate
simlegate / vimrc
Last active December 16, 2015 08:08
Vim configuration
" 定义
set number
colo desert
set guifont=DejaVu\ Sans\ Mono\ 14
syntax enable
syntax on
set autoindent
"显示当前的行号列号:
set ruler
"在状态栏显示正在输入的命令
@simlegate
simlegate / zshrc
Last active December 17, 2015 00:19
oh my zsh config file
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="juanghurtado"
ZSH_THEME="gnzh"
@simlegate
simlegate / MainActivity.java
Last active April 14, 2021 02:44
something should android do when screen on and screen off .
package com.simlegate.saveresource;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
@simlegate
simlegate / .tmux.conf
Last active December 18, 2015 03:49
tmux configure file for vim
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
@simlegate
simlegate / gist:5727530
Created June 7, 2013 07:07
redis error
config set stop-writes-on-bgsave-error no

Building Rich Domain Models in Rails.

Part 1. Decoupling Persistence.

Abstract

Domain model is an effective tool for software development. It can be used to express really complex business logic, and to verify and validate the understanding of the domain among stakeholders. Building rich domain models in Rails is hard. Primarily, because of Active Record, which doesn't play well with the domain model approach.

One way to deal with this problem is to use an ORM implementing the data mapper pattern. Unfortunately, there is no production ready ORM doing that for Ruby. DataMapper 2 is going to be the first one.

Another way is to use Active Record just as a persistence mechanism and build a rich domain model on top of it. That's what I'm going to talk about in this article.

@simlegate
simlegate / gist:5803922
Created June 18, 2013 09:21
git 命令
已经commit的文件即使在.gitignore中也会被跟踪
git rm --cached your_file
@simlegate
simlegate / 个人简历.md
Last active December 18, 2015 19:49
简历

个人简介

  • 姓名:张强(simlegate)
  • 性别:男
  • 年龄:23
  • 出生年月:1990.12.28

教育情况

毕业于成都学院(成都大学)软件工程

个人技能

@simlegate
simlegate / 签名.sh
Last active December 18, 2015 23:49
ubuntu 签名错误解决办法
#!/bin/bash
sudo apt-get clean
cd /var/lib/apt
sudo rm -rf lists.old
sudo mv lists lists.old
gpg --delete-key --armor 40976EAF437D05B5
sudo apt-key del 40976EAF437D05B5
@simlegate
simlegate / rubycas_test.md
Last active January 27, 2016 16:52
describe how to spec rubycas with rspec.

rubycas client configuration options in config/envirement.rb
[more details] (https://github.com/rubycas/rubycas-client)

# enable detailed CAS logging
cas_logger = CASClient::Logger.new(::Rails.root+'/log/cas.log')
cas_logger.level = Logger::DEBUG

CASClient::Frameworks::Rails::Filter.configure(
  :cas_base_url  => "https://cas.example.foo/",
  :login_url     => "https://cas.example.foo/login",