Skip to content

Instantly share code, notes, and snippets.

View jgoux's full-sized avatar
I'm the fastest meme alive

Julien Goux jgoux

I'm the fastest meme alive
View GitHub Profile
@jgoux
jgoux / helpers.js
Last active April 6, 2016 16:21
redux-loop helpers
import { loop, Effects as E, liftState } from "redux-loop"
import {
cond, pathEq, map, T, reduce, toUpper, pipe, transpose,
lensProp, set as lensSet, view as lensView
} from "ramda"
export const mkInit = (f) => pipe(f, liftState)
export const mkActionType = (namespace) => (type) => `${namespace}/${type}`
@jgoux
jgoux / webpack.config.babel.js
Last active May 11, 2016 13:41
Default webpack configuration file
import path from 'path'
import dotenv from 'dotenv'
import webpack from 'webpack'
import CopyPlugin from 'copy-webpack-plugin'
import HtmlPlugin from 'html-webpack-plugin'
import CleanPlugin from 'clean-webpack-plugin'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
// Constants ------------------------------------
@jgoux
jgoux / NestedRoutes.purs
Created August 17, 2016 07:38 — forked from sloosch/NestedRoutes.purs
nested routes
module Main where
import HeroPrelude
import Component as C
import Counter as Counter
import Data.String as String
import Pux as Pux
import Pux.Html as H
import Pux.Router as PuxRouter
import TypeHere as TypeHere
@jgoux
jgoux / ClickCounter.purs
Created August 26, 2016 19:36 — forked from sloosch/ClickCounter.purs
Adapt State and Actions
module ClickCounter where
import Prelude
import Component as C
import Pux.Html as H
import Pux.Html.Events as E
import Data.Generic (class Generic)
type State = Int

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@jgoux
jgoux / install_sqlplus.md
Created November 8, 2016 13:28 — forked from tcnksm/install_sqlplus.md
How to install oracle client to Ubuntu 12.04

Install SQL*Plus

  1. Download .rpm package here
    • oracle-instantclinet*-basic-*.rpm
    • oracle-instantclinet*-devel-*.rpm
    • oracle-instantclinet*-sqlplus-*.rpm
  2. Install alien (sudo apt-get install alien)
  3. Convert the rpm files and install
    • sudo alien -i oracle-instantclinet*-basic-*.rpm
  • sudo alien -i oracle-instantclinet*-devel-*.rpm
@jgoux
jgoux / utils.js
Last active December 20, 2016 19:46
R.lens* and R.cond are best friends!
import R from 'ramda'
export const getFormData = R.pipe(
(form) => [...(new FormData(form)).entries()],
R.reduce(
(a, [k, v]) => {
const kL = R.lensProp(k)
return R.cond([
[R.pipe(R.view(kL), R.isNil), R.set(kL, v)],
[R.pipe(R.view(kL), R.isArrayLike), R.over(kL, R.append(v))],
@jgoux
jgoux / App.jsx
Created February 15, 2017 21:51
Let's rebuild the GithubGist interface with react !
// I leave out all the props & state, this is not the point here
// Level 1, can you directly grasp what's the page purpose?
// Assuming the component is in a "pages" folder, no need to append "Page" to it, it's all about context!
// Same apply for the Form component, the context says that we're here to create a new gist, no need to overthink the name.
// Putting the boring layout stuff into it's own component so you can focus on the page's domain.
const NewGist = () => (
<Layout>
<LastGistsNav />
<Form />
@jgoux
jgoux / database.js
Last active March 13, 2017 14:42
Database service
import R from 'ramda';
import knex from 'knex';
export const connect = knex;
export const disconnect = async client => {
return await client.destroy();
};
export const withClient = R.curry(async (config, cb) => {
@jgoux
jgoux / App.js
Last active March 28, 2017 10:10
CSS Grid Layout + React, version 2! (https://www.webpackbin.com/bins/-KgGJxladDSzvMZkxAT8)
import React from 'react'
import styled, { injectGlobal, css } from 'styled-components'
import Grid from './Grid'
injectGlobal`
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}