December 15, 2012 #diary

This is the README file of this quoty project in github, so if you already knows about it you can totally ignore this post. I just want to mention it once in my blog.

What is Quoty?

http://quoty.me

Quoty - A place where people can share and save the most touching and inspiring quotes or words, in a modern way.

One of my hobby projects build with Rails, deployed on Heroku, try it.

The Vision

The Problems

If you search for any famous quotes on google, you may find lots of sites with disturbing ads, messy layouts, unreadable fonts. Once you looked, closed the tab, and that's it. Nothing more happens.

What I want to create

Quoty, well it's still a temporary name, doesn't aim to be the biggest quotes website. Instead, I want to create a community who loves the essence of human intelligence, which I believe is our language, the words, quotes, conversations, or even jokes. Besides those quotes from some "Big Giants", not trying to deny them here but they are not a MUST condition to make a quote classic and lasts forever, our parents, friends, wife/husband, anyone can say something very touching, warming words. If there is a story about it, if it means something to you and you really want to "save" that moment, I hope you can find here is the right place. At least that's what I'm trying to build.

So the general/traditional quotes are really not everything here. Tweets, video clips, lines from some movies, words from friends or family members, just post it. I'll try to find the right way to keep the original taste and flavour. And that's why I said Quoty is a temporary name, because it emphasize "quotes" too much.

Oh I won't put any ads on it. Try to make it clean and simple. A peaceful place. (I may need some design help to really create the visual feelings about it.)

Requirements

  • Rails 3.2+
  • Ruby 1.9.3+
  • RVM

Installation

In most cases:

git clone [email protected]:kinopyo/quoty.git
cd quoty
bundle
rake db:setup
rails s
open "http://localhost:3000"

If you need twitter or facebook integration, you have to setup your own keys to config/initializers/omniauth.rb.

TODO

https://www.pivotaltracker.com/projects/697543

Also I'm using github issues as a diary or blog tool, when building any mentionable features I'll sent a pull request to my self, write down the timestamp and upload a very cute emoji. Please take a look :)

Contributing

Currently Quoty is still under construction, it lacks of many very basic stuff(UI design and functions). Although I bought a domain and told some frinds about it, I still consider it's a alhpa version website. If you found something you want to have, please open an issue to tell me, with your pull requests would make it perfect. Thanks in advance for your help!

I'll put your name into the contributors list _^

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contributors

License

MIT License. Copyright (c) 2012 Qihuan Piao

December 12, 2012 #diary

These days work is extremly boring.

Before our team had dark era, after that it seemed going well for a moment but I'm not sure what specific things caused this feeling again.

I sit down and tried to think logically to find out the reason, why I'm not motivated, why I feel boring, why I get so tired everyday? Is it related to my personal life? Or is it because I'm already in the holiday mood? Is it because the evaluation? I kept asking myself questions to break down the negtive feelings into separate parts so that I can find each solution. But I couldn't make it, I found myself hard to stay rational, because the more I asked myself, the more cleary I can see the answer.

The answer is simple, I don't believe the guy. I don't believe we're gonna make it, to be specifically, his goal, his ambition, judging by the way how we worked. I don't know every detail stories about it, but I think I've made the judgement subconsiously. My friend mentioned the same thing at yesterday's lunch, totally different story but I think it inspired me somehow, "I've made the judgement". The feeling from subconsious is hard to deal with, hard to change, it's based on the self expierences and observations in quite a log time.

The project itself of course has potential, I never doubt that. I'm not saying he is a bad person neither. And I absolutely have resoponsibilities, how I participated the project, how I interacted with the team, etc. It just he as a leader, I've found myself hard to follow him.

November 25, 2012 #sublimetext

If you find yourself typing these kind of similar codes very often, and want a snippet to save your time, this is it.

@topic = Topic.find(params[:topic_id])
@car_item = CarItem.find(params[:car_item_id])
@user = User.find(params[:id])

It maps the variable name to its model name by converting the first character or the character after a underscore to uppercase, which is a convention in Rails framework.

Demo Video

The Snippet

I put it and named as SublimeText/Packages/User/Snippets/model_find.sublime-snippet.

