forked from SurreyCodes/100DaysofCode-Log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodyRathor-100daysofCode
More file actions
379 lines (292 loc) · 22.2 KB
/
CodyRathor-100daysofCode
File metadata and controls
379 lines (292 loc) · 22.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
During My 100 days of code challenge I will be attempting to complete the entire FreeCodeCamp curriculum!
Day 61,62,63,64,65,66,67,68 - April 1st - 8th:
Made it to the end and got my certificate! Excited to move onto new projects of my own :) building the simon game had different challenges than the TicTacToe game. I do however feel that the TicTacToe game was more challenging by far. Building the simon game did help me learn time intervals further especially when it came to flashing diplays or pressing buttons with a delay. I think I might spend the rest of the time working on My Wife's site and get version 2 up and running.
Day 60 - March 31st:
Started the SurreyCodes landing page this morning with Luis. Did some more work on my simon game for FreeCodeCamp. Can't seem to get a setTimeout to work for delaying the computer when pressing the sequence for the player to follow. Will spend more time tomorrow figuring it out before going to my inlaws for Easter dinner :)
Day 59 - March 30th:
Read up on redux and the new React changes in version 16.3, not much coding but plan on a longer day tomorrow!
Day 55,56,57,58 - March 26th - 29th:
Started the final project on FreeCodeCamp. This week was busy but I did manage to get some progress on my Simon Game and attended to meetups! Yesterdays Meetup was a react native workshop. The workshop included building a list of movies with an image, title and description. The instructor showed uyou how to use tools and import them into your project. He also introduced my to axios as a way of pulling data from an API. Overall the workshop was a great experience and it allowed me to meet some recruiters and well as network.
Day 49,50,51,52,53,54 - March 20th - 25th:
Finished the TicTacToe game for FreeCodeCamp! this challenge took me a long time. I had to start from scratch on my logic three times before I finally figured out how to update data correctly in react. It was mostly the computer I struggled with building a simple game with 2 players was a breeze, but when it came to actually implementing the ai I struggled a lot. After watching tutorials on the minmax algorithm and a ton of reading I was finally able to understand how the algorithm works though I'm still not sure its the most efficient sometimes it goes for the double chance to win instead of straight for the win. There was something I cam across about counting how many times the function was being called and subtracting it from the score. Had to ask twitter for help with my final issue of being able to click on the computers turn, which turned out awesome! added a boolean value to the onclick and was able to toggle it. Definitely learned a lot on this one!! well worth the time and effort put in.
Day 48 - March 19th, 2018:
Not much programming today got the function working that chooses where the computer picks. Now to implement the minimax algorithm.
Day 46 - 47, March 17-18th, 2018:
Completed the styling of my TicTacToe Game. down to just building the computer. Have to start research on the minimax algorithm to build the computer. The end is coming I can almost taste the certificate!
Day 44 - 45, March 15-16th, 2018:
Continued on the TicTacToe challenge, once I figured out the best way store my data I was able to make some changes to my code to shorten it up and make it a little easier to read. In doing so I managed to break my function renderButtons, for some reason I have to make it a function that calls each button separately instead of using a map function. may just take it for what it is and try and solve it later, perhaps it's time to use my first //TODO:. So far this game has presented me with the biggest challenge, figuring out how create a computer that plays against you. So far haven't figured it out, I'm currently styling it while brainstorming ideas on how to approach it. I feel like it is really easy and I am just overthinking it.
Day 43 - March 14th, 2018:
Worked more on the TicTacToe project for FreeCodeCamp and attended a meetup about VR game development. It talked about some of the issues you deal with when create such a game. Some issues were with simulator sickness, dealing with collision objects, room sizes etc. he talked about the unity engine and the community of support it comes with.
Day 40,41,42 - March 11-13th, 2018:
Missed a couple posts! was coding the whole time. Ended up finishing my Pomodoro Clock, even added a progress bar of sorts. I found the Date function to be a weakness of mine, I will have to put more time in and play around with times. especially if I want to get into backend development and become a fullstack developer.
Pomodor Link >> https://codepen.io/crathor/full/aYomXd/
for the Remaining time I started the Tic-Tac-Toe game. It's going to be my biggest challenge yet! building a computer to play against. Can't wait to get my certificate!!
TicTacToe Link >> https://codepen.io/crathor/full/YayxJb/
Day 39 - March 10th, 2018:
I am currently stuck trying to figure out how to format the countdown. have the clock setting the correct seconds. Still need to add a pause feature and have it switch to the breaktime clock once the countdown equals 0. also need to find a sound to play!
Day 38 - March 9th, 2018:
Struggling to figure out how to create a countdown. I understand that I have to create a function and set an interval but I can't quite figure out how to render the timer. have most on the style done, Maybe fresh eyes tomorrow will help!
Day 36 - 37 Marth 7-8th, 2018:
Finished the JavaScript calculator using React. this project was good for learning how to create dynamic elements with react. Started working on the Pomodoro Clock in you guessed it.. React! having way to much fun building with it. I also attended an intro to react-native it was very informative!
Day 35 - March 6th, 2018:
Almost complete the JavaScript calculator, the styling is complete still working out a few bugs, such as being able to add more than one "." to an entered number. Did manage to solve being able to remove the whole number currently entered from the history. Almost there!!
Day 34 - March 5th, 2018:
Got the Math working, now onto styling and figuring out how to show a rounded answer it seems to work for my history but not for the main display.
Day 33 - March 4th, 2018:
Decided to switch my calculator function to React. was a bit of a struggle figuring out how to dynamically render my keypad, but in the end figured it out! Got to love problem solving! code below >>
https://codepen.io/crathor/full/jZRjPx/
Day 32 - March 3rd, 2018:
Started a CSS grid course on https://courses.wesbos.com. Which helped me get the grid up and running for my JavaScript calculator on FreeCodeCamp. Link below for my code so far >>
https://codepen.io/crathor/pen/PQLMrw?editors=0110
The course so far has gone through display : grid and setting up the colums using px, rem, %, fr (stands for fractional allows the grid spaces to take up space proportional to the fraction ie 1fr 2fr 1fr the 2fr will take up the combine space of the 1fr's).
also learned how to place the items in there grids or span extra spaces like I have done in my calculator app.
Day 31 - March 2nd, 2018:
Finished 'pairwise' on FreeCodeCamp and finally made it to the last 4 projects!! excited to finish this and get my Front End certificate!
Code Below >>
function pairwise(arr, arg) {
var results = [];
for (var i=0; i<arr.length; i++){
var a = arr[i];
for (var j=i+1; j<arr.length; j++){
if(a + arr[j] === arg){
console.log(j," ", results.indexOf(j));
if(results.indexOf(i) === -1 && results.indexOf(j) === -1){
results.push(i, j);
}
}
}
}
if (results.length === 0){
return 0;
}
return results.reduce(function(a,b){return a+b;});
}
Day 30 - March 1st, 2018:
Finished the 'Map the debris' challenge and onto 'pairwise'. Last challenge before the projects begin!! Can't Wait to get started! Also side note found out today that the company I currently work for is closing in 2 months, looks like the time is now to start looking for Front End Developer jobs! pair wise is currently presenting a weird challenge for me can't see to figure out how to sum the indices correctly.
Code Below >>
function orbitalPeriod(arr) {
var GM = 398600.4418;
var earthRadius = 6367.4447;
var result = [];
for (var i=0; i<arr.length; i++){
var orbitalPeriod = Math.round(2 * Math.PI * Math.sqrt(Math.pow((earthRadius + arr[i].avgAlt), 3)/GM));
result.push({name: arr[i].name, orbitalPeriod: orbitalPeriod});
}
return result;
}
Day 29 - Feb.28th, 2018:
Solved the 'no repeats'! took me a long time to spot my mistake.. ended up having heapPerm(size - i) instead of (size - 1). Literally put my code into an infinite loop. Sometimes I wonder how old systems use to handle infinite loops, can only imagine how brutal it would have been trying to debug :P
Anyways also passed the challenge of method inside closures, basically a class with methods in my opinion.
Currently tackling the 'Map the Debris' challenge. Math Math Math!
Day 28 - Feb.27th, 2018:
Almost solved the 'no repeats' on FreeCodeCamp. have it creating the permutations, just need to filter out the doubles and return the results. should be too hard provided I am in fact making the correct permutations :P
Day 27 - Feb.26th, 2018:
Attempted to solve the no repeats with pure math while trying to avoid creating an array and using regex. found that the only way was to program each separate solution in and that is not efficient. So to the drawing board I went. have most of the code working, still need to figure out how to truly randomize the letters. here is the code so far ->
function permAlone(str) {
var permutations = factorial(str.length);
var count = 0;
var arr = [];
var perms = [];
var offset = 0;
while(count < permutations){
var temp = [];
for( var i=0; i < str.length; i++) {
var pointer = (i + offset) % str.length;
temp.push(str[pointer]);
}
arr.push(temp);
offset++;
count++;
}
arr.forEach(function(item){
var res = 1;
for(var i=0; i<item.length; i++){
if(item[i] === item[i+1]){
res = 0;
continue;
}
}
perms.push(res);
});
console.log(perms.reduce(function(a,b){return a+b;}));
return perms.reduce(function(a,b){return a+b;});
}
permAlone('aabb');
function factorial(num){
for (var i=num-1; i>0; i--){
num *= i;
}
return num;
}
Wish me luck as I continue down the path to Front End Developer!!! counting down the days til I get to do projects again!!
Day 26 - Feb.25th, 2018:
Read about permutations trying to figure out how to do the math for the current FreeCodeCamp algorithm 'no repeats please'.
Day 25 - Feb.24th, 2018:
Finished the Update Inventory algorithm. I knew I had to use a sort function at the very end but was hard pressed in finding a solution that worked until I came across one on stackoverflow (where would we be without stackoverflow.. :P). solution here ->
function updateInventory(arr1, arr2) {
// All inventory must be accounted for or you're fired!
arr2.forEach((newItem, newIndex) => {
arr1.forEach((currItem, index) => {
if (newItem[1] === currItem[1]){
arr1[index][0] += newItem[0];
}
});
if(!checkArray(arr1, newItem[1])){
arr1.push(arr2[newIndex]);
}
});
function checkArray(arr, value){
var bool = false;
arr.forEach((item)=>{
if(item[1] === value){
bool = true;
}
});
return bool;
}
return arr1.sort(function(a, b){
var A=a[1].toLowerCase(), B=b[1].toLowerCase();
if (A < B) //sort string ascending
return -1;
if (A > B)
return 1;
return 0; //default return value (no sorting)
});
}
Wish me luck with the next challenge!
Day 24 - Feb.23rd, 2018:
Finished the Exact Change algorithm. took a while but I was able to crack it!
code below ->
function checkCashRegister(price, cash, cid) {
var change = cash - price;
var cashOnHand = 0;
var currency = [
{ name: 'ONE HUNDRED', val: 100.00},
{ name: 'TWENTY', val: 20.00},
{ name: 'TEN', val: 10.00},
{ name: 'FIVE', val: 5.00},
{ name: 'ONE', val: 1.00},
{ name: 'QUARTER', val: 0.25},
{ name: 'DIME', val: 0.10},
{ name: 'NICKEL', val: 0.05},
{ name: 'PENNY', val: 0.01},
];
// adds each amount of currency in the drawer
for (var i in cid.reverse()){
currency[i].amount = cid[i][1];
cashOnHand += cid[i][1];
}
// takes obvious insufficient funds
if (cashOnHand < change){
return "Insufficient Funds";
} else if (cashOnHand === change){
return "Closed";
} else{
change = getChange(change, currency);
}
// Here is your change, ma'am.
return change;
}
function getChange(amount, arr){
var change_arr = [];
for (var i in arr){
var currentChange = 0;
while (arr[i].amount > 0 && arr[i].val <= amount){
currentChange += arr[i].val;
arr[i].amount -= arr[i].val;
amount -= arr[i].val;
amount = Math.round(amount * 100) / 100;
}
if (currentChange > 0){
currentChange = Math.round(currentChange * 100) / 100;
change_arr.push([arr[i].name, currentChange]);
}
}
if(amount !==0){
return "Insufficient Funds";
}
return change_arr;
}
checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
Having to rounding the amount tripped me up for a very long time, also accidentally compared arr[i].amount instead of .val and that sent me on a wild goose chase! The joys of learning :P
Day 23 - Feb.22nd, 2018:
FreeCodeCamp section 283. Currently stuck on the how to best store the data for easy iteration when calculating Exact Change. I have the first 2 parts of the algorithm complete.
Day 22 - Feb.21st, 2018:
FreeCodeCamp section 282 to 283. Finally solved the symmetrical difference algorithm. had to build a function that took two arrays and looped eachother for differences returning one result that could then be looped with another array if one existed. Onto the Exact Change challenge!
/*---- You are too far away now haha - Luis ---*/
Day 21 - Feb.19th, 2018:
FreeCodeCamp section 282. Stuck on this algorithm. can solve it for 2 arrays, but once there is a third array my current code fails. Time to go watch Black Panther! and of course mull over some ideas for how to correct my code.
Day 20 - Feb.19th, 2018:
FreeCodeCamp sections 280 to 282. Solved the regex expression for US telephone numbers. Found a great resource for creating them -> https://regexr.com/
afterwards I completed the algorithm for updating objects by either adding to them or deleting from them, based on the data provided.
Day 19 - Feb.18th, 2018:
FreeCodeCamp sections 275 to 280. onto the advanced algorithms. predicting a slower progression through this section. going to have to read even more now on regex to build one for US Telephone numbers. I love learning the algorithms and the challenges they pose, but I still wish there was context on where they would come in handy.
Day 18 - Feb.17th, 2018:
FreeCodeCamp sections 270 to 275. Finished a few more challenges. not much to say just been reading and attempting to solve algorithms until I found a solution. getting excited for some of the advanced algorithms coming up.
Day 17 - Feb.16th, 2018:
FreeCodeCamp section 270. Completed the algorithm challenge after about 3 hours of reading and attempting different methods. Finally made something that worked after many attempts. here is the code ->
function spinalCase(str) {
str = str.replace(/([-_\s])/g, "_");
str = str.replace(/([A-Z])/g, "_$1");
return str.split("_").filter(function(val){return val !== "";}).join("-").toLowerCase();
}
Weekend has arrived. time to hit these challenges hard! and possibly work on a landing page for SurreyCodes if Luis has time to design it.
Day 16 - Feb.15th,2018:
FreeCodeCamp sections 268 to 270. Algorithms are getting harder now. spent sometime reading about regex. was able to get through one of the challenges, sadly the day has run late. time to rest and look at it with fresh eyes tomorrow. Also had a meeting today about the Surreycodes foundation, excited to see the outcome of the foundation.
Day 15 - Feb.14th, 2018:
Not much coding today due to it being Valentines day. did manage to do a couple sections on FreeCodeCamp I am now on 268. Also did a little work on some issues with the SurreyCodes website.
Day 14 - Feb.13th, 2018:
FreeCodeCamp sections 263 to 266. Made it to the missing letters algorithm. I have tried a few different ways of attacking the problem. however I keep hitting a snag with character that are the final letter. they produce a NaN by default and I am having issues figuring out how to solve it. Tomorrow is a new day! Perhaps fresh eyes will help.
Day 13 - Feb.12th, 2018:
FreeCodeCamp section 262 to 263. Took awhile but I finally cracked the algorithm to check an array of properties against another argument. Code below =>
function whatIsInAName(collection, source) {
// What's in a name?
var arr = [];
var i;
// Only change code below this line
var sourceArr = Object.keys(source);
if (sourceArr.length > 1){
for (i=0; i<collection.length; i++){
if (collection[i].hasOwnProperty(sourceArr[0]) && collection[i].hasOwnProperty(sourceArr[1]) && collection[i][sourceArr[0]] === source[sourceArr[0]] && collection[i][sourceArr[1]] === source[sourceArr[1]]){
arr.push(collection[i]);
}
}
} else{
for (i=0; i<collection.length; i++){
if (collection[i].hasOwnProperty(sourceArr[0]) && collection[i][sourceArr[0]] === source[sourceArr[0]]){
arr.push(collection[i]);
}
}
}
// Only change code above this line
return arr;
}
whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
It took me about 5 hours of writing code and pondering different ways to do it while keeping the line count down. If anyone else is reading my progress and has a better solution than the one above please PM me with the answer!
Day 12 - Feb.11th, 2018:
FreeCodeCamp sections 259 to 262. Struggled for about 5 hours on the Roman Numeral algorithm challenge before finally admitting defeat. My code was over 100 lines long and was by no means efficient. after viewing the answer, I made sure to read it and understand it before moving on. Today is the first day of 100DaysOfCode that I had to use a lifeline.
Day 11 - Feb.10th, 2018:
FreeCodeCamp section 258 to 259. Completed the TwitchTV Project. Had a lot of fun adding my own flavor. really enjoyed working with the Twitch API. Learned a ton of stuff about React as I continued through the project. Struggled mostly with updating components through state changes (specifically which life-cycle method to call). I may not have built it to React standards but it is fully functioning :) On to bigger challenges and more bugs to fix!!
Day 10 - Feb.9th, 2018:
FreeCodeCamp section 258. Found out I had programmed some functions against the standards of React. Started reading more documentation on componentDidMount as well as other built in methods. Have to redo some of the code in order to correct the issue. Got most of the styling done. just have to propgram an online-offline status signal and add the functionality for showing Online only, Offline only and All.
Day 9 - Feb.8th, 2018:
FreeCodeCamp section 258. Started working on the TwitchTv Project. I decided to add more than what is required functionally so that I could push myself a little further to gain more knowledge and understanding. Got the app pulling all the data I need, now I am excited to style it all!
Day 8 - Feb.7th, 2018:
FreeCodeCamp section 257. Finished the Wikipedia Viewer project. Figured out how to setup CORS and pull in the data required to complete the challenge. I decided to do the challenge in React to get more practice and keep my existing knowledge of it relevant. Now onto the TwitchTV JSON API challenge. Will also attempt to complete it in React :)
Day 7 - Feb.6, 2018:
FreeCodeCamp section 257. Worked on the Wikipedia Viewer project. have the css completed and all the functions set up. did some reading on CORS and attempted to get a succesful API request with no success. Keeping my head up there is always another day.
Day 6 - Feb.5, 2018:
FreeCodeCamp sections 247 to 257. Finished the Weather App Project. On to the Wikipedia Viewer. Learned a great deal about setting elements based on API calls. very good challenge for getting the data you want to display how and when you want it to!!. Awesome challenge looking forward to them becoming more and more challenging.
Day 5 - Feb.4, 2018:
FreeCodeCamp sections 240 to 247. Finished the JSON section and move on the the first intermediate project, the random quote generator. Still need to figure out how to escape some characters when passing them to twitter API! Other than that the project was completed today!
Day 4 - Feb.3, 2018:
FreeCodeCamp sections 232 to 240. Finished the algorithm challenge and started the section on JSON and ajax requests using jQuery.
Day 3 - Feb.2, 2018:
FreeCodeCamp sections 223 to 232. Completed more of the challenges, currently stuck on checking whether all characters of one array index exist in another. I am more stuck on words that are in reverse. (perhaps i will have to reverse or sort).
Day 2 - Feb.1, 2018:
FreeCodeCamp sections 202 to 223. Learned more about Arrays, specifically functions like :
- split, reduce, filter, sort, reverse, concat, join, and map.
also went through regular expressions. (Still need to read more on them to understand more).
I have now started the section of algorithm challenges!
Day 1 - Jan.31, 2018:
Worked On FreeCodeCamp sections 183 to 202. Learned about Arrays, Objects and the Math.Random() function.