Skip to content

Instantly share code, notes, and snippets.

View tmtk75's full-sized avatar

Tomotaka Sakuma tmtk75

View GitHub Profile
@tmtk75
tmtk75 / main.go
Last active July 3, 2021 01:28
Full example for DynamoDB batch-get-item in golang
module github.com/tmtk75/m
go 1.16
require (
github.com/aws/aws-sdk-go-v2/config v1.4.1 // indirect
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.4.0 // indirect
)
@tmtk75
tmtk75 / markdown-tag.rb
Created November 30, 2011 08:10
Jekyll Markdown Tag
=begin
Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
Usage:
{% markdown <filename> %}
Dependency:
- kramdown
=end
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tmtk75
tmtk75 / list-reminders.swift
Created July 13, 2019 07:00
List your reminders in JSON
import Darwin
import EventKit
import Foundation
var debug = false
if ProcessInfo.processInfo.environment["DEBUG"] != nil {
debug = true
}
// https://stackoverflow.com/questions/28016578/how-to-create-a-date-time-stamp-and-format-as-iso-8601-rfc-3339-utc-time-zone
@tmtk75
tmtk75 / switchMap-sample.ts
Created May 21, 2019 00:30
RxJS switchMap sample
import { of, interval, never } from "rxjs";
import { map, switchMap } from "rxjs/operators";
const a = of(1, 2, 3, 4);
const b = of(1, 2, 3, 4).pipe(map(e => e * 10));
const c = of(1, 2, 3, 4).pipe(map(e => e * 100));
const main = interval(1000).pipe(
switchMap(i => {
switch (i % 3) {
//import Cocoa
//var str = "Hello, playground"
import EventKit
let eventStore = EKEventStore()
func allowAuthorization() {
if getAuthorization_status() {
// 許可されている
return
@tmtk75
tmtk75 / lunr-sample.js
Created April 29, 2019 00:07
Lunr sample
const lunr = require("lunr");
const lunrstemmer = require("lunr-languages/lunr.stemmer.support");
const lunrtinyseg = require("lunr-languages/tinyseg");
const lunrja = require("lunr-languages/lunr.ja");
lunrstemmer(lunr);
lunrtinyseg(lunr);
lunrja(lunr);
// console.trace("init lunr");
@tmtk75
tmtk75 / main.go
Created October 3, 2018 03:37
Concatenate image files in .png vertically
package main
import (
"flag"
"fmt"
"image"
"image/draw"
"image/png"
"log"
"math"
@tmtk75
tmtk75 / hover.html
Created January 9, 2017 23:21
Detection hover more than 500 milliseconds with RxJS
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
#main { display: flex; flex: 1; }
.node { border: 1px solid gray; width: 160px; height: 100px; margin: 1px; }
.node:hover { background-color: rgba(0, 0, 0, 0.1); }
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.0.1/Rx.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
@tmtk75
tmtk75 / showcase.yaml
Created February 3, 2011 06:58
YAML showcase
###
### YAML Showcase
### Thanks for http://jp.rubyist.net/magazine/?0009-YAML
### To run:
### cat $0 | ruby -r pp -r yaml -e 'pp YAML.load STDIN.read'
###
collection:
mapping(block-style):
name: Taro
age: 32