Skip to content

Commit 86d4747

Browse files
authored
Merge pull request #18 from codersforcauses/feature/add-old-articles
Feature/add old articles
2 parents b71d005 + b30098b commit 86d4747

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1527
-260
lines changed
13.5 KB
Loading

assets/content/davidthrone.jpg

665 KB
Loading

assets/content/docs-content.png

50.9 KB
Loading

assets/content/graphql-companies.png

648 KB
Loading

assets/content/mosaic-main.png

1.65 MB
Loading

assets/content/nav-yaml.png

87.5 KB
Loading

assets/content/ui-component-list.png

66 KB
Loading

content/articles/about.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: About Coders for Causes and Blog
3+
description: About us
4+
updatedAt: December 30, 2018
5+
img: https://og-social-cards.vercel.app/**.%2Fcoders_for_causes**.png?theme=dark&md=1&fontSize=125px&images=https%3A%2F%2Fcodersforcauses.org%2Flogo%2Fcfc_logo_white_full.svg
6+
tags:
7+
- about-us
8+
alt: About
9+
author:
10+
name: David Yu
11+
bio: I love to code
12+
img: /_nuxt/assets/content/davidthrone.jpg
13+
---
14+
15+
This blog was started by [David](https://github.com/noobling) which mainly discusses software and tips for student/professional developers. Content would revolve around what I am working on. Writing helps me learn. Underneath the hood this blog is built using Nuxt/Vue.
16+
17+
If you found any mistake or want to make an addition please create a new issue [here](https://github.com/codersforcauses/blog-guides/issues)
18+
19+
If you want to help develop this app further please read [this](https://github.com/codersforcauses/blog-guides/blob/master/README.md)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Best Practices for Express Apps
3+
description: Best practices in production Express apps
4+
updatedAt: December 30, 2018
5+
img: https://images.unsplash.com/photo-1549605659-32d82da3a059?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=60
6+
tags:
7+
- express
8+
- best-practices
9+
alt: Best Practices Production Express Apps
10+
author:
11+
name: David Yu
12+
bio: I love to code
13+
img: /_nuxt/assets/content/davidthrone.jpg
14+
---
15+
16+
## Process managers
17+
18+
- Automatically restart app
19+
- Performance metrics
20+
- Modify settings dynamically to improve performance
21+
- Control clustering
22+
23+
### Examples
24+
25+
#### Forever
26+
27+
Simple cli to that runs a script continuously forever. Good for small apps.
28+
29+
#### PM2
30+
31+
Production process manager that has a built in load balancer. Allows applications to be up forever with no downtime
32+
33+
#### Strong Loop Process Manager
34+
35+
- Build, package and deploy your Node.js app to local or remote system
36+
- View CPU profiles and heap snapshots to optimize performance and diagnose memory leaks
37+
- Keep processes and clusters alive forever
38+
- Unify multiple StrongLoop PMs to a distributed mircoservices runtime that is managed from Arc
39+
40+
### Security Best Practices
41+
42+
- Don't use a deprecated or vulnerable versions of Express and Node
43+
- Use TLS
44+
- Use Helmet
45+
- Use cookies securely
46+
- Ensure dependencies are secure
47+
- Avoid other known vulnerabilities
48+
49+
#### TLS
50+
51+
Encrypts data before it is sent from the client to the server. Preventing some common and easy hacks. TLS is the next progression of SSL
52+
53+
#### Use Helmet
54+
55+
Prevents some well known web vulnerabilities by setting HTTP headers appropriately
56+
57+
#### Use cookies securely
58+
59+
- Don't use in memory storage in production
60+
- Don't use default session cookie name
61+
- `app.use(session({name: 'notdefaultsessionidname'})`
62+
- Helps prevent attacks from discovering what framework is used
63+
- Set cookie security options
64+
- `app.use(session({name: 'session', cookie: { secure: true, httpOnly: true, domain: 'example.com', path: 'foo/bar', expires: expiryDate})`
65+
66+
#### Ensure your dependencies are secure
67+
68+
- Use snyk to check for vulnerabilities in your app
69+
70+
### Performance and reliability
71+
72+
- Use gzip compression
73+
- Don't use synchronous functions like console.log
74+
- Handle exceptions properly
75+
- Node app crashes from uncaught exception
76+
- use try-catch and promises
77+
- next() function propagates errors through the middleware chain
78+
- Set node env to production
79+
- Ensure app auto restarts on failure, if all exceptions properly handled the app should not crash however as a fail safe this should be added.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Join the Next Billion Dollar Startup
3+
description: Startup Canva pops off
4+
updatedAt: December 30, 2018
5+
img: https://images.unsplash.com/reserve/LJIZlzHgQ7WPSh5KVTCB_Typewriter.jpg?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60
6+
alt: Billion Dollar Startup
7+
tags:
8+
- startups
9+
author:
10+
name: David Yu
11+
bio: I love to code
12+
img: /_nuxt/assets/content/davidthrone.jpg
13+
---
14+
15+
Tech companies are constantly being acquired for hundreds of millions even billions of dollars. Take for example the this recent acquisition by Amazon http://www.businessinsider.com/why-amazon-acquired-ring-2018-3/?r=AU&IR=T or our very own Australian company Canva https://techcrunch.com/2018/01/08/new-sequoia-china-investment-values-australian-design-company-canva-at-1-billion/
16+
17+
There are new sites popping up to connect talented people with these start ups take a look at these sites
18+
19+
https://angel.co and https://triplebyte.com
20+
21+
https://triplebyte.com
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: Break Down of Current Programming Landscape
3+
description: Current programming landscape as of 2018
4+
updatedAt: December 30, 2018
5+
img: https://images.unsplash.com/reserve/LJIZlzHgQ7WPSh5KVTCB_Typewriter.jpg?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60
6+
alt: Programming Landscape
7+
tags:
8+
- 2018
9+
- programming-landscape
10+
author:
11+
name: David Yu
12+
bio: I love to code
13+
img: /_nuxt/assets/content/davidthrone.jpg
14+
---
15+
16+
The much anticipated annual SO survey has just dropped here is the link to the entire results https://insights.stackoverflow.com/survey/2018/
17+
18+
Here are the key takeaways:
19+
20+
- Data scientists and Dev Ops are the highest paid
21+
- Most popular development environment Visual Studio Code
22+
- Web development industry is the biggest employer of developers
23+
- 81.1% of programmers are either happy or fine with their job
24+
- Developers value compensation and benefits the most when searching for a job
25+
- Most wanted programming language is python
26+
- 80.8% of programmers have side projects outside of work/uni
27+
- 93% of programmers are males
28+
- Most programmers spend 9-12 hours a day on computers
29+
- Most loved programming language is python
30+
- Most popular framework is node js
31+
- Most popular OS is linux
32+
- Most loved framework is TensorFlow
33+
34+
Note information from voluntary surveys are subject to response bias (and other biases) where a certain group of individuals are more likely to take the survey hence skewing the results for example individuals who feel they are paid well tend to respond to the survey skewing the results for salary.

content/articles/break-down-db-url.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Break Down of a Database URL
3+
description: Break down of mysql database url
4+
updatedAt: December 30, 2018
5+
img: https://images.unsplash.com/photo-1489875347897-49f64b51c1f8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60
6+
alt: SQL Database URL
7+
tags:
8+
- sql
9+
- database-url
10+
author:
11+
name: David Yu
12+
bio: I love to code
13+
img: /_nuxt/assets/content/davidthrone.jpg
14+
---
15+
16+
```c
17+
mysql://USER:PASS@HOST:PORT/DATABASENAME
18+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: CFC Project Learnings
3+
description: CFC project learnings for 2019
4+
updatedAt: August 25, 2019
5+
img: https://og-social-cards.vercel.app/**.%2Fcoders_for_causes**.png?theme=dark&md=1&fontSize=125px&images=https%3A%2F%2Fcodersforcauses.org%2Flogo%2Fcfc_logo_white_full.svg
6+
alt: CFC Project Learnings
7+
tags:
8+
- cfc
9+
- projects
10+
author:
11+
name: David Yu
12+
bio: I love to code
13+
img: /_nuxt/assets/content/davidthrone.jpg
14+
---
15+
16+
It has been a while since I posted on this blog. Hopefully I can get back into it :)
17+
Running projects require a different skill set than programming. Here are some things I learnt while running projects for Coders for Causes
18+
19+
## Learnings regarding students
20+
21+
- Its hard to conduct workshops. The most effective way is maybe to copy frontend masters where the presenter talk for a bit, write code then gives out exercises where they can then walk around and mentor people and go through the solution
22+
- 1 on 1 programming is effective in teaching people how to code
23+
- We need to motivate students more
24+
- Designating times where everyone comes in. Maybe 3 times a week
25+
- Get big name companies in so they want to do well to impress them
26+
- Possible effective workflow
27+
- Build a basic project scaffold for them to work off so they can follow the best practices and its easier for them to get started
28+
- Use a physical board for task tracking
29+
- Everyone pushes to master but everyone is also paired up. Especially initially when code constantly changes
30+
- Its hard to manage a large group of students
31+
32+
## Managing Client Expectations
33+
34+
Clients don't have a lot of technical knowledge so we need to inform them and continually inform them of the best approach to things. We need to also educate them a little in software. Here is a checklist we need to convey
35+
36+
- [ ] **Sometimes we need to push back on features** that are not important in order to be efficient and deliver the best possible product in terms of reliability, maintainability and usability. It is very easy to waste a lot of time building a low impact feature so we need a disciplined process to determine how meaningful a feature is and how much time it takes for the programmer to make.
37+
- [ ] **Software is very hard to build well.** Thats why you constantly see bugs and websites getting hacked for example linkedIn losing millions of passwords [https://en.wikipedia.org/wiki/2012_LinkedIn_hack](https://en.wikipedia.org/wiki/2012_LinkedIn_hack) Facebook storing passwords in plain text [https://www.theverge.com/2019/4/18/18485599/facebook-instagram-passwords-plain-text-millions-users](https://www.theverge.com/2019/4/18/18485599/facebook-instagram-passwords-plain-text-millions-users) and the bug in IPhones that allowed people to eavesdrop on others [https://www.zdnet.com/article/iphone-facetime-bug-now-apple-sued-over-eavesdrop-on-lawyers-client-phone-call/](https://www.zdnet.com/article/iphone-facetime-bug-now-apple-sued-over-eavesdrop-on-lawyers-client-phone-call/). Bear in mind these companies have the smartest people with the most funding. So it is important that you as the client understand these points so they can help us in building the best possible software application with our given resources.
38+
- [ ] **There will be bugs mostly small ones but occasionally there will be the big one.** The reason is because it relates to the first point, building good software is hard because its very technical. This means its easy to get things wrong due to oversights or lack of understanding. Therefore we need a strategy to minimize the impact of bugs and to catch them. The most obvious one is rigorous testing. We need tight feedback loops between building a feature and user testing.
39+
- [ ] **You need to ask yourself do you really need programmers?** There are a lot of easy to use websites and tools to help you create websites and applications for example SquareSpace and Wix. Since building software is hard it can be a stressful process for both the clients and programmers so you need to consider this carefully. Hiring programmers allow you to **build customized solutions** for example it will be very hard to pull data from your company database and display it in a chart on the website securely. They can also can give you guidance on how to build a secure, scalable and maintainable solution.
40+
- [ ] **Building software is also a discovery process.** The idea you had will likely change when it takes shape. For example you wanted to build a chatbot for students but as you test it you find out that students don't like chat-bots and won't use it. Then you have to pivot and you find that a mobile app would be a better choice to engage students.
41+
- [ ] **What exactly can software developers provide?** Good ones can build out whatever your idea is. It won't exactly match your idea to the pixel but the main features will be built. There will be minimal bugs and the features will be delivered in a timely manner. They can also provide you guidance both on the technical and high level on how to build an software application
42+
- [ ] **Be mindful that seemingly simple changes may not be simple to implement in code.** Try not to assume that the programmer is being lazy (if they are a good one) when they push back on your simple request. For example moving a text box around. This seems really simple and you can easily do it in photoshop but at a code level it may not be because the programmer has to consider the optimal location on all devices. The text box also won't magically resize they have to code it. Finally software development is very broad they may not be knowledgeable in coding layouts.
43+
44+
## Potential Action Items for Next Project
45+
46+
- Use a more effective workflow
47+
- Keep groups small e.g. max 5 people
48+
- Get big name companies involved by giving workshops (issue since we are reducing the number of people it may not be as attractive for them)
49+
- Give a week or two worth of workshops before the projects in the style of frontend masters
50+
- Be physically available to mentor them
51+
- Designate 3 days a week to have the group come in to work
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Simple Common Laravel Mistakes
3+
description: Common mistakes for Laravel
4+
updatedAt: December 30, 2018
5+
img: https://images.unsplash.com/photo-1517852058149-07c7a2e65cc6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60
6+
alt: Common Laravel Mistakes
7+
tags:
8+
- laravel
9+
- common-mistakes
10+
author:
11+
name: David Yu
12+
bio: I love to code
13+
img: /_nuxt/assets/content/davidthrone.jpg
14+
---
15+
16+
1. Everything looks bigger in production but in local environment everything is sized correctly.
17+
- Zoom level is different for the web pages
18+
19+
2. The webserver is failing silently there is no log errors but the page doesn't load
20+
- CSRF token is not being passed in the form
21+
22+
3. The data is not being saved to the database but all the data is there just not being saved
23+
- The elements have not been whitelisted e.g. fillable
24+
25+
4. Jquery is not changing the data on screen but I am sure the code is right
26+
- Check that the targeted code is in a async call or not if it is you have to wait for the async operation to finish before you can start manipulating the code
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
title: Create a Mosaic in HTML and CSS
3+
description: Guide to making a mosaic in HTML and CSS
4+
updatedAt: March 20, 2019
5+
img: /_nuxt/assets/content/mosaic-main.png
6+
alt: Mosaic
7+
tags:
8+
- mosaic
9+
- html
10+
- css
11+
author:
12+
name: David Yu
13+
bio: I love to code
14+
img: /_nuxt/assets/content/davidthrone.jpg
15+
---
16+
17+
Click [here](https://www.youtube.com/watch?v=vnjZ3jYylsY) to view the screen cast in a new tab or watch below.
18+
19+
<iframe loading="lazy" width="100%" height="522" src="https://www.youtube.com/embed/vnjZ3jYylsY" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
20+
21+
Here is the accompanying code.
22+
23+
```html
24+
<!DOCTYPE html>
25+
<html>
26+
<head>
27+
<meta charset="utf-8" />
28+
<meta
29+
http-equiv="X-UA-Compatible"
30+
content="IE=edge"
31+
/>
32+
<title>Mosaic</title>
33+
<meta
34+
name="viewport"
35+
content="width=device-width, initial-scale=1"
36+
/>
37+
<style>
38+
.container {
39+
display: grid;
40+
grid-gap: 10px;
41+
max-width: 1200px;
42+
margin: auto;
43+
grid-template-columns: repeat(4, 1fr);
44+
grid-template-rows: repeat(4, minmax(10px, 150px));
45+
}
46+
.image1 {
47+
grid-column: 1/4;
48+
grid-row: 1/3;
49+
background-image: url(img1.jpg);
50+
}
51+
.image2 {
52+
grid-column: 1/3;
53+
grid-row: 3/5;
54+
background-image: url(img2.jpg);
55+
}
56+
.image3 {
57+
grid-column: 3/5;
58+
grid-row: 3/5;
59+
background-image: url(img3.jpg);
60+
}
61+
.image4 {
62+
grid-column: 4/5;
63+
grid-row: 1/2;
64+
background-image: url(img4.jpg);
65+
}
66+
.image5 {
67+
grid-column: 4/5;
68+
grid-row: 2/3;
69+
background-image: url(img5.jpg);
70+
}
71+
/* Use this if you want the shrinking image effect */
72+
/* [class^="image"] > img {
73+
width: 100%;
74+
height: 100%;
75+
object-fit: cover;
76+
} */
77+
[class^='image'] {
78+
overflow: hidden;
79+
position: relative;
80+
background-size: cover;
81+
background-position: left center;
82+
background-repeat: no-repeat;
83+
}
84+
@media screen and (max-width: 600px) {
85+
.container {
86+
display: block;
87+
}
88+
[class^='image'] {
89+
margin-bottom: 1rem;
90+
height: 200px;
91+
}
92+
}
93+
</style>
94+
</head>
95+
<body>
96+
<div class="container">
97+
<div class="image1"></div>
98+
<div class="image2"></div>
99+
<div class="image3"></div>
100+
<div class="image4"></div>
101+
<div class="image5"></div>
102+
</div>
103+
</body>
104+
</html>
105+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: How to Delete Documents with Mongoose
3+
description: Deleting documents with mongoose
4+
updatedAt: December 30, 2018
5+
img: https://images.unsplash.com/photo-1489875347897-49f64b51c1f8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60
6+
alt: Mongoose
7+
tags:
8+
- mongoose
9+
- delete-documents
10+
author:
11+
name: David Yu
12+
bio: I love to code
13+
img: /_nuxt/assets/content/davidthrone.jpg
14+
---
15+
16+
You have to add a callback to the statement e.g.
17+
`User.deleteOne({_id: req.params.userId}, err => console.log(err));`
18+
19+
You can't do something like this
20+
`User.deleteOne({_id: req.params.userId})`
21+
22+
If that doesn't work try this longer way
23+
24+
```js
25+
TodoList.findOne({ _id: req.params.todoListId }).then((result) => {
26+
result.participants.push(req.user.id)
27+
result.save()
28+
res.json('worked')
29+
})
30+
```

0 commit comments

Comments
 (0)