Skip to content

Instantly share code, notes, and snippets.

View cedricdelpoux's full-sized avatar
🏠
Working from home

Cédric Delpoux cedricdelpoux

🏠
Working from home
View GitHub Profile
@mlocati
mlocati / color-scale.js
Last active October 25, 2024 13:11
Javascript color scale from 0% to 100%, rendering it from red to yellow to green
// License: MIT - https://opensource.org/licenses/MIT
// Author: Michele Locati <[email protected]>
// Source: https://gist.github.com/mlocati/7210513
function perc2color(perc) {
var r, g, b = 0;
if(perc < 50) {
r = 255;
g = Math.round(5.1 * perc);
}
else {
@bcomnes
bcomnes / git-gpg.md
Last active February 13, 2024 07:33
my version of gpg on the mac
  1. brew install gnupg, pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf 
    
@ivanoats
ivanoats / fetch-from-contentful.js
Created June 17, 2016 18:45
fetch-from-contentful.js
#!/usr/bin/env babel-node
require('dotenv').config()
import contentful from 'contentful'
import fs from 'fs-extra-promise'
// Contentful Config
const apiToken = process.env.CONTENTFUL_DELIVERY_API_TOKEN
const spaceId = process.env.CONTENTFUL_SPACE_ID
const client = contentful.createClient({ accessToken: apiToken, space: spaceId })
#!/usr/bin/env babel-node
import contentful from 'contentful'
import fs from 'fs-extra-promise'
// Requires a test to see if .env file exists because it will not on CI build
if (fs.existsSync('.env')) require('dotenv').config()
// Contentful Config
const apiToken = process.env.CONTENTFUL_DELIVERY_API_TOKEN
@jorilallo
jorilallo / Flex.js
Created August 17, 2017 20:06
Flexbox component for React
// @flow
import React from 'react';
import styled from 'styled-components';
type GlobalCssValues = 'initial' | 'inherit' | 'unset';
type WrapValue = 'nowrap' | 'wrap' | 'wrap-reverse' | GlobalCssValues;
type JustifyValue =
| 'center'
@naamancampbell
naamancampbell / dashboard.html
Last active October 19, 2019 21:38
Display Multiple Strava Activity Maps in Flask Template
{% for activity in activities %}
<div class="post">
{% if activity.strava_data['map']['polyline'] is not none %}
<div id="map_{{ activity.id }}" class="img-fluid" style="height: 300px;"></div>
{% endif %}
{# other activity data #}
</div>
{% endfor %}
@MantasMikal
MantasMikal / ImageZoom.jsx
Last active October 20, 2022 09:22
Easy way to zoom gatsby-image with react-medium-image-zoom
// Demo https://guste.design/gallery/
// Install https://www.npmjs.com/package/react-medium-image-zoom
// ImageZoom.jsx
import React from 'react'
import Image from 'gatsby-image'
import Zoom from 'react-medium-image-zoom'