Skip to content

Instantly share code, notes, and snippets.

@takashi
takashi / index.js
Created February 26, 2016 02:15
minimum redux implimentation
import {element, createApp} from 'deku'
function action() {
return {
type: 'CLICKED'
}
}
function reducer(state, action) {
switch(action.type) {
import sublime, sublime_plugin
class IncrementSelectionCommand(sublime_plugin.TextCommand):
def run(self, edit):
start_value = int(self.view.substr(self.view.sel()[0]))
counter = 0
for selection in self.view.sel():
self.view.insert(edit, selection.begin(), str(start_value + counter))
counter = counter + 1
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"Alignment",
"AutoFileName",
"Babel",
import {Rx} from '@cycle/core';
import {h} from '@cycle/dom';
export default class Element {
constructor() {
return (responses) => {
let actions = this.intent(responses.DOM);
let tree$ = this.view(this.model(responses, actions))
let events = {}
return {
@takashi
takashi / index.js
Last active April 25, 2016 08:13
cycle.js
import Cycle, {Rx} from '@cycle/core'
import {h, makeDOMDriver} from '@cycle/dom';
const intent = () => {};
const model = (actionMap) => Rx.Observable.just([]);
const view = (stateStream) => {
return stateStream.map((state) => {
@takashi
takashi / lstv_nginx.md
Created July 5, 2015 04:17
lstv format for nginx

lstv format for nginx

access_log /var/log/access.log ltsv; error_log /var/log/error.log;

log_format ltsv 'time:$time_iso8601\t'
angular.module('moduleName')
.controller('TestController', function($scope) {
$scope.onFileSet = function(file) {
var reader = new FileReader();
reader.onload = function(e) {
$scope.$apply(function() {
$scope.article.thumbnail.url = e.target.result;
});
}
reader.readAsDataURL(file)
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AnalyticsEventPluginFactory
@takashi
takashi / gulpfile.js
Last active August 29, 2015 14:19
build with browserify and watchify
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require ('del');
var watchify = require('watchify');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
@takashi
takashi / CaptureImage.java
Last active May 9, 2020 03:27
opencv face detection w/ JavaCV
import javax.swing.JFrame;
import java.io.File;
import java.io.IOException;
import org.bytedeco.javacpp.opencv_objdetect;
import org.bytedeco.javacv.Blobs;
import org.bytedeco.javacv.CanvasFrame;
import org.bytedeco.javacv.OpenCVFrameConverter;