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
/** Original **/ | |
void method1() { | |
var fuga = hoge(); // 何かしらの複雑な処理 | |
method2(); | |
} | |
void method2() { | |
var fuga = hoge(); // 何かしらの複雑な処理 | |
method3(); | |
} |
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
/// followは全ユーザのフォロー・フォロワーの関係が入っているリスト | |
List<Tweet> tweets(String uid, List<Follow> follows, List<Tweet> tweets, | |
List<ReTweet>reTweets) { | |
var result = <Tweet>[]; | |
// フォローしているユーザのUserIDを抽出 | |
var followUserIDs = <String>[]; | |
for (var follow in follows) { | |
if (follow.from != uid) { | |
followUserIDs.add(follow.to); |
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
/// followは全ユーザのフォロー・フォロワーの関係が入っているリスト | |
List<Tweet> tweets(String uid, List<Follow> follows, List<Tweet> tweets, | |
List<ReTweet>reTweets) { | |
var result = <Tweet>[]; | |
// フォローしているユーザのTweetを抽出 | |
for (var follow in follows) { | |
// 自分がフォローしている人だけを通す | |
if (follow.from != uid) { | |
continue; |
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
/// followは全ユーザのフォロー・フォロワーの関係が入っているリスト | |
List<Tweet> tweets(String uid, List<Follow> follows, List<Tweet> tweets, | |
List<ReTweet>reTweets) { | |
var result = <Tweet>[]; | |
for (var follow in follows) { | |
// 自分がフォローしている人だけを通す | |
if (follow.from != uid) { | |
continue; | |
} | |
// フォローしているユーザのTweetを抽出 |
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
List<Tweet> tweets(String uid, List<Follow> follows, List<Tweet> tweets, | |
List<ReTweet>reTweets) { | |
var result = <Tweet>[]; | |
// フォローしているユーザのUserIDを抽出 | |
var followUserIDs = getFollowUserIDs(follows, uid); | |
// フォローしているユーザのTweetを抽出 | |
result.addAll(getTweets(followUserIDs, tweets)); |
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 State { | |
bool aisatu = false; | |
int onigiriPrice = 100; | |
} | |
var state = new State(); | |
void onMessage(String message) { | |
state = updateState(state, message); | |
} |
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
bool aisatu = false; | |
int onigiriPrice = 100; | |
void onMessage(String message) { | |
switch (message) { | |
case "こんにちは": | |
onAisatu(); | |
return; | |
case "おにぎり3個ください": | |
onOnigiriRequest(); |
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 Video { | |
String videoID; | |
List<String> playedUsers; | |
} | |
class User { | |
String userID; | |
List<String> playedVideos; | |
} |
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 Video { | |
String videoID; | |
} | |
class User { | |
String userID; | |
} | |
class PlayEvent { | |
String userID; |
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
#!/usr/bin/env ruby | |
require "socket" | |
require 'thwait' | |
server = TCPServer.open(3000) | |
htmlsoc = server.accept | |
threads = [] |
OlderNewer