Skip to content

Instantly share code, notes, and snippets.

View andreypopp's full-sized avatar
🏠
Working from home

Andrey Popp andreypopp

🏠
Working from home
View GitHub Profile

Fastpack - pack JavaScript fast & easy

This gist is a submission for a lightning talk on the ReactiveConf 2018.

Why?

  • JavaScript bundling can be a lot faster
  • There are proper tools to guarantee consistency
  • Writing OCaml code is fun!
@okonet
okonet / lightning_talk_proposal.md
Last active April 10, 2018 10:09
Make linting great again! -- ReactiveConf 2017 ⚡️talk proposal

Please 🌟 this gist to vote for this proposal!

Make linting great again!

tabs vs spaces

No other topic in software development probably has so much controversy as linting.

With a wrong workflow linting can be really a pain and will slow you and your team down. With a proper setup, though, it can save you hours of manual work reformatting the code and reducing the code-review overhead.

Parser

  • /src/parser/spider_monkey_ast.ml: The type definitions for the AST. Tries to stay very close to ESTree
  • /src/parser/lexer_flow.mll: The ocamllex lexer logic
  • /src/parser/parser_flow.ml: The recursive descent JS parser

Inference

  • /src/typing/type_inference_js.ml: Contains the "entry point" for inference (Function called infer_ast).
  • /src/typing/statement.ml: Most of the inference logic (runs through the AST and generates the initial constraints)
#!/usr/bin/env python
import pynvim, os, re, sys, time
# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
# buffers that have had `:bdelete` called on them and aren't in the buffer
# list, so we have to filter those out.
def get_listed_buffers(nvim):
return set(buf.number for buf in nvim.buffers \
if nvim.eval('buflisted(%d)' % buf.number))
@jbeda
jbeda / nar-spec.md
Created September 1, 2015 23:04
Nix Archive (NAR) file specification

This is taken directly from Figure 5.2 in http://nixos.org/~eelco/pubs/phd-thesis.pdf. It is presented here to be more directly linkable.

serialise(fso) = str("nix-archive-1") + serialise1(fso)

serialise1(fso) = str("(") + seralise2(fso) + str(")")

serialise2(type=Regular, exec, contents) =
  str("type") + str("regular")
 + (
@natew
natew / gist:f0c396442584b071915f
Last active August 29, 2015 14:18
Nested animations through context in Reapp
<ViewList animator> // passes context: { step: 0.555 }
<View /> // extends context with { index: 0 }
<View /> // ...
<View> // extends context with { index: 2 }
// here's the tricky part: you can nest ViewLists, and they should pass their "new" context down to their children
<ViewList> // reset context { step: 0 }
<View /> // reset context { index: 0 }
</ViewList>
</View>
@nkbt
nkbt / .eslintrc.js
Last active April 23, 2024 03:19
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
/** @jsx React.DOM */
var Bubbler = React.createClass({
render: function() {
return <input type="button" onClick={this.props.onFoo} value="Click me"/>;
}
});
var Handler = React.createClass({
onFoo: function() {
@chenglou
chenglou / gist:caff72e06e0c3d72c9b4
Last active October 24, 2015 20:05
Thoughts on Layout

While I was experimenting with animation, I had to make a few basic prototypes for a layout system and see how they intertwine. Here's the API in conjunction with React:

var MyComp = React.createClass({
  registerLayoutValues: function() {
    return {
      self: {
        width: 30,
        left: (get('parent', 'width') - get('self', 'width')) / 2 // Center.
 }