Skip to content

Instantly share code, notes, and snippets.

View toshimasa-nanaki's full-sized avatar

Toshimasa Nanaki toshimasa-nanaki

  • 日本(東京)
View GitHub Profile
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Last active March 26, 2023 06:55
Rust if文
fn main() {
let x = 5;
//if(x == 5) { //←こうも書けるが、コンパイル時に警告が出る
if x == 5 {
println!("x is 5");
} else {
println!("x isn't 5");
}
//ifは式だからこんなこともできる。(三項演算子はない)
@toshimasa-nanaki
toshimasa-nanaki / hello.py
Created November 16, 2017 14:32
Hello World API Python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
name = "This is the route."
return name
@app.route('/hello')
def hello():
@toshimasa-nanaki
toshimasa-nanaki / LibrePdfOutputTest.java
Last active June 20, 2022 14:39
JODConverter4.1.0 PDF出力テストコード
package jp.example;
import java.io.File;
import org.jodconverter.core.DocumentConverter;
import org.jodconverter.core.office.OfficeException;
import org.jodconverter.core.office.OfficeManager;
import org.jodconverter.local.LocalConverter;
import org.jodconverter.local.office.LocalOfficeManager;
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Created December 15, 2018 02:32
Rust 電卓アプリ ボタン出してみた
//クレートとしてconrodを読み込む
#[macro_use] extern crate conrod;
fn main() {
//featureモジュールのmain関数呼び出し
feature::main();
}
//モジュール
mod feature {
//conrodで利用するものを宣言
@toshimasa-nanaki
toshimasa-nanaki / index.html
Last active April 2, 2020 13:51
PDF.jsサンプル Pythonサーバー 
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="../static/libs/pdf.js"></script>
</head>
<body>
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Last active December 24, 2018 03:25
Rust テストコード確認(ドキュメントテスト)
/// メイン関数
/// 標準入力を求め、入力された文字にビックリマークをつけて返す
pub fn main() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
println!("{}", public_function(s.trim().parse().ok().unwrap()));
}
/// これはパブリックな関数
/// 渡された文字列の後ろにビックリマークをつけて返す
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Created December 24, 2018 02:12
Rust テストコード確認(モジュール)
/// メイン関数
/// 標準入力を求め、入力された文字にビックリマークをつけて返す
pub fn main() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
println!("{}", public_function(s.trim().parse().ok().unwrap()));
}
/// これはパブリックな関数
/// 渡された文字列の後ろにビックリマークをつけて返す
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Created December 24, 2018 01:49
Rust テストコード確認(基本)
/// メイン関数
/// 標準入力を求め、入力された文字にビックリマークをつけて返す
pub fn main() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
println!("{}",public_function(s.trim().parse().ok().unwrap()));
}
/// これはパブリックな関数
/// 渡された文字列の後ろにビックリマークをつけて返す
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Created December 23, 2018 14:51
Rust ドキュメンテーション生成用サンプル
/// メイン関数
/// 標準入力を求め、入力された文字にビックリマークをつけて返す
pub fn main() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
println!("{}",public_function(s.trim().parse().ok().unwrap()));
}
/// これはパブリックな関数
/// 渡された文字列の後ろにビックリマークをつけて返す
@toshimasa-nanaki
toshimasa-nanaki / main.rs
Last active December 23, 2018 02:51
Rust 電卓アプリ 計算できるようにした
//クレートとしてconrodを読み込む
#[macro_use] extern crate conrod;
fn main() {
//featureモジュールのmain関数呼び出し
feature::main();
}
/// モジュール
mod feature {
use conrod::backend::glium::glium::{self, Surface};