Imaging for a second you can get any help you want, what type of help do you need for your project?
Of course, we need a project. Though obvious, decent amount of details need to be presented before meaningful architect, or right architect so to speak. You have limited market share to capture, you have limited budget to spend, you have limited resources to work for you. Moreover you get limited expansion power, for instance, your imagination (or time, or business requirement) might dry out sooner than you think.
In short, you need some historical context to sink in before…
Is this level of trouble worth it in the end?
Like any tech-savvy person who would chase the latest computer spec, I’m very much into understanding what’s really going on with a new language, especially when the new language starts to show its potential in practical fields.
The learning isn’t that difficult, at least not the beginning. I’ve been practicing the functional programming, comfortable of functions as a first class citizens, and strongly feeling that function probably is what the programming is about, not the implementation.
>>> length (takeWhile (<1000) (scanl1 (+) (map sqrt [1..]))) + 1
With recursive feature…
Me and my wife together finished a 5000 pieces of jigsaw. We attempted this project couple of years ago before we had our son, but failed since none of us had a clue how we could finish it back then.
But this year is different, I guess time is all we have. So we gave it another shot, of course this time we were mentally prepared before we started. That is very important.
Solving puzzle isn’t easy especially when it comes to the magnitude of 5000, because taking 500 pieces as a typical task, dealing with 10 of them at…
We implemented a “Single Repo System” a while back successfully, where we added features for multiple domains embedding small websites inside a website. In this article I’d like to extend this model to multiple instances. For instance, there could be different features on different instance, even for the same feature, it might be subtle workflow difference for each instance. Most of commercial products these days, when sold to customers with different needs, are having this built in core.
The gain of using single repo is, obviously in the sense, that most of features done in the past could potentially get…
Back couple years ago, I started to explore ways to hedge risk when things is going to be risky. After some experimentation that costed me time and money, I started to understand more and thus the problem with it.
Once a risk is discovered, trying to understand or minimize it is definitely a positive move. Therefore the strategy of applying hedge to your portfolio (or your project) is a common move.
You’d like to buy an insurance in case bad things happens in future period of time with some cost.
Practically I run into some serious problem with “period of…
After ES6
, we tend to use map
, filter
a lot. And sometimes if we really need to get hands dirty, we can use reduce
where we take an initial state and reduce it to next state going through all elements.
Looping through the entire array can be a bit expensive, especially when you want to stop when certain condition is met. This conditional reduce can be implemented using a Lazy library, where each element traverse is deferred till needed, therefore only loops to the point when a match is found. …
ES6
adds quite a bit functionalities to array with map
, filter
etc. They are extremely handy, but I start to have trouble keeping track of the indexes.
For instance
arr.filter(v => v == 3)
We can find out if there’s a specific element that we need, however once it’s filtered, we lost its original index. Therefore we tend to use indexOf
. But the point here is that we do want to filter, at the same time we need to have additional properties to be preserved during the process.
In order to do that, we could do
arr .map((v, i) =>…
Create an array in Javascript isn’t 100% straightforward as in other languages. Although on the surface it does seem simple, and most of the online tutorial can put you in the right (working) direction. Does it occur to you it’s not well designed?
Consider the following array statement, what’s odd is that
const a = new Array(10)
map
right awayfill
There’re many libraries (even ES6
) extending the array functionalities, but they rarely talk about the definition or the initialization of the array…
How difficult is writing a
for
loop?
We start programming by learning how to perform a loop, such as the following example.
for (let i = 0; i < 6; i++) { print i; }
I don’t know if this bothers you, but looping isn’t pretty to look at. Not to mention the additional boilerplate as well as keeping track of the extra index. Moreover it breaks the flow of your reasoning. Mentally you have to take a break whenever you encounter a loop.
It is costly, for sure, we don’t want to approach problem in higher dimensions, we tend…
Question: Advent of Code 2015, Day 3
<^^<>v^v^vv<>>>>v^v<>><^^v>vv^^>v^v>v<vv>>v>><
vv>>^>^^<>><>^>vvv>>^vv>^<><>^<v^>^>^><vv^vv^>
v^^vv><<<>v<>v>^<vvv^<^<v<v<^vv^^>>vv^<^^v^><^
^^^^v<^<v<^>>>vv^v^>^<v>^<><v^<^v>>><^v^<<v<<v
<>v>^v<v^v>>^^v<<v<v<<>>>vv>>^v>>^<<<<^><<<><^
import Data.List (nub)type Pos = (a, a)next :: (Num a) => Pos -> Char -> Pos
next (x,y) '^' = (x, y+1)
next (x,y) 'v' = (x, y-1)
next (x,y) '<' = (x-1, y)
next (x,y) '>' = (x+1, y)
next (x,y) _ = (x,y)visited :: Num a => [Char] -> [Pos]
visited = scanl next (0,0)uniqueVisits :: Eq a => [a] -> Int
uniqueVisits = length . nub-- Nefrubyr's every from StacksOverflow every :: Int -> [a] -> [a] every n xs…
Front-end Engineer