Skip to content

Instantly share code, notes, and snippets.


Christie christiearcus

  • Sharesies
  • Wellington
View GitHub Profile
View session1.scala
// Base types
val a: Int = 10
// Functions
// first class citizens - can be passed as values.
def add(a: Int, b:Int): Int = {
a + b
christiearcus /
Last active Mar 10, 2017
Pulling the latest changes from 'upstream'

When we refer to 'upstream' in our project, we are referring to the central version (and not our personal forks). By default, when you clone your fork, there will be no reference to the upstream version. But it's necessary to add this, as this allows us to pull the latest changes when pull requests are merged.

To set this up use the following steps:

  • Check your remote versions on your project:

git remote -v- if you want to look at it in your project code, you can check the config file of the .git folder.

  • Add the reference to the upstream repository:
View client-side-rendering-graphql.js
// add an option to your query, which forces apollo to make the request on the client.
export default graphql(Query, {
options: { ssr: false }

There are a couple of issues with our Wordpress deployment.

The EC2 instances running our wordpress site have databases running within them. Each of the databases is keeping state of the app for that instance. If the instance dies, and a new one is started by our ASG, our state will be lost.

To improve this, we can separate our database out from the instance running our app. This means that if our instance dies, our state is safe.

We will need:

  • A RDS instance to run our MySQL database.
  • An S3 bucket to store a tarball of our customised Wordpress app (with the correct database access file).
christiearcus /
Last active May 15, 2017
Ops weekly hangs 01
yum install mysql-server mysql php php-mysql mysql-devel mysql-libs httpd -y
tar xvfz latest.tar.gz -C /var/www/html/
service httpd start
service mysqld start
chown -R apache /var/www/html
christiearcus /
Last active Sep 16, 2016
Design Patterns Course

Decorator Pattern

The decorator pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality.

Aims to avoid 'class chaos'. Uses open / closed principle. Add new behaviour, but without implementing regression. Uses delegation and composition.

christiearcus / destructuring.js
Created Aug 4, 2016
View destructuring.js
const avengers = ['Natasha Romanoff', 'Tony Stark', 'Steve Rogers'];
const ['blackWidow', ...theOthers] = avengers;
// blackWidow = 'Natasha Romanoff
// theOthers = ['Tony Stark', 'Steve Rogers']
christiearcus /
Last active Jul 24, 2016
Setup react build tools

Do a blog post on this, as it’s so annoying to re-remember!

1 Set up libraries & dependencies

Set up blank project folder:

  • npm init (and follow the prompts)
  • npm install react react-dom —save
  • npm install webpack webpack-dev-server -g
  • npm install babel -g
christiearcus /
Created Jul 20, 2016
Debugging tools for node.

To be able to debug & reload for node apps (e.g. express), here are some steps:

npm install -g nodemon npm install -g node-inspector

  • When running your app, instead of node app.js, you can now run nodemon app.js and it will restart the app on change.
  • To run in debug mode, start your app with nodemon --debug app.js. Then start node-inspector node-inspector.
  • Use the localhost URL provided by node-inspector to view your app in the console.
  • When you want to debug, put a debugger statement in your code. When you refresh your browser (on your app process), node-inspector will break at that point and allow you to debug.