Skip to content

Instantly share code, notes, and snippets.

View LucaColonnello's full-sized avatar
👋
Come say hello on Twitter!

Luca Colonnello LucaColonnello

👋
Come say hello on Twitter!
View GitHub Profile
@LucaColonnello
LucaColonnello / MDN_Languages.js
Created December 11, 2015 10:59 — forked from ethertank/MDN_Languages.js
MDN_Languages
var MDN_Languages_AlphabetOrder = {
"ar" : "عربي",
"ca" : "català",
"cs" : "Čeština",
"de" : "Deutsch",
"el" : "Ελληνικά",
"en-us" : "English (US)",
"es" : "Español",
"fa" : "فارسی",
"fi" : "suomi",
@LucaColonnello
LucaColonnello / languages.json
Created December 11, 2015 11:25 — forked from abiank/languages.json
languages.json
/**
* @author Phil Teare
* using wikipedia data
*/
isoLangs = {
"ab":{
"name":"Abkhaz",
"nativeName":"аҧсуа"
},
"aa":{
@LucaColonnello
LucaColonnello / # Redux Async Actions Utils
Last active January 16, 2016 11:05
Redux Async Actions Utils
Lib purpose
@LucaColonnello
LucaColonnello / pipe-tag-es6-tpl-string.js
Created January 20, 2016 08:49
String leading whitespaces
// Strip margin (Leading whitespaces)
function pipeFactory( separator = ' ' ){
return (s, ...args) => {
return s
.map(( v, i ) => v + ( args[i] || '') )
.join('')
.replace(/(\r\n|\r|\n)([\s]+)?\|/g, separator)
;
};
@LucaColonnello
LucaColonnello / react-18next-with-hot-replacement.js
Created February 17, 2016 17:27
react-i18next with hot replacement
import i18next from 'i18next'
const resources = require("i18next-resource-store-loader!../assets/i18n/index.js");
i18next
.init({
lng: 'en', // set dynamically on build
fallbackLng: 'en',
resources: resources,
debug: true,
@LucaColonnello
LucaColonnello / Filter.jsx
Created March 9, 2016 21:29 — forked from gianmarcotoso/Filter.jsx
React Filter HoC
import React from 'react';
import { Component } from 'react';
let Filter = Filterable => class extends Component {
constructor(props) {
super(props);
this.state = {
items: props.items
};
@LucaColonnello
LucaColonnello / Sort.jsx
Created March 9, 2016 21:30 — forked from gianmarcotoso/Sort.jsx
React Sort HoC
import React from 'react';
import { Component } from 'react';
let Sort = Sortable => class extends Component {
constructor(props) {
super(props);
this.state = {
items: []
}
@LucaColonnello
LucaColonnello / bindNestedActionCreators.js
Last active May 23, 2016 08:58
Redux bind nested action creators
import { bindActionCreator } from 'redux';
export default function bindNestedActionCreators(actions, dispatch) {
if (typeof actions !== 'function' && (typeof actions !== 'object' || actions === null)) return false;
let dispatchedActions;
if (typeof actions === 'object') {
dispatchedActions = {};
@LucaColonnello
LucaColonnello / AContainer.jsx
Created August 5, 2016 15:39
withRender HoC
import React, { Component } from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
// supposed to receive a class and return a new function (curryed) that
// if called add a render function to the received class,
// rendering the received component passing down all the props
import { withRender } from './utils';
// container class with event handler and action creator dispatch
@LucaColonnello
LucaColonnello / Example of render engine.jsx
Created December 2, 2016 09:13
Example of render engine
const componentMap = {
TemplateX: ({ children }) => (<div>{children}</div>),
Header: ({ text }) => (<h1>{text}</h1>),
HeroBanner: ({ imgUrl, text }) => (
<section style={{ backgroundImage: `url(${imageUrl}) center center` }}>
<h2>{text}</h2>
</section>
),
Markdown: ({ content }) => (<ReactMarkdown content={content} />),
Carousel: ({ children }) => (<ReactSlick>{children}</ReactSlick>)