├── wiki ├── proglangs │ ├── the-closure-in-a-loop-problem.md │ ├── guard-stmt.md │ ├── verification.md │ ├── gc.md │ ├── numeric-types.md │ ├── the-default-arg-eval-problem.md │ ├── the-mutating-while-iterating-problem.md │ ├── unused-nodiscard-annotations.md │ ├── the-shelve-problem.md │ ├── modules-packages.md │ ├── strings-and-unicode.md │ ├── datatypes.md │ ├── tooling.md │ ├── the-equality-problem.md │ ├── the-accessor-problem.md │ ├── bool-expr-problem.md │ ├── misc-features.md │ ├── tower-defense.md │ ├── compiler-construction.md │ └── plt.md ├── api-design.md ├── devops │ ├── server-names.md │ ├── tools.md │ └── things-to-monitor.md ├── ada.md ├── bash.md ├── optimization.md ├── open-source.md ├── unicode.md ├── operating-systems.md ├── cmd-line-ui.md ├── time.md ├── security.md ├── distributed-systems.md ├── docker.md ├── c.md ├── car-insurance.md ├── rfcs.md ├── software-marketing.md ├── web-testing.md ├── apartment-hunting.md ├── python.md ├── win11.md ├── win11-fixes.reg ├── cars.md ├── sql-grievances.md ├── uncategorized.md ├── web.md ├── humor.md ├── jobhunting-and-employment.md ├── where-to-live.md ├── james-mickens.md ├── influence.md └── scala-cheatsheet.md └── blog ├── saltcon-keynote-slide.png ├── saltstack.md ├── misc-web.md └── bootstrap.md /wiki/proglangs/the-closure-in-a-loop-problem.md: -------------------------------------------------------------------------------- 1 | like in Python 2 | -------------------------------------------------------------------------------- /wiki/api-design.md: -------------------------------------------------------------------------------- 1 | * https://swift.org/documentation/api-design-guidelines/ 2 | -------------------------------------------------------------------------------- /wiki/devops/server-names.md: -------------------------------------------------------------------------------- 1 | * https://xkcd.com/1417/ 2 | * https://xkcd.com/1554/ 3 | -------------------------------------------------------------------------------- /wiki/devops/tools.md: -------------------------------------------------------------------------------- 1 | icanhazip.com (details: http://major.io/icanhazip-com-faq/) 2 | -------------------------------------------------------------------------------- /wiki/ada.md: -------------------------------------------------------------------------------- 1 | * http://getadanow.com/Ada-Distilled-24-January-2011-Ada-2005-Version.pdf 2 | -------------------------------------------------------------------------------- /wiki/proglangs/guard-stmt.md: -------------------------------------------------------------------------------- 1 | [The `guard` statement](http://nshipster.com/guard-and-defer/) 2 | -------------------------------------------------------------------------------- /wiki/bash.md: -------------------------------------------------------------------------------- 1 | * [How to comment a multi-line command](http://stackoverflow.com/a/12797512/3342739) 2 | -------------------------------------------------------------------------------- /wiki/optimization.md: -------------------------------------------------------------------------------- 1 | * [The Mature Optimization Handbook](http://carlos.bueno.org/optimization/) 2 | -------------------------------------------------------------------------------- /blog/saltcon-keynote-slide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cvrebert/notes/HEAD/blog/saltcon-keynote-slide.png -------------------------------------------------------------------------------- /wiki/proglangs/verification.md: -------------------------------------------------------------------------------- 1 | * [Whiley](http://whiley.org): A Programming Language with Extended Static Checking 2 | -------------------------------------------------------------------------------- /wiki/proglangs/gc.md: -------------------------------------------------------------------------------- 1 | * [Paper on GC in Dylan](http://www.ravenbrook.com/project/mps/doc/2002-01-30/ismm2002-paper/ismm2002.html) 2 | -------------------------------------------------------------------------------- /wiki/open-source.md: -------------------------------------------------------------------------------- 1 | * [How to Spread The Word About Your Code](https://hacks.mozilla.org/2013/05/how-to-spread-the-word-about-your-code/) 2 | -------------------------------------------------------------------------------- /wiki/proglangs/numeric-types.md: -------------------------------------------------------------------------------- 1 | * [Towards an API for the Real Numbers](https://blog.acolyer.org/2020/10/02/toward-an-api-for-the-real-numbers/); Boehm in PLDI '20 2 | -------------------------------------------------------------------------------- /wiki/proglangs/the-default-arg-eval-problem.md: -------------------------------------------------------------------------------- 1 | * default argument values should be re-evaluated on every function execution 2 | * pure expressions should be optimized 3 | -------------------------------------------------------------------------------- /wiki/proglangs/the-mutating-while-iterating-problem.md: -------------------------------------------------------------------------------- 1 | mutating a collection while iterating over it can screw up its iterator's state 2 | it would be nice if the language addressed this somehow 3 | -------------------------------------------------------------------------------- /wiki/proglangs/unused-nodiscard-annotations.md: -------------------------------------------------------------------------------- 1 | Proposal of `[[unused]]`, `[[nodiscard]]` and `[[fallthrough]]` attributes. 2 | 3 | http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0068r0.pdf 4 | -------------------------------------------------------------------------------- /wiki/proglangs/the-shelve-problem.md: -------------------------------------------------------------------------------- 1 | > [Because of semantics, a shelf [(disk-backed dict)] cannot know when a mutable persistent-dictionary value is modified.](https://docs.python.org/2/library/shelve.html) 2 | -------------------------------------------------------------------------------- /wiki/unicode.md: -------------------------------------------------------------------------------- 1 | * [Unidecode: lib for ASCII transliterations of Unicode text](https://pypi.python.org/pypi/Unidecode) 2 | * [Computerphile on internationalization](https://www.youtube.com/watch?v=0j74jcxSunY) 3 | -------------------------------------------------------------------------------- /wiki/operating-systems.md: -------------------------------------------------------------------------------- 1 | * [Operating Systems: Three Easy Pieces](http://pages.cs.wisc.edu/~remzi/OSTEP/) 2 | * [The little book about OS development, by Erik Helin & Adam Renberg](https://littleosbook.github.io/) 3 | -------------------------------------------------------------------------------- /wiki/cmd-line-ui.md: -------------------------------------------------------------------------------- 1 | * [GNU standard command-line option names](http://www.gnu.org/prep/standards/standards.html#Option-Table) 2 | * [The Art of Unix Programming: Command-Line Options](http://www.catb.org/~esr/writings/taoup/html/ch10s05.html) 3 | -------------------------------------------------------------------------------- /wiki/time.md: -------------------------------------------------------------------------------- 1 | * [Falsehoods programmers believe about time](http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time) 2 | * [The Problem with Time & Timezones - Computerphile](https://www.youtube.com/watch?v=-5wpm-gesOY) 3 | -------------------------------------------------------------------------------- /wiki/proglangs/modules-packages.md: -------------------------------------------------------------------------------- 1 | * [A Ban on `import`s](http://gbracha.blogspot.com/2009/06/ban-on-imports.html) 2 | * [How `import` Works (PyCon)](http://pyvideo.org/video/1707/how-import-works) 3 | * https://gist.github.com/mitsuhiko/7ea0eff8883615997416 4 | -------------------------------------------------------------------------------- /wiki/security.md: -------------------------------------------------------------------------------- 1 | * [Apple Secure Coding Guide](https://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/SecureCodingGuide.pdf) 2 | * [OWASP Secure Headers Project](https://www.owasp.org/index.php/OWASP_Secure_Headers_Project) 3 | -------------------------------------------------------------------------------- /wiki/proglangs/strings-and-unicode.md: -------------------------------------------------------------------------------- 1 | * [Why is Swift's String API So Hard?](https://www.mikeash.com/pyblog/friday-qa-2015-11-06-why-is-swifts-string-api-so-hard.html) ([proggit](https://www.reddit.com/r/programming/comments/3rs0s8/why_is_swifts_string_api_so_hard/)) 2 | * TL;DR: Because grapheme cluster vs. codepoints vs. code units vs. bytes 3 | -------------------------------------------------------------------------------- /wiki/proglangs/datatypes.md: -------------------------------------------------------------------------------- 1 | * [CRDTs](https://www.google.com/search?q=crdt&ie=UTF-8&oe=UTF-8) 2 | * [Strong Eventual Consistency and Conflict-free Replicated Data Types (Speaker: Marc Shapiro)](http://research.microsoft.com/apps/video/default.aspx?id=153540&r=1) 3 | * https://developers.soundcloud.com/blog/roshi-a-crdt-system-for-timestamped-events 4 | * http://www.bloom-lang.net/calm/ 5 | -------------------------------------------------------------------------------- /wiki/distributed-systems.md: -------------------------------------------------------------------------------- 1 | * https://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing 2 | * [Notes on Distributed Systems for Young Bloods](http://www.somethingsimilar.com/2013/01/14/notes-on-distributed-systems-for-young-bloods/) 3 | * [A Distributed Systems Reading List](https://dancres.github.io/Pages/) 4 | * [HTTP requests are hard](http://www.mobify.com/blog/http-requests-are-hard/) 5 | -------------------------------------------------------------------------------- /wiki/proglangs/tooling.md: -------------------------------------------------------------------------------- 1 | * progress bar for simple loop: https://github.com/noamraph/tqdm 2 | * have a built-in scaffolding generator 3 | * https://github.com/fujimura/hi 4 | * https://github.com/audreyr/cookiecutter 5 | * have an automatic style enforce/formatter, ala `gofmt` 6 | * Powerful std lib: http://www.rebol.com/oneliners.html 7 | * have a wonderful IDE: http://worrydream.com/LearnableProgramming/ 8 | -------------------------------------------------------------------------------- /wiki/proglangs/the-equality-problem.md: -------------------------------------------------------------------------------- 1 | `"hello".equals(42)` should be a compile-time type error 2 | 3 | Also, given: 4 | * `non-abstract class Circle(int radius)` 5 | * `non-abstract class ColoredCircle(int radius, Color color) extends Circle(int radius)` 6 | 7 | Then: `somePlainCircle == someColoredCircle` should probably be a type error. 8 | 9 | What is the color of a colorless circle? What color could an undefined color possibly be equal to? 10 | -------------------------------------------------------------------------------- /wiki/proglangs/the-accessor-problem.md: -------------------------------------------------------------------------------- 1 | The accessor problem: 2 | 3 | ``` 4 | class Foo { 5 | private List bar; 6 | public List getBar() { 7 | /* This should be an error! */ 8 | return bar; 9 | } 10 | } 11 | ``` 12 | Why that should be an error: 13 | ``` 14 | Foo().getBar().append(2); 15 | /* We've now unwittingly altered Foo's internal state */ 16 | ``` 17 | 18 | It should be illegal, by default, to return a mutable member of an object. 19 | -------------------------------------------------------------------------------- /blog/saltstack.md: -------------------------------------------------------------------------------- 1 | Partial HipChat transcript: 2 | 3 | (Thursday January 30, 2014) 4 | (Context: After finding many Salt bugs via pylint and submitting fixes for many of them) 5 | 6 | [Colleague in DevOps]: Prototypical conversation with anyone from SaltStack: "Oh, you're from Hulu - do you know Chris Rebert?" 7 | [[!saltcon-keynote-slide.png]] 8 | [Colleague in DevOps]: Slide in the keynote. 9 | [Colleague in DevOps]: You got thanked specifically by name as well. 10 | [Colleague in DevOps]: You win. 11 | -------------------------------------------------------------------------------- /wiki/docker.md: -------------------------------------------------------------------------------- 1 | * Name your images: `docker build --tag name-goes-here .` 2 | * Name your containers: `docker run --name rorschach some-image` 3 | * For non-daemons, you probably want: 4 | * `docker run --rm=true some-image` to avoid temporary containers from piling up and hogging all your disk space 5 | * `ENTRYPOINT ["/path/to/the/binary"]` (instead of `CMD`) 6 | * Don't get `CMD` and `RUN` mixed up. 7 | * At most one `CMD` per Dockerfile 8 | * `RUN` is for setup steps 9 | * `chmod` must happen **AFTER** `chown`, due to https://github.com/docker/docker/issues/6047 10 | -------------------------------------------------------------------------------- /wiki/c.md: -------------------------------------------------------------------------------- 1 | * [New-school C](http://programming.oreilly.com/2012/12/c-programming-language-ben-klemens.html) 2 | * [C99-to-C89 converter](https://github.com/libav/c99-to-c89) 3 | * [Autotools Mythbuster](https://www.flameeyes.eu/autotools-mythbuster/) 4 | * [Autotools: a practitioner's guide to Autoconf, Automake and Libtool](http://www.freesoftwaremagazine.com/books/autotools_a_guide_to_autoconf_automake_libtool) 5 | * [cling: a c++ REPL](http://blog.coldflake.com/posts/2012-08-09-On-the-fly-C++.html) 6 | * [CERT C Secure Coding Standard](https://www.securecoding.cert.org/confluence/display/seccode/CERT+C+Coding+Standard) 7 | -------------------------------------------------------------------------------- /wiki/car-insurance.md: -------------------------------------------------------------------------------- 1 | * As of: 2023-03-14 2 | 3 | ### Shopping considerations 4 | * May involve credit checks; unfreeze credit beforehand 5 | * Your lease may specify minimum requirements 6 | 7 | ### Rec'd Coverages 8 | * Injury: $100K/person, $300K/accident 9 | * Property Damage: $100K 10 | * Consider: Umbrella liability: Typically increases to $300K/person 11 | * Uninsured Motorist (medical): Yes 12 | * Only if your Health Insurance sucks: Personal Injury (of you), Medical Payments 13 | * If leasing: GAP 14 | 15 | ### Ways to save 16 | * Increase deductible 17 | * Ask for adjustment due to car's depreciation 18 | -------------------------------------------------------------------------------- /wiki/rfcs.md: -------------------------------------------------------------------------------- 1 | * [RFC 6902: JSON Patch](http://tools.ietf.org/html/rfc6902) 2 | * [RFC 6901: JSON Pointer](http://tools.ietf.org/html/rfc6901) 3 | * [RFC 6570: URI Templates](http://tools.ietf.org/html/rfc6570) 4 | * [RFC 7493: The I-JSON Message Format](https://tools.ietf.org/html/rfc7493) 5 | * [Problem Details for HTTP APIs (draft-ietf-appsawg-http-problem-00)](https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00) 6 | * [RFC 7763: The text/markdown Media Type](https://tools.ietf.org/html/rfc7763) 7 | * [RFC 7764: Guidance on Markdown: Design Philosophies, Stability Strategies, and Select Registrations](https://tools.ietf.org/html/rfc7764) 8 | -------------------------------------------------------------------------------- /wiki/software-marketing.md: -------------------------------------------------------------------------------- 1 | * [Debian: UpstreamGuide: making your program easy to package](https://wiki.debian.org/UpstreamGuide) 2 | * [Adding Bash completion for your tool](http://eli.thegreenplace.net/2013/12/26/adding-bash-completion-for-your-own-tools-an-example-for-pss/) 3 | * [Perl and CPAN - A Reading of a Modern Story](http://www.reddit.com/r/programming/comments/v4eul/perl_and_cpan_a_reading_of_a_modern_story/) 4 | * Have a spiffy website 5 | * On its own domain 6 | * Put a good description in the `` 7 | * Find relevant folks on Twitter via http://followerwonk.com/bio/ and reach out 8 | * Reach out to relevant blogs or newsletters 9 | * Build X in ~15mins demo video? 10 | -------------------------------------------------------------------------------- /wiki/web-testing.md: -------------------------------------------------------------------------------- 1 | * [OS X Safari 10.0 native WebDriver support](https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_0.html#//apple_ref/doc/uid/TP40014305-CH11-DontLinkElementID_28) 2 | * iOS Safari Simulator 3rd-party WebDrivers 3 | * https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/mobile-web.md 4 | * https://github.com/ios-driver/ios-driver/ 5 | * Prospect of there being a native one eventually 6 | * [MS Edge WebDriver](https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/dev-guide/tools/webdriver/) 7 | * Wait for Windows Server 2016 probably, in order to get Edge. Remember that GCP supports Windows. 8 | * Physical machine + VirtualBox for IE? 9 | * [GeckoDriver for Firefox](https://github.com/mozilla/geckodriver) 10 | -------------------------------------------------------------------------------- /wiki/apartment-hunting.md: -------------------------------------------------------------------------------- 1 | * Ask about lead (paint) 2 | * Built before 1978 = Possibility of lead paint 3 | * Ask about asbestos 4 | * Built before 1981 = Possibility of asbestos 5 | * Ask whether utilities included 6 | * Ask about internet providers 7 | * Never live near the on-site gym 8 | * Ask how package delivery works 9 | * Good taqueria in the area? 10 | * Electric car charging? 11 | * Air quality; Use AQI meter 12 | * Noise level; Use sound meter 13 | * Avoid churches/schools 14 | * Avoid wide/trafficky roads 15 | * Home office vs. Coworking space proximity 16 | * Vs. Buying a House: 17 | * https://www.nytimes.com/interactive/2014/upshot/buy-rent-calculator.html 18 | * https://www.nytimes.com/2005/09/25/realestate/is-it-better-to-buy-or-rent.html 19 | * https://www.nytimes.com/2010/04/21/business/economy/21leonhardt.html 20 | -------------------------------------------------------------------------------- /wiki/proglangs/bool-expr-problem.md: -------------------------------------------------------------------------------- 1 | Having the traditional boolean operators always return boolean values as results isn't flexible enough. 2 | 3 | * Matrix math libraries like NumPy want to make them operate matrix-wise and result in a matrix 4 | * ORM libraries want to use them to formulate query expressions 5 | * But on an individual row/active-record, we want them to produce a boolean 6 | * The normal short-circuiting behavior of these operators 7 | 8 | ORM example: 9 | ```scala 10 | class Task( 11 | val deadline: Timestamp, 12 | val completedAt: Timestamp 13 | ) { 14 | def isExpired = completedAt >= deadline 15 | } 16 | ``` 17 | 18 | Possible solution: Return some kind of `BooleanExpression` rather than a `Boolean`, which evaluates to a `Boolean` in the context of conditions, but which can be used as an AST in other contexts. 19 | -------------------------------------------------------------------------------- /wiki/python.md: -------------------------------------------------------------------------------- 1 | * [The Hitchhiker’s Guide to Python](http://docs.python-guide.org/en/latest/) 2 | * Testing tools: https://wiki.python.org/moin/PythonTestingToolsTaxonomy 3 | * Branch coverage: [Instrumental](http://instrumental.readthedocs.org/en/latest/index.html) 4 | * [testfixtures](https://pypi.python.org/pypi/testfixtures) 5 | * Compute a property lazily and only once: http://pypi.python.org/pypi/lazy 6 | * Profiling in production 7 | * [statprof](https://pypi.python.org/pypi/statprof/) - profiling via statistical sampling 8 | * [Python Low-Overhead Profiler](https://github.com/bdarnell/plop) 9 | * [Vulture - dead code finder](http://pypi.python.org/pypi/vulture) 10 | * https://pypi.python.org/pypi/caniusepython3 11 | * [GvR explains Twisted Deferreds](https://groups.google.com/forum/#!topic/python-tulip/ut4vTG-08k8/discussion) 12 | 13 | To disable nose and pylint simultaneously: 14 | ```py 15 | some_line_of_code() # pragma: nocover # pylint: disable=F0401,W0612 16 | ``` 17 | -------------------------------------------------------------------------------- /wiki/devops/things-to-monitor.md: -------------------------------------------------------------------------------- 1 | (Based largely on http://word.bitly.com/post/74839060954/ten-things-to-monitor?h=2) 2 | 3 | * rate of new process creation (`fork()` rate) 4 | * flow control packets 5 | * swap rate 6 | * (unexpected) system reboots 7 | * clock accuracy/skew 8 | * ensure that ntpd is running 9 | * whether your SSL certificates are still valid (haven't expired yet) 10 | * number of open file descriptors vs. the configured fd limit 11 | * number of open connections of server application (e.g. MySQL) vs. configured connection limit 12 | * service restart rate (assuming auto-restart is setup) 13 | * DNS 14 | * whether external users can resolve your domains 15 | * perf stats on your internal DNS servers 16 | * whether your upstream DNS server is working 17 | * DB slave replication status 18 | * the obvious ones: CPU, RAM, disk space 19 | * max subdirectories in a single directory (Ext3 w/o dir_index has a limit of 32K subdirs) 20 | * free inodes per filesystem 21 | * number of cgroups 22 | -------------------------------------------------------------------------------- /wiki/win11.md: -------------------------------------------------------------------------------- 1 | ## Windows 11 2 | 3 | * Permanently disable "Sign in to your Microsoft account" [nag](https://www.deceptive.design/types/nagging) notification in the Start Menu, that only offers a "Remind me later" option and no "Never ask again" option. 4 | 1. Settings ❯ Personalization ❯ Start ❯ Show account related notifications occasionally in Start 5 | 2. Done. Registry-based alternative: `regedit` 6 | 3. `HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\AccountNotifications` 7 | 4. New DWORD: `DisableAccountNotifications` Data value: 1 8 | * [ElevenForum: Disable ads in Windows 11](https://www.elevenforum.com/t/disable-ads-in-windows-11.8004/) 9 | * Disable tracking that's not even utilized anymore: 10 | * Settings ❯ Privacy & security ❯ Activity history 11 | * Edge: 12 | 1. Navigate to `edge://flags` 13 | 2. Search for and disable anything involving "Bing". 14 | 15 | ### Development 16 | * [WSL file paths](https://learn.microsoft.com/en-us/windows/wsl/setup/environment#file-storage) 17 | -------------------------------------------------------------------------------- /wiki/proglangs/misc-features.md: -------------------------------------------------------------------------------- 1 | * [Branch likeliness annotations](http://stackoverflow.com/questions/109710/likely-unlikely-macros-in-the-linux-kernel) 2 | * `if likely <condition>:` / `if unlikely <condition>:` 3 | * Integrated unit test runner: `foo-compiler test` to run test suite (assume some conventions) 4 | * [What are the coolest/best features ever created in programming languages?](http://www.reddit.com/r/ProgrammingLanguages/comments/15ofha/what_are_the_coolestbest_features_ever_created_in/) 5 | * [Interesting features from various modern programming languages](https://news.ycombinator.com/item?id=15668256) 6 | * [Why aren't user-defined operators more common?](http://www.reddit.com/r/programming/comments/15ob1l/why_arent_userdefined_operators_more_common/) 7 | * [VerbalExpressions - regex alternative](https://github.com/VerbalExpressions/ScalaVerbalExpressions) 8 | * `tandem`/`simultaneous`/`atomic`/`together` keyword/block 9 | * e.g. `tandem { first_box_ball_count--; other_boxes_ball_count++; }` 10 | * e.g. `tandem { self.length++; self.elements[index] = new_elem; }` 11 | * [TiML: A Functional Programming Language with Time Complexity](https://github.com/mit-plv/timl) 12 | -------------------------------------------------------------------------------- /wiki/proglangs/tower-defense.md: -------------------------------------------------------------------------------- 1 | > The Tower Defense model is an approach to software reliability that focuses on catching bugs at the lowest level, to avoid the inevitable combinatorial explosion in test coverage surface area. In other words, deal with problems like these at the language level, so there is NO NEED to deal with them at a higher process-level. 2 | > 3 | > No one is disputing that processes, QA or Devops couldn't/shouldn't hypothetically catch these bugs before entering production. The problem of course is that they usually don't, because the lower level defenses are allowing too many bugs through, that they really shouldn't and the higher level processes become overwhelmed, fail, and allow bugs to cross the critical production threshold. 4 | > 5 | > This means always giving higher priority to lower-level methods of reliability. For example, 6 | > 7 | > * Language rules are more important than 8 | > * Unit tests are more important than 9 | > * Integration tests are more important than 10 | > * Code reviews are more important than 11 | > * QA is more important than 12 | > * Monitoring is more important than 13 | > * Bug reports 14 | > 15 | > -- [eldude](https://news.ycombinator.com/user?id=eldude) in https://news.ycombinator.com/item?id=7599717 16 | -------------------------------------------------------------------------------- /wiki/win11-fixes.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System] 4 | "NoLocalPasswordResetQuestions"=dword:00000001 5 | ;Disable password resets via answering security questions. 6 | 7 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] 8 | "verbosestatus"=dword:00000001 9 | ;More detailed logon/logoff/bootup/shutdown screen messages. 10 | ; https://learn.microsoft.com/en-us/troubleshoot/windows-server/performance/enable-verbose-startup-shutdown-logon-logoff-status-messages 11 | 12 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge] 13 | "BrowserSignin"=dword:00000000 14 | ;Disable ability to sign into Edge (via a Microsoft Account). 15 | ; https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies#browsersignin 16 | "DefaultBrowserSettingEnabled"=dword:00000000 17 | ;Disable prompts asking to make Edge the default browser. 18 | "DefaultBrowserSettingsCampaignEnabled"=dword:00000000 19 | ;Disable periodic prompts that forcibly revert the default search engine to Bing. 20 | ; https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies#defaultbrowsersettingscampaignenabled 21 | 22 | [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\AccountNotifications] 23 | "DisableAccountNotifications"=dword:00000001 24 | ;Permanently disable "Sign in to your Microsoft account" nag notification in Start Menu. 25 | 26 | [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer] 27 | "DisableSearchBoxSuggestions"=dword:00000001 28 | ;Disable Web results in Start Menu search. 29 | -------------------------------------------------------------------------------- /wiki/cars.md: -------------------------------------------------------------------------------- 1 | # Car Shopping 2 | 3 | ## Leasing 4 | 5 | * APR = `(Money Factor) * 2400` 6 | * Verify that the lease is "closed-end". 7 | * Term should be max. 36 months. Only accept longer if cheaper and still within warranty period. 8 | 9 | ## Verify 10 | 11 | * Spare tire 12 | * Whether included, or whether there's space for one. 13 | * Cross out any bogus extras/fees on the contract 14 | * That paperwork is full/complete. No blanks, no other sections. 15 | * If leasing, that the Money Factor in the contract is correct 16 | 17 | ## Pricing 18 | 19 | * Check window sticker price 20 | * Financing/rebates don't depend on the price. 21 | * Down payment: (Circa 2017) $2-3K max. 22 | * Use credit card, if possible. For points & protection. 23 | * Typical profit is ~2-3% of MSRP 24 | * Compare **capitalized** cost across dealers 25 | 26 | ### Bogus Fees/Charges 27 | 28 | * Rustproofing 29 | * Fabric protection 30 | * Paint protect/seal 31 | * VIN etching 32 | * Extended warranty 33 | * Anti-theft system 34 | * Pinstriping 35 | * Disability Insurance 36 | * Credit Life Insurance 37 | * Locate/Procurement fee 38 | * The following are redundant to the destination charge: 39 | * Pre-delivery inspection fee 40 | * Delivery fee 41 | * Dealer Prep fee 42 | * (Manufacturers alrerady pay dealers to clean/prep the cars.) 43 | 44 | ### OK Fees 45 | 46 | * Destination charge 47 | * Advertising charge 48 | * Should be pre-agreed 49 | * Documentation/Conveyance fee 50 | * Consider as part of total price 51 | * GAP insurance 52 | * If not included, purchase yourself separately 53 | * Title & registration 54 | * Sales tax 55 | 56 | ## Unnecessary Features for You 57 | 58 | * AWD 59 | 60 | ## Test Drive 61 | 62 | * Plan out a route beforehand 63 | * Include highway portion 64 | * Speedometer, after adjusting wheel 65 | * Steering wheel controls 66 | * Acceleration, Brakes, Steering 67 | * Engine+Wind noise 68 | * Passenger seat comfort 69 | 70 | -------------------------------------------------------------------------------- /wiki/sql-grievances.md: -------------------------------------------------------------------------------- 1 | (Postgres fixes at least some of these. I've only had hands-on experience with MySQL.) 2 | 3 | * No first-class list/array support 4 | * [SQLAlchemy workaround](http://docs.sqlalchemy.org/en/latest/orm/extensions/orderinglist.html) 5 | * Having to manually specify `JOIN` conditions, when very often there's only 1 sensible way to do the JOIN 6 | * SQL's syntax isn't nicely composable. 7 | * e.g. I can't just tack on another `WHERE` clause to filter things further, the clauses must appear in a specific order, etc. 8 | * I mean, you could use lots of nested subqueries, but it's fugly and probably doesn't optimize well. 9 | * Quoting of names varies by SQL implementation; e.g. `[MyArbitrarilyNamedTable]` in MS SQL Server vs. `` `MyArbitrarilyNamedTable` `` in MySQL 10 | * Column type definitions default to nullable, implicitly. 11 | * Too easy to accidentally write an unindexed query; should issue a warning which can be upgraded to an error via configuration 12 | * [Coping mechanism](http://danbirken.com/quicktip/2014/04/16/improve-developer-habits-with-db-diagnostisc.html) 13 | * Awkwardness of "backwards" JOINs 14 | * MySQL doesn't default to UTF-8 encoding for strings; it uses Latin-1... 15 | * MySQL doesn't default to UTC timezone 16 | * MySQL has several layers of timezone settings: system, server, and connection timezones 17 | * [Terrible choices: MySQL](http://blog.ionelmc.ro/2014/12/28/terrible-choices-mysql/) 18 | * [MySQL? Choose something else.](http://grimoire.ca/mysql/choose-something-else) 19 | * Audit logging not built-in 20 | * Soft deletion not built-in 21 | * Trailing/leading spaces in text fields 22 | * Trees are kinda cumbersome 23 | * However: [Representing Trees in PostgreSQL](https://woss.name/articles/representing-trees-in-postgresql/) ([HN](https://news.ycombinator.com/item?id=8642035)) 24 | * SQL is not the last word in databases 25 | * [Immutable databases and automatic caching](http://blog.confluent.io/2015/03/04/turning-the-database-inside-out-with-apache-samza/) 26 | -------------------------------------------------------------------------------- /wiki/uncategorized.md: -------------------------------------------------------------------------------- 1 | * [Out of the Tar Pit; Ben Moseley & Peter Marks; 2006-02-06](http://shaffner.us/cs/papers/tarpit.pdf) 2 | * [Use of Formal Methods at AWS](http://research.microsoft.com/en-us/um/people/lamport/tla/amazon.html) 3 | * [Akka Cheatsheet](https://github.com/sjuvekar/reactive-programming-scala/blob/master/ReactiveCheatSheet.md) 4 | * [A Practical Soft Type System for Scheme](http://www.cs.rice.edu/CS/PLT/Publications/Scheme/lfp94-wc.ps.gz) 5 | * [Knockout 3.2.0](http://blog.stevensanderson.com/2014/08/18/knockout-3-2-0-released/) 6 | * http://www.forbes.com/sites/travisbradberry/2014/02/06/how-successful-people-stay-calm/ 7 | * [The Essence of Algol](http://www.cs.cmu.edu/~crary/819-f09/Reynolds81.ps) 8 | * [Odersky: The trouble with types](http://www.reddit.com/r/programming/comments/1ptiy2/martin_odersky_the_trouble_with_types/) 9 | * [Simon Peyton Jones - Haskell is useless](http://www.reddit.com/r/programming/comments/1pstav/haskell_is_useless/) 10 | * [Intro to Moose](http://www.houseabsolute.com/presentations/intro-moose-class/) 11 | * [Everything is a stream](http://deanwampler.github.io/polyglotprogramming/papers/ReactiveDesignLanguagesAndParadigms.pdf) 12 | * [Further app arch](http://martinfowler.com/eaaDev/) 13 | * [The little manual of API design](http://www4.in.tum.de/~blanchet/api-design.pdf) 14 | * [A Programmer's Guide to Data Mining](http://guidetodatamining.com) 15 | * [CONS Should Not CONS Its Arguments, Part II](http://www.pipeline.com/~hbaker1/CheneyMTA.html) 16 | * http://www.cs.princeton.edu/~rs/talks/ScienceCS10.pdf 17 | * [The Downfall of Imperative Programming](http://www.reddit.com/r/programming/comments/s112h/the_downfall_of_imperative_programming_functional/) 18 | * [C11: A New C Standard Aiming at Safer Programming](http://blog.smartbear.com/codereviewer/c11-a-new-c-standard-aiming-at-safer-programming/) 19 | * [Machine Learning for Programming](http://www.infoq.com/presentations/machine-learning-general-programming) 20 | * https://sourcegraph.com/blog/live/gopherconindia/111854129512 21 | -------------------------------------------------------------------------------- /wiki/web.md: -------------------------------------------------------------------------------- 1 | * [Switch to HTTPS Now, For Free](https://konklone.com/post/switch-to-https-now-for-free) 2 | * [The Flask Mega-Tutorial](http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world) 3 | * [Pagination: You're (Probably) Doing It Wrong.](http://www.reddit.com/r/programming/comments/1ae0tl/pagination_youre_probably_doing_it_wrong/) 4 | * [Coaster: lib for common Flask stuff](https://github.com/hasgeek/coaster) 5 | * [JSON isn't a JS subset](https://medium.com/joys-of-javascript/42a28471221d) 6 | * [The JavaScript Problem](http://www.haskell.org/haskellwiki/The_JavaScript_Problem) 7 | * [TypeScript](http://www.typescriptlang.org/) 8 | * [Auto-updating "N time-units ago" delta strings](http://timeago.yarp.com/) 9 | * [History.js: History API polyfill/wrapper](https://github.com/browserstate/history.js) 10 | * [Zed A. Shaw - The Web Will Die When OOP Dies](http://vimeo.com/m/43380467) 11 | * [Searchable AJAX-powered `<select>` widget](https://github.com/brianreavis/selectize.js) 12 | * [DOMLint](http://kangax.github.io/domlint/) 13 | * JS Best Practices? https://news.ycombinator.com/item?id=5393419 14 | * [Eloquent JavaScript](http://eloquentjavascript.net/contents.html) 15 | * [Learning JavaScript Design Patterns](http://addyosmani.com/resources/essentialjsdesignpatterns/book/) 16 | * [JS The Right Way](http://jstherightway.com/) 17 | * [Learning Advanced JavaScript](http://ejohn.org/apps/learn/) 18 | * [Large-Scale JS Application Architecture](http://addyosmani.com/largescalejavascript/) 19 | * [MVC Architecture for JS](http://michaux.ca/articles/mvc-architecture-for-javascript-applications) 20 | * [Incomplete List of Mistakes in the Design of CSS](https://wiki.csswg.org/ideas/mistakes) 21 | * https://news.ycombinator.com/item?id=10453850 22 | * [About HTML semantics and front-end architecture – Nicolas Gallagher](http://nicolasgallagher.com/about-html-semantics-front-end-architecture/), or why "semantic" is bullshit 23 | * ["The Web is an error condition"](http://deirdre.net/programming-sucks-why-i-quit/) 24 | -------------------------------------------------------------------------------- /wiki/proglangs/compiler-construction.md: -------------------------------------------------------------------------------- 1 | * [Why Rebol Red's Parse dialect is Cool vs. Regex/CFG](http://blog.hostilefork.com/why-rebol-red-parse-cool/) 2 | * [What's wrong w/ Scala, according to its compiler writer](http://www.youtube.com/watch?v=TS1lpKBMkgg) 3 | * [Example interpreter using PyPy](https://bitbucket.org/pypy/example-interpreter) 4 | * [LLVM Tutorial](http://llvm.org/docs/tutorial/LangImpl1.html) 5 | * [How Dalvik works](http://www.slideshare.net/jserv/understanding-the-dalvik-virtual-machine) 6 | * [inline cache applications in scheme](http://wingolog.org/archives/2012/05/29/inline-cache-applications-in-scheme) 7 | * [Mapping High-Level Constructs to LLVM IR](http://llvm.lyngvig.org/Articles/Mapping-High-Level-Constructs-to-LLVM-IR) 8 | * [MinCaml: Beautiful Japan's ML Compiler](http://esumii.github.io/min-caml/index-e.html) 9 | * [So, You Want To Write Your Own Language? (by Walter Bright)](http://www.reddit.com/r/programming/comments/1vtm2l/so_you_want_to_write_your_own_language_dr_dobbs/) 10 | * [Growing a Language, by Guy Steele (OOPSLA, 1998)](http://www.reddit.com/r/programming/comments/19gsaz/growing_a_language_by_guy_steele_oopsla_1998/) 11 | * [The Joy of Joy](http://ncreep.github.io/language_perils/blog/2013-03-18-the-joy-of-joy.html) 12 | * [Multi-assignment syntax](https://blog.mozilla.org/dherman/2011/12/01/now-thats-a-nice-stache/) 13 | * [Reactive Extensions: Rx](https://rx.codeplex.com/) 14 | * [Let's Write an LLVM Specializer for Python](http://dev.stephendiehl.com/numpile/) 15 | * [Compiler Design in C](http://www.holub.com/software/compiler.design.in.c.html) 16 | * [Some problems of recursive descent parsers](http://eli.thegreenplace.net/2009/03/14/some-problems-of-recursive-descent-parsers) 17 | * [LL and LR in Context: Why Parsing Tools Are Hard](http://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsing-tools.html) 18 | * [Resources for Amateur Compiler Writers](http://c9x.me/comp-bib/) 19 | * http://www.reddit.com/r/programming/comments/1sl483/stanford_computer_science_lectures_about/ 20 | * [A Complete Guide to LLVM for Programming Language Creators](https://www.reddit.com/r/programming/comments/kjjijf/a_complete_guide_to_llvm_for_programming_language/) 21 | -------------------------------------------------------------------------------- /wiki/humor.md: -------------------------------------------------------------------------------- 1 | * [How many software developers would it take to change a lightbulb?](http://tommorris.org/posts/8786) 2 | * [Never given enough time to do it right](https://twitter.com/jaykreps/status/296459382718349314) 3 | * [HTML9 Responsive Boilerstrap JS](http://html9responsiveboilerstrapjs.com) 4 | * [Why are there so many JS frameworks?](http://www.reddit.com/r/programming/comments/1wl5f3/you_might_not_need_jquery/cf36d8k?context=1) 5 | * [The Birth and Death of JavaScript](https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript) 6 | * [Cocktails for programmers](https://github.com/the-teacher/cocktails_for_programmers/blob/master/cocktails_for_programers.md) 7 | * [If programming languages were cars](http://users.cms.caltech.edu/~mvanier/hacking/rants/cars.html) 8 | * [Nepal Standard Time = UTC+12:45](https://en.wikipedia.org/wiki/Nepal_Standard_Time) 9 | * [The Emularity — January 23, 2015 (Jason Scott)](http://ascii.textfiles.com/archives/4546) (Running Windows 3.1 in JavaScript) 10 | * [Relentless Persistence - July 9, 2015 (Cube Drone)](http://cube-drone.com/comics/c/relentless-persistence). The JavaScript ecosystem. 11 | * [Ingeniuty of Sorts - Nov 16, 2014 (Cube Drone)](http://cube-drone.com/comics/c/ingeniuty-of-sorts). PHP masochists. 12 | * [Dear Guy Who Just Made My Burrito](https://medium.com/@luckyshirt/dear-guy-who-just-made-my-burrito-fd08c0babb57) 13 | * [How to get help with Linux: Insult it](http://bash.org/?152037) 14 | * [Cunningham's Law](https://meta.wikimedia.org/wiki/Cunningham%27s_Law): "The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer." 15 | * <blockquote>Should be entitled "The tragic history of CSS episode n" where n is any number between 0 and infinity. 16 | CSS is a complete utter crap that failed to solve the problems for which it exists. Today CSS is a broken tool that still can't easily be used to design even the most basic layout without requiring a ton of hacks. — [0x4a42](https://news.ycombinator.com/item?id=10395078)</blockquote> 17 | * <blockquote>The "otherwise excellent design of CSS"? That's something I've never heard anyone say... — [wmil](https://news.ycombinator.com/item?id=10394958)</blockquote> 18 | -------------------------------------------------------------------------------- /wiki/jobhunting-and-employment.md: -------------------------------------------------------------------------------- 1 | * Questions 2 | * Interviewer load & process 3 | * Performance eval process 4 | * WFH/WFO(Office) policy 5 | * Socialization for remote workers 6 | * [Jobs at Incidental Complexity](http://incidentalcomplexity.com/hiring/) 7 | * http://www.baysano.com/b/top-companies-hiring-scala-engineers-cm574 8 | * http://www.typesafe.com/customers/our-customers-are-hiring 9 | * [The Open Guide to Equity Compensation](https://github.com/jlevy/og-equity-compensation) 10 | * [How Liquidation Preferences Work](http://www.businessinsider.com/how-liquidation-preferences-work-2014-3) 11 | * [Startup Employee Equity Bill of Rights](http://www.businessinsider.com/startup-employee-equity-bill-of-rights-2014-3) 12 | * [Employees That Stay In Companies Longer Get Paid Less](http://www.forbes.com/sites/cameronkeng/2014/06/22/employees-that-stay-in-companies-longer-than-2-years-get-paid-50-less/) ([HN](https://news.ycombinator.com/item?id=7928008)) 13 | * [Most software engineering interview questions of hot tech companies in one place](http://www.reddit.com/r/programming/comments/2q78ze/most_software_engineering_interview_questions_of) 14 | * [Salary comparisons](http://www.reddit.com/r/personalfinance/comments/2t1zds/i_currently_make_71500_i_was_offered_a_promotion/cnv0fau) 15 | * [Questions to ask your potential employer](https://web.archive.org/web/20140101200009/http://www.stefankendall.com/2013/11/10-questions-to-ask-your-potential.html) ([HN](https://news.ycombinator.com/item?id=6701707)) 16 | * [How do you get Google/Microsoft/Facebook's recruiters' attention?](http://www.quora.com/Engineering-Recruiting/How-do-you-get-Google-Microsoft-Facebooks-recruiter-attention-as-a-student) 17 | * [Google employees confess the worst things about working at Google](http://www.reddit.com/r/programming/comments/1pto3b/google_employees_confess_the_worst_things_about/) 18 | * [What's the best place to find Scala job postings?](http://www.reddit.com/r/scala/comments/2t86tt/whats_the_best_place_to_find_scala_job_postings/) 19 | * [Top Recruiter Reveals the Perfect Technical Resume](http://www.careercommits.com/blog/top-recruiter-reveals-the-perfect-technical-resume/) 20 | * [Startup vs. Corporate Life](http://blog.lawnstarter.com/post/87331474878/startup-vs-corporate-life) ([HN](https://news.ycombinator.com/item?id=7825818)) 21 | -------------------------------------------------------------------------------- /wiki/where-to-live.md: -------------------------------------------------------------------------------- 1 | # Choosing Where to Live: Considerations 2 | 3 | * Individual dwelling 4 | * Non-proximity to 5 | * Superfund sites 6 | * Industrial businesses 7 | * Gas station / Car repair / Oil change 8 | * Ambient environmental quality 9 | * Air quality 10 | * Noise pollution 11 | * From traffic 12 | * From church bells 13 | * From schools 14 | * From children playing after school 15 | * Non-presence of 16 | * Lead paint 17 | * Asbestos 18 | * For remote jobs: 19 | * Commute distance to co-working space or cafe/library 20 | * Home-office room in separate floor/building 21 | * Local area 22 | * Weather microclimate (if applicable) 23 | * Walkability / Bikeability 24 | * Public transit 25 | * For in-person jobs: 26 | * Commute distance; see US Census' "Mean travel time to work" 27 | * Public parks, Public pools 28 | * Low crime rate 29 | * Fast Internet speeds 30 | * Supermarket proximity 31 | * Eateries/Restaurants/Bars/Cafes 32 | * Burrito, Indian curry, Thai curry, Fish, Brunch/Diner 33 | * Mobile Internet coverage 34 | * Entertainment venues 35 | * Movie theater 36 | * ~~School quality/cost~~ 37 | * Metro area 38 | * Proximity to family/friends 39 | * Weather 40 | * Humidity 41 | * I hate it, but tolerable with A/C. And how many outdoor activites do I partake in? 42 | * Amount of sunny vs. overcast days 43 | * See: Why dad left Pittsburgh 44 | * Amount of rain/snow 45 | * Is Washington/Oregon acceptable? 46 | * Typical temperatures 47 | * Wind speed (see Daly City, Chicago) 48 | * Typical sunset time (Latitude) 49 | * I hear Scotland can be depressing because of this? 50 | * Prevalence of house bugs (roaches, centipedes, etc.) 51 | * Correlates with weather and urbanity 52 | * Employers in the Tech industry 53 | * Activities/Groups/Events of interest 54 | * TODO 55 | * Proximity to nature 56 | * Beaches, Forests, Mountains, Rivers/Lakes 57 | * Decent hosptial system 58 | * Airport / National-level Train Station, for ability to travel 59 | * Entertainment venues 60 | * Music venue 61 | * Theatre 62 | * Comedy club 63 | * Nightclub 64 | * ~~Sports~~ 65 | * ~~Opera~~ 66 | * ~~Orchestra~~ 67 | * Cultural norms 68 | * Diversity 69 | * Religiosity 70 | * State / National 71 | * Developed country 72 | * Politics, Political system 73 | * Parliamentary system 74 | * Modern, non-plurality voting system; e.g. Proportional representation 75 | * Current threat level of fascism 76 | * Languages 77 | * Use of English as working language 78 | * Prevalence & acceptability of English 79 | * Difficulty level of local language 80 | * Immigration requirements 81 | * Xenophobia level 82 | * Cost of living 83 | * House prices / Rent prices 84 | * Tax rates 85 | * Utility rates 86 | * Public health 87 | * COVID vaccination level 88 | * COVID death rate 89 | * Natural disaster risk 90 | * Affected by climate change 91 | * Can be individually mitigated 92 | * Heat wave (by A/C) 93 | * Power outage caused by natural disaster 94 | * Requires regional planning 95 | * Blizzard 96 | * Drought 97 | * Wildfire 98 | * Flood 99 | * Sea level rise 100 | * Smoke drift from wildfire 101 | * Tornado / Hurricane / Typhoon 102 | * Earthquake / Tsunami 103 | * ~~Volcanic eruption~~ 104 | -------------------------------------------------------------------------------- /blog/misc-web.md: -------------------------------------------------------------------------------- 1 | ## Not as simple as you thought: the humble `<input type="text">` 2 | * Doing the bare minimum is trivial. Doing it with optimal UX isn't. 3 | * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input 4 | * `autocapitalize`: `none`/etc. E.g. Stop trying to capitalize my username 5 | * `autocomplete="off"` (if you want to avoid the Firefox persistent disabledness bug) 6 | * I know how my username is spelled, dammit! 7 | * `autocorrect="off"` 8 | * `spellcheck="false"` 9 | * `inputmode` 10 | * `verbatim` for non-prose 11 | * `numeric` for ID "numbers" 12 | * `autofocus`, on a page-wide basis 13 | * Griping about `:invalid` 14 | * Leading/trailing spaces 15 | * Masking out invalid characters 16 | * Ignoring punctuation 17 | 18 | ## Tangent: The Web stack sucks 19 | 20 | [all] [these] [browser] [bugs] 21 | [how did this pass QA?] 22 | "leave your sense of logic at the door" indeed 23 | N different vendors 24 | design by committee prog langs in general 25 | 26 | ### JS sucks 27 | preface: Python 28 | `this` craziness 29 | no integers craziness 30 | weak typing 31 | N different module systems 32 | Wat. 33 | 34 | JS tooling ecosystem 35 | puzzle solving 36 | perverse incentives 37 | self-inflicted/artificial problems 38 | 39 | ### CSS sucks 40 | no module system 41 | all the selectors suck 42 | it's the future, where's my damn "has X child" selector yet 43 | or perhaps, IE sucks 44 | 45 | ### HTML sucks 46 | an advanced video game system with an obtuse and either primitive or oversimplified interface 47 | "semantic" 48 | ARIA kinda sorta 49 | mdoml 50 | but it's popular 51 | but, Web Components! 52 | damn overcomplicated 53 | 54 | ## Tangent: designer hate 55 | native vs. custom 56 | they give you the world, and you toss it aside 57 | you vs. Apple/Microsoft/GoogleAndroid 58 | folks are familiar with native anyway 59 | 60 | ## Tangent: The GitHub issue tracker is mediocre 61 | The GitHub issue tracker is very simple and lightweight. Aside from its search and milestone features, and its commit message integration, it's close to a minimal viable bug tracking product. It's missing some a few features that would alleviate a lot of pain for projects that get lots of issues. 62 | * Unlike Bugzilla or Chromium's issue tracker, we can't present a template for the user to fill out when reporting their issue. Thus, issue triagers must waste time posting follow-up comments asking the OP for information that they really ought to have included in the initial post (e.g. What version of the program are you using? What platform are you using? Example that demonstrates the problem (screenshots don't count!)?) 63 | * No explicit tracking of duplicates. 64 | * A "similar issues" prompt when reporting new bugs. Bugzilla has this. This makes the "search for duplicates" step of the bug reporting process easier & mandatory. You will quickly learn that without this, many folks won't bother searching for duplicates, or will neglect to include closed issues in the search (Guess what? Your issue was already reported and has been fixed in `master`! We just haven't rolled a release yet.). 65 | 66 | # Tangent: Bower / Web packaging sucks 67 | deps on bootstrap-sass vs. bootstrap-less (vs. hypothetical bootstrap-css) 68 | bower expects tools to trace the dep tree themselves 69 | `main` fiasco 70 | module formats 71 | tip about `version` being optional 72 | bower should error on asterisks in `main` 73 | bower should warn on CSS+(SASS/Less) in `main` 74 | bower should warn on fonts or images in `main` 75 | bower should warn on minified files in `main` 76 | * https://github.com/bower/bower/commit/1690dd4728c56803093428a61154300530f6cdd9 77 | bower is too unopinionated 78 | -------------------------------------------------------------------------------- /wiki/proglangs/plt.md: -------------------------------------------------------------------------------- 1 | * [Crash Course on Notation in Programming Language Theory](http://siek.blogspot.com/2012/07/crash-course-on-notation-in-programming.html) 2 | * [So You Still Don't Understand Hindley-Milner?](http://www.reddit.com/r/programming/comments/1fx1b7/so_you_still_dont_understand_hindleymilner/) 3 | * [Prog Lang Politics (Steve Yegge)](https://plus.google.com/u/0/110981030061712822816/posts/KaSKeg4vQtz) 4 | * [Why OO Sucks by Joe Armstrong](http://harmful.cat-v.org/software/OO_programming/why_oo_sucks) 5 | * [Not enough by Fogus](http://blog.fogus.me/2012/06/20/not-enough/) 6 | * [Socio-PLT: Principles for Programming Language Adoption by @LMeyerov](http://www.eecs.berkeley.edu/~lmeyerov/projects/socioplt/paper0413.pdf) 7 | * [F* and termination checking](http://www.reddit.com/r/programming/comments/23xzp3/f_a_dependentlytyped_variant_of_f_for_program/) 8 | * [Pipes.Tutorial: Stream processing done right](http://hackage.haskell.org/package/pipes-4.0.0/docs/Pipes-Tutorial.html) 9 | * [Programming with Managed Time](http://research.microsoft.com/pubs/211297/managedtime.pdf) 10 | * https://news.ycombinator.com/item?id=7702796 11 | * [Great Works in Programming Languages, Benjamin C. Pierce](http://www.cis.upenn.edu/~bcpierce/courses/670Fall04/GreatWorksInPL.shtml) 12 | * [Dart for the Language Enthusiast](http://www.infoq.com/presentations/dart-introduction) 13 | * [Backpack: Retrofitting Haskell with Interfaces, by SPJ et al.](http://plv.mpi-sws.org/backpack/) 14 | * [Rust: Aliasing + Mutability = Problems](https://air.mozilla.org/guaranteeing-memory-safety-in-rust/) 15 | * On operator overloading, type conversion, and symmetry 16 | * [C#: Inconsistent equality](http://www.reddit.com/r/programming/comments/1vae5d/c_inconsistent_equality/) 17 | * [Go at Google: Language Design in the Service of Software Engineering, by Rob Pike at SPLASH 2012](http://talks.golang.org/2012/splash.article) 18 | * [The issue is that programming languages don¹t go forward, they move sideways or diagonally, or sometimes backwards.](http://chrisdone.com/posts/one-step-forward-two-steps-back) 19 | * [Toward a better programming](http://www.chris-granger.com/2014/03/27/toward-a-better-programming/) 20 | * [Oberon - The Overlooked Jewel, by Michael Franz](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.103.7874&rank=1) 21 | * [Gradual Typing for Functional Languages](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.61.8890) 22 | * [Liquid Types](http://goto.ucsd.edu/~rjhala/papers/liquid_types.pdf) 23 | * [Progressive Types; Politz; Brown Univ.](http://cs.brown.edu/research/plt/dl/progressive-types/progressive-types.pdf) 24 | * [Cross-language syntax comparison](http://rigaux.org/language-study/syntax-across-languages/) 25 | * "Make illegal behavioral interactions (particularly WRT subclassing) fail to compile" 26 | * Avoid bidirectional relationships between components 27 | * Composition over inheritance 28 | * Scala & Perl suffer from syntactic diabetes 29 | * http://homotopytypetheory.org/book/ 30 | * [So you want to learn type theory... but where to start? Here are some suggestions.](http://purelytheoretical.com/sywtltt.html) 31 | * [Ada, C, C++, and Java vs. The Steelman](http://www.dwheeler.com/steelman/steeltab.htm) 32 | * [Program-Transformation.Org, The Program Transformation Wiki](http://www.program-transformation.org/) 33 | * ["Data oriented" demo of Jonathan Blow's new language](http://www.reddit.com/r/programming/comments/2t7wuu/data_oriented_demo_of_jonathan_blows_new_language/) 34 | * [Callbacks: What color is your function?](http://www.reddit.com/r/programming/comments/2ugvzr/what_color_is_your_function/) 35 | * [Practical Category Theory](http://www.infoq.com/presentations/functional-category-theory) 36 | * [Refinements in Ruby 2.1](http://rkh.im/ruby-2.1) 37 | * [Dependent Types At Work](http://www.cse.chalmers.se/~peterd/papers/DependentTypesAtWork.pdf) 38 | * [The theory behind covariance and contravariance in C# 4](http://www.reddit.com/r/programming/comments/v9uk6/the_theory_behind_covariance_and_contravariance/) 39 | * [Sylph: the programming language I want, by eevee](eev.ee/blog/2015/02/28/sylph-the-programming-language-i-want/) 40 | * [Loyc language](http://loyc.net) 41 | * [Compiler Errors for Humans](http://elm-lang.org/blog/compiler-errors-for-humans) (compiler error message UX) 42 | * [Compilers as Assistants](http://elm-lang.org/blog/compilers-as-assistants) 43 | * [Things Rust shipped without](http://graydon2.dreamwidth.org/218040.html) 44 | * [Swift Evolution Proposal 0004: Remove the `++` and `--` operators](https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md) 45 | * [Midori: Microsoft's discontinued internal research language](http://joeduffyblog.com/2015/11/03/blogging-about-midori/) 46 | * [Midori's error-handling model](http://joeduffyblog.com/2016/02/07/the-error-model/) 47 | * https://wiki.theory.org/index.php/YourLanguageSucks 48 | * [Near Future of Programming Languages](https://news.ycombinator.com/item?id=15582429) 49 | * [Chris Lattner: The Future of Computing and Programming Languages](https://lexfridman.com/chris-lattner-2/) 50 | * [Thinking with Types (eBook)](https://leanpub.com/thinking-with-types) 51 | 52 | > barrkel on HN: 53 | > There's a simple concept that one should bear in mind when designing APIs: "pit of success" (credit to Rico Mariani). 54 | > That is, failure should take effort. Dangerous options should be more laborious to express. The happy path should be the most concise and straightforward path. 55 | -------------------------------------------------------------------------------- /blog/bootstrap.md: -------------------------------------------------------------------------------- 1 | ## Why Bootstrap? 2 | So, let's start at the beginning. Why start using Bootstrap in the first place? Bootstrap appeals to a few different audiences, but for me as a backend developer, I started using it for internal apps because: 3 | * I would like my app to not look completely plain/barebones, as it would without any CSS (or barely any CSS). 4 | * Since this is an internal app, I don't have any significant branding or exact look-and-feel requirements that I'm required to adhere to. 5 | * I am not an artist/designer and don't have one at my disposal. It would be difficult to come up with a pleasing visual design on my own from scratch. 6 | * CSS can be rather arcane. Outwardly, the common "Holy Grail Layout" looks simple and reasonable, yet there are entire articles on how to achieve it in CSS with varying degrees of kludginess. There are several other examples of simple things requiring unnecessary complexity. 7 | * (Yes, [flexbox now makes this particular case pretty simple](http://philipwalton.github.io/solved-by-flexbox/demos/holy-grail/) and sane, but [browser support limitations](http://caniuse.com/#feat=flexbox) (and [bugs in some versions of the implementations](https://github.com/philipwalton/flexbugs)) prevent it from being a option for lots of folks.) 8 | * I want to avoid having to directly deal with browser bugs and inconsistencies as much as possible. Bootstrap works around (or at least documents) these so I don't have to. 9 | 10 | ## Getting involved 11 | 12 | How first involved 13 | 14 | First somewhat nontrivial commit 15 | ``` 16 | fixes #5494: style invalid fields as invalid regardless of required-ness 17 | commit 76f9c9128e95f55efee66ade30b7f8a31b34208e 18 | Author: Chris Rebert 19 | Date: Sun Nov 4 18:26:25 2012 -0800 20 | ``` 21 | First refactoring commit 22 | ``` 23 | refactor tables.less to use nesting more 24 | commit da072fff21f565521d3dbe1f5f4f42550ecc989e 25 | Author: Chris Rebert 26 | Date: Tue Jul 2 11:25:57 2013 -0700 27 | ``` 28 | 29 | ### Triage 30 | * [3,326 issues commented on](https://github.com/twbs/bootstrap/issues?q=commenter%3Acvrebert+type%3Aissue+-author%3Acvrebert) (as of 2014-01-16, excludes PRs, excludes issues I opened) 31 | * Assuming I started triaging with the first refactoring commit on 2013-07-02, that equates to: 32 | * ~5.9 issues per day 33 | * approx one issue every 4 hours 34 | * TL;DR: Bootstrap is crazy popular 35 | 36 | inundated with issues 37 | maintainers not active enough 38 | Haunt script horribleness 39 | debug stuff 40 | JS Bin is nice 41 | 42 | ## Sending patches 43 | 44 | Simple refactorings to reduce duplication in Less source 45 | The first patches I submitted were simple refactorings to reduce redundancy in the Less source code. Very little Less or CSS knowledge required. 46 | I also started submitting documentation patches to answer FAQs and common pitfalls that were coming up repeatedly on the issue tracker. 47 | Build system, since fat went AFK 48 | Testability 49 | Sauce Labs 50 | 51 | ## Going meta 52 | 53 | By this point, the number of spurious bug reports starts to get to me. They tend to fall into a few general categories: 54 | * Malformed HTML 55 | * Not adhering to the DOM structure prescribed by the docs 56 | * Not including jQuery 57 | * Many duplicate issues 58 | * Duplicates of issues fixed in `master` and thus closed 59 | 60 | (Cite Brooks' Law) 61 | 62 | And thus I had the germ of the idea for [LMVTFY](https://github.com/cvrebert/lmvtfy) and [Bootlint](https://github.com/twbs/bootlint) 63 | I was (and still mostly am) enfatuated with Scala at the time, so I used this as an excuse to learn and try out Akka and Spray (I mean, the actor model is the future, right?) 64 | Also [the HTML5 validator](https://github.com/validator/validator) is in Java, so a JVM language seems like an easy way to integrate with it. 65 | 66 | As for Bootlint, it needed to work on the command line to be able to interact with people on the issue tracker, and having folks be able to use it in the browser is a plus, thus, it's in JavaScript (sigh), although very strictly linted and pretty well unit-tested JS. 67 | Had to dig through a couple layers of Cheerio's dependency stack to get my main feature [outputting the line (and column) number where each mistake is](https://github.com/twbs/bootlint/issues/29) 68 | 69 | [Rorschach](https://github.com/twbs/rorschach) 70 | The basic problem is folks who don't understand the project structure and try to make changes directly to the compiled CSS instead of the source Less. Rorschach has seen less action than I'd anticipated, having lived through the pre-v3 era, but I speculate that contributions will ramp up in the pre-v4 era. 71 | 72 | For such a large project, the testing was fairly basic. The closest thing to CSS testing is looking through the docs. Mostly relied on hordes of users manually testing by finding issues in their own apps. 73 | 74 | [Savage](https://github.com/twbs/savage) 75 | the Sauce/Travis bug 76 | Sauce claimed to be working on it a while ago, but there have been no public updates since then. 77 | 78 | Most recently, I wrote [Gruntworker](https://github.com/twbs/gruntworker/), a simple script to keep our dist files up to date (if we're gonna have generated artifacts in the repo, we might as well completely automate the generation and keep it from ever getting too outdated). 79 | 80 | Future: No Carrier 81 | Problems of the issue tracker: 82 | * overall, folks expecting responses to posts on long-closed issues that aren't really being monitored anymore. 83 | * people thinking a long-closed issue is related to a current bug that they're seeing 84 | * often it's only superficially related 85 | * if it's a real regression, we'd much rather open a new bug to specifically track a regression anyway 86 | * +1's and "thanks" noise 87 | 88 | Future: [WebdriverCSS](https://github.com/webdriverio/webdrivercss-adminpanel) or Gemini 89 | 90 | customer service, jaded, soul-sucking 91 | -------------------------------------------------------------------------------- /wiki/james-mickens.md: -------------------------------------------------------------------------------- 1 | He is Infallible; You Are Lucky to Receive His Wisdom 2 | 3 | [Mickens is currently an Associate Professor and "Authority on all Things" at Harvard's School of Engineering & Applied Sciences.](http://mickens.seas.harvard.edu/wisdom-james-mickens) [Previously, he was at Microsoft Research.](https://web.archive.org/web/20150606055853/http://research.microsoft.com/en-us/people/mickens/) 4 | 5 | * [Atlantis: Robust, Extensible Execution Environments for Web Applications – SOSP 2011](http://www.youtube.com/watch?v=4c0DdOvH6lg) 6 | * "Your web browser is a trainwreck. It is one of the most adversarial programming environments that Satan has ever created." 7 | * "There's a dirty little secret about the Web. And that secret is that the aggregate Web protocol is actually a huge disaster." 8 | * "Each browser will fail you in different ways. And this is heartbreaking." 9 | * "These browsers are murderous thieves. And so what they do is they present you a flaky, semi-consistent set of APIs." 10 | * 'So take my hand, if you will, and join me on the garden path I like to call "Why the Suicide Rate for Web Developers is 89%".' 11 | * "Some of these DOM trees are vibrant and full of life, they're overflowing with joy. Other of these DOM trees are somewhat more minimal, but they still possess certain tree-like characteristics. And other DOM trees are so horrifying that I don't feel comfortable discussing them in polite conversation." 12 | * "So, in conclusion, we think that Web browsers have a lot of potential. Now, of course, when someone tells you you have a lot of potential, that means that you're actually failing right now." 13 | * [Computers are a Sadness, I am the Cure – Monitorama PDX 2014](https://vimeo.com/95066828) 14 | * USENIX humor columns [in PDF] 15 | * [This World of Ours](http://scholar.harvard.edu/files/mickens/files/thisworldofours.pdf) ([archive.org](https://web.archive.org/web/20150606055911/http://research.microsoft.com/en-us/people/mickens/thisworldofours.pdf)) (On how security research is focusing on the wrong problems) 16 | * [The Night Watch](http://scholar.harvard.edu/files/mickens/files/thenightwatch.pdf) ([archive.org](https://web.archive.org/web/20150606055857/http://research.microsoft.com/en-us/people/mickens/thenightwatch.pdf)) (On systems programmers being hardcore) 17 | * [The Saddest Moment](http://scholar.harvard.edu/files/mickens/files/thesaddestmoment.pdf) ([archive.org](https://web.archive.org/web/20150606055900/http://research.microsoft.com/en-us/people/mickens/thesaddestmoment.pdf)) (On Byzantine fault tolerance research) 18 | * [Mobile Computing Research Is a Hornet’s Nest of Deception and Chicanery](http://scholar.harvard.edu/files/mickens/files/nestofhornets.pdf) ([archive.org](https://web.archive.org/web/20150606055855/http://research.microsoft.com/en-us/people/mickens/nestofhornets.pdf)) (On the problems with smartphones and on mobile computing researchers' overoptimism) 19 | * [The Slow Winter](http://scholar.harvard.edu/files/mickens/files/theslowwinter.pdf) ([archive.org](https://web.archive.org/web/20150606055910/http://research.microsoft.com/en-us/people/mickens/theslowwinter.pdf)) (On the history and bleak future of CPU design) 20 | * [To Wash It All Away](http://scholar.harvard.edu/files/mickens/files/towashitallaway.pdf) ([archive.org](https://web.archive.org/web/20150606055905/http://research.microsoft.com/en-us/people/mickens/ToWashItAllAway.pdf)) (On the horror & hopelessness of the web and web browsers) 21 | * [Life is Terrible: Let's Talk About the Web – Øredev Conference, November 2014](https://vimeo.com/111122950) 22 | * "The JavaScript language basically is like being inside an insane person's brain; it was very disturbing." 23 | * "I basically determined that JavaScript arrays are best described as array-list-dictionary combined multi-type objects. [...] And they remember things they shouldn't remember, and they just really make me feel uncomfortable." 24 | * Regarding The Rhino Book's weasel-word-filled description of "array-like" objects: 25 | * "What the [deleted expletive] am I reading? Am I hallucinating this? Am I having a stroke? Am I reading a book that was written by the devil?" 26 | * "'actually do occasionally'. That makes me want to drink bleach." 27 | * "but for some reason we're okay with these [weasel] words being used to describe a scripting language that runs banking websites" 28 | * "I'd really like for my online financial transactions to be implemented in a programming language that actually knows what an array is." 29 | * "if you're a JavaScript programmer, and you actually rely on automatic semicolon insertion, if hitting the semicolon key is too much work for you, you're lazy, and you're going to get diabetes. For sure." 30 | * "And that's a valid point. There weren't a lot of black people in *Tron*." 31 | * "It's not this book's fault that it's describing a nightmare world." (Regarding *JavaScript: The Definitive Guide* AKA The Rhino Book) 32 | * "The Feature Factory is this attitude that a lot of browser vendors have, [...] and web developers have. They just want to keep on adding new features as quickly as possible, but they often don't spend the time to think about the security or robustness implications of those features." 33 | * "I am not against these JavaScript frameworks. [...] However, I will say there are too many JavaScript frameworks. Far too many. So, what percentage of frameworks do I think should be deleted? Roughly 99.7% of them. So I guess that in practice, I am against JavaScript frameworks." 34 | * "We've got a client-side solution. We've got a server-side solution. We've got a story for mobile. And if it doesn't move, we've got a story for stationary objects too." 35 | * "There is no reason for anything happy to ever happen on the web, ever. Every website I've been to has been at least partially massively disappointing." 36 | * "The educational system has failed web programmers." 37 | * "So whenever someone comes up to you and says 'Let's add a new feature' [to the web platform], just punch 'em right in the face." 38 | * "We all know we shouldn't use DOM0 event handlers. We all do it anyway, because we're all sick in the head." 39 | * "When you push out new [web platform] features and you don't think about the implications, you [create monkey Jesus](http://www.bbc.com/news/world-europe-19349921)." 40 | * [Not Even Close: The State of Computer Security – NDC Oslo, June 2015](https://vimeo.com/135347162) 41 | * [It Was Never Going to Work, So Let's Have Some Tea – USENIX LISA 2015](https://vimeo.com/146524997) 42 | * [Mickens' AmA on reddit](https://www.reddit.com/r/IAmA/comments/2syfmu/happy_mlk_day_iama_black_computer_scientist_who/) 43 | -------------------------------------------------------------------------------- /wiki/influence.md: -------------------------------------------------------------------------------- 1 | ## Summary of "Influence" by Cialdini 2 | 3 | ### Intro 4 | higher priced sells better if buyers uninformed (jewelry tourists; expensive = good; price inflated falsely) 5 | Favors granted more often when reason for request given using keyword "because", even if reason not informative ("may I use the xerox because I have to make some copies?") 6 | We tend to look at a single highly representative factor (rule of thumb) when making a decision, due to cognitive laziness brought about by info/busyness overload, complex, fast paced env; don't typically do extensive analysis 7 | Alfred North Whitehead: "civilization advances by extending the number of operations we can perform without thinking about them" 8 | Contrast Principle: differences between items exaggerated if diff items presented to us in succession. If buy expensive item, overpriced accessories seem more reasonable/cheap by contrast. Good product seems great in contrast to bad product shown initially. 9 | 10 | 11 | Six principles: 12 | 13 | ### Reciprocation 14 | Reciprocation: we should repay others' deeds in kind 15 | Favors obligate us ("much obliged" = "thank you") 16 | Obligates us even when we dislike the favor-giver (cf Hare Krishnas giving out unsolicited flowers, refusing their return, and getting donations back instead, from conservative businesspeople) 17 | Cf free samples, campaign contribs, polit "logrolling" 18 | Jonestown woman who refused favor from Jones and thus found will to reject his suicide cmd 19 | Works when favor is uninvited; giver can dictate form of requested return favor; Favors can be unfairly unequal 20 | Psychologically difficult/impolite to turn down some favors 21 | "Pressure to reciprocate a gift, but not to purchase an unwanted commercial product"; so charities position free address labels as gifts 22 | Being indebted is psychologically uncomfortable 23 | We don't want to be seen as moochers 24 | Reciprocal Concession: Rejection-Then-Retreat: make large request intended to be rejected, then make smaller genuine request, requestee is more likely to accept since requester has made (insincere) concession; request doesn't have to be small, just comparatively smallER 25 | Contrast principle makes 2nd request seem even smaller & more reasonable 26 | And if 1st request agreed to, then bigger win; no-lose! 27 | Rejection technique also leads to greater follow-thru than direct request 28 | People feel more satisfied about & responsible for the agreement for having gotten the concession 29 | HowToSayNo: decline initial favor (difficult & mean), recognize (post favor) the favor as in fact a sales strategy which as such does not require reciprocation 30 | 31 | 32 | ### Consistency 33 | After committing to a decision, we feel more certain about it 34 | We want to feel (& look to others) as consistent 35 | Faraday, when asked whether his hated rival was always wrong: "He's not that consistent." 36 | Consistency means we don't need to make decisions repeatedly, we also don't have to confront worrisome implications of our choices; cf TranscendentalMedidation, we use consistency to actively silence our reasoning/logical faculties 37 | Commitment mints consistency. Particularly written or public commitment. You change your self-perception to match your actions. 38 | severe (painful or humiliating) initiations made group members commitment to group greater, found grp more valuable;  cf hazings 39 | We feel committed when we chose to do something in the absence of strong outside pressures (eg big prizes/ threats) 40 | ThrowingALowball - offering an inducement to make a certain choice, then taking away the inducement, knowing that consistency means we will have found other reasons to justify the choice, removing the original logical justification for the choice (typically a purchase decision) 41 | HowToSayNo: recognize when it'd be foolish to be consistent; ask yourself "Knowing what I know now, would I still make the same decision?" 42 | 43 | ### Social Proof 44 | Social Proof: we infer what is correct based on what others think is correct 45 | Salespeople fake such evidence 46 | eg canned laughter, priming of tip jars & collection plates w/ cash, fake long lines to get into clubs, "X is the best-selling brand of Y", fake man-on-the-street endorsers/interviews 47 | the more similar to us others are, the stronger the proof they provide 48 | Jonestown suiciders had no other context except other Jonestowners 49 | HowToSayNo: recognize & reject anything using such fake evidence 50 | 51 | ### Liking 52 | Liking: we tend to comply with requests from people we like (are physically attractive, similar to us (opinion, personality, background, lifestyle), who give us compliments, who we find familiar) 53 | great passage on the classroom environment p178 54 | group dynamics 55 |    to create intergroup hostility, separate into groups, let groupmembers commiserate, then have groups compete 56 |    to remove hostility, impose situations where intergroup cooperation is necessary & competition would be harmful to all 57 | we like people associated, even irrelevantly/illogically, with good things (the converse is why people "shoot the messenger"; guilt by association; why car ads include hot women) 58 | food, sex, celebs assoc with products 59 | Asimov: "All things being equal, you root for your own sex, culture, locality, and what you want to prove is that you are better than the other person. Whomever you root for represents you; and when he wins, you win" 60 | HowToSayNo: when you like someone, ask yourself why? Are your reasons good and the qualities not forged/forgable? Separate the seller from what he is selling. 61 | 62 | ### Authority 63 | The Milgram Experiment 64 | doctor errors that should have been caught via nurse double/sanity-checking not questioned since docs hold authority positions 65 | use of actors playing docs in adverts 66 | we are fooled by false authority conveyed by mere symbols of authority: 67 |    titles: more grand title makes us perceive person as physically taller; vice-versa 68 | cards with higher absolute dollar amounts seen as physically larger 69 |    clothes/uniform 70 |    trappings: eg luxury car 71 | compliance trick: expert argues slightly against their own self-interest in order to seem impartial & gain your trust; then present countervailing advantage to offset the shortcoming they admitted, and exploit your trust in them 72 | HowToSayNo: is the authority truly a relevant expert? 73 | 74 | 75 | BE SURE TO MENTION THE JOB INTERVIEW APPEARANCE RESEARCH SOMEWHERE 76 | 77 | ### Scarcity 78 | Humans respond more to potential loss than potential gain, even when the loss is only of an opportunity; using such phrasing increases compliance 79 | Marketers fake scarcity or a deadline 80 | We hate to lose freedoms we already have: Romeo&Juliet's defiance, defiance of censorship (people want to see censored works more and sympathize with the views of the censored work more; some deliberately get their works censored to invoke this) or other bans 81 | We infer that scarce things must be better than abundant ones 82 | We find "exclusive" information more persuasive than generally-available info 83 | Newly-experienced scarcity produces greater rxn than const scarcity; revolutions tend to happen at a short sharp downturn that followed a period of upswing, the middle class rises up in resp to the loss of newly estab econ/soc freedoms, contrast to the constantly deprived lower class 84 | Similarly, parents ought to enforce discipline consistently so as to not inadvertently estab and then take away freedoms from their children 85 | When a product is scarce due to apparent/visible adversarial competition (even if fake) can make us jealous and thus convince us to buy now; equiv of feeding frenzy; powerful example is The Poseidon Adventure 86 | 87 | HowToSayNo: recog your instinctual rxn as best you can & resist; does the product's actual value lie in its scarcity (eg status symbol, collector's item) or in its utility of use (most other stuff)? If the latter, disregard its scarcity as irrelevant. 88 | -------------------------------------------------------------------------------- /wiki/scala-cheatsheet.md: -------------------------------------------------------------------------------- 1 | ### Environment 2 | * Use `mvn scala:console` to get a Scala REPL with all of your classes & dependencies on the classpath (and thus importable) 3 | * To workaround an annoying bug and not bork your terminal afterwards: `echo 'jline.shutdownhook=true' > ~/.jline.rc` 4 | 5 | ### Operators 6 | * Func call operator is `apply` 7 | * defining it on a class' companion object is one way to provide an (alternate) convenience constructor 8 | * No `[]` operator; call a collection like a function instead 9 | * You can assign to function calls; this calls the `update` method 10 | * When an object is immutable, `+=` etc. desugar like in Python 11 | * Unlike in Java, `==` is not retarded, and even handles null 12 | * `x -> y` results in a 2-tuple 13 | * `::` is cons 14 | * `:::` is list concat 15 | * `x +: xs` is immutable prepend 16 | * `xs :+ x` is immutable append 17 | * Prefix operators: `+`, `-`, `!`, `~` 18 | * invoke `unary_+` etc methods 19 | * any method of 1 argument can be called like infix operator: `foo whateverMethod bar` === `foo.whateverMethod(bar)` 20 | * `foo.bar = baz` can desugar to a call to the `bar_=` method of foo 21 | 22 | ### For-expression 23 | ```scala 24 | // super-simple 25 | for {x <- xs if x.somePredicate} { 26 | // do something 27 | } 28 | 29 | // nested iteration, with inline filters 30 | for { 31 | file <- files 32 | if file.isText 33 | line <- file.lines 34 | trimmed = line.trim // can create inline val for intermediate result 35 | if trimmed.startswith("//") 36 | } { 37 | println(trimmed) 38 | } 39 | 40 | // construct new collection using "yield" 41 | val trimmedLineLengths = for {line <- file.lines} yield { line.trim } 42 | ``` 43 | * ~~NOTE: Scala does NOT have `break` or `continue`~~ 44 | 45 | ## Strings/Chars 46 | Like Java: single-quotes are for chars, double-quotes are for strings 47 | Has Python-style triple-quoted strings 48 | 49 | ## Collections 50 | * declare things as `Seq` rather than `List` 51 | * `import scala.collection.JavaConverters._` for non-copying `.asJava` & `.asScala` interconversion methods 52 | * the empty list is `Nil` 53 | * `mkString(sep)` is the string-join-with-separator operation 54 | * for lazy collection computations, use `.iterator` 55 | * `1 to 3` gives 1,2,3 56 | * `1 until 3` gives 1,2 57 | * `Seq(1,2,3,4).sliding(2)` gives `List(1, 2), List(2, 3), List(3, 4)` 58 | * `Seq(1,2).sliding(5)` gives `List(1, 2)` 59 | * `Seq(1,2,3,4,5,6,7).grouped(3)` gives `List(1, 2, 3), List(4, 5, 6), List(7)` 60 | * `Seq('a','b','c').zipWithIndex` gives `(a,0),(b,1),(c,2)` 61 | 62 | ## Functions 63 | def statements can be nested 64 | Nothing return type indicates throwing an exception (no normal return ever occurs) 65 | 66 | ```scala 67 | // Varargs 68 | def foo(args: String*) = ... // declaring 69 | foo(someArray: _*) // using 70 | 71 | 72 | // Currying 73 | def foo(bar: Int)(baz: Int) = ... 74 | 75 | 76 | // Anonymous funcs 77 | val myFunc = (x: Int) => x + 42 78 | Seq(1, 2, 3).map { x => x + 1} // Parameter parens and type can be omitted when the type is inferrable 79 | 80 | // Call-by-name 81 | object Foo { 82 | var enableLogging = true 83 | def efficientLog(message: => String) { // note lack of "()" in the declaration of the message function argument 84 | if (enableLogging) { 85 | println("BEGIN") 86 | println(message) // note that the function is called without explicitly calling it 87 | println("MIDDLE") 88 | println(message) // note: the function is called again every time we reference it 89 | println("END") 90 | } 91 | } 92 | def expensiveComputation = { 93 | println("Computing...") 94 | "42" 95 | } 96 | } 97 | Foo.efficientLog(Foo.expensiveComputation) // the argument is implicitly wrapped in an anonymous function 98 | /* Output: 99 | BEGIN 100 | Computing... 101 | 42 102 | MIDDLE 103 | Computing... 104 | 42 105 | END 106 | */ 107 | Foo.enableLogging = false 108 | Foo.efficientLog(Foo.expensiveComputation) // No output; the argument was never referenced 109 | ``` 110 | 111 | ### Imports 112 | ```scala 113 | import java.util._ // wildcard import 114 | import train.{Engineer => TrainEngineer} // renaming import 115 | import java.util.{List,Map,Set} // import certain named things 116 | ``` 117 | 118 | ### Generics 119 | ```scala 120 | class ImmutableList[+T](...) {// covariant; (which is typical) 121 | // ImmutableList[subclass_of_T] can substitute for ImmutableList[T] 122 | // T cannot be directly used as a method parameter type 123 | def cons[S >: T] // S must be (superclass of) T 124 | (item: S): ImmutableList[+S] = new ImmutableList(item, this) 125 | // Why S must be (superclass of) T: 126 | // List[Base] + List[Subclass] => List[Base]; CANNOT make List[Subclass] 127 | // List[Base] + List[Superclass] => List[Superclass]; this is why we care about the superclass case 128 | } 129 | 130 | class PrintableList[T <: Printable] // T must be (subclass of) Printable 131 | 132 | class Sink[-T] { // contravariant; (which is unusual; basically only for function-like stuff) 133 | // Sink[superclass_of_T] can substitute for Sink[T] 134 | def consume(item: T) 135 | // TeeTo(Sink[Base], Sink[Subclass]) => TeeTo<Subclass> 136 | // TeeTo(Sink[Base], Sink[Superclass]) => TeeTo<Base> 137 | // Sink[Superclass] can deal with Subclass instances 138 | } 139 | ``` 140 | 141 | ### Pattern Matching 142 | ```scala 143 | val result = node match { 144 | case 0 => 0 145 | case BinaryOperation(e, "+", 0) => e 146 | case BinaryOperation(left, "+", right) if left == right => BinaryOperation(2, "*", left) // can use "if" guards 147 | case Floor(f@Floor(_)) => f // i.e. flooring is idempotent 148 | case s: String => Integer.parse(s) 149 | case _ => "not defined" 150 | case Array(first, second, _*) => "non-empty list; first item: " + first.toString 151 | } 152 | 153 | 154 | // Making your own non-case classes work with pattern matching: 155 | class CurrencyAmount(val wholePart: Int, val fracPart: Int, val currencyCode: String) { 156 | // the "unapply" method is used as an "extractor"/"deconstructor" in destructuring binds in pattern matches 157 | def unapply(String string): Option[Int, Int, String] = ... // e.g. it turns "12.34 USD" into (12, 34, "USD") 158 | 159 | } 160 | object FormattedNumber { 161 | // If you don't wish to bind any variables, return a Boolean indicating whether the match should succeed 162 | def unapply(String string): Boolean = string.filter{ c => !(",.0123456789" contains c) }.length > 0 163 | } 164 | object CommaSeparatedList { 165 | // To bind arbitrarily many things 166 | def unapplySeq(String str): Option[Seq[String]] = str.split(",") 167 | } 168 | // Using it: 169 | someString match { 170 | case CurrencyAmount(whole, fractional, currency) => println("Valid currency amount denominated in " + currency) 171 | case FormattedNumber => println("Plausible number") 172 | case CommaSeparatedList("a", "b", "c") => println("You entered: a,b,c") 173 | case _ => println("Invalid input!") 174 | } 175 | ``` 176 | 177 | ### Misc 178 | * no checked exceptions (smile) 179 | * Scala performs tail-call optimization (TCO) on final self-recursive methods; use @tailrec to ensure your method is written correctly 180 | * `throw` can be used in an expression context; same semantics as usual 181 | * `try-catch` is an expression 182 | ```scala 183 | // try-catch uses pattern matching 184 | try { 185 | val f = new FileReader("foo.txt") 186 | } 187 | catch { 188 | case ex: FileNotFoundException => handleTheException 189 | case ex: IOException => handleTheException 190 | } 191 | ``` 192 | 193 | ### Classes 194 | * default access level is public 195 | * filenames need not correspond to class names 196 | * package can be used as a block-scoped construct 197 | 198 | ```scala 199 | class Rational(val numer: Int, val denom: Int) \ 200 | extends Integral(superklass, constructorArgs, goHere) \ // superclass 201 | with AlgebraicField with Mathematical { // mix-in some traits 202 | // these assignments will be performed in the generated constructor in the given order 203 | private val g = gcd(numer, denom) 204 | private val reducedNumer = numer / g 205 | private val reducedDenom = denom / g 206 | 207 | println("I'm inside the constructor!") 208 | 209 | // auxiliary constructor 210 | def this(integer: Int) = this(numer = integer, denom = 1) 211 | 212 | // note use of "override" keyword 213 | override def toString: String = numer + "/" + denom 214 | 215 | // when a method is just a mutator; note lack of "=" 216 | def print { // return type is Unit (like Java's void) 217 | println(this) 218 | } 219 | // silly "if-else" expression example 220 | def isNonZero: Boolean = true if numer != 0 else false 221 | } 222 | 223 | object Rational { 224 | // constants use UpperCamelCase 225 | val OneHalf = new Rational(1, 2) // "new" still needed for instantiations 226 | } 227 | ``` 228 | 229 | ##Design-by-Contract 230 | ```scala 231 | def addNaturals(nats: List[Int]): Int = { 232 | require(nats forall (_ >= 0), "List contains negative numbers") // can throw IllegalArgumentException 233 | nats.foldLeft(0)(_ + _) 234 | } ensuring(_ >= 0, "Result is not a natural") 235 | ``` 236 | 237 | ### Abstract related types 238 | ```scala 239 | class Beverage 240 | abstract class Drinker { 241 | type DrinkOfChoice <: Beverage 242 | def drink(d: DrinkOfChoice) 243 | } 244 | 245 | class Alcohol extends Beverage 246 | class Alcoholic { 247 | type DrinkOfChoice = Alcohol 248 | override def drink(d: Alcohol) {...} 249 | } 250 | 251 | class Soda extends Beverage 252 | class Child { 253 | type DrinkOfChoice = Soda 254 | override def drink(d: Soda) {...} 255 | } 256 | // Scala ensures that a Child never drinks Alcohol, only Soda 257 | ``` 258 | 259 | ### Further Reading 260 | * [Twitter's "Scala School" pages](http://twitter.github.io/scala_school/) 261 | * [Twitter's "Effective Scala" document](http://twitter.github.io/effectivescala/) 262 | * Scala collections library design document 263 | --------------------------------------------------------------------------------