Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Escalante jescalan

View GitHub Profile
@jescalan
jescalan / browser-support-table.md
Last active Mar 13, 2020 — forked from danbovey/browser-support-table.md
Browser support table in markdown
View browser-support-table.md

Table

Chrome Firefox Opera Safari IE
Latest Latest Latest Latest 11+

Code

![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_24x24.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_24x24.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_24x24.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_24x24.png) | ![
@jescalan
jescalan / transform.js
Created Jan 13, 2020
A small babel transform to switch `getStaticProps` to `getServerProps` in nextjs
View transform.js
// getStaticProps, which we use as the primary method for data fetching on all our pages,
// runs at build time and generates page data statically. this data is not regenerated
// unless the site is rebuilt, a lot like a static site generator. therefore, it's not
// helpful when you are trying to live preview content changes without rebuilding the entire
// site, even though its great for performance in production.
//
// In order to solve this, we run this script before pushing the preview version of the website,
// which replaces `getStaticProps` with `getServerProps`, a method with the same signature that
// dynamically fetches data fresh on every page load, making it excellent for fast-changing data,
// which is just what we need for a preview environment.
@jescalan
jescalan / github-commits.md
Last active Sep 25, 2019
Github commit best practice
View github-commits.md

Github Commit Security

Within github, there are two things you can do to make your commits more secure both for you and for others you work with: signing your commits, and ensuring that your personal email remains private in your commits. In this piece, We'll go over each of these methods, why they are important, and how to accomplish them smoothly on Mac OSX.

Commit Signing

Anyone who has access to a repository can push a commit to that repo under your name, and nobody will be able to tell the difference. All they have to do is change their git settings to use your name and email address for commits. Let that sink in for a minute, or if it helps more, read this piece explaining how it can turn into a serious problem. The way you can solve this problem is through signing your commits with a GPG key - when you do this, github will display a "verified" badge next to each commit. You can even set up repos so t

View interface-example.js
new SpikeDatoCMS({
addDataTo: locals,
token: 'xxx',
templates: [
{
collection: (dato) => dato.blogPosts,
path: 'templates/post.html',
output: (post) => { return `posts/${post.slug}.html` }
}
]
@jescalan
jescalan / index.md
Last active May 8, 2017
Spike v1 Migration Guide
View index.md

Spike v1 Migration Guide

Spike v1 represents a significant change, mostly because it includes an update from webpack v1 to webpack v2 behind the scenes. The aim of this piece is to guide you through the process of migration from one version to the next, and explain a bit of the rationale behind these changes.

App.js Updates

The bulk of the migration work lies in the app.js file. Webpack drastically changed its configuration in a very breaking manner between v1 and v2, so spike was forced to do the same, since spike is an extension of webpack.

Webpack Config Changes

View foo-markdown
---
title: 'wow'
---
hello, this is **markdown**!
@jescalan
jescalan / fooLoader.js
Created Feb 9, 2017
The issue with passing functions to loaders in webpack2
View fooLoader.js
module.exports = function (source) {
console.log(this.query) // { foo: [null] } -- this is because when it's json serialized, it nulls out functions
const realOptions = this.options.module.rules.reduce((m, r) => {
const fooLoaderUse = r.use.find((u) => u.loader === 'foo-loader')
return fooLoaderUse ? fooLoaderUse.options : m
}, null)
console.log(realOptions) // foo: [() => 'bar'] -- it works, but is v. ugly
}
@jescalan
jescalan / index.js
Last active Dec 11, 2016 — forked from tkraak/index.js
Gist from mistakes.io
View index.js
/**
* @param {number} n - integer (n >= 0)
* @param {number} d - digit (0 <= d <= 9)
* square all numbers k between 0 and n (0 <= k <= n)
* count the number of digits d used in the k*k's
* example
*
* n = 10
* d = 1
@jescalan
jescalan / post.sgr
Created Dec 1, 2016
Almost pure markdown, but infinitely more flexible
View post.sgr
extend(src='layout.sgr')
block(name='content')
.post(md).
# A markdown post
Here you can write **pure markdown** without issue.
You can treat this entire block like it's a normal markdown file and it will be compiled as such. Pretty cool! Everything works -- headlines, links, etc.
.footnote What's nice is that if you need to inject some extra html, javascript, add another block to change the title, etc. this is very simple to do since you have the capability to write full html with a reshape file as opposed to markdown.
@jescalan
jescalan / index.md
Last active Aug 29, 2016
Some helpful tools for working with open source node projects
View index.md

Helpful Node Tools

  • greenkeeper
    when one of your projects' dependencies releases a new version, creates a pull request to update it
    install: npm i greenkeeper -g, run: gk enable
  • npm-check
    command line tool which checks your projects dependencies, tells you when there are any out of date, upgrades them
    install: npm i npm-check -g, run: npm-check -u
  • fixpack
    checks your package.json file to make sure it has important fields, organizes fields consistently
You can’t perform that action at this time.