Source : Learn to combine RxJs sequences with super intuitive interactive diagrams
#! /usr/bin/env bash | |
set -e | |
set -m | |
set +x | |
output_device="PCH" | |
if cat /proc/asound/cards | grep -q Scarlett; then | |
output_device="USB" |
require "rubygems" | |
require "twitter" | |
# get these from apps.twitter.com | |
CONSUMER_KEY = "foo" | |
CONSUMER_SECRET = "bar" | |
OAUTH_TOKEN = "blee" | |
OAUTH_TOKEN_SECRET = "baz" | |
TWITTER_USER = "your_username" # needs to be the one associated with keys above |
var am = "data:image/jpeg;base64,/9j/4aaqskzjrgabaqaasabiaad/4qcarxhpzgaatu0akgaaaagabqesaamaaaabaaeaaaeaaauaaaabaaaasgebaauaaaabaaaaugeoaamaaaabaaiaaidpaaqaaaabaaaawgaaaaaaaabiaaaaaqaaaegaaaabaakgagaeaaaaaqaaaeqgawaeaaaaaqaaabqaaaaa/+0aofbob3rvc2hvccazljaaoejjtqqeaaaaaaaaoejjtqqlaaaaaaaq1b2m2y8asgtpgamy7phcfv/idohjq0nfufjprklmrqabaqaadnhhchbsahaaag1udhjsr0igwflaiafhaaeafwawaamaigfjc3bbufbmaaaaaefquewaaaaaaaaaaaaaaaaaaaaaaad21gabaaaaanmtyxbwbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaewrlc2maaafqaaaaymrzy20aaag0aaabvmnwcnqaaan0aaaai3d0chqaaaoyaaaafhjywvoaaaosaaaafgdywvoaaapaaaaafgjywvoaaapuaaaafhjuukmaaapoaaaidgfhcmcaaav0aaaaihzjz3qaaawuaaaamg5kaw4aaaxeaaaapmnoywqaaayeaaaalg1tb2qaaaywaaaakgjuukmaaapoaaaidgduukmaaapoaaaidgfhymcaaav0aaaaigfhz2caaav0aaaaigrlc2maaaaaaaaacerpc3bsyxkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabtbhvjaaaaaaaaaciaaaamahjiugaaabyaaagoa29lugaaabyaaagobmjotwaaabyaaagoawqaaaaaabyaaagoahvivqaaabyaaagoy3ndwga |
It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar.
Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and
rendering normally. Some settings may also make firefox unstable.
I am not liable for any damages/loss of data.
Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions
(HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".
This is an example of how I combine interaction/service classes with Wisper event broadcasting in Rails.
In this example, I show a UsersController#create
API, a corresponding service object, and all the test code/listeners to make it all happen.
The outcome is:
- Concepts in your system ("Signing up a user", "Creating an order") have a single entry point in your codebase, vs. making raw ActiveRecord calls to
object.save
in dozens of places. - Since your concept has one entry point (the service class), you can easily
grep
for usage of it. - Stupid easy to attach listeners to the service class
- All event listeners are very small and easily unit tested
As we've seen, seq
is the mechanism in Clojure for converting a collection into something that responds to first and rest, so that we can traverse it as we would a linked list. Sequences automatically print at the REPL like a list.
=> (seq '(1 2 3 4))
(1 2 3 4)
=> (seq [1 2 3 4])
(1 2 3 4)
=> (seq #{1 2 3 4})
(1 4 3 2)
=> (seq {:a 1, :b 2})
First, here is the cleverly concise version of freqs that I showed in class, which builds a bunch of maps that map each element to the number 1, and then merges them together using +:
(defn freqs [l]
(apply merge-with + (for [item l] {item 1})))
Here is one way of coding it using loop-recur:
This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.
Highly recommended things!
This is my five-star list. These are my favorite things in all the world.
A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★