Skip to content

Instantly share code, notes, and snippets.

View tek-nishi's full-sized avatar

Nobuyuki Nishiyama tek-nishi

View GitHub Profile
@tek-nishi
tek-nishi / QuickJS_Sample.cpp
Created June 15, 2020 02:02
QuickJS test code.
#include <iostream>
#include <string>
#include <fstream>
#include <quickjs.h>
std::string readTextFile(const std::string& path)
{
std::ifstream ifs(path);
return std::string(std::istreambuf_iterator<char>(ifs),
@tek-nishi
tek-nishi / SavePlace.mm
Created January 24, 2019 09:10
Get macOS Application Support Folder from SDK.
std::string getDocumentFolder()
{
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
if ([paths count] == 0)
{
// Error.
return std::string("");
}
NSString* applicationSupportDirectory = [NSString stringWithFormat:@"%@/%@",
@tek-nishi
tek-nishi / Sphere.pde
Created October 15, 2018 00:59
ProcessingでSphere
//
// 自前で球を生成する
//
// 分割数と半径の定義
int div = 30;
float radius = 250;
// 頂点配列
PVector[] vtx;
@tek-nishi
tek-nishi / main.cpp
Created June 24, 2018 09:31
OpenSiv3D実装会(6/24)で作ったサンプル2
//
// Siv3Dで3D
//
# include <Siv3D.hpp>
// ベクトル&行列ライブラリ
// SOURCE https://glm.g-truc.net/0.9.8/index.html
# include "glm/glm.hpp"
# include "glm/gtc/matrix_transform.hpp"
# include "glm/gtx/transform.hpp"
@tek-nishi
tek-nishi / main.cpp
Created June 24, 2018 09:29
OpenSiv3D 実装会(6/24)で作ったサンプル1
//
// Siv3Dで3D
//
# include <Siv3D.hpp>
// ベクトル&行列ライブラリ
// SOURCE https://glm.g-truc.net/0.9.8/index.html
# include "glm/glm.hpp"
# include "glm/gtc/matrix_transform.hpp"
# include "glm/gtx/transform.hpp"
@tek-nishi
tek-nishi / sclang.el
Created December 12, 2017 09:16
SuperCollider startup from emacs
;;; sclang.el --- SuperCollider handling
(defvar sclang-buffer
"*sclang*"
"*The name of the sclang process buffer.")
(defvar sclang-command
"/Applications/SuperCollider.app/Contents/MacOS/sclang"
"*The SuperCollider server command.")
@tek-nishi
tek-nishi / spacemacs-disable-mouse.el
Created October 13, 2017 09:46
Disable mouse in spacemacs
;; disable-mouse を有効にした上で、以下のコードを実行する
(define-key evil-motion-state-map (kbd "<down-mouse-1>") nil)
(remove-hook 'helm-cleanup-hook #'spacemacs//unprevent-minibuffer-escape)
@tek-nishi
tek-nishi / spacemacs-disable-mouse.el
Created October 13, 2017 09:44
Disable mouse in spacemacs
;; disable-mouse を有効にした上で、以下のコードを実行する
(define-key evil-motion-state-map (kbd "<down-mouse-1>") nil)
(remove-hook 'helm-cleanup-hook #'spacemacs//unprevent-minibuffer-escape)
@tek-nishi
tek-nishi / my-mode-line-bom-info.el
Created September 18, 2017 04:57
display with signature text or not, mode-line
(defun my-mode-line-bom-info ()
"if with-signature text -> output (B)"
(let ((bc (format "%s" buffer-file-coding-system)))
(concat (and (string-match "with-signature" bc) "(B)"))))
@tek-nishi
tek-nishi / buffer-encoding-abbrev.el
Last active March 16, 2018 05:41
spacemacs buffer-encoding-abbrev with signature(BOM)
(spaceline-define-segment buffer-encoding-abbrev
"The line ending convention used in the buffer."
(let ((buf-coding (format "%s" buffer-file-coding-system)))
(list (replace-regexp-in-string "-with-signature\\|-unix\\|-dos\\|-mac" "" buf-coding)
(concat (and (string-match "with-signature" buf-coding) "ⓑ")
(and (string-match "unix" buf-coding) "ⓤ")
(and (string-match "dos" buf-coding) "ⓓ")
(and (string-match "mac" buf-coding) "ⓜ")
)))
:separator " ")