(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/usr/bin/env python3 | |
| """ | |
| Simple Claude Code StatusLine Script | |
| Shows context usage/progress with colored bar | |
| Uses current_usage field for accurate context window calculations | |
| BUG WORKAROUND (remove when fixed): | |
| https://github.com/anthropics/claude-code/issues/13783 | |
| The statusline API's context_window data is inaccurate. This script parses | |
| the transcript JSONL as a workaround. When bug #13783 is fixed, delete: |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // I found this somewhere on the intertubes, and optimized it | |
| $.fn.insertAtCaret = function(myValue) { | |
| return this.each(function() { | |
| var me = this; | |
| if (document.selection) { // IE | |
| me.focus(); | |
| sel = document.selection.createRange(); | |
| sel.text = myValue; | |
| me.focus(); | |
| } else if (me.selectionStart || me.selectionStart == '0') { // Real browsers |