<snippet>
  <content><![CDATA[
@${1} = ${1/^(.)|_(.)/\U\1\2/g}.find(params[:${2:${1}_}id])
]]></content>
  <tabTrigger>mf</tabTrigger>
  <scope>meta.rails.controller</scope>
</snippet>

So now I just have to hit mf -> tab to trigger it.

SublimeText Document

Here I'm using the Substitutions feature of SublimeText 2 snippet.

The substitution syntax has the following syntaxes:

  • ${var_name/regex/format_string/}
  • ${var_name/regex/format_string/options}

e.g.

Original: ${1:Hey, Joe!}
Transformation: ${1/./=/g}

# Output:

      Original: Hey, Joe!
Transformation: =========
November 24, 2012 #diary

We use our phones every day. They have a modern name “Smart Phone”, as it can do much more tasks compared to the old one. I’ve been using iPhone for over 3 years now. And since yesterday, I started not to use it, you probably wonder why but I got some personal issues so maybe this is one of the actions I have to take.

Anyway, here is the interesting things I found that I can’t do without a phone based on these 2 days of experience. So many surprises.

  • I have to find a clock alarm, the physical item, to get myself up at morning.
  • I feel so boring when I’m on a train. I can’t check Twitter, Facebook or any RSS newsletters. I can’t read my kindle book either.
  • I was in the mood of cooking, and I realized, “Oh, I don’t have a kitchen timer.” Then after I cooked, I couldn’t take a picture.
  • Yes I can’t take a picture whenever and wherever I want like before, my phone is the only camera.
  • I can’t check-in in foursquare when I enter a cafe or restaurant, to keep log of my life.
  • I can’t track my running records, although I have a fixed route so I know exactly how many kilometers I’ve run but still I can’t keep those data.
  • I can’t block the noise by putting earphone, to be specific here, a noisy child cries loudly, rolled on the floor said to his parents that he wants juice, right in the center of a shopping center, he is totally guilty and not innocent. I have to say the f**k words and hold myself try not to kill him.
  • I don’t know the time when I’m out. I have a watch but I don’t have the habit to wear it…
  • I can’t access to the Internet, when I want to search a place, I have to do the research in my laptop before moving.
  • I can’t keep tracking my expenses. I’m using an app to do that, now if I really want to continue, maybe I have to input the amounts in some kind of Excel-like interface…
  • I can’t take a note, I don’t carry a notebook and a pen with me, I was using Evernote or Apple’s native Notes app to do this thing.
  • And of course, I can’t contact to any friends by calling or sending text messages.
  • And at work, when my boss asked, “hey, this thing seems not work in smartphone browser, go check it”, “OK, damn it! I don’t have a phone…”. Really funny.

I’m not sure where I’m going, but there was not just negative “findings” about this. I found myself have time to think about something normally I would not to because I must be checking not-that-important tweets or just trying to use the phone to kill the time. Any tasks/ideas/todos comes to my mind, I have to keep it there, into my mind stack. And trust myself if this thing is important I won’t forget about it.

I wrote this post doesn’t mean I like this idea and try to convince any of you to do the same crazy-seems-nonsense thing. But by doing this, it reminds me how my social/technical life has changed within 3 years, how great iPhone it is to make life easier.

I’m sure I can go back, live without a phone completely if I really want to. I can find lots of alternative tools, I still miss paperback books, sometimes I still want to grab a pen to take notes or just skitch some ideas to the paper. But when it comes to keep connections with friends or family, it’s still very convenient when we keep our phones in our pockets.

October 25, 2012 #rails capistrano

I’m not familiar with capistrano at all, I kind of use it in daily base but what I’m capable of is just the one major command: ca deploy, heh that’s all I got.

Capistrano Callback Order

If you like me always get confused by the callback orders, image is really gonna help you out.

Capistrano Task explanation

Capistrano recipes: deploy is brief explanations of each task, same in the source code I think, highly recommend you go through them once.

Another good resource is capistrano recipes source code

task :update do
  transaction do
    update_code
    create_symlink
  end
end

Like this :update task is easy to guess: run update_code and create_symlink in a transaction.

October 24, 2012 #recommend diary

About the video

Original url

