Skip to content

Instantly share code, notes, and snippets.

View maxluster's full-sized avatar

Max Luster maxluster

View GitHub Profile
@schettino
schettino / useUserReducer.ts
Created March 30, 2019 20:23
Better Reducers with React and Typescript 3.4
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"
@staltz
staltz / introrx.md
Last active November 19, 2024 13:42
The introduction to Reactive Programming you've been missing
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