Skip to content

Instantly share code, notes, and snippets.

View biglovisa's full-sized avatar
🌍
Patch is hiring!

Lovisa Svallingson biglovisa

🌍
Patch is hiring!
View GitHub Profile
@biglovisa
biglovisa / control-flow.md
Created May 4, 2017 17:53
Control flow: check-ins

Control Flow

Student grades

  • Create an if/else statement which tells you if a student should get an A, B, C, or D based on their score.
    • A: 100 - 95
    • B: 94 - 85
    • C: 84 - 75
    • D: 74 or below
@biglovisa
biglovisa / logical-operators.md
Created May 4, 2017 17:29
Logical operators: check-ins

Logical Operators

Logical operators

  • Write down two statements using the || operator and two using the && operator.
    • Verifying the return value of the statements in the Node console first, let the person next to you guess whether the four statements will evaluate to true or false.
  • What does "hello" || false evaluate to? Why?
  • What does "hello" && undefined evaluate to? Why?
  • What does "hello" && "it's me" evaluate to? Why?
  • What does "hello" || "it's me" evaluate to? Why?
@biglovisa
biglovisa / data-types.md
Created May 4, 2017 17:13
data types: check-ins

Data types: check-ins

Greeting

  • Create three variables - name, age, and, homeTown - and assign them values.
    • Print "My name is X and I am Y years old. I live in Z.", where X, Y, Z represents one of your three variables.

Creating a sentence

  • Assign the value tomatoes to a variable expression
@biglovisa
biglovisa / z.md
Created April 24, 2017 01:06
superfizz

Superfizz

Iteration 1

  • Print all numbers 1-10 to the screen.

Iteration 2

  • Print all numbers 1-10 to the screen.
  • For multiples of 3, print "Fizz" instead of the number
@biglovisa
biglovisa / solution.js
Created July 10, 2016 23:28
SimpleAddNewForm-solution
import React, { Component, PropTypes } from 'react';
class SimpleAddNewForm extends Component {
constructor(props) {
super(props);
this.state = { value: '' }
this.handleChange = () => this._handleChange();
this.handleClick = () => this._handleClick();
}
@biglovisa
biglovisa / sublime.json
Created April 26, 2016 01:13
Sublime settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"font_face": "Inconsolata",
"font_options":
[
"gray_antialias"
],
"font_size": 18,
@biglovisa
biglovisa / react-notes.md
Created December 16, 2015 16:53
React in theory
@biglovisa
biglovisa / refute-assert-puts.md
Last active March 24, 2016 20:39
Refute/Assert/Puts

Minitest: Assert and Refute

Minitest provides some handy methods which allows us to check for falsey/truthy values and actually compare values.

  • assert
    • The first argument passed to this method is whatever we are going to assert is truthy. For example, assert "Hello" returns true since "Hello" is a truthy value.
    • The second argument passed to this method is an optional error message. If no argument is given, it will default to Failed Assertion, no message given. For example, assert nil, "Nil is falsey" will fail, and the error message printed in the terminal will be "Nil is falsey".
  • assert_equal
    • This method takes two arguments. As the name of the method indicates, we are asserting an equality of the two given values.
  • refute
$(document).ready(function() {
renderAllItems();
fetchToken();
});
function fetchToken() {
$.ajax({
url: '/api/v1/env_variables.json',
type: 'GET',
success: function(response) {