Skip to content

Instantly share code, notes, and snippets.

View nakamura-to's full-sized avatar

Toshihiro Nakamura nakamura-to

View GitHub Profile
@piscisaureus
piscisaureus / daemonize.c
Created April 3, 2012 22:14
daemonize.c
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
void set_cloexec(int fd) {
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@Gab-km
Gab-km / github-flow.ja.md
Last active October 29, 2024 10:17 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@taichi
taichi / nue_mod.js
Created October 4, 2012 08:43
nue.jsの改善案
// async の引数が無い場合、全部が次に渡される様にして欲しい。
// コールバック関数の引数が3つ以上の場合、次のステップには配列が入ってきてよい。
// 目的
// コールバック関数の引数がerrのみ、もしくは二つの場合、
// つまりas(1)で事足りるケースをnueに特別扱いして貰って楽に記述したい。
// nodeのcallbackを取る関数は殆どがそうなっている。
// 現状1
flow(function start(file1, file2) {
fs.readFile(file1, 'utf8', this.async(as(1)));
@jimoneil
jimoneil / WNSHelper.cs
Created November 8, 2012 07:04
Sample code for OAuth and push notification handling for Windows Store applications
/*
Copyright (c) Microsoft
All rights reserved.
Licensed under the Microsoft Limited Public License (the “License”); you may not
use this file except in compliance with the License.
You may obtain a copy of the License at http://msdn.microsoft.com/en-us/cc300389.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS
OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
@gakuzzzz
gakuzzzz / 1_LogicalDeletable.java
Last active December 10, 2015 03:08
汎用的なDelegateのリフレクション使わない版
import org.joda.time.DateTime;
import org.seasar.doma.Column;
import org.seasar.doma.Entity;
@Entity
public abstract class LogicalDeletable {
@Column
protected DateTime deletedTime;
@asafge
asafge / ng-really.js
Created November 12, 2013 13:06
ng-really? An AngularJS directive that creates a confirmation dialog for an action.
/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
@wilsonwc
wilsonwc / stateMock.js
Created January 10, 2014 17:24
Angular Mock for properly resolving ui-router $state in Karma unit tests
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@kawasima
kawasima / SafeResolver.java
Last active October 3, 2020 02:40
Struts1 S2-020対応
/**
* A Resolver that doesn't call getClass().
*
* @author kawasima
*/
public class SafeResolver extends DefaultResolver {
private static final char NESTED = '.';
private static final char MAPPED_START = '(';
private static final char MAPPED_END = ')';
private static final char INDEXED_START = '[';

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).