Skip to content

Instantly share code, notes, and snippets.

View harrisonmalone's full-sized avatar

Harrison Malone harrisonmalone

View GitHub Profile
# this is an example of composition, we're initializing an instance of a class inside the parent
class Home
attr_reader :navbar
def initialize
@links = []
@navbar = Navbar.new
end
end
using System;
using System.Text;
namespace string_stuff
{
class StringChallenge {
// Using a Console.WriteLine, display the number of letters in the startingMessage.
// Using a Console.WriteLine, display the position or index of the "#" in the startingMessage.
// Create a new string that contains the phrase "harrypotter".
// Insert a space between the word "harry" and the word "potter".
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="./index.js"></script>
</body>
const express = require('express')
const router = express.Router()
router.use('/users', require('./users'))
module.exports = router
const request = require('supertest')
const app = require('../app')
test('image passes through successfully', async () => {
await request(app)
.post('/products')
.attach('image', 'tests/images/dog.jpg')
.field('name', 'harrison')
.then((response) => {
console.log(response.text)

Lesson Material

Backend Deployment

I know we went through how to deploy with now.sh and this works most of the time. In saying that, I've lost a bit of faith in Now over the past few cohorts seeing some weird bugs.

Now used to be great for Express deployments but it has changed a lot over the past year.

You can see what kinds of deployments Now is great for by running:

import React from 'react';
class App extends React.Component {
constructor(props) {
super(props)
// state definition
// data that belongs to a single component
this.state = {
count: 0,
message: ''
@harrisonmalone
harrisonmalone / .eslintrc.json
Last active December 30, 2019 00:59
eslint config for ===
{
"parserOptions": {
"ecmaVersion": 6
},
"extends": "eslint:recommended",
"rules": {
"eqeqeq": [
"error",
"always"
]
@harrisonmalone
harrisonmalone / index.rb
Last active December 30, 2019 00:55
this is what i want all ruby challenges to eventually look like, with rspec tests
# to solve the code below you need to
# => gem install rspec
# then to execute this code run
# => rspec index.rb --format doc
# 1.
def sum(num1, num2)
# your code here
end
NODE_ENV=production