This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn personality-stddev | |
[faved mehed hated mean] | |
(let [points (concat (take faved (cycle [1])) | |
(take mehed (cycle [0.5])) | |
(take hated (cycle [0]))) | |
squared (map #(expt (- % mean) 2) points)] | |
(sqrt (/ (apply + squared) (count squared))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn personality | |
[faved mehed hated] | |
(let [score (personality-score faved mehed hated)] | |
{ :score score | |
:stddev (personality-stddev faved mehed hated score) | |
:total (+ faved mehed hated) })) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [faved (brains.db/user-site-faved-count uid) | |
mehed (brains.db/user-mehed-count uid) | |
hated (brains.db/user-hated-count uid)] ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn personality-score | |
[faved mehed hated] | |
(/ (+ faved (* mehed 0.5)) (+ faved mehed hated))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ :score AVERAGE-RATING | |
:stddev STANDARD-DEVIATION | |
:total TOTAL-RATINGS } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn db-personality-user | |
[uid] | |
(let [faved (brains.db/user-site-faved-count uid) | |
mehed (brains.db/user-mehed-count uid) | |
hated (brains.db/user-hated-count uid)] | |
(assoc (personality faved mehed hated) | |
:uid uid))) | |
(defn db-personality-users | |
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<list> | |
<item> | |
<name>Use the correct goddamed shift keys.</name> | |
<identifier>private.fucking_shift_keys_how_do_they_work</identifier> | |
<autogen>--KeyToKey-- KeyCode::Q, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>--KeyToKey-- KeyCode::W, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>--KeyToKey-- KeyCode::E, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>--KeyToKey-- KeyCode::R, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> | |
<autogen>--KeyToKey-- KeyCode::T, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\sR - Open a REPL | |
\et - Eval current toplevel form | |
\ef - Eval current file | |
\lw - Look up documentation for current word | |
C-X C-O - Autocomplete current word smartly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Firefox | |
| | |
V | |
OS X Laptop port 4565 on OS X Linux VM | |
Nginx on port 80 -------> is forwarded to 80 on ------> Nginx on port 80 | |
the VM | | |
V | |
Gunicorn server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
old_file = sys.argv[1].rsplit('.', 2)[0] | |
if os.path.exists(old_file): | |
os.system('osascript -e \'tell app "Finder" ' | |
+ 'to move the POSIX file "' | |
+ os.path.abspath(old_file) + '" to trash\'') |