Instantly share code, notes, and snippets.

View carousel.js
View debounce.js
export default (delay, fn) => {
let timerId;
return function (...args) {
if (timerId) {
clearTimeout(timerId);
}
timerId = setTimeout(() => {
fn(...args);
timerId = null;
View aspect-ratio.scss
&__image {
position: relative;
display: flex;
justify-content: center;
a {
width: 100%;
height: 0;
padding-bottom: 95%;
}
View App.jsx
import React from 'react';
import Dropdown, {CLOSE_ALL, TOGGLE} from '../Core/Dropdown';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
sortOptions: {
label: '',
items: []
View gist:00237100900e57a8363621e28253f45c
/*
A Tour of Go: page 44
http://tour.golang.org/#44
Exercise: Loops and Functions
As a simple way to play with functions and loops, implement the square root function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating: z - (z*z - x) / (2 * z)
View for-switch-select-break-label.go
package main
import "fmt"
func main() {
loop:
for {
switch {
case true:
fmt.Println("breaking out...")
View for-select-chan.go
package main
import "fmt"
func fibonacci(c, quit chan int) {
x, y := 0, 1
for {
select {
case c <- x:
x, y = y, x+y
View brew-java-and-jenv.md

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

View pure-value.css
.block {
--d: 30;
width: calc(var(--d) * 1vw);
height: calc(var(--d) * 1vh);
}
/*
Number --> Unit: calc(var(--v) * 1px)
Unit --> Number: You can't
*/