- Bubble Sort
- Merge Sort
- Linear Search
- Binary Search
| console.log("MONITORING CLS") | |
| let cls = 0; | |
| new PerformanceObserver((entryList) => { | |
| for (const entry of entryList.getEntries()) { | |
| if (!entry.hadRecentInput) { | |
| cls += entry.value; | |
| console.log('Current CLS value:', cls, entry); | |
| } | |
| } |
| // Complete the countingValleys function below. | |
| function countingValleys(n, s) { | |
| let level = 0; | |
| let numberOfValleys = 0; | |
| for (let i = 0; i < n; i++) { | |
| const next = s[i] | |
| if (next === 'U') { | |
| if (level === -1) { | |
| numberOfValleys = numberOfValleys + 1; |
| let countingValleys = (~s) => { | |
| let rec iter = (~numberOfValleys, ~level, ~s) => | |
| if (String.length(s) === 0) { | |
| numberOfValleys; | |
| } else { | |
| let next = s.[0]; | |
| let rest = String.sub(s, 1, String.length(s) - 1); | |
| switch (next, level) { | |
| | ('U', (-1)) => iter(~numberOfValleys=numberOfValleys + 1, ~level=level + 1, ~s=rest) | |
| | ('U', _) => iter(~numberOfValleys, ~level=level + 1, ~s=rest) |
I hereby claim:
To claim this, I am signing this object:
| defmodule CatFinder do | |
| def find(scheduler) do | |
| send scheduler, {:ready, self} | |
| receive do | |
| { :find, file, scheduler_pid} -> | |
| send scheduler_pid, { :answer, file, num_of_cats(file) } | |
| find(scheduler) | |
| { :shutdown } -> |
| package main | |
| import ( | |
| "fmt" | |
| "net" | |
| ) | |
| //foo | |
| func main() { |
| function! RemoveLibPrefix(path) | |
| let shortenedPath = split(a:path, "/")[1:] | |
| return join(shortenedPath, "/") | |
| endfunction | |
| function! FindCurrentFileUsage() | |
| let filePath = RemoveLibPrefix(@%) | |
| let rubyPath = substitute(filePath, ".rb", "", "") | |
| exec "silent grep! " . rubyPath . " **/*.rb" | |
| exec "copen" |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "net/http" | |
| ) | |
| type person struct { | |
| UserId int `json:"userId"` |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer