Skip to content

Instantly share code, notes, and snippets.

View erlenstar's full-sized avatar

Jeff Zerger erlenstar

  • Phykos, PBC
  • Pacifica, CA
View GitHub Profile
@matthiasott
matthiasott / vscode-extensions.sh
Created April 23, 2020 00:08
A bash script to install Visual Studio Code extensions via the CLI
# https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
code --install-extension aaron-bond.better-comments
# https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager
code --install-extension alefragnani.project-manager
# https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client
code --install-extension bmewburn.vscode-intelephense-client
# https://marketplace.visualstudio.com/items?itemName=christian-kohler.npm-intellisense
@BretFisher
BretFisher / present.zsh-theme
Last active September 22, 2023 11:33
oh-my-zsh theme for presentations (hides prompt features based on path)
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme
@blainerothrock
blainerothrock / gen.swift
Last active July 12, 2018 15:56
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
@xem
xem / readme.md
Last active April 5, 2024 23:16
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@erlenstar
erlenstar / .block
Created May 4, 2016 20:58 — forked from mbostock/.block
Nest Treemap
license: gpl-3.0
height: 1060

I18n with Records

Goals:

  1. Elm's typechecker enforces that
  • each localization has all the same messages.
  • the messages you are referring to in your view code exist.
  1. Only the localized strings for the current locale are sent across the wire
  2. Messages which have interpolations are typechecked as well
@FrancesCoronel
FrancesCoronel / sampleREADME.md
Last active March 26, 2024 01:21
A sample README for all your GitHub projects.

Repository Title Goes Here

Frances Coronel

INSERT GRAPHIC HERE (include hyperlink in image)

Subtitle or Short Description Goes Here

ideally one sentence >

@danawoodman
danawoodman / 1-react-websockets-reflux.md
Last active September 15, 2021 14:48
Using WebSockets with Reflux and React

WebSockets + Reflux + React

Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.

Overview

This trifect works well if you think of things like so:

  1. Reflux Store: The store fetches, updates and persists data. A store can be a list of items or a single item. Most of the times you reach for this.state in react should instead live within stores. Stores can listen to other stores as well as to events being fired.
  2. Reflux Actions: Actions are triggered by components when the component wants to change the state of the store. A store listens to actions and can listen to more than one set of actions.

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

function numerical_int(dx, y_array) {
var maxy = Math.max.apply(null, y_array);
var dy_array = y_array.map(function(num) {
return Math.abs(maxy - num);
});
var profile_integral = 0;
var n = dy_array.length;
for (i = 1; i < n; i++) {
var dy_init = dy_array[i - 1];
var dy_end = dy_array[i];