Skip to content

Instantly share code, notes, and snippets.

View jescalan's full-sized avatar

Jeff Escalante jescalan

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

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 January 13, 2020 15:58
A small babel transform to switch `getStaticProps` to `getServerProps` in nextjs
// 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 November 30, 2022 04:48
Github commit best practice

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

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 18:25
Spike v1 Migration Guide

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

---
title: 'wow'
---
hello, this is **markdown**!
@jescalan
jescalan / fooLoader.js
Created February 9, 2017 20:16
The issue with passing functions to loaders in webpack2
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 December 11, 2016 21:02 — forked from tkraak/index.js
Gist from mistakes.io
/**
* @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 December 1, 2016 15:54
Almost pure markdown, but infinitely more flexible
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 August 29, 2016 15:37
Some helpful tools for working with open source node projects

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