Skip to content

Instantly share code, notes, and snippets.

@BenJanecke
BenJanecke / backbone.js
Created October 6, 2022 22:15
Contrived interactive component example
(function (window, $, Backbone, app, _) {
app.TodoItem = Backbone.View.extend({
tagName: "li",
template: _.template(
'<div class="view">' +
'<input class="toggle" type="checkbox" <%= completed ? "checked" : "" %>>' +
'<label><%- title %></label>' +
'<button class="destroy"></button>' +
'</div>' +
'<input class="edit" value="<%- title %>"></input>'
@BenJanecke
BenJanecke / new.js
Created October 6, 2022 21:43
Game of life comparison
function main(width = 50, height = 20, refreshRate = 250) {
let life = generateRandomBoard(width, height);
draw(life);
setInterval(() => {
life = nextGeneration(life);
draw(life);
}, refreshRate);
}
const states = {
"Mui Component": {
"prefix": "muicomp",
"body": [
"import * as React from 'react';",
"import classnames from 'classnames';",
"import { withStyles, createStyles, WithStyles, Theme } from '@material-ui/core/styles';",
"",
"const styles = (theme: Theme) => createStyles({",
"\troot: {},",
#!/bin/sh
TIMEOUT=15
QUIET=0
echoerr() {
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
}
usage() {
@BenJanecke
BenJanecke / react-meetup-cpt.md
Last active March 5, 2018 09:03
react-meetup-cpt
  1. Stateless/Presentational
class ICauseHeadaches extends Component {
  render() {
    return <div />
  }
}
const IRenderADiv = () => <div />;
@BenJanecke
BenJanecke / common-words.txt
Created February 27, 2018 06:01
common words
"ability","able","aboard","about","above","accept","accident","according",
"account","accurate","acres","across","act","action","active","activity",
"actual","actually","add","addition","additional","adjective","adult","adventure",
"advice","affect","afraid","after","afternoon","again","against","age",
"ago","agree","ahead","aid","air","airplane","alike","alive",
"all","allow","almost","alone","along","aloud","alphabet","already",
"also","although","am","among","amount","ancient","angle","angry",
"animal","announced","another","answer","ants","any","anybody","anyone",
"anything","anyway","anywhere","apart","apartment","appearance","apple","applied",
"appropriate","are","area","arm","army","around","arrange","arrangement",

Keybase proof

I hereby claim:

  • I am benjanecke on github.
  • I am otherben (https://keybase.io/otherben) on keybase.
  • I have a public key ASC2WYfNyYHnj02gxBItDjtLkWn4sLGIDM2qWD2IRNpcTAo

To claim this, I am signing this object: