Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Brodzinski AdamBrodzinski

View GitHub Profile
@AdamBrodzinski
AdamBrodzinski / meteor-1.2.1-install
Created Apr 8, 2016
Install a stable version of Meteor CLI
View meteor-1.2.1-install
#!/bin/sh
# This is the Meteor install script!
#
# Are you looking at this in your web browser, and would like to install Meteor?
#
# MAC AND LINUX:
# Just open up your terminal and type:
#
# curl https://install.meteor.com/ | sh
@AdamBrodzinski
AdamBrodzinski / rethinkdb_helpers.ex
Created Feb 26, 2016 — forked from sikanhe/rethinkdb_helpers.ex
helpers for rethinkdb elixir
View rethinkdb_helpers.ex
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"
View rdb_helpers.ex
defmodule MyApp.RethinkDB.Helpers do
def run(query, opts) do
query
|> MyApp.Database.run(opts)
|> handle_response
end
def run(query) do
run(query, [])
View rethinkdb-elixir-helpers.ex
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)
@AdamBrodzinski
AdamBrodzinski / rethink_query_wrapper.ex
Created Feb 1, 2016 — forked from sikanhe/rethink_query_wrapper.ex
Functions to wrap commonly used rehinkdb queries with error handling
View rethink_query_wrapper.ex
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
@AdamBrodzinski
AdamBrodzinski / setup.sh
Last active Dec 29, 2015
Ubuntu Setup Script for DO
View setup.sh
#!/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
View folder-structure.md

Folder Structure

Motivations

  • 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)
View EvenOrOdd.jsx
EvenOrOdd = React.createClass({
render() {
return (
<div className='EvenOrOdd'>
Hello World
</div>
);
}
});
@AdamBrodzinski
AdamBrodzinski / EvenOrOdd_spec.js
Last active Aug 29, 2015
EvenOrOdd_spec.js step 2
View EvenOrOdd_spec.js
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);
View EvenOrOdd_spec.js
describe(“EvenOrOdd Component”, function() {
it(“should pass test”, function() {
expect(1 + 1).toEqual(2);
});
});
You can’t perform that action at this time.