Skip to content

Instantly share code, notes, and snippets.

@babie
babie / pty-keeper
Last active December 27, 2015 08:39
#!/usr/bin/env ruby
require "pty"
require "optparse"
require "tmpdir"
module PtyKeeper
module Core
def parse!(argv)
options = {}
@babie
babie / .zshrc
Last active December 27, 2015 08:39
earthquake () {
/usr/bin/ssh -t dev 'socat STDIN,echo=0,icanon=0 SYSTEM:"reptyr $(cat /tmp/earthquake.pid)",pty,stderr,ignbrk=1'
sleep 20
earthquake
}

Clojureを勉強している12

  • Clojure Documentation
    • ClojureDocs
      • 関数名やマクロ名で検索できる
      • See Alsoセクションが似たような機能の関数を集めていて便利
      • Quick Referenceもまた便利。チートシートだ。
    • Grimoire
      • チートシートになってる。
  • clojure/clojure
@babie
babie / books_suite_test.go
Last active April 12, 2017 01:36
Use stretchr/testify/assert on onsi/ginkgo without onsi/gomega.
package books_test
import (
. "github.com/onsi/ginkgo"
//. "github.com/onsi/gomega"
ta "github.com/stretchr/testify/assert"
"testing"
)
@babie
babie / api.js
Last active August 19, 2017 07:25
simple rest fetch api
import 'whatwg-fetch'
import store from './store'
function _buildUrl (path, query) {
let url = path
if (query !== undefined) {
let queryArray = []
for (const key of Object.keys(query)) {
queryArray = [...queryArray, `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`]
}
@babie
babie / authorization.js
Created July 30, 2017 07:33
Authorization and default currentUser prop by HOC
import React, { Component } from 'react'
import { connect } from 'react-redux'
const Authorization = (allowRoles) => {
return (WrappedComponent) => {
class WithAuthorization extends Component {
render () {
const { role } = this.props.currentUser
if (allowRoles.includes(role)) {
return <WrappedComponent {...this.props} />
@babie
babie / base64.js
Last active October 5, 2017 18:57
ダサい。助けてくれ……できれば async/await で……→こんな感じか?
export function encode (blob) {
return new Promise((resolve) => {
const r = new FileReader()
r.onload = () => {
const dataURL = r.result
const base64 = dataURL.split(',', 2)[1]
resolve(base64)
}
r.readAsDataURL(blob)
@babie
babie / keybindings.json
Last active May 23, 2018 14:02
vscode user keybindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+tab",
"command": "workbench.action.previousEditor"
},
{
"key": "ctrl+tab",
"command": "workbench.action.nextEditor"
},
@babie
babie / settings.json
Last active May 25, 2018 16:58
tslint and prettier settings for vscode
// Place your settings in this file to overwrite the default settings
{
"javascript.validate.enable": false,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"eslint.enable": true,
"eslint.autoFixOnSave": false,
"eslint.alwaysShowStatus": true,
"tslint.enable": true,
"tslint.autoFixOnSave": false,
{
"extends": ["airbnb", "standard", "prettier"],
"plugins": ["react", "mocha", "standard", "prettier"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"mocha": true,