Skip to content

Instantly share code, notes, and snippets.

View yossan's full-sized avatar

Kosuke Yoshimoto yossan

  • Nagoya, Aichi, Japan
View GitHub Profile
@yossan
yossan / print_type_name.rs
Created July 11, 2021 08:34
print type name
fn print_type_name<T>(_: T) -> &'static str {
std::any::type_name::<T>()
}
@yossan
yossan / plugin¥cargo.vim
Last active July 6, 2021 12:52
setup gradle project in vim
aug cargo_project_enter
au!
au VimEnter * if empty($filetype) && !empty(findfile('Cargo.toml')) | call SetupCargo() | endif
aug END
fu! SetupCargo()
echom "detect a cargo project"
setl path+=src/**
endfu
@yossan
yossan / index.html
Created March 6, 2021 04:31
A sample.html rotating rect at center in Canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body style="min-height: 100% height: 100%">
<canvas id="drawingview" style="width: 100%; height: 100%">
<script>
@yossan
yossan / Sharing value with lifetime
Created March 2, 2021 15:13
Rust Lifetime problems
#[derive(Debug)]
struct Value(i32);
#[derive(Debug)]
struct Shared<'a> { val: &'a Value }
#[derive(Debug)]
struct A<'a> {
shared: &'a mut Shared<'a>,
}
@yossan
yossan / using text-alignment
Created October 13, 2020 14:59
Center Aligning
<!DOCTYPE html>
<html>
<head>
<title>中央寄せ</title>
<style>
.container {
display: block;
text-align: center;
}
.content {
@yossan
yossan / my-paragraph
Last active October 13, 2020 14:57
web components by using templates
<html>
<head></head>
<body>
<template id="my-paragraph">
<style>
p {
color: white;
background-color: #666;
padding: 5px;
}
syntax on
filetype on
filetype plugin on
filetype indent on
packadd minpac
call minpac#init()
call minpac#add('scrooloose/nerdtree')
" open NERDTree with `Ctrl+n`
@yossan
yossan / filesystem_sample
Created August 19, 2020 15:18
Web/API/FileSystem
<html> <head> <title>ファイルを書き込む</title> <meta charset="utf-8">
</head>
<body>
<script>
function onInitFs(fs) {
fs.root.getFile('log3.txt', {create: true}, function(fileEntry) {
// Create a FileWriter object for our FileSystemFileEntry (log.txt).
fileEntry.createWriter(function(fileWriter) {
fileWriter.onwriteend = function(e) {
filetype plugin on " required
filetype indent on " required
" ctags
set fileformats=unix,dos,mac
set fileencodings=utf-8,sjis
" {{{ minpac memo
" プラグイン管理
" プラグインの更新 :minpac#update()
@yossan
yossan / _gvimrc
Created June 2, 2019 02:25
vimrc for windows
"set encoding=utf-8
"set guifont=MS_Gothic:h13:cANSI:qDRAFT
"set guifont=*
set guifont=MS_Gothic:h14
syntax enable
set background=light
"colorscheme solarized
"colorscheme inkstained
"colorscheme one