Just my solution to the project I found the solution to the project provided in the book really good, but it zipped the entire folder structure in the absolute path. Something I am not pleased with. By adding the filepath base name to the zipfile.Zipfile.write() function, after the absolute file path (of the file to […]
With this script we can make a new directory and move files with a given ending into the directory. This was not a task in the book, but just something I thought of solving. Quite interesting to know what you could do with string operations like “startWith” and “endWith”. # creates new directory and moves […]
Searching through a list of text files in a given directory … I personally found this enjoyable. It was easier to solve compared to last problem. What I can say at this stage is, learn how to search to documentation and google! It helps… heheh.. oh yea, leave your suggestions in the comment box. see […]
Creating MadLib: It was quite a task to solve this problem but worth it. I learned how to retrieve command line arguments using sys module, regex to match and search for the keyword in a given string, and os to create new files and open files. I think a step further would be to […]
If you came all the way from part 1, you should get the book: Functional JavaScript In the last post, we learned about Closures and Scopes. Today, we are addressing Higher Order Functions – Let’s do this! Higher Order Function A first-class function takes a function as an argument returns a function as a result […]
Remember the Book: Functional JavaScript So chapter 3 right?…hm Scopes From my understanding, where a variable lives, while the extent of a scope means how long a variable holds a value. Global Scope This has the longest lifespan when you declare a variable without the var, you are defining a global variable (accessible to […]
Hey!! you missed me ? no..okay .. so chapter 2 First Class Functions According to the author, I quote, “the term first class means that soething is just a value. Is one that can go anywhere that any other value can go”. Therefore a first class function is as shown below: var number = function(){return […]
Hope you found the part 1 helpful.. Okay, let’s begin… Styling style property to access a specific style property e.g. border-width, use selection.style.borderWidth or for background-color backgroundColor. getProperty, setProperty, removeProperty methods get – takes in only one argument; returns the value of that property e.g. selection.getProperty(“background-color”) set – updates the value of a specific property; […]
Scope the life-time of a variable; Global scope – variables declared without a (var) are in the global scope. Their life time is the longest. They are also easy to mutate at any time, thus you should take extra care when declaring variables in the global scope. Lexical scope – defines the visibility of the […]