Skip to content

Instantly share code, notes, and snippets.

View elmasse's full-sized avatar

Masse Fierro elmasse

View GitHub Profile
npm version patch && git push --follow-tags
npm publish
@elmasse
elmasse / gist:d70565bf9668a9b2f4ea
Created June 15, 2015 19:50
babel mocha tests
'scripts': {
'test': 'mocha --compilers js:babel/register'
}
@elmasse
elmasse / Uninstall-node
Last active January 29, 2016 22:35
Uninstall node + npm on Mac OS
// delete all files create by node installer
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
// remove folders and bom files
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
// remove user related
sudo rm -rf ~/.npm*
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
@elmasse
elmasse / webtask.js
Last active April 13, 2017 14:36
webtaks slack bot npm stats
'use latest';
const express = require('express');
const request = require('request');
const moment = require('moment');
const { fromExpress } = require('webtask-tools');
const app = express();
@elmasse
elmasse / -components-header.js
Created June 27, 2017 22:05
next issue with safari
import Link from 'next/link'
const Header = () => (
<div>
<Link href='/'>
<a>Home</a>
</Link>
<Link href='/about'>
<a>About</a>
</Link>
@elmasse
elmasse / gh-pages-deploy.md
Created July 24, 2017 15:07 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@elmasse
elmasse / next.config.js
Created September 23, 2017 01:57
nextein: custom routes
const nexteinConfig = require('nextein/config').default
const stories = ['food', 'cars'].reduce( (prev, entry) => ({
...prev,
[`/${entry}`]: { page: '/stories', query: { category: `stories/${entry}` } }
}), {})
module.exports = nexteinConfig({
exportPathMap: () => ({
'/all-posts': { page: '/all-posts' },
new Date(post.data.date).toLocaleString(format.locale, format.options)
Use toLocaleDateString();
The toLocaleDateString() method returns a string with a language-sensitive representation of the date portion of the date. The locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function.
The values you can passed in options for different keys:
day:
The representation of the day.
@elmasse
elmasse / components-page-transitions.js
Created February 6, 2018 12:32
Exploring Next animated transitions
import React, { Component } from 'react'
import Router from 'next/router'
import { parse, format } from 'url'
import raf from 'raf'
Router.ready(function() {
// monkey patching Router.router
const router = Router.router
if (!router.__patched) {
const _change = router.change