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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>서울시 날씨정보-wunderground API이용</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1" charset="utf-8"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> | |
<script> |
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
# encoding: utf-8 | |
lines=File.readlines("oliver.txt") | |
line_count=lines.size | |
text=lines.join | |
total_character=text.length | |
total_character_no_whitespace=text.gsub(/\s+/,'').length | |
word_count=text.split.length | |
paragraph_count=text.split(/\n\n/).length | |
sentence_count=text.split(/\.|\!|\?/).length | |
puts "전체 길이 : #{line_count}" |
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
# encoding: utf-8 | |
# Stop_words 2012-12-26 | |
stop_words = %w{the a by on for of are with just but and to the my I has some in} | |
text=%q{Korea is officially the only divided nation in the world.} | |
words = text.scan(/\w+/) | |
key_words = words.select { |word| !stop_words.include?(word)} | |
puts "문장 중 키워드의 비율은 : #{((key_words.length.to_f/words.length.to_f)*100).to_i}%" | |
puts key_words.join(' ') |
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
def current_user | |
@current_user ||= User.find(session[:user_id]) | |
end |
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
class TaskController < ApplicationController | |
def incomplete | |
@tasks = Task.find(:all, :conditions => ['complete = ?', false]) | |
end | |
def last_incomplete | |
@task = Task.find(:first, :conditions => ['complete =?', false], :order => 'created_at DESC') | |
end | |
end |
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
=begin 문자열 출력해보기 | |
**이 문서는 루비 2.0.0-p0 버전의 Ruby core API 기반의 메소드를 사용합니다.** | |
** 작성자 정보 | |
** 박창주 | |
** pcjpcj2@gmail.com | |
** http://parkcj.wordpress.com | |
** 2013-04-07 | |
single quotation vs double quotation | |
''와 ""의 차이를 알아보자 | |
우선 puts 는 문자열을 출력하는 함수이다. |
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
=begin | |
**이 문서는 루비 2.0.0-p0 버전의 Ruby core API 기반의 메소드를 사용합니다.** | |
** 작성자 정보 | |
** 박창주 | |
** pcjpcj2@gmail.com | |
** http://parkcj.wordpress.com | |
** 2013-04-07 | |
예를 들어 특정 횟수만큼 문장을 반복할 일이 생긴다면 | |
어떻게 해야할까? | |
-> 1. 1번의 Hello World!를 출력해보자 |
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
=begin | |
**이 문서는 루비 2.0.0-p0 버전의 Ruby core API 기반의 메소드를 사용합니다.** | |
** 작성자 정보 | |
** 박창주 | |
** pcjpcj2@gmail.com | |
** http://parkcj.wordpress.com | |
** 2013-04-07 | |
이상 시인의 시 오감도 제 1호를 작성하여 보자 | |
시의 전문 : | |
오감도(烏瞰圖) 시 제1호 |
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
# encoding: utf-8 | |
=begin | |
**이 문서는 루비 1.9.3-p392 버전의 Ruby core API 기반의 메소드를 사용합니다.** | |
** 작성자 정보 | |
** 박창주 | |
** pcjpcj2@gmail.com | |
** http://parkcj.wordpress.com | |
** 2013-04-07 | |
조금 더 문자열에 대해서 알아보자. |
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
# encoding: utf-8 | |
=begin | |
**이 문서는 루비 2.0.0-p0 버전의 Ruby core API 기반의 메소드를 사용합니다.** | |
** 작성자 정보 | |
** 박창주 | |
** pcjpcj2@gmail.com | |
** http://parkcj.wordpress.com | |
** 2013-04-07 | |
이상의 오감도 제 1호 계속 |
OlderNewer