This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*-coding: utf-8 -*- | |
def add(x, y): | |
return x + y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXX=g++ | |
CFLAGS=-Wall -O2 | |
main: main.o hoge.o | |
$(CXX) $(CFLAGS) main.o hoge.o -o main | |
test: test_main.o hoge.o | |
$(CXX) $(CFLAGS) test_main.o hoge.o -o test | |
test_main.o: test_main.cpp hoge.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*-coding: utf-8 -*- | |
def hoge(n): | |
return n * 2 | |
def piyo(): | |
return "Hello." | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <fstream> | |
int main() | |
{ | |
std::string data = "hoge, piyo, fuga"; | |
std::ofstream ofs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
static void func(const int *val); | |
static void func2(const char *val); | |
static void func3(const char val[]); | |
static void func4(int *val); | |
static void func5(const char *val); | |
int main(void) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init_clang_conf() | |
for i in [6, 5, 4] | |
if executable("clang-3.".i) && executable("clang-format-3.".i) | |
let g:clang_exec = "clang-3.".i | |
let g:clang_format_exec = "clang-format-3.".i | |
return | |
endif | |
endfor | |
let g:clang_exec = "clang" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <iostream> | |
#include <string> | |
#include <sstream> | |
bool CheckFCC(std::string &buf, int start, size_t byte_count) | |
{ | |
char fcc = buf[byte_count + 4]; | |
char calc_fcc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sqlite3 | |
def vaccum(db_name): | |
with sqlite3.connect(db_name) as db: | |
try: | |
db.execute("VACUUM") | |
except: | |
raise IOError("Vacuum failed.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
queries = {} | |
def test1(): | |
sql = "" | |
with open("./test.sql") as f: | |
sql = f.read() | |
with sqlite3.connect("./test.db") as db: | |
cursor = db.cursor() | |
cursor.execute(sql) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding -*- utf-8 -*- | |
import unittest | |
def add(x, y): | |
return x + y | |
class SampleUnitTest(unittest.TestCase): | |
#テストメソッドは先頭に必ず「test」と書く |