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
@cedricdelpoux
cedricdelpoux / objectToQueryString.js
Last active August 29, 2015 14:27
Object to query string
Object.keys(object).reduce((result, key) => (
object[key] !== null && object[key] !== undefined
? (result += key + '=' + object[key] + '&')
: result
), '?').slice(0, -1)
@cedricdelpoux
cedricdelpoux / jsxSwitch.js
Created September 16, 2015 09:01
Switch statements in Jsx
render() {
const { name } = this.props
return (
<div>
{ (() => {
switch (nane) {
case 'toto': return <span>Toto</span>
case 'tata': return <span>Tata</span>
case 'titi': return <span>Titi</span>
}
@cedricdelpoux
cedricdelpoux / MyComponent.js
Last active August 25, 2016 09:21
Async Route Leave Hook
import React, {Component, PropTypes} from "react"
class MyComponent extends Component {
constructor(props, context) {
super(props, context)
this.state = {
modal: null,
}
@cedricdelpoux
cedricdelpoux / GoogleMap.js
Created August 9, 2016 15:21
React Google Map
import React, {Component, PropTypes} from "react"
import placesLoader from "./placesLoader"
import placesShape from "./placesShape"
import styles from "./GoogleMap.css"
import iconMarker from "./iconMarker.png"
import iconTrash from "./iconTrash.png"
const {arrayOf, func, number, shape, string} = PropTypes
@cedricdelpoux
cedricdelpoux / fetch-content.js
Created May 4, 2017 15:21
Script to fetch content from Contentfull using Phenomic
import contentful from "contentful"
import fs from "fs-extra-promise"
import request from "request-promise"
import grayMatter from "gray-matter"
import get from "lodash/get"
import pkg from "../package.json"
const client = contentful.createClient({
accessToken: pkg.contentful["access-token"],
var polyline = require("@mapbox/polyline")
const Trace = ({mapPolyline}) => {
const coordinates = polyline.decode(mapPolyline).map(coordinate => ({
lat: coordinate[0],
lng: coordinate[1],
}))
const minLat = coordinates.reduce(
(min, coordinate) => (coordinate.lat < min ? coordinate.lat : min),
{
"meta": { "theme": "papirus" },
"basics": {
"name": "Cédric Delpoux",
"label": "Développeur Front-end",
"picture": "https://avatars1.githubusercontent.com/u/2683300?s=460&v=4",
"email": "[email protected]",
"phone": "+33 6 74 63 20 45",
"website": "https://cedricdelpoux.fr",
"summary": "Passionné par le développement web et sensibilisé aux belles interfaces et à l'ergonomie logicielle, je mets toute mon énergie pour concevoir des sites at applications modernes, responsives et faciles à prendre en main afin que les utilisateurs les moins technophiles puissent appréhender au mieux mes créations.",