Skip to content

Instantly share code, notes, and snippets.

@knubie
knubie / urbit-cheatsheet.md
Last active October 6, 2023 03:09
An Urbit cheat sheet

This cheat sheet contains lists of 'Hoon' words and symbols and short descriptions of what they are or what they do. Note that we unabashedly map Hoon concepts to the closest corresponding concept in other programming languages, even if the concepts are not quite the same. For example, in biology, [http://evolution.berkeley.edu/evosite/evo101/IIC1Homologies.shtml bird wings and bat wings are said to be analogous but not homologous], because they have similar function but they are not quite the same and indeed the common ancestor of birds and bats did not have wings. In this table, we map analogous concepts to each other even if they are not homologous; if bat wings and bird wings were here, we would map bat wings to bird wings. For example, we map 'gate' to 'function; see the section "Gates and lambda" from [http://doc.urbit.org/doc/hoon/tut/4/ Hoon tutorial section 4] for more discussion of this.

Please note that i am writing this in the process of learning Hoon, and i don't understand most of what is writt

{
"title": "Change caps_lock key (rev 2)",
"rules": [
{
"description": "Change caps_lock key to command+control+option+shift. (Post escape key when pressed alone)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",

(put! ch val) - Puts a value onto a channel, doesn't block at all. (>! ch val) - Puts a value onto a channel, "blocks" in a go block (parks). (>!! ch val) - Puts a value onto a channel, blocks. Not available in js.

(take! ch cb) - Takes a value from a channel, doesn't block at all. Take a callback fn. (<! ch) - Takes a value from a channel, "blocks" in a go block (parks). (<!! ch) - Takes a value form a channel, blocks. Not available in js.

Let's compare core.async with three prominent async strategies in Javascript:

Purposely directing and redirecting your attention is an important part of meditation training. You want to continuously cultivate your ability to intentionally direct attention to any object you choose, regardless of its intrinsic interest. You do this by redirecting attention, over and over again, back to the meditation object whenever it wanders. This is how directed attention leads to stable attention. If you’re reluctant to let go of an object you find particularly engaging, evoke discipline and diligence. Discipline doesn’t mean forcing the mind to do something it can’t, but rather a firm, intentional resolve to let go of an object that’s captured your attention and return to the breath. Being diligent means doing this consistently and promptly.

Like a muscle, the more you exercise this faculty, the stronger it grows. In other words, your conscious intention to redirect attention, repeated often enough, will gradually train your unconscious to do it automatically and almost instantly. Then, intentional

“Purposely directing and redirecting your attention is an important part of meditation training. You want to continuously cultivate your ability to intentionally direct attention to any object you choose, regardless of its intrinsic interest. You do this by redirecting attention, over and over again, back to the meditation object whenever it wanders. This is how directed attention leads to stable attention. If you’re reluctant to let go of an object you find particularly engaging, evoke discipline and diligence. Discipline doesn’t mean forcing the mind to do something it can’t, but rather a firm, intentional resolve to let go of an object that’s captured your attention and return to the breath. Being diligent means doing this consistently and promptly.”
@knubie
knubie / jp-you.md
Last active October 29, 2017 16:32

よう

The word よう(様) means appearance or manner. Because it is a noun we can modify it with い-adjectives or descriptive clauses.


RELATIVE-CLAUSE + よう

*Aようだ seems like A

In this ussage a relative clause can be anything that is able to directly modify a noun, including い-adjectives, conjugated state-of-being, and verb-clauses.

Examples

@knubie
knubie / .tmux.conf
Last active September 13, 2017 10:12
Experimental zsh/tmux set up. Display CWD/vim file and git repo information in the tmux status bar.
# Update the status bar by fetching an environment variable set earlier by a shell script.
# Requires Thomas Adam's hook patch for tmux
# https://github.com/ThomasAdam/tmux/tree/ta/hooks
set-hook -g -n 'after-select-window' 'run "tmux set -q status-left \"`tmux show -environment TMUX_STATUS_#I | cut -c 15-`\""'
set-hook -g -n 'after-kill-window' 'run "tmux set -q status-left \"`tmux show -environment TMUX_STATUS_#I | cut -c 15-`\""'
;;; nlinum-relative.el --- Relative line number with nlinum -*- lexical-binding: t; -*-
;; Copyright (C) 2016 codefalling
;; Author: codefalling <code.falling@gmail.com>
;; Keywords: convenience
;; Package-Version: 20160526.8
;; Version: 0.1
;; Package-Requires: ((emacs "24.4") (nlinum "1.5"))
...
// makePly :: (Game, Ply) -> Game
var makePly = function(game, ply) {
check(arguments, [Game]);
if (ply.type === 'MovePly') {
return movePly(
Piece.of(R.evolve({position: Position.of}, ply.piece)),
Position.of(ply.position),
game);
@knubie
knubie / sanctuary-dom.js
Last active September 8, 2016 01:07
Messing around with DOM parsing using sanctuary.js
const R = require('ramda');
const Sanctuary = require('sanctuary');
const $ = require('sanctuary-def');
//=============================
// Type definitions
//=============================
// Tokens :: Array String
const Tokens = $.NullaryType(