Skip to content

Instantly share code, notes, and snippets.

@dseg
dseg / select.tsx
Created January 27, 2017 06:32
A React Select Snippet
<select>
{
// options が undefined or nullなら、何も出力しない。配列なら選択肢に整形する。
options && Array.isArray(options) && options.map((item : any, idx : number) =>
<option
key={`inq_opt_${idx}`}
value={item.value}>{item.label}</option>)
}
</select>
@jaredmorrow
jaredmorrow / read_write_fifo_erlang.md
Last active April 22, 2023 20:05
Reading and Writing to Fifo (named pipes) in Erlang

edit

@akash-akya pointed out in the comments that the file module supports named pipes since OTP 20. So none of this post is really needed anymore if you are on >= OTP 21.


Erlang and Named Pipes

The intention of this post is to provide a solution (with examples) to a somewhat uncommon issue in Erlang. I hate searching for answers to the same problems over and over, and I had a hard time finding answers to this particular problem, so I wrote it all down once I figured it out. If one day you decide to read and write data through fifo's (named pipes) and then decide you want to read or write the other end of the pipe from Erlang, this post is for you.

@tatsuhiro-t
tatsuhiro-t / bench-backend.conf
Last active August 4, 2017 17:24
HTTP/2 server benchmark Jan 2015
listen: 3001
http2-max-concurrent-requests-per-connection: 1024
max-connections: 15000
num-threads: 1
hosts:
localhost:
paths:
/:
file.dir: /path/to/htdocs
@obolton
obolton / elb-nodejs-ws.md
Last active November 12, 2023 11:49
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

/* See Kobito.app/Contents/Resources/markdown.css for predefined style. */
/* ------------------------------
* HTML element
* ------------------------------ */
html {
background-color: #FFFFFF;
padding: 0;
}
@bretthoerner
bretthoerner / PKGBUILD
Created September 13, 2014 15:47
Mesos 0.20.0
# Maintainer: Daichi Shinozaki <dsdseg@gmail.com>
pkgname=mesos
pkgver=0.20.0
pkgrel=1
pkgdesc="A cluster manager that simplifies the complexity of running applications on a shared pool of servers"
arch=('x86_64')
url='http://mesos.apache.org/'
license=('Apache')
groups=('science')
depends=('python2' 'python2-boto' 'curl' 'libsasl' 'leveldb' 'java-environment' 'libunwind')
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@anchetaWern
anchetaWern / laravel-ums.markdown
Created December 6, 2012 11:14
Building a User Management System in Laravel

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
@sgergely
sgergely / gist:3793166
Created September 27, 2012 09:43
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@jdonaldson
jdonaldson / JsonHxDef.hx
Created December 10, 2011 01:54
jsonhxdef is a ruby script that helps you quickly define a typedef from some arbitary json
typedef JsonObj = {
glossary:Glossary,
}
typedef Glossary = {
title:String,
GlossDiv:GlossDiv,
}
typedef GlossDiv = {