Skip to content

Instantly share code, notes, and snippets.

View namelos's full-sized avatar
💤
zzz

Yifan Wang namelos

💤
zzz
View GitHub Profile
@sitkevij
sitkevij / minikube-mac-install.md
Last active September 24, 2021 12:11
minikube mac install

Hello Minikube Mac Install

install brew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
@Preetam
Preetam / fdb-flow.md
Created February 3, 2016 15:33
FoundationDB Flow

Flow: Actor-based Concurrency with C++

Engineering challenges

FoundationDB began with ambitious goals for both high performance per node and scalability. We knew that to achieve these goals we would face serious engineering challenges while developing the FoundationDB core. We'd need to implement efficient asynchronous communicating processes of the sort supported by Erlang or the Async library in .NET, but we'd also need the raw speed and I/O efficiency of C++. Finally, we'd need to perform extensive simulation to engineer for reliability and fault tolerance on large clusters.

To meet these challenges, we developed several new tools, the first of which is Flow, a new programming language that brings actor-based concurrency to C++11. To add this capability

@glortho
glortho / dispatch_decorator_debug.js
Created December 29, 2015 19:22
Output useful debug info from Flux dispatch decorator
const groupStyle = 'font-weight: normal; color: gray';
const stackStyle = 'color: gray';
function dispatchDecoratorFactory( ACTION ) {
return function dispatchDecorator( target, key, descriptor ) {
const fn = descriptor.value;
descriptor.value = function decoratedMethod( ...args ) {
if ( myModeFlag === 'debug' ) {
console.groupCollapsed( `%c${target.constructor.name}.${key}(%O) -> ${ACTION}`, groupStyle, args );
console.debug( `%c${( new Error() ).stack}`, stackStyle );
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active July 4, 2024 07:31
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@namelos
namelos / minCounter.js
Last active February 19, 2016 10:58
Minimalist redux example
import React, { Component } from 'react'
import { render } from 'react-dom'
import { createStore, bindActionCreators } from 'redux'
import { connect, Provider } from 'react-redux'
const increment = () => ({ type: 'increment' })
const counter = (state = 0, action) => {
switch (action.type) {
@almost
almost / flow-type-at-pos.el
Last active June 9, 2016 20:57
Use flow.js to show type signature for value under cursor whenever the cursor is idle for more than half a second (assumes espresso-mode.el)
(defun call-process-on-buffer-to-string (command)
(with-output-to-string
(call-process-region (point-min) (point-max) shell-file-name nil standard-output nil shell-command-switch command)))
(defun flow-type ()
(interactive)
(let* ((info (json-read-from-string
(call-process-on-buffer-to-string
(format "flow type-at-pos --json %d %d" (line-number-at-pos) (current-column)))))
@aldendaniels
aldendaniels / alternative-to-higher-order-components.md
Last active October 6, 2018 09:50
Alternative to Higher-order Components

React now supports the use of ES6 classes as an alternative to React.createClass().

React's concept of Mixins, however, doesn't have a corollary when using ES6 classes. This left the community without an established pattern for code that both handles cross-cutting concerns and requires access to Component Life Cycle Methods.

In this gist, @sebmarkbage proposed an alternative pattern to React mixins: decorate components with a wrapping "higher order" component that handles whatever lifecycle methods it needs to and then invokes the wrapped component in its render() method, passing through props.

While a viable solution, this has a few drawbacks:

  1. There's no way for the child component to override functionality defined on the higher order component.
;;; packages.el --- cdlatex Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <[email protected]>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
@koistya
koistya / ReactJS-Server-Side-Rendering.md
Last active September 15, 2023 07:32
Server-side Rendering (SSR) for ReactJS / Flux Applications. Setting document.title

Files

The basic structure of a React+Flux application (see other examples)

 - /src/actions/AppActions.js     - Action creators (Flux)
 - /src/components/Application.js - The top-level React component
 - /src/constants/ActionTypes.js  - Action types (Flux)
 - /src/core/Dispatcher.js        - Dispatcher (Flux)
 - /src/stores/AppStore.js        - The main store (Flux)
@bensmithett
bensmithett / AppComponent.cjsx
Last active April 20, 2020 06:59
The world's tiniest guide to getting started with React, JSX, CoffeeScript & Webpack
React = require("react")
VideoPlayerComponent = require("components/VideoPlayerComponent")
AppComponent = React.createClass
# Need to add this manually if you want it to show up in React Chrome Dev Tools
# See https://github.com/jsdf/coffee-react-transform/issues/16
displayName: "AppComponent"
render: ->
<div>