Skip to content

Instantly share code, notes, and snippets.

Max Fierro elmasse

Block or report user

Report or block elmasse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .babelrc
{
"presets": ["env"]
}
@elmasse
elmasse / index.js
Last active Jul 2, 2018
nextein-plugin-markdown-from-git
View index.js
const fetch = require('isomorphic-fetch')
const fm = require('frontmatter')
const { readFileSync, statSync } = require('fs')
const { resolve, basename, extname, relative, dirname, sep } = require('path')
const pathToRegEx = require('path-to-regexp')
const parser = require('./parser')
module.exports = {
source : async ({ extension = 'md', entriesDir = ['posts'], remark = [], rehype = [] } = {}) => {
@elmasse
elmasse / post-list-entry.js
Last active May 5, 2018
PostList for nextein 1.3.0-beta.4
View post-list-entry.js
//nextein-example/components/post-list-entry.js
import React from 'react'
import Link from 'nextein/link'
import { Content } from 'nextein/post'
const countWords = (s) => {
s = s.replace(/(^\s*)|(\s*$)/gi,"");//exclude start and end white-space
s = s.replace(/[ ]{2,}/gi," ");//2 or more space to 1
s = s.replace(/\n /,"\n"); // exclude newline with a start spacing
View Keybase.md

Keybase proof

I hereby claim:

  • I am elmasse on github.
  • I am elmasse (https://keybase.io/elmasse) on keybase.
  • I have a public key ASBwebycwQP2p7sgVTrnn8kRBI-Ec4oCraSrIxbv9u_kNQo

To claim this, I am signing this object:

@elmasse
elmasse / components-page-transitions.js
Created Feb 6, 2018
Exploring Next animated transitions
View components-page-transitions.js
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
View Date.toLocaleString
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 / next.config.js
Created Sep 23, 2017
nextein: custom routes
View next.config.js
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' },
@elmasse
elmasse / gh-pages-deploy.md
Created Jul 24, 2017 — 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).
View gh-pages-deploy.md

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 / -components-header.js
Created Jun 27, 2017
next issue with safari
View -components-header.js
import Link from 'next/link'
const Header = () => (
<div>
<Link href='/'>
<a>Home</a>
</Link>
<Link href='/about'>
<a>About</a>
</Link>
@elmasse
elmasse / webtask.js
Last active Apr 13, 2017
webtaks slack bot npm stats
View webtask.js
'use latest';
const express = require('express');
const request = require('request');
const moment = require('moment');
const { fromExpress } = require('webtask-tools');
const app = express();
You can’t perform that action at this time.