Skip to content

Instantly share code, notes, and snippets.

View kinoshita-lab's full-sized avatar
🌐
middle of nowhere

kaz saita kinoshita-lab

🌐
middle of nowhere
View GitHub Profile
#include <cstdio>
template <typename FunctionPointer>
class Hoge
{
public:
Hoge(FunctionPointer functionPointer) : _func(functionPointer) {}
void call() {
(*_func)();
@kinoshita-lab
kinoshita-lab / gist:1051047
Created June 28, 2011 12:38
sicp chapter 2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 2.1.1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (make-rat n d)
(cons n d))
(define (numer x)
(car x))
(define (denom x)
@kinoshita-lab
kinoshita-lab / gist:4022337
Created November 6, 2012 03:15
arduino operator new
#include <stdint.h>
#include <string.h>
void* operator new[](size_t size)
{
return malloc(size);
}
@kinoshita-lab
kinoshita-lab / gist:4250447
Created December 10, 2012 13:02
DJ Shield 2.0 kazbo setting -- please save this as .tsi
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<NIXML><TraktorSettings><Entry Name="DeviceIO.Config.Controller" Type="3" Value="RElPTQAHBnBESU9JAAAABAAAAAFERVZTAAcGXAAAAAFERVZJAAcGUAAAAAwARwBlAG4AZQByAGkAYwAgAE0ASQBEAElEREFUAAcGLERESUYAAAAEAAAAAERESVYAAAAaAAAACQAyAC4AMQAuADMAIABEAGUAdgAAABBERElDAAAALAAAABQARABKACAAUwBoAGkAZQBsAGQAIAB2ADIALgAwACAAawBhAHoAYgBvRERQVAAAACwAAAAJAEEAbABsACAAUABvAHIAdABzAAAACQBBAGwAbAAgAFAAbwByAHQAc0REREMABvfYRERDSQADe+QAABAQRENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAAMAAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAAMQAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAAMgAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAAMwAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAANAAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAANQAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAANgAAAAcAAAAAQv4AAAAAAAH/////RENEVAAAAC4AAAALAEMAaAAwADEALgBDAEMALgAwADAANwAAAAcAAAA
@kinoshita-lab
kinoshita-lab / private_method_can_call_from_global.cpp
Created February 17, 2013 02:46
dunno why DHoge::method() is accessible from outside...
#include <cstdio>
class Hoge
{
public:
Hoge() {}
virtual ~Hoge() {}
virtual void method() {
puts("hoge");
@kinoshita-lab
kinoshita-lab / gist:5038090
Last active December 14, 2015 05:49
Comparison between call by reference and call by value
The Code:
int add_ref(const int& a, const int& b)
{
return a + b;
}
int add_value(const int a, const int b)
{
return a + b;
@kinoshita-lab
kinoshita-lab / gist:5038141
Last active December 14, 2015 05:49
Comparison between call by reference and call by value part 2
The Code:
int add_ref(const int& a, const int& b)
{
return a + b;
}
int add_value(const int a, const int b)
{
return a + b;
@kinoshita-lab
kinoshita-lab / gist:5627815
Last active December 17, 2015 14:58
look for a best way to impl counter..
The Code:
#include <cstdio>
#define MAX_COUNT (11)
void someFunction()
{
puts("unko");
}
@kinoshita-lab
kinoshita-lab / gist:5764901
Last active December 18, 2015 09:59
compare normal method within a namespace, and static class method.
in unko.h
-------------------
class StaticClass
{
public:
static int method() {
return 1;
}
};
@kinoshita-lab
kinoshita-lab / gist:5765356
Created June 12, 2013 13:43
compare normal method within a namespace, and static class method(again), this time i added both class value and global value.
in unko.h
-------------------
class StaticClass
{
public:
static int counter();
static int value;
};