Skip to content

Instantly share code, notes, and snippets.

View KentaKomai's full-sized avatar
🏠
Working from home

kken KentaKomai

🏠
Working from home
  • vitte
  • Tokyo, Japan
View GitHub Profile
@KentaKomai
KentaKomai / cloneObject.js
Created November 16, 2015 10:23
ネストしているObjectを全部コピーする
export default const cloneObject = function(obj){
var Clone = {};
for(var i in obj){
console.dir(typeof obj[i]);
if( obj[i] instanceof Array){
Clone[i] = obj[i].map( o => {return cloneObject(o)})
}
else if(typeof obj[i] == "object"){
Clone[i] = cloneObject(obj[i]);
@KentaKomai
KentaKomai / Dump.jsx
Created November 12, 2015 13:21
dataに受け取ったものをjsonに出すだけのcomponent。
var Dump = React.createClass({
render: function() {
return (
<pre>{JSON.stringify(this.props.data, 0, 2)}</pre>
)
}
});
export default StateDump;
class Child extends React.Component {
// 子の関数
onChildChange(){
this.props.onParentChange()
}
}
class Parent extends React.Component {
//子に渡してる親の関数
@KentaKomai
KentaKomai / user.scala
Last active August 29, 2015 14:18
anormで汎用的なモデル考えてみた
package models
import java.sql.Connection
import anorm._
import anorm.SqlParser._
import play.api.Play.current
import play.api.db.DB
/** 性別を表すクラス(本来は別ファイルにしたほうがいいかも) */
import math._
1L // Long型の 1
1:Long // Long型の 1
127:Byte // Byte型の 127
32767:Short // Short型の 32767
(1+2).toLong // Long型への変換
(2+3) toLong // Long型への変換

同僚のディレクターに聞かれたので共有用のメモ。

MySQL, json, XML

厳密に言うとちょっと違う部分もあるけど、まぁ なんとなく雰囲気つかむためのもの

MySQL

世界で最も利用されている、無償で利用できるデータベースサーバ。

@KentaKomai
KentaKomai / rails_resources.md
Last active August 29, 2015 14:13 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@KentaKomai
KentaKomai / javascript_resources.md
Last active August 29, 2015 14:13 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@KentaKomai
KentaKomai / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@KentaKomai
KentaKomai / gist:051fc57a5025fce87725
Created June 27, 2014 00:52
ロックマンのチャージみたいなやつ
int length = 20; // element count
float[] x = new float[length]; //element x
float[] y = new float[length]; //element y
float[] ang = new float[length];
float[] rot = new float[length];
float[] c = new float[length];
float[] radius = new float[length];
float cx, cy; //center x, y
float power = 0;