Avatar for abr

abr

Member since Oct 2012 • Last active Dec 2022

Most recent activity

  • in Miscellaneous and Meaningless
    Avatar for abr

    Looks like markdown code tags aren't supported, but html pre tag is.

    <details>
    <summary>Spoiler</summary>
    <pre>
    Code here
    </pre>
    </details>

  • in Miscellaneous and Meaningless
    Avatar for abr

    Definitely a bit of a jump between yesterday and today's. Wasted a fair bit of time trying to recursively calculate the aggregated directory sizes after building the file system.

    Once I calculated the dir sizes as I went along building the file system, it was much easier.

    Solution >
    let fs = {}
    let dirHistory = []
    let currentDir = fs
    
    arr.forEach(i => {
      if (i === '$ cd ..') {
        currentDir = dirHistory.pop()
      } else if (/\$ cd [a-z]+/.test(i)) {
        dirHistory.push(currentDir)
        let dirName = i.match(/[a-z]+/g)[1]
        currentDir = currentDir[dirName]
      } else if (/dir [a-z]+/.test(i)) {
        let dirName = i.match(/[a-z]+/g)[1]
        currentDir[dirName] = { size: 0 }
      } else if (/[0-9]+/.test(i)) {
        let size = Number(i.match(/[0-9]+ /)[0].trim())
        currentDir.size += size
        dirHistory.forEach(histItem => {
          histItem.size += size
        })
      }
    })
    
    
    let sizeArr = []
    let getSizes = obj => {
      sizeArr.push(obj.size)
      if (Object.values(obj).length < 2) {
        return
      }
      return Object.values(obj).filter(i => !Number.isInteger(i)).forEach(getSizes)
    }
    
    getSizes(fs)
    sizeArr.filter(i => i <= 100000).reduce((a, i) => a + i, 0)
    
  • in Wanted Adverts
    Avatar for abr

    Ragleys look to be just what I'm after (sorry @ltc!) - will DM.

  • in Miscellaneous and Meaningless
    Avatar for abr

    Made the most of being woken up at 5.45am today.
    Do like the ones where part 2 is the same as part 1, but makes you rewrite a naive/quick and dirty solution to part 1.

    let n = 14
    let i = 0
    let found = false
    
    while (!found) {
      if (new Set(str.slice(i, i + n)).size === n) {
        found = true
      } else {
        i++
      }
    }
    
    console.log(i + n)
    
  • in Wanted Adverts
    Avatar for abr

    Cheers - interested in the salsa bend deluxe 27deg and ragley back sweep - which ones are the Ragleys in the pic?

    What are you after for each?

  • in Current Projects
    Avatar for abr

    Moved some bits over from my pump track bike which I can't use at the moment, to a £50 frame I got on eBay, to build something cheap and utilitarian but nice to ride.

    Frame is 1650g(!) and the whole thing is around 11kg at the moment. Quite happy with the £70 8 speed Microshift drivetrain.

    Planning to get some thinner, slightly lighter tyres (as nice as cornering on 2.3" semi-slicks is) and some more swept bars, to make it more suited to longer distances.

  • in Complete bikes and frame & forks
    Avatar for abr

    Interested in the mech, cassette, shifter and brakes in case you end up splitting.

  • in Complete bikes and frame & forks
    Avatar for abr

    This has to be worth way more than £300 to the right person, surely... maybe eBay for further reach?

    Either way, best to update the thread title to the new price though, so more people see what a bargain it is.

    GLWS!

Actions