- Mac OS X 10.7.4
- デフォルトのruby1.8.7が入っている
- rails 3.0.8を入れてある
- rvmでのインストールを試みたが、はまったので、あきらめた
http://www.oiax.jp/rails/zakkan/rails_3_1_installation_on_macosx.html
| ruby -r open-uri -e 'open("http://b.hatena.ne.jp/hotentry") {|f| puts f.read.scan(/entry-link.+?>(.+?)</)}' | sed -e "s/続きを読む//g" |
| ruby -r open-uri -e 'open("http://uni.2ch.net/newsplus/") {|f| puts f.read.scan(/<a.+?>\d+?:\s(.+?)</)}' | nkf -w |
| # directory name | |
| ls -laF | ruby -e '$stdin.read.scan(%r![\S]+/!) {|m| puts m}' | |
| # or | |
| ls -laF | ruby -ne 'puts $_.split("\s")[8]' |
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int x = 1; | |
| int *p = &x; | |
| printf("%d\n", x); | |
| printf("%p\n", &x); | |
| printf("%d\n", *&x); |
| # -*- coding: utf-8 -*- | |
| require 'open-uri' | |
| require 'json' | |
| query = "猫 instagr.am" | |
| url = URI.escape("http://search.twitter.com/search.json?q=#{query}&include_entities=true") | |
| res = open(url).read | |
| json = JSON.parse(res) |
| # 前提 | |
| # Ruby 1.9.2 |
http://www.oiax.jp/rails/zakkan/rails_3_1_installation_on_macosx.html
| #perl基礎文法練習(途中) | |
| use strict; | |
| use warnings; | |
| #スカラー | |
| my $number1 = 3; | |
| my $number2 = 4; | |
| my $result = $number1 + $number2; | |
| print $result . "\n"; |
| # -*- coding: utf-8 -*- | |
| #バージョンは、Python 2.7.1 | |
| # スカラー | |
| number1 = 3 | |
| number2 = 4 | |
| result = number1 + number2 | |
| print result | |
| # 配列 |
| <html lang="ja"> | |
| <head> | |
| <script src="http://connect.facebook.net/ja_JP/all.js"></script> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="start_section"></div> | |
| <div id="friend_section"></div> | |
| <div id="fb-root"></div> | |
| <script type="text/javascript"> |