It's the video about a speech DHH presented 2010 at Stanford. It's very inspring, good to know about the insight of these things, I just randomly listed:

  • why VC is a time bomb
  • why it's good to spend your own money for your own business
  • how to work as a startup
  • how to manage your time
  • stories about Rails and Basecamp then 37signals company
  • what kind of company is a smart company
  • etc...

I wish I could have watched this when I was still in school. But maybe then I wound't understand the essence of many things. Anyway highly recommend. The video is about 1 hour long but the speech itself is maybe less than 20 or 25 minutes I think. After that was Q&A session and it's still quite good.

About Japanese Way of (Time) Management

This is my thought, as well as my complains about the topic, you can ignore this if you're not interested in.

I'm not sure if it's the majority or just among old guys who happen to be the managers or board members or whatever high postion, higher than you, the people I've met tend to think that working hard, say 50 or 60 hours a week is just normal. And not do themselves stick to this principle, they also ask you to do the same thing. It doesn't mean they're terrible human beings, actually usually there's nothing wrong with their personalities or characters, it's just the way they've been educated, been expeirenced by their managers when they were young.

But my argument is, our industry is different, different from old days, it calls for creative, we need passions, need to be motivated. Not even mention how many flaws or damages or consequences it will cause if you force your employees to just work more. Here I quote DHH's speech:

I think there's just a lot of misconception out there about how hard you must work. I'm sure this was true in the industrial age when you were hammering on stuff. If you hammered for another five hours, you would produce another 10 widgets and you can sell those widgets. If you're working in stuff like software or anything else that doesn't require your personal labor in manufacturing widgets which is basically none. None of this stuff matters.

Wow it ended up longer artcies than I expected, maybe I should refactor this to another post =_=;

October 9, 2012 #git

Sometimes it's common that we tracked some files in the git repository first but later decided not to. For instance in rails application it could be database.yml file. So you added database.yml to .gitignore but when you changed something in that file, git will still show you.

Solution

  1. First added files you don't want to track to .gitignore
  2. Then use either method 1 for single file, or method 2 for folders below.

method 1: git update-index --assume-unchanged

git update-index --assume-unchanged config/database.yml

This works very well with single file, I'm not sure but maybe it doesn't support folder.

Method 2: git rm -r --cached

# This removes everything from the index
git rm -r --cached .

# This will only add files not listed in the .gitignore
git add .
# then commit it
git commit -m ".gitignore is now working"

git - .gitignore file not ignoring - Stack Overflow

October 9, 2012 #rails

Short note

  • rake assets:precompile
  • config.serve_static_assets = true # on production.rb
  • rails s -e production

That's all.

config.serve_static_assets

When you run rake middleware you'll see use ActionDispatch::Static in the development mode but not in production mode.

In normal case, you should not set that to true unless for trying production mode on local machine. As the comment on the source code suggested:

Disable Rails's static asset server (Apache or nginx will already do this)

October 9, 2012 #diary recommend

Peepcode video by Lars Pind

If you haven't watched it yet, I highly recommend you do it. It's totally worth 12$ at least for me.

Peepcode - Productivity for Programmers

Here I share some quotes and notes I found useful.

What is productivity?

Productivity is a method for managing your time and your other resources. In other words, it's managing yourself so you can achieve the most results in the least amount of time. The way I measure that is not by the number of lines of code but rather by how quickly you achieve your end result.

This makes much sense.

Notes I took

Before

  • Define your goal, outcome
  • Write it down
  • Be specific
  • Regularly dump your Open Loops(Give yourself 15 mins, write down all the TODOs or anything that bothers you at that time. Then review it either tell yourself you're gonna do it or just let it go)

During

  • Avoid Distractions
  • The 50/10 Rule(50 mins of focus, 10 mins break)
  • Work with your energy, honor your energy, track your energy.

After

  • Get rest
  • Get exercise
  • Celebrate

Off topic

Find another boss

In the "After - Get rest" part Lars told us the tip to deal with your boss:

Now I deserve to take some time off. If your boss doesn't agree, you should have a conversation with your boss about that. If he still doesn't agree, find another boss.

Maybe it's the easiest and most efficient way :)

Emotional Design

In the video it mentioned about the book "Emotional Design", I didn’t remember when and where I heard this book before, I was very interested in this book long ago. (Maybe it was in the book Drive?). So after I ran into it this time, I 1-clicked on Amazon without hesitation ^