This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto" | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/sha256" | |
"crypto/x509" | |
"encoding/hex" | |
"encoding/pem" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.clock { | |
display: inline-block; | |
--size: 360px; | |
width: var(--size); | |
height: var(--size); | |
position: relative; | |
overflow: hidden; | |
} | |
.clock > .hour { | |
--pointer-size: 12px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function guides(hashes, shared) { | |
let g = undefined, | |
gs = {}, | |
list = [], | |
step = 0, | |
astyle, | |
padding, | |
m, | |
width = 0, | |
height = 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.yinyang { | |
--size: 360px; | |
--dot: 60px; | |
--yin: #222; | |
--yang: #c30; | |
--duration: 8s; | |
width:var(--size); | |
height:var(--size); | |
position: relative; | |
overflow: hidden; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import { Response } from "https://deno.land/[email protected]/http/server.ts"; | |
export async function wasmAt(src: string): Promise<any> { | |
if(/^http[s]?:\/\//i.test(src)) { | |
return fetch(src); | |
} | |
return new Response(await Deno.readAll(await Deno.open(src)), {status: 200, headers:{ | |
'content-type': 'application/wasm' | |
}}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cifblocknr = 1; | |
const findsymtolerance = 0; | |
// convert VASP POSCAR to cif format | |
function vasp2cif(poscar: string): string { | |
const lines = poscar.split('\n'); | |
const cell = new Cell(); | |
cell.HMSymbol = "'P 1'"; | |
cell.label = cifblocknr.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* <div class="dual"><div class="box"><div onclick="this.parentElement.classList.add('flipped')">current</div><div onclick="this.parentElement.classList.remove('flipped')">current</div></div></div> */ | |
.dual { | |
max-width: 100%; | |
position: relative; | |
margin: 2rem 0; | |
perspective: 1280px; | |
} | |
.dual:hover { | |
z-index: 999; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A simple helper to test functions not-exported but with _ prefix | |
const privateCases = async function (flpath: string, cases: Function) { | |
const decoder = new TextDecoder("utf-8"); | |
let body = decoder.decode(await Deno.readFile(flpath)); | |
body = body.replace(/\nfunction _/g, "\nexport function _"); | |
const tmppath = flpath.replace(/([^\/]+)$/, "~$1"), | |
encoder = new TextEncoder(); | |
await Deno.writeFile(tmppath, encoder.encode(body)); | |
cases(await import(tmppath)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* simple require implemented for browser | |
* usage example : | |
* require.dirs({root:'/service/grpc/', modules:'/prefix/node_modules/'}) | |
* && require('hello.js', function(exports){ | |
* window.hello = exports; | |
* }) | |
**/ | |
!window.require && (function(){ // begin require | |
const cachedModules = {}, | |
cachedMains = {}, |