Skip to content

Instantly share code, notes, and snippets.

FROM golang:1.20-alpine as builder
RUN apk update && apk add --repository http://dl-cdn.alpinelinux.org/alpine/v3.4/main --no-cache ca-certificates gcc libc-dev
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY run/ ./run
@s-aska
s-aska / 0_clipboard.html
Last active July 20, 2023 17:04
もう addEventListener しなくて良い...!!
<div data-controller="clipboard">
<button data-action="click->clipboard#copy" type="button" data-clipboard-target="value" data-copy="some copy text"></button>
<div data-clipboard-target="tooltip" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
Copied!
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
</div>
@s-aska
s-aska / Makefile
Created May 14, 2021 19:33
deploy-function ではじまるすべてのターゲットを実行する Makefile
PROJECT_ID="some-project-id"
ENV="dev"
TARGETS=$(shell grep -E '^deploy-function[a-zA-Z_-]+:' $(MAKEFILE_LIST) | cut -d : -f 1)
deploy-all: $(TARGETS)
deploy-function_some:
gcloud --project $(PROJECT_ID) functions deploy --region asia-northeast1 SomeFunction \
--set-env-vars PROJECT_ID=$(PROJECT_ID),RUNTIME_ENVIRONMENT=$(ENV) \
--runtime go111 \
'use strict';
const now = new Date();
const addDays = function(date, days) {
const d = new Date(date);
d.setDate(d.getDate() + days);
return d;
};
const toYMD = function(date) {
(function(){
"use strict";
const template = '<span class="fontsize-m" style="margin-right: 6px;"><a href="https://stocks.finance.yahoo.co.jp/stocks/detail/?code={{ .stock.Code }}.T" class="underline">{{ .stock.Code }}(JQ)</a></span>{{ .stock.Close | Commify }}円&nbsp;<br class="show_sp"><small class="fontsize-m">前日比:{{ .stock.Diff | Commify }}円 出来高:{{ .stock.Volume | Commify }}株</small>';
const script = document.createElement('script');
script.src = 'https://denkei-agh-tools-prod.an.r.appspot.com/?callback=stockWidgetCallback&symbol=1783.T';
const parent = document.getElementsByTagName('script')[0];
parent.parentNode.insertBefore(script, parent);
window.stockWidgetCallback = (res) => {
console.log(res);
const inner = document.getElementById('widget-inner');
@s-aska
s-aska / fuck-the-azure-proxy.go
Created October 11, 2017 09:43
azure-functions-cli(nodejs) で text/html がエラーになるので proxy 書いた
package main
import (
"io"
"net/http"
"strings"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@s-aska
s-aska / thumbnail.go
Created October 4, 2017 07:41
サムネイル生成くん
package main
import (
"fmt"
"image"
"image/jpeg"
"io/ioutil"
"os"
"path"
"path/filepath"
@s-aska
s-aska / capture.go
Created September 5, 2017 01:16
request capture
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
<script type="text/javascript">
if (location.protocol != 'https:') {
location.href = 'https:' + location.href.substring(location.protocol.length);
}
</script>
plackup -MData::Dumper -e 'sub { [200, [], [Dumper(\@_)]] }'