View chart.js
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
/** | |
* This is a quick and dirty way to make charts in HTML. | |
* | |
* I made this for an email campaign, where embedding images was cumbersome | |
*/ | |
function chart({ x_axis_values, x_axis_label, y_axis_values, y_axis_unit }) { | |
const x_axis = x_axis_values | |
.map(d => `<td style="text-align:center;vertical-align:top;font-size:8px;">${d}</td>`) | |
.join("\n"); |
View quick-command.vim
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
" Add the following in your vim config | |
function! ShowNodeResult() | |
" command to run on current buffer | |
let op = system("node", bufnr()) | |
" name of output buffer | |
let win = bufwinnr("__NODE_OUTPUT__") |
View emacs-mac-cmd-bindings.el
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
;; I installed emacs today and wanted to bind some functions to cmd key. | |
;; That simple objective somehow ended with me noting down all default keybindings. | |
;; Sharing here so you don't have to go on this side quest like me. :) | |
;; For letters, if a corresponding capital letter is missing, | |
;; it means it calls the same function as its small case form | |
;;(global-set-key (kbd "s-`") 'other-frame) | |
;;(global-set-key (kbd "s-~") 'ns-prev-frame) | |
;;(global-set-key (kbd "s-1,2,3,4,5,6,7,8,9") ) ;; grouped together |
View scrape.ts
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
/*** | |
* DESCRIPTION: | |
* A small scraper to fetch chapters of a story from RoyalRoad.com. | |
* Give it the url of a chapter and it pulls all chapters until the end! | |
* | |
* USAGE: deno run scrape.ts <royalroad.com/fiction/x/y/chapter/x/y [text | html (default)] | |
* | |
* OUTPUT: story.[txt | html] | |
*/ |