In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:
- Separate big codebases into multiple repositories.
$(function() { | |
// good opportunity to combine into a single statement | |
// qq w cw <esc> A, <esc> 0 j q | |
var a = 10; | |
var b = 20; | |
var c = 30; | |
var d = 40; | |
var e = 50; | |
// opportunity to simplify syntax |
import R from 'ramda' | |
const isObject = R.compose(R.equals('Object'), R.type); | |
const allAreObjects = R.compose(R.all(isObject), R.values); | |
const hasLeft = R.has('left'); | |
const hasRight = R.has('right'); | |
const hasBoth = R.both(hasLeft, hasRight); | |
const isEqual = R.both(hasBoth, R.compose(R.apply(R.equals), R.values)); | |
const markAdded = R.compose(R.append(undefined), R.values); |
import React, { PureComponent } from "react"; | |
import { StyleSheet } from "react-native"; | |
import ReglView from "./ReglView"; | |
import mat4 from "gl-mat4"; | |
import bunny from "bunny"; | |
export default class Bunny extends PureComponent { | |
drawCommand = regl => { | |
return regl({ | |
vert: ` |
const compose = (f, g) => x => f(g(x)) | |
const Id = x => | |
({ | |
fold: f => f(x), | |
map: f => Id(f(x)) | |
}) | |
Id.of = Id | |
const Tuple = (_1, _2) => |
A general-purpose DOM tree walker based on https://stackoverflow.com/questions/10730309/find-all-text-nodes-in-html-page (Phrogz' answer and its comments).
The textNodesUnder()
function would then look like this:
function textNodesUnder(el) {
return walkNodeTree(el, {
inspect: n => !['STYLE', 'SCRIPT'].includes(n.nodeName),
collect: n => (n.nodeType === Node.TEXT_NODE),
//callback: n => console.log(n.nodeName, n),
});