Skip to content

Instantly share code, notes, and snippets.

View gersomvg's full-sized avatar
:shipit:

Gersom van Ginkel gersomvg

:shipit:
View GitHub Profile
// please check https://docs.netlify.com/configure-builds/environment-variables/#declare-variables for most up to date info
// this was created before those docs existed
process.env = {
/**
*
* AUTOMATICALLY SET BY NETLIFY. IMMUTABLE!
* docs: https://www.netlify.com/docs/continuous-deployment/#environment-variables
*
*/
@HoverBaum
HoverBaum / create-and-publish-assets.js
Last active March 16, 2020 14:05
Create and publish assets in Contentful.
const createAndPublishAssets = (assets, managementToken, spaceId, locale, simpleLog = console.log) => new Promise(async resolve => {
simpleLog('Creating Contentful client')
const client = contentful.createClient({
accessToken: managementToken,
logHandler: (level, data) => simpleLog(`${level} | ${data}`)
})
const iterableAssets = makeIterator(assets)
const space = await client.getSpace(spaceId)
const cmsAssets = []
@Anthodpnt
Anthodpnt / video-masking.js
Last active December 14, 2022 22:51
Canvas - Video Masking
/**
* This gist is for Javascript beginners.
* @author: Anthony Du Pont <antho.dpnt@gmail.com>
* @site: https://www.twitter.com/JsGists
*
* You can do really cool effects with Canvas and I am going to show you how to use a video to mask
* and image with it. To be honest I am not really sure this gist is really for beginners but I really
* wanted to do it. So if you are not comfortable with the code below, take a minute, breathe and maybe
* start by reading the basics of Canvas. You will quickly start to notice this gist is not so difficult
* to understand.
@branneman
branneman / better-nodejs-require-paths.md
Last active June 12, 2024 02:40
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions