Skip to content

Instantly share code, notes, and snippets.

View MoOx's full-sized avatar
:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)

Max MoOx

:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)
View GitHub Profile
@MoOx
MoOx / stylesheet.js
Created May 2, 2014 19:00
Rework gulp task
var gulp = require("gulp")
var opts = require("./options")
var util = require("gulp-util")
var plumber = require("gulp-plumber")
var rework = require("gulp-rework")
var reworkPlugins = {
imprt: require("rework-npm"),
// parent: require("rework-parent"),
// breakpoints: require("rework-breakpoints"),
vars: require("rework-vars"),
@MoOx
MoOx / svgicon.css
Last active December 3, 2018 08:50
Svg icons with React.js with webpack loader (svg: raw-loader)
.SVGIcon {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* fix webkit/blink poor rendering issues */
transform: translate3d(0,0,0);
/* it's better defined directly because of the cascade shit
width: inherit;
height: inherit;
@MoOx
MoOx / storage.js
Created May 22, 2014 11:56
Simple localStorage abstraction
var prefix = "storage."
, storage = {
getAll: function() {
var data = {};
for (var key in localStorage){
if (key.indexOf(prefix) === 0) {
data[key.replace(prefix, "")] = storage.getFromLocalStorage(key);
}
}
var gulp = require("gulp")
gulp.task("styles", require("./tasks/styles"))
// build
gulp.task("dist", [
"styles"
])
// dev tasks
@MoOx
MoOx / options.js
Last active October 20, 2016 14:37
Optimized watchify/browserify with gulp
/**
* parses cli arguments as options
*/
var options = require("minimist")(process.argv.slice(2))
var defaults = {
debug: true,
plumber: true,
minify: false
}
// set some defaults options depending on some flags
@MoOx
MoOx / bem.css
Created June 17, 2014 15:09
my CSS indentation with BEM
.Block {
}
.Block--modifier {
}
.Block:state {
@MoOx
MoOx / gulpfile.js
Created June 23, 2014 11:11
My current gulpfile with watch inside
var gulp = require("gulp")
var server = require("./tasks/server")
gulp.task("clean", require("./tasks/clean"))
// generated assets
gulp.task("icons", require("./tasks/icons"))
gulp.task("scripts:linting", require("./tasks/scripts-linting"))
gulp.task("scripts", ["scripts:linting"], require("./tasks/scripts"))
gulp.task("styles", require("./tasks/styles"))
@MoOx
MoOx / README.md
Last active May 5, 2023 12:35
rework vs postcss benchmarks

Rework vs Postcss

❯ node rework.js
rework: parsing/stringify done in 243.85ms (avg on 50 runs)

❯ node postcss.js
postcss: parsing/stringify done in 408.26ms (avg on 50 runs)
@MoOx
MoOx / input-clearable.js
Created July 29, 2014 15:37
React clearable input
/**
* <InputClearable />
*
* @es6
* @jsx React.DOM
*/
module React from "react"
import IconSvg from "../iconsvg"
replaceFunctionCall("blah TRUC(1) machin TRUC(2)", "TRUC", fn(body) {
// body === 1, then 2
/* your stuff on body */
// eg body += "truc"
return body
})
// => "blah 1truc machin 2truc"