Skip to content

Instantly share code, notes, and snippets.

View ef2k's full-sized avatar

Eddie Flores ef2k

  • Brooklyn, NY
View GitHub Profile
@ef2k
ef2k / id-software-principles.md
Created March 23, 2019 22:40
Id Software Principles - The Early Days of Id Software - John Romero @ WeAreDevelopers Conference 2017

https://www.youtube.com/watch?v=KFziBfvAFnM

  1. No prototypes. Just make the game. Polish as you go. Don't depend on polish happening later. Always maintain constantly shippable code. (Large teams require more planning though.)

  2. It's incredibly important that your game can always be run by your team. Bulletproof your engine by providing defaults (for input data) upon load failure.

@ef2k
ef2k / gist:a9091900636172f30564b971b109bfdc
Created January 20, 2019 02:44
Local dist module outside of $GOPATH
In project using module:
`go module init <project name>`
```
// go.mod
module main
require (
github.com/ef2k/paco v0.0.0 // Path used in import path
)
@ef2k
ef2k / google-map.js
Last active December 25, 2018 19:06
Google Maps React Wrapper
/* global window, document */
import React, { Component } from 'react';
import PropTypes from 'prop-types';
/**
* A component wrapping the Google Maps v3 API. Lazy loads the google maps
* script if not already loaded.
*/
export class GoogleMap extends Component {
constructor(props) {
@ef2k
ef2k / fetchMiddleware.js
Created December 4, 2018 06:19
jwt middleware
/**
* fetchMiddleware appends a JWT to the header of each fetch action
* and checks the response. If a 401 is encountered, it prompts for
* a redirect to /login.
*/
const fetchMiddleware = (fetch, history) => store => next => (action) => {
if (action.type === 'FETCH') {
const { url, params } = action;
const { token } = store.getState();
if (!params.headers) {
@ef2k
ef2k / keybindings.json
Created October 30, 2018 02:18
VSC Keybindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl+l",
"command": "workbench.action.navigateRight"
},
@ef2k
ef2k / settings.json
Created October 30, 2018 02:15
VSC User Settings
{
"vim.enableNeovim": false,
"vim.neovimPath": "nvim",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/vendor": true,
@ef2k
ef2k / settings.json
Created September 26, 2018 03:35
VSCode Settings
{
"vim.enableNeovim": false,
"vim.neovimPath": "nvim",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/vendor": true,
@ef2k
ef2k / keybindings.json
Created September 26, 2018 03:33
VSCode Keybindings like Ctrl+P in VIM
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl+l",
"command": "workbench.action.navigateRight"
},
@ef2k
ef2k / chroma_renderer.go
Last active July 10, 2020 00:10
Chroma renderer for Blackfriday
package build
import (
"io"
"github.com/alecthomas/chroma"
"github.com/alecthomas/chroma/formatters/html"
"github.com/alecthomas/chroma/lexers"
"github.com/alecthomas/chroma/styles"
"github.com/russross/blackfriday"
@ef2k
ef2k / stick-it.vue
Last active June 23, 2018 18:31
A minimal implementation of a fixed header on scroll with a translucent bg.
<template>
<header>
<h1>Brand</h1>
</header>
</template>
<script>
;(() => {
const header = document.querySelector('header');
const stick = header.offsetTop;