<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ゆーすけぶろぐ &#187; sinatra</title>
	<atom:link href="http://yusukezzz.net/blog/archives/tag/sinatra/feed" rel="self" type="application/rss+xml" />
	<link>http://yusukezzz.net/blog</link>
	<description>yusukezzz&#039;s weblog... ぷろぐらむとか ruby, android, java, thinkpad, milestone2</description>
	<lastBuildDate>Wed, 28 Dec 2011 13:21:54 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>rubyのTwitter::Base.newで得られるメソッド一覧</title>
		<link>http://yusukezzz.net/blog/archives/1618</link>
		<comments>http://yusukezzz.net/blog/archives/1618#comments</comments>
		<pubDate>Wed, 11 Nov 2009 07:05:27 +0000</pubDate>
		<dc:creator>yusukezzz</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://yusukezzz.net/blog/archives/1618</guid>
		<description><![CDATA[使い方は気合いで 以上]]></description>
			<content:encoded><![CDATA[<p>使い方は気合いで</p>
<pre class="brush: ruby; title: ; notranslate">
require 'twitter' # ver 0.7.0

==
===
=~
__id__
__send__
b64encode
blank?
block
class
client
clone
dclone
decode64
decode_b
delete
direct_message_create
direct_message_destroy
direct_messages
direct_messages_sent
disable_notifications
display
dup
enable_notifications
encode64
enum_for
eql?
equal?
extend
favorite_create
favorite_destroy
favorites
follower_ids
followers
freeze
friend_ids
friends
friends_timeline
friendship_create
friendship_destroy
friendship_exists?
frozen?
get
hash
help
id
inspect
instance_eval
instance_exec
instance_of?
instance_variable_defined?
instance_variable_get
instance_variable_set
instance_variables
is_a?
is_list_member?
kind_of?
list
list_add_member
list_create
list_delete
list_members
list_remove_member
list_subscribe
list_subscribers
list_timeline
list_unsubscribe
list_update
lists
memberships
method
methods
nil?
object_id
post
private_methods
protected_methods
public_methods
put
rate_limit_status
replies
respond_to?
send
singleton_methods
status
status_destroy
taguri
taguri=
taint
tainted?
tap
to_a
to_enum
to_json
to_s
to_yaml
to_yaml_properties
to_yaml_style
type
unblock
untaint
update
update_delivery_device
update_profile
update_profile_colors
user
user_timeline
verify_credentials
</pre>
<p>以上</p>
]]></content:encoded>
			<wfw:commentRss>http://yusukezzz.net/blog/archives/1618/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sinatraでsessionを有効にする</title>
		<link>http://yusukezzz.net/blog/archives/1572</link>
		<comments>http://yusukezzz.net/blog/archives/1572#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:23:00 +0000</pubDate>
		<dc:creator>yusukezzz</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://yusukezzz.net/blog/archives/1572</guid>
		<description><![CDATA[これまたsinatraというよりもrackの、なんだけども 参考：Sinatra と OAuth を使って Twitter のタイムラインを取得してみた &#8211; まちゅダイアリー(2009-08-18) こちらに [...]]]></description>
			<content:encoded><![CDATA[<p>これまたsinatraというよりもrackの、なんだけども</p>
<p>参考：<a href="http://www.machu.jp/diary/20090818.html#p01" target="_blank">Sinatra と OAuth を使って Twitter のタイムラインを取得してみた &#8211; まちゅダイアリー(2009-08-18)</a></p>
<p>こちらにあった例を試すと</p>
<pre class="brush: ruby; title: ; notranslate">
use :sessions, true # 0.9.4 &amp; Mongrelで動かず
enable :sessions # 試してない；　動くかも
# でもこんな感じでやらないと改ざんされて涙目になるかも
use Rack::Session::Cookie, :secret =&gt; Digest::SHA1.hexdigest(rand.to_s)
</pre>
<p>こんな感じでした<br />
デフォルトで使えないというのにちょっとびっくり</p>
]]></content:encoded>
			<wfw:commentRss>http://yusukezzz.net/blog/archives/1572/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[sequel][jQuery][sinatra]で今日やったこと</title>
		<link>http://yusukezzz.net/blog/archives/1556</link>
		<comments>http://yusukezzz.net/blog/archives/1556#comments</comments>
		<pubDate>Mon, 28 Sep 2009 07:01:42 +0000</pubDate>
		<dc:creator>yusukezzz</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sequel]]></category>
		<category><![CDATA[sinatra]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://yusukezzz.net/blog/archives/1556</guid>
		<description><![CDATA[・xml出力 みたいにします もちろんerbなどのテンプレートを用いることも可能 ・sequelで削除 みたいな感じ findだとdeleteメソッドがないって怒られた　ｲﾐﾌ ・jqueryでAjax inputのva [...]]]></description>
			<content:encoded><![CDATA[<p>・xml出力</p>
<pre class="brush: ruby; title: ; notranslate">
get '/hoge.xml' do
  content_type 'text/xml', :charset =&gt; 'utf-8'
  '&lt;hoge&gt;&lt;body&gt;hogehoge&lt;/body&gt;&lt;/hoge&gt;'
end
</pre>
<p>みたいにします<br />
もちろんerbなどのテンプレートを用いることも可能</p>
<p>・sequelで削除</p>
<pre class="brush: ruby; title: ; notranslate">
Posts.filter('id = ?', request[:id]).delete
</pre>
<p>みたいな感じ<br />
findだとdeleteメソッドがないって怒られた　ｲﾐﾌ</p>
<p>・jqueryでAjax</p>
<pre class="brush: jscript; title: ; notranslate">
  var params = {};
  $('input').each(function(){ params[this.name] = this.value });
  ajax = $.post('/post',
        params,
        function(responseText){
          var res = responseText;
          if(res != 'failed'){
            alert('posted!');
          } else {
            alert('failed');
          }
        }
      );
</pre>
<p>inputのvalueをハッシュ（JSON？）にセットしてpostするとシンプル…かな？</p>
]]></content:encoded>
			<wfw:commentRss>http://yusukezzz.net/blog/archives/1556/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sinatraでレイアウトを無効にする</title>
		<link>http://yusukezzz.net/blog/archives/1392</link>
		<comments>http://yusukezzz.net/blog/archives/1392#comments</comments>
		<pubDate>Thu, 28 May 2009 08:38:51 +0000</pubDate>
		<dc:creator>yusukezzz</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://yusukezzz.net/blog/archives/1392</guid>
		<description><![CDATA[sinatraでも（Ajaxなんかで）HTMLを返す際にレイアウトを無効に出来ます Templateを指定する部分で erb :index, :layout => false と指定します]]></description>
			<content:encoded><![CDATA[<p>sinatraでも（Ajaxなんかで）HTMLを返す際にレイアウトを無効に出来ます<br />
Templateを指定する部分で<br />
erb :index, :layout => false<br />
と指定します</p>
]]></content:encoded>
			<wfw:commentRss>http://yusukezzz.net/blog/archives/1392/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sinatraでファイルアップロード</title>
		<link>http://yusukezzz.net/blog/archives/1388</link>
		<comments>http://yusukezzz.net/blog/archives/1388#comments</comments>
		<pubDate>Tue, 26 May 2009 14:17:29 +0000</pubDate>
		<dc:creator>yusukezzz</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://yusukezzz.net/blog/archives/1388</guid>
		<description><![CDATA[Sinatraというか、Rackのparamsを用いたアップロードの仕方ですね rubyではいつもファイルのアップロードの仕方を忘れてしまうのでメモメモ 普通に:tempfileを移動するだけでもいい気がする… Sina [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sinatrarb.com/" taget="blank">Sinatra</a>というか、Rackのparamsを用いたアップロードの仕方ですね<br />
rubyではいつもファイルのアップロードの仕方を忘れてしまうのでメモメモ</p>
<pre class="brush: ruby; title: ; notranslate">
post '/upload' do
	if params[:file]
		new_filename = DateTime.now.strftime('%s') + File.extname(params[:file][:filename])
		save_file = './public/files/' + new_filename
		File.open(save_file, 'wb'){ |f| f.write(params[:file][:tempfile].read) }
		@mes = 'upload completed!'
	end
end
</pre>
<p>普通に:tempfileを移動するだけでもいい気がする…<br />
Sinatra簡単でいいですね<br />
久々のプログラミング楽しい</p>
<p>@iMRC 文化祭向けには（出来れば面白い）画像のアップローダーでも作ろうかと思ってます…皆写真撮るよね？</p>
]]></content:encoded>
			<wfw:commentRss>http://yusukezzz.net/blog/archives/1388/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

