In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py
)
Save and open the script in your editor of choice.
import addons from '@storybook/addons'; | |
import { FORCE_RE_RENDER } from '@storybook/core-events'; | |
import { themes } from '@storybook/theming'; | |
// Automatically switch light/dark theme based on system pref. | |
addons.register("auto-theme-switcher", api => { | |
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)'); | |
let lastTheme; |
fs =require 'fs' | |
path =require 'path' | |
coffeelint =require 'coffeelint' | |
debug =console .log | |
file =process .argv[ 2 ] | |
content =fs .readFileSync file, 'utf8' | |
# $$ Inserts a "$". | |
# $& Inserts the matched substring. | |
# $` Inserts the portion of the string that precedes the matched substring. | |
# $' Inserts the portion of the string that follows the matched substring. |
I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.
In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.
While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.
Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio
<select name="currency_code"> | |
<option value="">Select Currency</option> | |
<option value="AUD">Australian Dollar</option> | |
<option value="BRL">Brazilian Real </option> | |
<option value="CAD">Canadian Dollar</option> | |
<option value="CZK">Czech Koruna</option> | |
<option value="DKK">Danish Krone</option> | |
<option value="EUR">Euro</option> | |
<option value="HKD">Hong Kong Dollar</option> | |
<option value="HUF">Hungarian Forint </option> |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |