This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://www.newthinktank.com/2012/11/visitor-design-pattern-tutorial/ | |
| // https://www.youtube.com/watch?v=pL4mOUDi54o | |
| interface Visitor { | |
| visitLiquor(liquorItem: Liquor): number; | |
| visitTobacco(tobaccoItem: Tobacco): number; | |
| visitNecessity(necessityItem: Necessity): number; | |
| } | |
| class TaxVisitor implements Visitor { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const newHornerSequence = | |
| (...seq) => | |
| x => | |
| seq.slice(0, -1).reduce((acc, n) => (acc + n) * x, 0) + seq.pop(); | |
| console.log(newHornerSequence(4, 5, 6, 7, 8)(5)); // 3318 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const leftRiemannSum = (f, start, stop, inc) => { | |
| if (start >= stop) return 0; | |
| return f(start) * inc + leftRiemannSum(f, start + inc, stop, inc); | |
| }; | |
| const middleRiemannSum = (f, start, stop, inc) => { | |
| const middle = (start + inc) / 2; | |
| if (start >= stop) return inc * f(middle); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"dark":"1","docs":"apache_http_server/async/babel/bash/bootstrap~4/c/cpp/clojure~1.9/cmake~3.12/crystal/css/d3~5/dart~2/docker~17/dom/dom_events/electron/elixir~1.7/erlang~21/eslint/express/gcc~7/git/go/haskell~8/homebrew/html/http/javascript/jest/jsdoc/koa/kotlin/laravel~5.6/lodash~4/lua~5.3/markdown/moment/mongoose/nginx/nginx_lua_module/node/nokogiri/npm/numpy~1.14/pandas~0.22/perl~5.26/phoenix/php/postgresql~10/pug/puppeteer/python~3.7/qt~5.11/ramda/react/react_native/redis/redux/relay/requirejs/rethinkdb~javascript/rethinkdb~ruby/ruby~2.5/minitest/rails~5.2/rust/sass/socketio/sqlite/svg/terraform/typescript/vue~2/webpack/yarn"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const path = require("path"); | |
| const cson = require("cson"); | |
| const { folders } = require("./boostnote.json"); | |
| const DIRECTORIES = { | |
| IMPORT: "notes", | |
| EXPORT: "export", | |
| NOTES: "notes", | |
| SNIPPETS: "snippets" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| type spinner struct { | |
| chars []string | |
| current int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Drop while matches Char | |
| dropInitialMatches :: Char -> String -> String | |
| dropInitialMatches c xs = dropWhile (==c) xs | |
| -- Drop preceding spaces | |
| dropInitialSpaces :: String -> String | |
| dropInitialSpaces xs = dropInitialMatches ' ' xs | |
| -- Drop preceding linefeeds | |
| dropInitialNewLines :: String -> String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fib = | |
| n => | |
| n < 2 | |
| ? 1 | |
| : fib(n - 1) + fib(n - 2) | |
| const range = | |
| (min, max) => | |
| Array(max - min + 1).fill().map((_, i) => i + min) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" | |
| ) |