Skip to content

Instantly share code, notes, and snippets.

@hadashiA
hadashiA / file0.cpp
Created October 19, 2013 16:37
c++11のlambdaでイベントハンドラ ref: http://qiita.com/hadashiA/items/3c3c10f9596c8f5fcdc9
#include <iostream>
#include <functional>
#include <string>
#include <map>
#include <vector>
using namespace std;
struct Event {
Event(const string& name, int data)
XCODEROOT = %x[xcode-select -print-path].strip
SIM_SYSROOT = "#{XCODEROOT}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/"
DEVICE_SYSROOT = "#{XCODEROOT}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/"
MRuby::Build.new do |conf|
toolchain :gcc
conf.gembox 'default'
end
@hadashiA
hadashiA / file0.txt
Created June 23, 2013 07:15
OSX10.8 で、Pythonのbzrlib がみつからない問題 ref: http://qiita.com/hadashiA/items/8fe63889bebac7e26dda
$ brew install emacs --HEAD --cocoa
==> Cloning bzr://http://bzr.savannah.gnu.org/r/emacs/trunk
bzr: ERROR: Couldn't import bzrlib and dependencies.
Please check the directory containing bzrlib is on your PYTHONPATH.
Traceback (most recent call last):
File "/usr/local/bin/bzr", line 74, in <module>
import bzrlib
ImportError: No module named bzrlib
Error: Failure while executing: /usr/local/bin/bzr checkout --lightweight http://bzr.savannah.gnu.org/r/emacs/trunk /Library/Caches/Homebrew/emacs--bzr
  • npm
    • grunt
    • uglify
    • bower
    • n
  • ユーティリティ
    • lo-dash
    • Q
    • underscore.js
  • マルチメディア
@hadashiA
hadashiA / gist:5504659
Created May 2, 2013 19:20
weak_ptr をキーにしたハッシュ
#include <memory>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
using namespace std;
class Node {
public:
@hadashiA
hadashiA / file0.txt
Created March 9, 2013 15:55
expressのreq.format()を、urlの拡張子で判別してくれるようにする ref: http://qiita.com/items/e14e4eb1e6d748af15c4
app.get('/hoge.:format', function(req, res) {
res.format({
json: function(req, res) {
res.send({a: 1});
},
html: function(req, res) {
// ブラウザから /index.json にアクセスしてもこっちが実行される
res.render('index');
},
default: function(req, res) {
@hadashiA
hadashiA / file0.txt
Created March 3, 2013 13:26
サーバー/クライアント両方を javascript(coffee-script)で書くときのビルド設定 ref: http://qiita.com/items/808cdf082c74bfe6a0ce
.
├── Gruntfile.coffee
├── README.md
├── app.coffee
├── component.json
├── lib
├── package.json
├── public
│   ├── css
│   ├── img
@hadashiA
hadashiA / gist:4966452
Created February 16, 2013 11:08
std::function を使ったイベントハンドラ
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <string>
typedef int EventType;
struct Event {
public:
@hadashiA
hadashiA / gist:4700931
Created February 3, 2013 08:14
ミスタードリラーのブロックの色
うすい:#F4D6E0 [244, 214, 224]
こい:#DE7699 [222, 118, 153]
うすい:#CCE9F9 [204, 233, 249]
こい:#4CBAEB [76, 186, 235]
#include <iostream>
#include <sstream>
#include <string>
#include <v8.h>
using namespace std;
int main(int argc, const char **argv) {
// Create a scope and environment
v8::HandleScope scope;