🏄♂️
- GitHub Staff
- rickwinfrey.com
- @rewinfrey.bsky.social
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
1. Seperate all input and output from your core classes and push those methods into an IOGame class | |
2. Use methods or functions to determine state, rather than always maintaining state with explicit set methods | |
3. Use attr_reader rather than attr_accessor, and define your initialize contract for classes to take in all the data needed, rather than setting that data after instantiating an object | |
ex. | |
this is preferable: | |
player1 = Human.new("X", io_object) | |
rather than: | |
player1 = Human.new |
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 GameIO | |
attr_reader :game_input, :game_output | |
def initialize(input = $stdin, output = $stdout) | |
@game_input = input | |
@game_output = output | |
end | |
def output(msg) | |
game_output.puts msg |
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
Use app: | |
>> app.project_path(Project.first) | |
=> "/projects/130349783-with-attachments" | |
>> app.get "/735644780/projects/605816632-bcx.atom" | |
=> 200 | |
>> app.response.body | |
=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<feed xml:lang=\"en-US\" ... |
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 BGCCronInterval | |
def initialize(options) | |
@completion_reminder = options[:background_check_completion_reminder] | |
validate_options! | |
end | |
def cron_interval | |
@completion_reminder[:cron_interval] | |
end | |
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
Hi, | |
On Tue, 2011-03-01 at 18:02 +0530, Abhishek Kona wrote: | |
> Hi folks | |
> | |
> What is the best way to clear a Riak bucket of all key, values after | |
> running a test? | |
> I am currently using the Java HTTP API. | |
You can list the keys for the bucket and call delete for each. Or if you | |
put the keys (and kept track of them in your test) you can delete them |
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 Something | |
def injectable(injected_object) | |
injected_object.must_respond_to_this | |
end | |
end | |
class SomethingElse | |
def injectable(injected_object) | |
injected_object.must_respond_to_this | |
end |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
goog.fx.AbstractDragDrop.EventType = { | |
DRAGOVER: 'dragover', | |
DRAGOUT: 'dragout', | |
DRAG: 'drag', | |
DROP: 'drop', | |
DRAGSTART: 'dragstart', | |
DRAGEND: 'dragend' | |
}; | |
source: http://docs.closure-library.googlecode.com/git/closure_goog_fx_abstractdragdrop.js.source.html#line184 |
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
configuration file changes: | |
1. index.store.type: mmapfs | |
- memory mapped files utilize OS caches better | |
2. indices.memory.index_buffer_size: 30% | |
- more buffers allow ES to hold and handle more data horizontally (increases from default 10%) | |
3. index.refresh_interval: 5s |
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
% ./gradlew tomcatRun -Des.configFile=elasticsearch.yml | |
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/1.8/userguide/gradle_daemon.html. | |
The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead. | |
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead. | |
:QueryRelevancyProxy:compileJava UP-TO-DATE | |
:QueryRelevancyProxy:processResources UP-TO-DATE | |
:QueryRelevancyProxy:classes UP-TO-DATE | |
:QueryRelevancyProxy:tomcatRun | |
SLF4J: Class path contains multiple SLF4J bindings. | |
SLF4J: Found binding in [jar:file:/home/vagrant/.gradle/wrapper/dists/gradle-1.8-bin/vruqmccc8532n7gr46qavsii8/gradle-1.8/lib/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class] |