(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.
| import { useReducer } from 'react' | |
| export function updateName(name: string) { | |
| return <const>{ | |
| type: 'UPDATE_NAME', | |
| name | |
| } | |
| } | |
| export function addPoints(points: number) { |
| # GIFme | |
| # This is a really simple/stupid command line (specifically zsh) function to copy public Dropbox links to your gifs. | |
| # | |
| # Put this somewhere in your .zshrc and replace {{YOUR_PUBLIC_ID}} with your public Dropbox ID (find this by going to dropbox.com, finding a file in your "Public" folder, selecting it and clicking "Copy public link", and looking for the long number in the URL) | |
| # | |
| # This assumes your gifs (and other images you want to share) are stored in your Dropbox "Public" folder in a directory called "gifs". | |
| # This whole thing ain't pretty, and it could be much better. But it's a start. | |
| # | |
| # Usage: | |
| # "$ gifme yup.gif" will copy a public link to "{{Dropbox Directory}}/Public/gifs/yup.gif" |
(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.
| module Sass::Script::Functions | |
| def file_exists(path) | |
| return bool(false) unless options[:filename] # not all sass has a file name (e.g. std input) | |
| current_directory = File.dirname(options[:filename]) rescue nil # a sass filename from an importer may not be processable by File.dirname | |
| return bool(false) unless current_directory && File.exist?(current_directory) # not all sass files are served from the filesystem | |
| full_path = File.expand_path(path.value, current_directory) # a relative path will be expanded against the current_directory of the sass file, symlinks will be followed, absolute paths will be left alone. | |
| return bool(File.exist?(full_path)) | |
| end | |
| end |