Skip to content

Instantly share code, notes, and snippets.

@kyldvs
kyldvs / Chalk.re
Last active January 24, 2018 22:09
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*/
/* Uses Ansi.re from: https://gist.github.com/kyldvs/63430656217a39b0143d01704ccf6b5f */
module IntMap =
Map.Make(
{
type t = int;
@kyldvs
kyldvs / Foo.re
Created October 17, 2017 03:31
refmt CRLF repro
let x = 1;
/* foo */
let y = 2;

Keybase proof

I hereby claim:

  • I am kyldvs on github.
  • I am k4d (https://keybase.io/k4d) on keybase.
  • I have a public key whose fingerprint is 9FBF 284D F406 77EA 54C7 A918 B058 B163 CBE8 D588

To claim this, I am signing this object:

'use strict';
var NuclideFormatJSBase = require('nuclide-format-js-base');
var createModuleMap = NuclideFormatJSBase.createModuleMap;
var defaultAliases = NuclideFormatJSBase.defaultAliases;
var defaultBuiltIns = NuclideFormatJSBase.defaultBuiltIns;
var defaultBuiltInTypes = NuclideFormatJSBase.defaultBuiltInTypes;
var transform = NuclideFormatJSBase.transform;
'use strict';
var NuclideFormatJSBase = require('nuclide-format-js-base');
var createModuleMap = NuclideFormatJSBase.createModuleMap;
var defaultAliases = NuclideFormatJSBase.defaultAliases;
var defaultBuiltIns = NuclideFormatJSBase.defaultBuiltIns;
var defaultBuiltInTypes = NuclideFormatJSBase.defaultBuiltInTypes;
var transform = NuclideFormatJSBase.transform;
@kyldvs
kyldvs / async-flux.js
Last active August 29, 2015 14:27
An approach to async data fetching using flux/utils
/**
* One approach to async data fetching using Flux utils.
*/
// A helper class to deal with an asynchronous process, this is very basic, there
// is a lot of room for improvement here, like memoizing async tokens where data
// is null
type AsyncState = 'not_loaded' | 'loading' | 'error' | 'loaded';
class AsyncToken<T> extends Immutable.Record({state: null, data: null}) {
@kyldvs
kyldvs / FluxDerivedStore.js
Created August 14, 2015 16:04
FluxDerivedStore
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule FluxDerivedStore
* @flow
*/
'use strict';
import type Dispatcher from 'Dispatcher';
@kyldvs
kyldvs / gist:9de4c5d020b46a2d45e7
Last active August 29, 2015 14:25
Store with map
class BaseStore {
constructor(dispatcher) {
this._dispatcher = dispatcher;
this._actionMap = this.getActionHandlers();
this._dispatchToken = this._dispatcher.register(payload => {
this._actionMap[payload.type](payload);
});
}
}
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
@kyldvs
kyldvs / gist:7849562
Created December 7, 2013 22:00
Drawing an image from a 2D array of colors in java
package graphics;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;