3 đặc tính cần có của người đàn ông.

Sợt thuật ngữ chuyên môn, thấy hay nên ăn cắp về.

1. Thứ nhất phải có tri thức, tri thức của đàn ông là gì:
– Phông văn hóa cao
– Nền tảng học thuật phải cao
– Cách đối xử tinh tế
– Phải có nhân tâm (hiểu đời, trải nghiệm)
2. Thứ hai, phải sắc nét
– Trắng đen rõ ràng, một mặt đen, một mặt trắng, cướp cũng được nhưng phải ra cướp, vua cũng được nhưng phải ra vua, đừng lờ mờ, đừng lờ nhờ.
3. Thứ 3 là phải có sức mạnh, sức mạnh không phải là cơ bắp, vẻ bên ngoài mà là:

– Chất lượng sự tưởng tượng, chất lượng tư duy phải áp vào hành động, đạt mục tiêu cụ thể.
– Nói ít làm nhiều

Coffeescript: Fat arrow vs thin arrow

In any JavaScript function, the value of this is the object that the function is attached to. However, when you pass functions to other functions or reattach a function to another object, the value of this will change. Sometimes this is what you want, but often you would like to keep the original value of this.

For this purpose, CoffeeScript provides the =>, or fat arrow, which will define a function but at the same time capture the value of this, so that the function can be safely called in any context. This is especially useful when using callbacks, for instance in a jQuery event handler.

Read More »

omniauth-facebook + rails 3 + authlogic debug

Personally I prefer Devise to Authlogic but recently I have to work with Authlogic on a legacy codebase. But I still like Devise because it’s up-to-date, clean, easier to use…

omniauth-facebook provides a cool way to login with FB – display a popup instead of redirecting users to FB login page then back to our site. Obviously this is the way we want :)

We won’t re-invent the wheel here, let’s follow Railcasts #360 to have omniauth-facebook integrated to your app. These are some issues you may encounter:

Read More »

Rails + oauth-plugin + mongodb – Part 2: Consumer

In previous post, we went through the process to create a Provider with Oauth-plugin that works with Mongodb using mongid as the driver. Here we will build the Consumer using mongoid too.

This Consumer app will run on port 4000 (rails s -p 4000) and connect with the Provider app which will be running on port 3000.

Step 1 – step 3

Exactly the same as in previous post for Provider

Read More »

Rails + oauth-plugin + mongodb – Part 1: Provider

Recently I had a chance to work with Oauth and Rails using oauth-plugin and mongodb. Although oauth-plugin itself has a documentation but actually doesn’t cover the mongoid part detailed enough. Also I found this very good tutorial but it’s for SQLite3 only: Oauth Provider, Oauth Consumer

Base on the above posts, to get Rails and oauth-plugin working with mongodb, you need to do some changes.

Firstly, create a oauth-sample directory, you’ll put provider and consumer apps in there.

Read More »

BrowserCMS: from development to production

There’re some Rails CMS such as Radiant, Refinery, BrowserCMS… and I find BrowserCMS the best one to build simple websites for my customers, we can easily create dynamic content for you websites with Portlet, create new object to manage by with Content type, and easily create template for each page (homepage, subpages…).

In this post we won’t talk about how to use BrowserCMS, please go to the BrowserCMS Wiki if you’re finding that information. This post just concentrates on things you need to do to get BrowserCMS work properly on server in production mode.

Read More »

Mac OS: Lock screen with keyboard shortcut

When I step away from my Mac at work, I want a quick way to lock the screen, and hitting a hot-corner with the mouse is problematic for me. This hint details how to lock the screen from the keyboard by using Automator to build a Service in Snow Leopard.

First, check the General tab on the Security System Preferences panel to ensure that the Require password [some period] after sleep or screen saver begins box is checked.

Read More »