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
// Client | |
class Customer { | |
// places an order (requesting a command) | |
} | |
// Command | |
class Order { | |
// waiter places this | |
} |
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
// Client | |
class Student { | |
private int studentId; | |
public void requestEnrollment(int courseId) { | |
Enroll enroll = new Enroll(studentId, courseId); | |
Invoker invoker = new Invoker(); | |
invoker.request(enroll); | |
} |
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
abstract class AbstractScriptTemplate { | |
// Template Method Pattern | |
public final void runScript() { | |
setup(); | |
scriptLogic(); | |
clean(); | |
report(); | |
} |
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
$ convert wait.gif[0] wait_0.gif | |
$ convert wait.gif[1] wait_1.gif | |
$ convert wait.gif[2] wait_2.gif | |
$ convert wait.gif[3] wait_3.gif | |
$ convert wait.gif[4] wait_4.gif | |
$ convert wait.gif[5] wait_5.gif |
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
<animation-list android:oneshot="false"> | |
<item android:drawable="@drawable/wait_0" android:duration="50" /> | |
<item android:drawable="@drawable/wait_1" android:duration="50" /> | |
<item android:drawable="@drawable/wait_2" android:duration="50" /> | |
<item android:drawable="@drawable/wait_3" android:duration="50" /> | |
<item android:drawable="@drawable/wait_4" android:duration="50" /> | |
<item android:drawable="@drawable/wait_5" android:duration="50" /> | |
</animation-list> |
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
ImageView spinner = (ImageView) findViewById(R.id.spinner); | |
spinner.setBackgroundResource(R.drawable.spinner); | |
AnimationDrawable frameAnimation = (AnimationDrawable) spinner.getBackground(); | |
frameAnimation.start() |
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
import com.forrst.api; | |
ForrstAPI forrst = new ForrstAPIClient(); | |
// API stats | |
forrst.stats(); | |
// Authentication | |
forrst.usersAuth("USERNAME", "PASSWORD"); |
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
$ ant |
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
SELECT user.id AS user_id, ARRAY_AGG(group.id) AS group_ids | |
FROM users | |
LEFT JOIN groups ON group.user_id = group.id | |
GROUP BY user.id |
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
curl https://github.com/git/git/raw/master/contrib/completion/git-completion.bash -OL |
OlderNewer