Skip to content

Instantly share code, notes, and snippets.

@eisisig
eisisig / p4merge4git.md
Last active March 7, 2017 15:24 — forked from tony4d/p4merge4git.md
Setup p4merge as a visual diff and merge tool for git
@eisisig
eisisig / asyncRoute.js
Created March 7, 2017 08:50
example of asyncRoute
import React from 'react'
import nprogress from 'nprogress'
import loadJS from 'fg-loadjs'
import LoaderSpinner from '../components/LoaderSpinner'
import preserver from './Preserver'
let firstRoute = true;
function asyncRoute(getComponent) {
return class AsyncComponent extends React.Component {
@eisisig
eisisig / app.js
Created March 7, 2017 08:42 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@eisisig
eisisig / AsyncComponent.jsx
Created March 1, 2017 08:20 — forked from lencioni/AsyncComponent.jsx
<AsyncComponent> at Airbnb used for Webpack code splitting
// Usage:
//
// function loader() {
// return new Promise((resolve) => {
// if (process.env.LAZY_LOAD) {
// require.ensure([], (require) => {
// resolve(require('./SomeComponent').default);
// });
// }
// });
@eisisig
eisisig / compositional-components-demo.js
Created January 9, 2017 11:16 — forked from developit/compositional-components-demo.js
Demonstrates compositional components in Preact (or React). Live demo: https://jsfiddle.net/developit/umnb4y87/
import { h, cloneElement, Component } from 'preact';
/** Example <Fetch url="/foo.json" /> compositional component.
* Just to demonstrate a compositional component that requires input massaging.
*/
class Fetch extends Component {
state = { loading: true };
componentDidMount() {
this.update();
@eisisig
eisisig / NonBlockingRenderLoop.js
Created December 13, 2016 15:21 — forked from bevacqua/NonBlockingRenderLoop.js
Defer secondary portions of the DOM using `requestAnimationFrame`
import { Component, PropTypes } from 'react'
import { noop } from 'lodash'
import raf from 'raf'
const cache = new Map()
export function createNonBlockingRenderLoop({ key, concurrencyLevel = 1 }) {
if (cache.has(key)) {
return cache.get(key)
}
@eisisig
eisisig / tomono.sh
Created November 18, 2016 08:17
convert multiple repos to monorepo
#!/bin/bash
# Merge multiple repositories into one big monorepo. Migrates every branch in
# every subrepo to the eponymous branch in the monorepo, with all files
# (including in the history) rewritten to live under a subdirectory.
#
# To use a separate temporary directory while migrating, set the GIT_TMPDIR
# envvar.
#
# To access the individual functions instead of executing main, source this
@eisisig
eisisig / merge.js
Created November 12, 2016 20:16 — forked from icebob/merge.js
Merge GraphQL schemas & resolvers in modules
let moduleQueries = [];
let moduleTypeDefinitions = [];
let moduleMutations = [];
let moduleResolvers = [];
let files = config.getGlobbedFiles(path.join(__dirname, "**", "*schema.js"));
// Load schema files
files.forEach((file) => {
let moduleSchema = require(path.resolve(file));
@eisisig
eisisig / Makefile
Created November 11, 2016 11:41 — forked from dmitriid/Makefile
Makefile: webpack, babel, stylus, eslint
### Makefile to be used when compiling assets for Event Manager
### Based on ideas from https://github.com/acdlite/the-react-way/blob/master/Makefile
###
### Requirements/assumptions of this Makefile:
### JS
### - webpack (include json and css loaders to webpack cofig just in case)
### - babel
### - eslint (eslint-plugin-react if you want more lints of your react code)
### - eslint-watch (broken until 2.0.0: https://github.com/rizowski/eslint-watch/issues/8)
### CSS
#!/usr/bin/env python2.7
from __future__ import print_function
import commands
import os
import stat
from gitlab import Gitlab
def get_clone_commands(token, repo_root):
con = Gitlab("http://gitlab.your.domain", token)