Skip to content

Instantly share code, notes, and snippets.

🤖
He is not a human

hashrock hashrock

🤖
He is not a human
Block or report user

Report or block hashrock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View save-svg-as-png.js
//from https://qiita.com/skryoooo/items/a37455bef54321a6195a
//変更内容:関数化とconst化
function saveSvgAsPng(el) {
const svgData = new XMLSerializer().serializeToString(el);
const canvas = document.createElement("canvas");
canvas.width = el.width.baseVal.value;
canvas.height = el.height.baseVal.value;
const ctx = canvas.getContext("2d");
@hashrock
hashrock / server.tsx
Created Oct 8, 2019
One file server with deno
View server.tsx
import { serve } from "https://deno.land/std@v0.19.0/http/server.ts";
import React from "https://dev.jspm.io/react";
import ReactDOMServer from "https://dev.jspm.io/react-dom/server";
const s = serve(":8000");
const hello: string = "Hello"
const View = (props) =>
<div className="deno">{hello}, {props.msg}</div>;
window.onload = async () => {
View vue-ssr.js
const Vue = require("vue");
const createRenderer = require("vue-server-renderer").createRenderer;
const compiler = require("vue-template-compiler");
const renderToString = createRenderer().renderToString;
var App = {
template: `<div>
<div v-for="item in items">{{item}}</div>
</div>`,
data() {
@hashrock
hashrock / pomodoro.py
Created May 14, 2019
My first pomodoro app for M5Stack
View pomodoro.py
from m5stack import *
import utime
import math
cnt = 0
m_cnt = cnt
start = False
done = False
def init():
View study-deno-chrome.ts
// import * as ws from "https://deno.land/std/ws/mod.ts";
//TODO 有効なChromeのパスを探す
const chrome =
"/opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app/Contents/MacOS/Google Chrome";
async function main() {
const dirName = await Deno.makeTempDir({ prefix: "deno_chrome_temp" });
const width = 400;
const height = 400;
@hashrock
hashrock / svg-drag.js
Last active Oct 15, 2019
SVG Drag and Drop with React Hooks
View svg-drag.js
import React from "react";
import ReactDOM from "react-dom";
const Circle = () => {
const [position, setPosition] = React.useState({
x: 100,
y: 100,
active: false,
offset: { }
});
@hashrock
hashrock / index.js
Created Dec 12, 2018
SVG gantt renderer for scrapbox, on firebase functions
View index.js
const functions = require("firebase-functions");
const app = require("express")();
const svgContent = "image/svg+xml; charset=utf-8";
function resetHMS(d) {
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
d.setMilliseconds(0);
@hashrock
hashrock / .htmlnanorc
Last active Dec 11, 2018
Parcel + Vue hinagata
View .htmlnanorc
{
"minifySvg": false,
"collapseWhitespace": "conservative",
"minifyCss": {
"safe": true
}
}
@hashrock
hashrock / index.ts
Last active Nov 29, 2018
Simple HTTP Server in deno (WIP), this is just a toy code, DO NOT USE THIS.
View index.ts
/**
* Simple HTTP Server
*/
import { serve } from "https://deno.land/x/net/http.ts";
import * as deno from "deno";
import { mime } from "./mime";
const addr = "0.0.0.0:8000";
const s = serve(addr);
@hashrock
hashrock / server.js
Created Dec 27, 2017
Koa my boilerplate
View server.js
const path = require('path');
const koaBody = require('koa-body');
const Koa = require('koa');
const app = module.exports = new Koa();
const datastore = require('nedb-promise')
const _ = require('koa-route');
const serve = require('koa-static');
var gsjson = require('google-spreadsheet-to-json');
app.use(koaBody());
You can’t perform that action at this time.