dl/dt/ddとか
http://desperadoes.biz/style/dl.php
$LAYYYTER
macklin celebrini has autism

@theartofmadeline

The Bowery Presents
🪼
Claire Keane
Aqua Utopia|海の底で記憶を紡ぐ
taylor price

shark vs the universe
Mike Driver
sheepfilms
todays bird

bliss lane
we're not kids anymore.
Xuebing Du

Kiana Khansmith
will byers stan first human second
NASA

seen from United States
seen from United States
seen from United States
seen from United States
seen from United Kingdom

seen from Colombia
seen from United States

seen from Vietnam
seen from Brazil
seen from United States

seen from United States
seen from United States

seen from United States
seen from United States

seen from United States
seen from Bangladesh
seen from Kenya

seen from United States

seen from Italy

seen from Spain
@moccow-the-tech
dl/dt/ddとか
http://desperadoes.biz/style/dl.php

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
BEM: https://github.com/juno/bem-methodology-ja/blob/master/definitions.md
SMACSS: https://app.codegrid.net/entry/smacss-1
clearFix: http://kojika17.com/2013/06/clearfix-2013.html
javascriptのオブジェクト
JavaScriptのオブジェクト指向 より
1 関数リテラル
関数を変数として扱う
<script type="text/javascript"> var func = function(n) { var total = 0; for(var i = 0; i < n; i++) { total += i; return total; } } var num = prompt("数字を入力:"); var res = func(num); alert(res); </script>
js( & jquery)ではまったところ
js連想配列のkeyに変数を使えない。
jqueryの要素(セレクタ)指定は、文字列にすれば良いということがやっとわかった。
DOM生成:$(“<DOM>”) ← $(“DOM”)としてはまる
CSSとjs(さらにruby)の名前を共有するにはどうすべきか?
web技術ブックマーク
セッション
第3回 制御して 防いでこその セッションだ
「セッション管理」のすべて - ステップ1 [基本のしくみ]

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Developing Facebook Apps on Heroku | Heroku Dev Center | ※ | 宿題帳
とりあえず、全体の処理の流れを追い、個々の処理が何をしているのか、そして参照しているデータの正体を知ることが必要なんだと思う。 また、その背後にある技術的背景を知ること(結局のところ、これが一番の難所)。 宿題 |1| ※ 1. セッションについて理解する。 ※ 2. 例外処理について理解する。 ※ 3. ステータスコード、Rack-Middleware、バックトレースについても調べる。 宿題 |2| abortについて調べる。 宿題 |3| ※ 1. https について調べる(そうすれば、行目の if 文についても分かるかも)。 ※ 2. redirect について調べる。 ※ 3. environmentについては、ドキュメントではよく分からないので、オライリー本で調べる。 宿題 |4| 特になし 宿題 |5| 特になし 宿題 |6| ※ 1. OAuth について調べる。 ※ 2. ここでの Javascript SDK との関係を調べる。 ※ 3. Cookie や Session について調べないといけないなぁ。。 ※ 4. cross-site request forgery ( CSRF ) ? ※ 5. ※ 3とともに、トークンについても調べないと。 ※ 6. この prams [ :code ] はどっから来るのかなぁ。 宿題 |7| ※ 1. この辺はqueryのことを知らないと腑に落ちる理解には至らないんだろう。。 ※ 2. RESTってよく目にする用語だから、これも調べないと。。 宿題 |8| 特になし 宿題 |9| ※ 1. OGPについて調べること。 宿題 |10| ※ 1. IE対応。。。。。。 宿題 |11| ※ 1. <div>タグでライブラリを読み込むって、どういうことなんだろう? ※ 2. クロスドメインとは? ※ 3. xfbml は facebook の仕様を調べる必要があるんだろうな。 ※ 4. これは javascript でweb アプリを作る際の大枠の理解が必要そうだから、理解に時間がかかるかもしれない。 ※ 5. ここで JavaScript SDK を読み込んでいるようにもみえるが、そうすると、※ 1の <div> でやってたことと何がちがうんだろうか?
D3 is a JavaScript library for visualizing data with HTML, SVG and CSS.
・ D3.js - 日本語ドキュメント ・ 「D3.js」を使ったデータビジュアライゼーション ・ D3.js入門 (ドットインストール)
Developing Facebook Apps on Heroku | Heroku Dev Center | 11 |
body タグ内は Facebook SDK for JavaScript の設定から始まる(index.erb)。 まず、94 行目。
<body> <div id="fb-root"></div>
Developing Facebook Apps on Heroku | Heroku Dev Center | 10 |
index.erb
<script type="text/javascript" src="/javascripts/jquery-1.7.1.min.js"></script> <script type="text/javascript"> function logResponse(response) { if (console && console.log) { console.log('The response was', response); } } $(function(){ // Set up so we handle click on the buttons $('#postToWall').click(function() { FB.ui( { method : 'feed', link : $(this).attr('data-url') }, function (response) { // If response is null the user canceled the dialog if (response != null) { logResponse(response); } } ); }); $('#sendToFriends').click(function() { FB.ui( { method : 'send', link : $(this).attr('data-url') }, function (response) { // If response is null the user canceled the dialog if (response != null) { logResponse(response); } } ); }); $('#sendRequest').click(function() { FB.ui( { method : 'apprequests', message : $(this).attr('data-message') }, function (response) { // If response is null the user canceled the dialog if (response != null) { logResponse(response); } } ); }); }); </script>
ココを見ると、
FB.ui({ method: 'feed', link: 'https://developers.facebook.com/docs/dialogs/', caption: 'An example caption', }, function(response){});
最初の{ } の中で、method: 等の設定をし、function ( response ) { }の中でイベント時の処理を書く仕様になっている。今回のサンプルでは処理の部分に、ユーザー定義関数の logResponse ( response ) を呼び出している。 method: が 'send' のときはココ、'apprequests' のときはココ。 また、<body></body>内の該当箇所は以下。
<a href="#" class="facebook-button" id="postToWall" data-url="<%= url %>">
<a href="#" class="facebook-button speech-bubble" id="sendToFriends" data-url="<%= url %>">
<a href="#" class="facebook-button apprequests" id="sendRequest" data-message="Test this awesome app">
<!--[if IE]> <script type="text/javascript"> var tags = ['header', 'section']; while(tags.length) document.createElement(tags.pop()); </script> <![endif]-->
array.pop( ) は配列の最後尾を削除し、その削除した要素が戻り値になる。ん〜、IE対応なんだろうけど、これはなんのための処理なんだろう。※ 1
[ 今回の宿題 ] ※ 1. IE対応。。。。。。

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Developing Facebook Apps on Heroku | Heroku Dev Center | 9 |
2行目からいきなり爆弾が。。その名は OGP ※ 1
index.erb
<!DOCTYPE html> <html xmlns:fb="http://ogp.me/ns/fb#" lang="en">
Developing Facebook Apps on Heroku | Heroku Dev Center | 8 |
index.erb
<!DOCTYPE html> <html xmlns:fb="http://ogp.me/ns/fb#" lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes" /> <title><%= @app['name'] %></title> <link rel="stylesheet" href="stylesheets/screen.css" media="Screen" type="text/css" /> <link rel="stylesheet" href="stylesheets/mobile.css" media="handheld, only screen and (max-width: 480px), only screen and (max-device-width: 480px)" type="text/css" /> <!--[if IEMobile]> <link rel="stylesheet" href="mobile.css" media="screen" type="text/css" /> <![endif]--> <!-- These are Open Graph tags. They add meta data to your --> <!-- site that facebook uses when your content is shared --> <!-- over facebook. You should fill these tags in with --> <!-- your data. To learn more about Open Graph, visit --> <!-- 'https://developers.facebook.com/docs/opengraph/' --> <meta property="og:title" content="<%= @app['name'] %>" /> <meta property="og:type" content="website" /> <meta property="og:url" content="<%= url %>" /> <meta property="og:image" content="<%= url('/logo.png') %>" /> <meta property="og:site_name" content="<%= @app['name'] %>" /> <meta property="og:description" content="My First App" /> <meta property="fb:app_id" content="<%= @app['name'] %>" /> <script type="text/javascript" src="/javascripts/jquery-1.7.1.min.js"></script> <script type="text/javascript"> function logResponse(response) { if (console && console.log) { console.log('The response was', response); } } $(function(){ // Set up so we handle click on the buttons $('#postToWall').click(function() { FB.ui( { method : 'feed', link : $(this).attr('data-url') }, function (response) { // If response is null the user canceled the dialog if (response != null) { logResponse(response); } } ); }); $('#sendToFriends').click(function() { FB.ui( { method : 'send', link : $(this).attr('data-url') }, function (response) { // If response is null the user canceled the dialog if (response != null) { logResponse(response); } } ); }); $('#sendRequest').click(function() { FB.ui( { method : 'apprequests', message : $(this).attr('data-message') }, function (response) { // If response is null the user canceled the dialog if (response != null) { logResponse(response); } } ); }); }); </script> <!--[if IE]> <script type="text/javascript"> var tags = ['header', 'section']; while(tags.length) document.createElement(tags.pop()); </script> <![endif]--> </head> <body> <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId : "<%= @app['id'] %>", // App ID channelUrl : "<%= url_no_scheme('/channel.html') %>", // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); // Listen to the auth.login which will be called when the user logs in // using the Login button FB.Event.subscribe('auth.login', function(response) { // We want to reload the page now so Ruby can read the cookie that the // Javascript SDK sat. But we don't want to use // window.location.reload() because if this is in a canvas there was a // post made to this page and a reload will trigger a message to the // user asking if they want to send data again. window.location = window.location; }); FB.Canvas.setAutoGrow(); }; // Load the SDK Asynchronously (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <header class="clearfix"> <% if @user %> <p id="picture" style="background-image: url(https://graph.facebook.com/<%= @user['id'] %>/picture?type=normal)"></p> <div> <h1>Welcome, <strong><%= @user['name'] %></strong></h1> <p class="tagline"> This is your app <a href="<%= @app['@app'] %>"><%= @app['name'] %></a> </p> <div id="share-app"> <p>Share your app:</p> <ul> <li> <a href="#" class="facebook-button" id="postToWall" data-url="<%= url %>"> <span class="plus">Post to Wall</span> </a> </li> <li> <a href="#" class="facebook-button speech-bubble" id="sendToFriends" data-url="<%= url %>"> <span class="speech-bubble">Send Message</span> </a> </li> <li> <a href="#" class="facebook-button apprequests" id="sendRequest" data-message="Test this awesome app"> <span class="apprequests">Send Requests</span> </a> </li> </ul> </div> </div> <% else %> <div> <h1>Welcome</h1> <div class="fb-login-button" data-scope="<%= FACEBOOK_SCOPE %>">Log In</div> </div> <% end %> </header> <section id="get-started"> <p>Welcome to your Facebook app, running on <span>heroku</span>!</p> <a href="https://devcenter.heroku.com/articles/facebook?utm_source=facebook&utm_medium=app&utm_campaign=fb_integration" target="_top" class="button">Learn How to Edit This App</a> </section> <% if @user %> <section id="samples" class="clearfix"> <h1>Examples of the Facebook Graph API</h1> <div class="list"> <h3>A few of your friends</h3> <ul class="friends"> <% @friends.each do |friend| %> <li> <a href="#" onclick="window.open('http://www.facebook.com/<%= friend['id']%>')"> <img src="https://graph.facebook.com/<%= friend['id'] %>/picture?type=square" alt="<%= friend['name'] %>"> <%= friend['name'] %> </a> </li> <% end %> </ul> </div> <div class="list inline"> <h3>Recent photos</h3> <ul class="photos"> <% @photos.each_with_index do |photo, index| %> <li style="background-image: url(<%= photo['picture'] %>)" class='<%= 'first-column' if (index%4).zero? %>'> <a href="#" onclick="window.open('http://www.facebook.com/<%= photo['id'] %>')"> <%= photo['name'] %> </a> </li> <% end %> </ul> </div> <div class="list"> <h3>Things you like</h3> <ul class="things"> <% @likes.each do |like| %> <li> <a href="#" onclick="window.open('http://www.facebook.com/<%= like['id'] %>')"> <img src="https://graph.facebook.com/<%= like['id'] %>/picture?type=square" alt="<%= like['name'] %>"> <%= like['name'] %> </a> </li> <% end %> </ul> </div> <div class="list"> <h3>Friends using this app</h3> <ul class="friends"> <% @friends_using_app.each do |friend_result| %> <li> <a href="#" onclick="window.open('http://www.facebook.com/<%= friend_result['uid'] %>')"> <img src="<%= friend_result['pic_square'] %>" alt="<%= friend_result['name'] %>"> <%= friend_result['name'] %> </a> </li> <% end %> </ul> </div> </section> <% end %> <section id="guides" class="clearfix"> <h1>Learn More About Heroku & Facebook Apps</h1> <ul> <li> <a href="https://www.heroku.com/?utm_source=facebook&utm_medium=app&utm_campaign=fb_integration" target="_top" class="icon heroku">Heroku</a> <p>Learn more about <a href="https://www.heroku.com/?utm_source=facebook&utm_medium=app&utm_campaign=fb_integration" target="_top">Heroku</a>, or read developer docs in the Heroku <a href="https://devcenter.heroku.com/" target="_top">Dev Center</a>.</p> </li> <li> <a href="https://developers.facebook.com/docs/guides/web/" target="_top" class="icon websites">Websites</a> <p> Drive growth and engagement on your site with Facebook Login and Social Plugins. </p> </li> <li> <a href="https://developers.facebook.com/docs/guides/mobile/" target="_top" class="icon mobile-apps">Mobile Apps</a> <p> Integrate with our core experience by building apps that operate within Facebook. </p> </li> <li> <a href="https://developers.facebook.com/docs/guides/canvas/" target="_top" class="icon apps-on-facebook">Apps on Facebook</a> <p>Let users find and connect to their friends in mobile apps and games.</p> </li> </ul> </section> </body> </html>
Developing Facebook Apps on Heroku | Heroku Dev Center | 7 |
koala について調べる 2。APIクラス。 まず、該当箇所の概要
get "/" do # Get base API Connection @graph = Koala::Facebook::API.new(access_token) # Get public details of current application @app = @graph.get_object(ENV["FACEBOOK_APP_ID"]) if access_token @user = @graph.get_object("me") @friends = @graph.get_connections('me', 'friends') @photos = @graph.get_connections('me', 'photos') @likes = @graph.get_connections('me', 'likes').first(4) # for other data you can always run fql @friends_using_app = @graph.fql_query("SELECT uid, name, is_app_user, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1") end erb :index end
Developing Facebook Apps on Heroku | Heroku Dev Center | 6 |
今回は、前回、全体の処理の流れを追うため詳しく見なかった、 koala オブジェクトについて調べる。koala が Facebook との連携部分を担っている。 機能としては、おもに、API クラス( Koala :: Facebook :: API )と OAuth クラス( Koala :: Facebook :: OAuth )のメソッドから構成されいる。API クラスは Facebook との情報(ソーシャルグラフ)のやり取り部分を担い、OAuth クラスは認証時の手続きを容易にしてくれている。OAuth 自体については後で調べる(※ 1)ことにして、koala での扱い方を調べるのである。また、OAuth については、他にもライブラリがあるようだ。 アプリケーションの流れが、“認証 → Facebook 情報のアクセス”となっているので、まず OAuth クラスから。
① Koala :: Facebook :: OAuth オブジェクトについて
@oauth = Koala::Facebook::OAuth.new(app_id, app_secret, callback_url)
Developing Facebook Apps on Heroku | Heroku Dev Center | 5 |
環境設定を見てきたので、ここで全体の処理の流れを追ってみる。
① まず、before の処理があって
before do ー省略ー end
② そして、get ' / ' の処理へ
get "/" do # Get base API Connection @graph = Koala::Facebook::API.new(access_token) # access_tokenはhelpers内定義のメソッド # 省略 # end

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Developing Facebook Apps on Heroku | Heroku Dev Center | 4 |
helpers do def host request.env['HTTP_HOST'] end
Developing Facebook Apps on Heroku | Heroku Dev Center | 3 |
before do # HTTPS redirect if settings.environment == :production && request.scheme != 'https' redirect "https://#{request.env['HTTP_HOST']}" end end
# settings.environment >> development # request.scheme >> http # request.env['HTTP_HOST'] >> localhost:5000