This file contains hidden or 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
# Add this to a buildr 'buildfile' to receive growl notifications when compilation | |
# completes or fails (including cc compilations) | |
require 'ruby_gntp' | |
# Growl setup | |
Buildr.application.on_completion do |title, message| | |
GNTP.notify({ | |
:app_name => "buildr", | |
:title => title, |
This file contains hidden or 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 Semaphore(private var count : Int) { | |
def p() { | |
synchronized { | |
while (count < 1) {} | |
count = count - 1 | |
} | |
} | |
def v() { | |
synchronized { |
This file contains hidden or 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 actors.Actor._ | |
val n = 8 | |
val front = 0 | |
val back = 0 | |
val buffer = new Array[Int](n) | |
val full = new Semaphore(0) | |
val empty = new Semaphore(n) | |
// Producer |
This file contains hidden or 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
rails new <appname> | |
cd <appname> | |
git init | |
rm -r test | |
gem 'rspec-rails' -> Gemfile | |
bundle install | |
rails generate rspec:install | |
gem 'factory_girl_rails' -> Gemfile |
This file contains hidden or 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 Frappuccino.Backbone.Event extends Backbone.Event | |
event: (event_name) -> new Frappuccino.Event(this, event_name) | |
class Frappuccino.Event extends Backbone.Event | |
constructor: (origin, event) -> | |
@origin = origin | |
@event = event | |
@origin.bind(@event, (value) => this.occur(value)) | |
This file contains hidden or 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 | |
emoji = [":bowtie:", ":smile:", ":laughing:", ":blush:", ":smiley:", ":relaxed:", ":smirk:", ":heart_eyes:", ":kissing_heart:", ":kissing_face:", | |
":flushed:", ":relieved:", ":satisfied:", ":grin:", ":wink:", ":wink2:", ":tongue:", ":unamused:", ":sweat_smile:", ":sweat:", ":weary:", | |
":pensive:", ":disappointed:", ":confounded:", ":fearful:", ":cold_sweat:", ":persevere:", ":cry:", ":sob:", ":joy:", ":astonished:", ":scream:", | |
":neckbeard:", ":tired_face:", ":angry:", ":rage:", ":triumph:", ":sleepy:", ":yum:", ":mask:", ":sunglasses:", ":dizzy_face:", ":imp:", ":smiling_imp:", | |
":neutral_face:", ":no_mouth:", ":innocent:", ":alien:", ":yellow_heart:", ":blue_heart:", ":purple_heart:", ":heart:", ":green_heart:", ":broken_heart:", | |
":heartbeat:", ":heartpulse:", ":two_hearts:", ":revolving_hearts:", ":cupid:", ":sparkles:", ":star:", ":star2:", ":dizzy:", ":boom:", ":collision:", | |
":anger:", ":exclamation:", ":question:", ":grey_exclamation:", ":grey_question:", ":zzz:", ":da |
This file contains hidden or 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
// Standard way of hooking up Events: | |
public class EventActivity extends Activity { | |
public onCreate(Bundle savedInstanceState) { | |
findViewById(R.id.button_one).setOnClickListener(new View.OnClickListener) { | |
@Override | |
public void onClick(View view) { | |
Toast toast = Toast.makeText(EventActivity.this, "Clicked One!", Toast.LENGTH_SHORT); | |
toast.show() | |
} |
This file contains hidden or 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
@Test | |
public void contentViewShouldBeMeasuredWithSpecExactly() { | |
Activity activity = Robolectric.buildActivity(Activity.class).create().get(); | |
final int[] measureModes = {0, 0}; | |
View contentView = new View(activity) { | |
@Override | |
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
measureModes[0] = MeasureSpec.getMode(widthMeasureSpec); | |
measureModes[1] = MeasureSpec.getMode(heightMeasureSpec); |
This file contains hidden or 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
$ fly --atcURL http://ci.initech.com:8080 execute -c test.yml --exclude-ignored </dev/null | cat | |
Connecting to 10.0.2.15:8080 (10.0.2.15:8080) | |
- 100% |*******************************| 10320k 0:00:00 ETA | |
initializing with docker:///cstott/node-ruby-kitchen-sink | |
running script/test.sh | |
+ git submodule init | |
perl: warning: Setting locale failed. | |
perl: warning: Please check that your locale settings: | |
LANGUAGE = (unset), | |
LC_ALL = (unset), |
This file contains hidden or 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
enum Direction { | |
case Left | |
case Right | |
} | |
func angle(direction: Direction): Int { | |
switch(direction) { | |
case Left: return 90 | |
case Right: return -90 | |
} |