既に穴だらけですが、やれるだけやっていきます。今回はパターンマッチの話です。
はい、あなたのよく知るパターンマッチです。ガードも使えますが、他の言語でガードを使うパターンの一部はOCamlのorパターンと同等の機能や範囲を表す機能によって置き換えることができます。
-- based on http://stackoverflow.com/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift | |
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes" | |
FROM stv_blocklist | |
INNER JOIN | |
(SELECT DISTINCT id, name FROM stv_tbl_perm) names | |
ON names.id = stv_blocklist.tbl | |
GROUP BY name | |
ORDER BY "Size in Gigabytes" DESC |
class List < Array | |
undef_method *%w(inject map size at index select reject detect all? any? one? none? min max minmax take_while grep include? partition group_by count join assoc zip reverse values_at compact take flat_map product) # !> `*' interpreted as argument prefix | |
def inject(init, &blk) | |
return init if empty? | |
(drop 1).inject( yield(init, first), &blk) | |
end | |
def map | |
inject([]) { |m, x| m << yield(x) } |
Ruby の HTTP クライアントライブラリ Faraday が便利そう
API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた
[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた
diff -c sl/sl.c sl_kq/sl.c | |
*** sl/sl.c 1998-07-22 23:01:01.000000000 +0900 | |
--- sl_kq/sl.c 2011-12-02 21:34:09.540165908 +0900 | |
*************** | |
*** 33,73 **** | |
#include "sl.h" | |
int ACCIDENT = 0; | |
int LOGO = 0; | |
int FLY = 0; |
I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.
I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real