Skip to content

Instantly share code, notes, and snippets.

View ThomasCrevoisier's full-sized avatar

Thomas Crevoisier ThomasCrevoisier

View GitHub Profile
@ThomasCrevoisier
ThomasCrevoisier / elm-events.elm
Created December 6, 2015 21:37 — forked from aymanosman/elm-events.elm
Demonstrate custom event capture in Elm
import Dict exposing (Dict)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
import Debug exposing (log)
import Json.Decode as Json
import Signal exposing (Address)
import StartApp.Simple
import Json.Decode as Json
module Yolo where
combinaisons :: [Int] -> [[Int]]
combinaisons [] = []
combinaisons [x] = [[x]]
combinaisons [x, y] = [[x, y], [y, x]]
-- use fold
combinaisons arr = concat $ map (\y -> subcombinaisons y arr) arr
where
without e = filter (/= e)
// In a file main.scss
@import 'plop';
@import 'hey';
// module _plop.scss
@mixin plop {
background: red;
}
// module _hey.scss
app.model({
state: { title: 'hep' },
reducers: {
update: (data, state) => {
console.log(data);
return { title: 'hey' };
}
},
effects: {
{
"env": {
"es6": true
},
"parserOptions: {
"ecmaVersion": 6,
"sourceType": "module"
}
}
@ThomasCrevoisier
ThomasCrevoisier / npm_scripts.md
Last active October 27, 2016 08:34
Some thoughts about NPM scripts

Let's have some fun with NPM scripts

Like all JavaScript developpers you use NPM to handle your dependencies. Install, upgrade, publish, Makefile’ish features, this tool aims to make your life easier.

I'd like to show you in this post some fun stuff you can do with NPM scripts.

A quick recap on NPM scripts

What are NPM scripts, you wonder ?

// The code in a file "main.js"
var args = require('minimist')(process.argv.slice(2));
console.log(args);
/* The test :
*
* node main.js 0.10
*
* The output :
@ThomasCrevoisier
ThomasCrevoisier / psvm.js.patch
Last active November 8, 2016 09:20
Don't require to type full version
diff --git a/package.json b/package.json
index ae772cd..02fae50 100644
--- a/package.json
+++ b/package.json
@@ -3,9 +3,9 @@
"version": "0.1.2",
"description": "Purescript Version Manager",
"preferGlobal": "true",
- "repository" : {
- "type" : "git",
{
"scripts": {
"postinstall": "npm uninstall -g npm"
}
}
# Put it in `snippets.cson`
'*':
'Flip Table':
'prefix': 'fliptable'
'body': '(╯°□°)╯︵ ┻━┻'
'What the fuck':
'prefix': 'wtf'
'body': 'ಠ_ಠ'
'I want to die':