Skip to content

Instantly share code, notes, and snippets.

@nodamushi
nodamushi / rust_macro_study.rs
Last active February 17, 2019 13:17
Rustのマクロを試し中。C++ライクなクラス構文を導入してみる
macro_rules! defclass {
(class $name:ident;) =>{struct $name;};
(class $name:ident {$($contents:tt)*}) =>{defclass!{$name,,{},$($contents)*}};
(struct $name:ident;) =>{struct $name;};
(struct $name:ident {$($contents:tt)*}) =>{defclass!{$name,pub,{},$($contents)*}};
($name:ident,$($visible:ident)*,{$($field:tt)*},public:$($rest:tt)*) =>{
defclass!{$name,pub,{$($field)*},$($rest)*}
};
($name:ident,$($visible:ident)*,{$($field:tt)*},private:$($rest:tt)*) =>{
defclass!{$name,,{$($field)*},$($rest)*}
@nodamushi
nodamushi / ihx16.py
Last active January 28, 2018 16:48
Convert decimal data file to intex hex file
#coding:utf-8
import sys
MAX_LINE_SIZE=32
a = []
if len(sys.argv) > 1:
with open(sys.argv[1],'r') as f:
for l in f:
a.append(int(l))
@nodamushi
nodamushi / MyTextArea.java
Created December 8, 2016 16:30
JavaFX9でTextAreaに行番号がついたTextAreaを作ってみた
package nodamushi.jfx;
import javafx.scene.control.TextArea;
import javafx.scene.control.skin.TextInputControlSkin;
import static javafx.collections.FXCollections.observableArrayList;
import static javafx.collections.FXCollections.unmodifiableObservableList;
import java.util.ArrayList;
import java.util.List;
@nodamushi
nodamushi / ToggleButtons.java
Last active August 29, 2015 14:16
an utility class of ToggleButton
package nodamushi.jfx.util;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;