- Clear feature ownership
- Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
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
EvenOrOdd = React.createClass({ | |
propTypes: { | |
number: React.PropTypes.number.isRequired | |
}, | |
isEven(num) { | |
return num % 2 === 0; | |
}, | |
render() { |
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
describe(“EvenOrOdd Component”, function() { | |
it(“should pass test”, function() { | |
expect(1 + 1).toEqual(2); | |
}); | |
}); |
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
describe("EvenOrOdd Component", function() { | |
var defProps, renderWithProps, component, el, $el; | |
beforeEach(function() { | |
defProps = { | |
number: 2 | |
}; | |
renderWithProps = function(props) { | |
component = renderComponent(EvenOrOdd, props); | |
el = React.findDOMNode(component); |
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
EvenOrOdd = React.createClass({ | |
render() { | |
return ( | |
<div className='EvenOrOdd'> | |
Hello World | |
</div> | |
); | |
} | |
}); | |
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 bash | |
apt-get update | |
apt-get upgrade | |
sudo apt-get install autossh | |
# prevent bruteforce on SSH | |
apt-get install fail2ban | |
# setup firewall |
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
defmodule App.Query do | |
import App.Database, only: [run: 1] | |
alias RethinkDB.Query | |
def get(table, id) when is_bitstring(id) do | |
Query.table(table) | |
|> Query.get(id) | |
|> run | |
|> catch_errors | |
|> handle_get_response |
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
defmodule App.Helpers do | |
use Timex | |
import App.Rethink, only: [run: 1] | |
alias RethinkDB.Query | |
def get(table, id) when is_bitstring(id) do | |
Query.table(table) | |
|> Query.get(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
defmodule MyApp.RethinkDB.Helpers do | |
def run(query, opts) do | |
query | |
|> MyApp.Database.run(opts) | |
|> handle_response | |
end | |
def run(query) do | |
run(query, []) |
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
defmodule RethinkDB.Helpers do | |
def run(query) do | |
query | |
|> do_run | |
|> handle_response | |
end | |
def handle_response(%RethinkDB.Exception.ConnectionClosed{}) do | |
raise "Cannot connect to RethinkDB" |