Skip to content

Instantly share code, notes, and snippets.

@b2l
b2l / absolute-to-relative.js
Created April 3, 2019 14:16 — forked from tibdex/absolute-to-relative.js
jscodeshift codemod to change imports of internal modules using absolute path to relative path
/**
* This codemod expects 2 CLI arguments:
* - packageDir: the path of the directory containing the package.json. It's used to detect whether a path points
* to a dependency or an internal module.
* - rootDirs: root directory paths separated by a comma if you have more than one root.
* Let's say that you have two files:
* - src/component.js
* - src/index.js containing the import "import Component from 'component.js';"
* To have the transformation successfully working you need to call jscodeshift with the "--rootDirs ./src" argument.
*/
@b2l
b2l / pre-commit
Created August 21, 2015 11:27
Git pre-commit to prevent committing console.log or describe.only
#!/bin/sh
# Don't allow console.log() or describe.only statements to be committed.
#
# Add to .git/hooks/pre-commit
js_dir=`pwd`/app/assets/javascripts/*
echo "searching for console.log"
count=`grep -iR 'console\.log' $js_dir | wc -l`
syntax on
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
runtime! macros/matchit.vim
set tabstop=2
set softtabstop=2
set shiftwidth=2
@b2l
b2l / README.md
Created February 4, 2015 10:49
mnd-bootstrap

mnd-bootstrap

Here are some tips to work with the styleguide.

1- Use mnd-bootstrap from an other project

Classic worflow here, you have to create a component, change some style, etc... for a scree in some application (lets say mndx-web). As usual, you will implement the style in the mnd-bootstrap project and use the styleguide to check what you are doing. But before you push your change and release a new version, you want to try those change in the mndx-web. With bower, you can add a local dependency, here is how it works:

{
"name": "",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
var gulp = require('gulp'),
to5ify = require('6to5ify'),
browserify = require('browserify'),
watchify = require('watchify'),
source = require('vinyl-source-stream'),
reactify = require('reactify'),
gutil = require('gulp-util'),
webserver = require('gulp-webserver'),
sourcemaps = require('gulp-sourcemaps'),
buffer = require('vinyl-buffer'),