-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,656 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_site |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
www.zlu.me |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: ForYogi Blog | ||
url: http://blog.foryogi.com | ||
description: Official blog of ForYogi.com | ||
author: ForYogi | ||
rss_path: feeds | ||
markdown: kramdown | ||
redcarpet: | ||
extensions: ["strikethrough"] | ||
pygments: true | ||
port: 5000 | ||
exclude: ["vendor"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<title>{{ page.title }}</title> | ||
<meta name="viewport" content="width=device-width"> | ||
|
||
<!-- syntax highlighting CSS --> | ||
<link rel="stylesheet" href="/css/syntax.css"> | ||
|
||
<!-- Custom CSS --> | ||
<link rel="stylesheet" href="/css/main.css"> | ||
|
||
</head> | ||
<body> | ||
|
||
<div class="site"> | ||
<div class="header"> | ||
<h1 class="title"><a href="/">{{ site.name }}</a></h1> | ||
<a class="extra" href="/">home</a> | ||
</div> | ||
|
||
{{ content }} | ||
|
||
<div class="footer"> | ||
<div class="contact"> | ||
<p> | ||
Your Name<br /> | ||
What You Are<br /> | ||
you@example.com | ||
</p> | ||
</div> | ||
<div class="contact"> | ||
<p> | ||
<a href="https://github.com/yourusername">github.com/yourusername</a><br /> | ||
<a href="https://twitter.com/yourusername">twitter.com/yourusername</a><br /> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
layout: default | ||
--- | ||
<h2>{{ page.title }}</h2> | ||
<p class="meta">{{ page.date | date_to_string }}</p> | ||
|
||
<div class="post"> | ||
{{ content }} | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
layout: post | ||
title: "Git auto complete" | ||
date: 2011-11-01 22:04 | ||
comments: true | ||
categories: git | ||
--- | ||
|
||
Git auto complete is a convenient feature. | ||
|
||
This feature is based on git-completion file comes with git. | ||
|
||
On OS X, if you install git via homebrew, you can find git source directory using: | ||
|
||
{% highlight bash %} | ||
locate git | grep Cellar | ||
{% endhighlight %} | ||
|
||
Locate the git-completion file. | ||
|
||
In my case, it is `/usr/local/Cellar/git/1.7.5/etc/bash_completion.d/git-completion.bash | ||
|
||
Open this file and you will find this explanation: | ||
|
||
The contained completion routines provide support for completing: | ||
|
||
* local and remote branch names | ||
* local and remote tag names | ||
* .git/remotes file names | ||
* git 'subcommands' | ||
* tree paths within 'ref:path/to/file' expressions | ||
* common --long-options | ||
|
||
And the steps to enable this | ||
|
||
* Copy this file to somewhere (e.g. ~/.git-completion.sh). | ||
* Add the following line `source ~/.git-completion.sh` to your .bashrc | ||
* Changing PS1 to show current branch `PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '` | ||
|
||
If you want some color in git prompt | ||
|
||
`PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '` | ||
|
||
If you want the prompt to show git-ps1 state | ||
`GIT_PS1_SHOWDIRTYSTATE=true` | ||
|
||
`Generating Site with Jekyllbe rake generate` | ||
|
||
Example: | ||
|
||
`zlu@zlu-mba:~/projects/me/octopress (master *)` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
layout: post | ||
title: "On Agile" | ||
date: 2012-01-30 18:11 | ||
comments: true | ||
categories: agile | ||
--- | ||
|
||
Programmers do not like rules. | ||
|
||
Programmers who are hesitate about adopting agile say agile is about adding rules | ||
to their development. | ||
|
||
Agile is not about implementing new rules. It is about breaking existing rules. | ||
The first rule to break when introducing XP into a traditional work place is to take down | ||
the cubicles. | ||
|
||
Agile is about communication. Pair programming is all about communication. The pair | ||
communicate via code. One write test, sees it fail, and the other write enough code | ||
to make the test pass. The pair constantly communicate verbally to making design decisions. | ||
|
||
Agile is about communication across functional areas. Customers, production, development, and | ||
QA all need to communicate. That is why heterogeneous pairing is so important. Has | ||
QA accepted the done criteria before developers start working on it? How many times | ||
do you have stories rejected and then started to talk to QA about what this feature | ||
is about? Miscommunication and missed communication imply wasted development and test cycles. | ||
|
||
The hardest thing for most developers to get about XP is TDD/BDD. If there is | ||
one thing you want to start with Agile, that has to be TDD. TDD is not about writing | ||
some code then a couple of tests to cover what you think is sufficient. It is about | ||
starting a feature by writing a single test and only enough code to make it pass. A | ||
method with a hard-coded string sometime is enough to make the test pass and that is ok. | ||
Another example is simply returning a 200 for a web request. The next test will be | ||
forcing the hard-coded string to change or returning an actual response body (or at | ||
least part of it). It is harder to think about test first, it is also more code to | ||
write because you may have several tests for a single line of production code. But | ||
the result is more robust and reliable code. You will save time in the end because | ||
you have considered how to defeat and defend your own code from the beginning, and | ||
you will want to naturally refactor towards the end goal. You will be less focused | ||
on the postive case, which is usually easy and spend more time on negative paths. | ||
|
||
Agile builds better programmers. You may think TDD is a rule. But it's really a habit. | ||
It is like Zen, a practice of life. When thinking about a feature, you think about | ||
how to make it testable. If you can't seem to figure out how to write test first, it | ||
means you are not understanding the feature well or the story needs redesign or being | ||
brutely honest, not getting TDD. TDD takes practice, much like learning a new programming | ||
language. I remember learning Java when I already know C. OO concepts seem to be foreign | ||
and hard to grasp, at first. | ||
|
||
Agile does not stop you from experimenting with new technology and building prototypes just | ||
to figure out whether something will work or not. It is called spikes. You can spike | ||
often as needed but remember developer time is valuable and obligation to deliver | ||
features to customers on time. Using existing infrastructure to meet customer requirements | ||
and refactor towards end goal is ideal. | ||
|
||
Agile is about emotions. Believe or not, coders are also emotional beings. Agile | ||
considers emotions first then about machines and programming languages. In order to | ||
better delivery business values, the team, as an aggregation of humans, needs to work | ||
towards the same goal. By effective communication and interaction, people make better | ||
decisions. Pair programming eliminates personal blames. Shifting pairs changes | ||
code ownership from individual to team. By building trust, pair forms a natural support | ||
system. It is often comforting to have someone sitting next to you to point out logical | ||
flaws. Afterall, coders want to deliver better code. |
20 changes: 20 additions & 0 deletions
20
_posts/2012-02-12-a-couple-things-to-watch-out-for-using-privatepub.markdown
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
layout: post | ||
title: "A Couple Things to Watch Out For Using PrivatePub" | ||
date: 2012-02-12 20:38 | ||
comments: true | ||
categories: [ruby] | ||
--- | ||
|
||
[Private Pub](https://github.com/ryanb/private_pub) is a convinent gem wraps around [Faye](http://faye.jcoglan.com/ruby.html). | ||
|
||
There are a few things to consider when using PrivatePub. | ||
|
||
1. It does __not__ support ssl. | ||
However, there is a [pull request](https://github.com/ryanb/private_pub/pull/33) for it. | ||
|
||
2. You almost always want to add some sort of filtering on the server or client side, or maybe both. | ||
For example, if you don't want your chat message to be received by everyone logged in, you will need to | ||
publish to a channel uniquely identified by each session of the chat. | ||
|
||
__UPDATE__ @rbates has merged this pull request. I was able to verify ssl support indeed works! |
34 changes: 34 additions & 0 deletions
34
_posts/2012-02-12-rspec-arbitrary-handling-of-arguments.markdown
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
layout: post | ||
title: "RSpec Arbitrary Handling of Arguments" | ||
date: 2012-02-12 19:32 | ||
comments: true | ||
categories: [rspec, tdd] | ||
--- | ||
|
||
RSpec lets you test the number, type, and order of arguments. For example, | ||
|
||
{% highlight ruby %} | ||
Foo.should_receive(:bar).with(1, kind_of(Hash), anything()) | ||
Foo.bar(1, {'a' => 'b'}, &b) | ||
{% endhighlight %} | ||
Pass! | ||
|
||
This tests that class method __bar__ will be called against class __Foo__ with 3 arguments. The first argument is integer 1, | ||
the second argument is an instance of Hash, the third argument can be anything. | ||
|
||
What if you want to test a bit more on the argument than that? | ||
|
||
For example, in order to test a [private_pub](https://github.com/ryanb/private_pub) method **publish_to**: | ||
|
||
{% highlight ruby %} | ||
PrivatePub.should_receive(:publish_to) do |channel, data| | ||
channel.should eq 'messages/new' | ||
data[:foo].should eq 'foo' | ||
end | ||
PrivatePub.publish_to['messages/new', {:foo => 'foo'} | ||
{% endhighlight %} | ||
Pass! | ||
|
||
This tests that **publish_to** takes 2 arguments. The first is channel and should be equal to 'messages/new'. | ||
The second is a hash and it equals to {:foo => 'foo'} |
33 changes: 33 additions & 0 deletions
33
_posts/2012-02-14-rubymine-and-pivotaltracker-integration.markdown
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
layout: post | ||
title: "RubyMine and PivotalTracker Integration" | ||
date: 2012-02-14 20:32 | ||
comments: true | ||
categories: [tools] | ||
--- | ||
|
||
**Task Server** is a lesser known feature in RubyMine. You can enable PivotalTracker (PT) integration by adding | ||
PT project as a Task Server. | ||
|
||
Press cmd + , to open Preferences. Type task to see this panel: | ||
|
||
![](http://f.cl.ly/items/0q0C3G471G1K3R2D0r1V/Screen%20Shot%202012-02-14%20at%208.56.43%20PM.png) | ||
|
||
Add PivotalTracker project by supplying project ID and api token. | ||
|
||
Now every story can be easily turned into a RubyMine changelist. | ||
Press cmd + shift + a, and type task. Select open task. Type part of the story to see a list of matched tracker stories. | ||
|
||
![](http://f.cl.ly/items/2O1I0v3M403D2W1N2P0X/Screen%20Shot%202012-02-14%20at%208.59.44%20PM.png) | ||
|
||
Select the desired story to work on and check start story. Now every change will be in this change list and RubyMine will | ||
autostart the story. | ||
|
||
Let's say you TDD'ed and finished the story. Press cmd + k to open changelist view. | ||
|
||
![](http://f.cl.ly/items/0w1K2E1E3S3S2m301W1Q/Screen%20Shot%202012-02-14%20at%209.03.29%20PM.png) | ||
|
||
You will see that commit message has been filled with story text. Commit the change and RubyMine will automatically | ||
finish the story. How cool is that? Now try to do that in Emacs or VI, I dare you :P | ||
|
||
P.S. I like Emacs. |
60 changes: 60 additions & 0 deletions
60
_posts/2012-02-21-install-native-ruby-gem-in-mountain-lion-preview.markdown
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
layout: post | ||
title: "Install Native Ruby Gem in Mountain Lion Preview" | ||
date: 2012-02-21 13:59 | ||
comments: true | ||
categories: [ruby, os x, gem, mountain lion] | ||
--- | ||
|
||
In Preview of OS X Mountain Lion, XCode has been distributed as a .app package verses the traditional installer. | ||
Also the Commandline Tools are not installed by default. Commandline Tools contains cc/gcc that you will need. | ||
|
||
After download the preview of XCode 4.4, drop it to the Application directory. | ||
|
||
Open XCode and cmd + , to open Preferences panel where you can install Commandline Tools: | ||
|
||
![](https://img.skitch.com/20120221-r2cidbjd92nh9tmswq19hj6rdc.jpg) | ||
|
||
Now in shell you should be able to `locate cc` and `locate gcc` | ||
|
||
Now if you try to `gem install hpricot` or any gem that requires native extension (c), you may encounter problems | ||
looks like this: | ||
|
||
<pre> | ||
|
||
checking for main() in -lc... *** extconf.rb failed *** | ||
Could not create Makefile due to some reason, probably lack of | ||
necessary libraries and/or headers. Check the mkmf.log file for more | ||
details. You may need configuration options. | ||
|
||
Provided configuration options: | ||
--with-opt-dir | ||
--without-opt-dir | ||
--with-opt-include | ||
--without-opt-include=${opt-dir}/include | ||
--with-opt-lib | ||
--without-opt-lib=${opt-dir}/lib | ||
--with-make-prog | ||
--without-make-prog | ||
--srcdir=. | ||
--curdir | ||
--ruby=C:/ruby/bin/ruby | ||
--with-hpricot_scan-dir | ||
--without-hpricot_scan-dir | ||
--with-hpricot_scan-include | ||
--without-hpricot_scan-include=${hpricot_scan-dir}/include | ||
--with-hpricot_scan-lib | ||
--without-hpricot_scan-lib=${hpricot_scan-dir}/lib | ||
--with-clib | ||
--without-clib | ||
|
||
</pre> | ||
|
||
If you cat the mkmf.log, you may see something like this: | ||
|
||
"gcc-4.2 -o conftest ...." | ||
|
||
So the fix is not to add configuration options but to simply create sym link of gcc-4.2: | ||
{% highlight bash %} | ||
ln -s /usr/bin/gcc /usr/bin/gcc-4.2 | ||
{% endhighlight %} |
9 changes: 9 additions & 0 deletions
9
_posts/2012-02-28-running-wireshark-on-mountain-lion.markdown
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
layout: post | ||
title: "Running Wireshark on Mountain Lion" | ||
date: 2012-02-28 09:06 | ||
comments: true | ||
categories: [wireshark, os x, mountain lion] | ||
--- | ||
|
||
X11 has been removed from Mountain Lion and you first need to install XQuartz |
Oops, something went wrong.