Or: “Everybody likes being given a glass of water.”
By Merlin Mann.
It's only advice for you because it had to be advice for me.
import React from "react"; | |
const FigmaPreview = ({ value }) => { | |
const { url } = value; | |
const host = `gavinmcfarland.co.uk;` // Change to your host/domain | |
const regex = /https:\/\/([\w\.-]+\.)?figma.com\/(file|proto)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/ | |
if (regex.test(url)) { | |
const embedUrl = `https://www.figma.com/embed?embed_host=${host}&url=${url}`; | |
return (<iframe |
const parallelLimit = require("async/parallelLimit"); | |
const fs = require("fs"); | |
const glob = require("glob"); | |
const sanityClient = require("@sanity/client"); | |
const client = sanityClient({ | |
projectId: 'get a project id', // TODO: projectId needed | |
dataset: "production", | |
token: 'get a write token', // TODO: token needed | |
useCdn: false |
const sanity = require('@sanity/client') | |
const fs = require('fs') | |
const EOL = require('os').EOL | |
const flatMap = require('lodash.flatmap') | |
const { subDays, isBefore } = require('date-fns') | |
const sanityExport = require('@sanity/export') | |
/** | |
* @param context {WebtaskContext} | |
*/ |
rebase
vs merge
).rebase
vs merge
)reset
vs checkout
vs revert
)git rev-parse
)pull
vs fetch
)stash
vs branch
)reset
vs checkout
vs revert
)https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
by Bjørn Friese
Beautiful is better than ugly. Explicit is better than implicit.
I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.
#include "ofMain.h" | |
#include "ofxTiming.h" | |
class ofApp : public ofBaseApp { | |
public: | |
ofVideoGrabber grabber; | |
DelayTimer delay; | |
ofTrueTypeFont font; | |
string description; | |
<?php | |
/* | |
Demos: | |
https://jsbin.com/gakudi/1/edit?output | |
https://jsbin.com/xunifo/edit?output | |
Usage: | |
php cssImage.php scale image output | |
*/ |