Skip to content

Instantly share code, notes, and snippets.

View christiearcus's full-sized avatar

Christie christiearcus

  • Sharesies
  • Wellington
View GitHub Profile
@christiearcus
christiearcus / date.js
Last active March 16, 2016 01:17
Date Method
// https://gist.github.com/epoch/309e4a021cd06f8ae32b#file-js-day2-else-if-md
console.log('date.js is alive');
var n = new Date();
var year = n.getFullYear();
if (year === 2015) {
console.log('Im in the present');
}
@christiearcus
christiearcus / christie-fortune.js
Last active March 16, 2016 01:20
Fortune Teller
// The Fortune Teller
// Why pay a fortune teller when you can just program your fortune yourself?
// Store the following into variables: number of children, partner's name, geographic location, job title.
// Output your fortune to the screen like so: "You will be a X in Y, and married to Z with N kids."
var children = Math.random() * 10;
var partnerName = Math.random() * 10;
var geoLocation = Math.random() * 10;
@christiearcus
christiearcus / Interview.md
Last active May 6, 2016 00:09
Interview Prep

Notes

List your top 5 skills before an interview.

  • e.g. debugging
  • Ruby models
  • CSS frameworks

Why is it a skill? Examples please. So important to be able to provide evidence of why it's a skill.

require 'pry'
class Phone
def initialize(number)
@number = number.gsub(/\D/,'')
end
def number
@christiearcus
christiearcus / geocodes-of-australian-states.js
Created May 12, 2016 01:16
Object of Australian Geocodes
var states = {
"VIC": {lat: -36.5185827, lng: 140.978258},
"SA": {lat: -31.9495406, lng: 130.5079709},
"NSW": {lat: -32.7503099, lng: 142.8255387},
"WA": {lat: 24.1709455, lng: 111.9329231},
"NT": {lat: -18.247301, lng: 124.4607377},
"QLD": {lat: -19.3313579, lng: 136.7358599},
"ACT": {lat: -35.5212255, lng: 148.5212304}
};
@christiearcus
christiearcus / index.html
Last active May 15, 2016 07:38
JS Reps Practice
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS Revision</title>
</head>
<body>
<h1>REPS</h1>
<script src="underscore.js" charset="utf-8"></script>
<script src="reps.js" charset="utf-8"></script>
@christiearcus
christiearcus / node-debugging.md
Created July 20, 2016 11:51
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.
@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
@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']