Skip to content

Instantly share code, notes, and snippets.

View christiearcus's full-sized avatar

Christie christiearcus

  • Sharesies
  • Wellington
View GitHub Profile
@christiearcus
christiearcus / basics.md
Last active August 18, 2024 00:59
Basics

Web Development Basics

Quick start a new basic web project:

Use this as a cheat sheet for saving time when doing assessments. This is how you construct it from scratch. There are many things out there that can generate stuff for you, but it helps to know how the foundations.

  1. Open iTerm terminal (the default Mac one sucks).
  2. cd ~ to go to your home directory and then pwd to show your location (using finder is also fine if you don't like the terminal).
  3. mkdir sylvia_study and then cd sylvia_study to navigate in to that directory.
  4. git init to initiate the folder as a git repository so that version changes can be seen.
@christiearcus
christiearcus / session1.scala
Created September 22, 2017 07:06
Scala - Session 1
// 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
christiearcus / adding-remote-repos.md
Last active March 10, 2017 00:36
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:
// add an option to your query, which forces apollo to make the request on the client.
export default graphql(Query, {
options: { ssr: false }
});
@christiearcus
christiearcus / ops-weekly-hangs-02.md
Last active January 18, 2017 05:35
Ops weekly hangs 02

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
christiearcus / launchconfig.sh
Last active May 15, 2017 09:57
Ops weekly hangs 01
#!/bin/bash
wget https://wordpress.org/latest.tar.gz
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
christiearcus / DecoratorPattern.md
Last active September 16, 2016 02:03
Design Patterns Course Lynda.com

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
christiearcus / destructuring.js
Created August 4, 2016 06:37
array-object-destructuring
const avengers = ['Natasha Romanoff', 'Tony Stark', 'Steve Rogers'];
const ['blackWidow', ...theOthers] = avengers;
// blackWidow = 'Natasha Romanoff
// theOthers = ['Tony Stark', 'Steve Rogers']
@christiearcus
christiearcus / react-env-setup.md
Last active July 24, 2016 08:54
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