Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdn.jsdelivr.net/gh/imaya/zlib.js/bin/rawdeflate.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/imaya/zlib.js/bin/deflate.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/imaya/zlib.js/bin/rawinflate.min.js"></script>
@likev
likev / index.html
Last active May 16, 2021 15:27
OpenLayers example// source https://jsbin.com/xadixoviju
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/css/ol.css"
type="text/css">
<style>
.map {
height: 600px;
width: 100%;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>d3.contours</title>
<script src='https://d3js.org/d3.v6.min.js'></script>
</head>
<body>
<script>
@likev
likev / console.js
Created February 8, 2021 05:21
Interactive Node.js Console Apps Demo
const readline = require('readline');
const max_row = 10;
let row = 0, col = 0;
const stdin = process.stdin;
//https://nodejs.org/api/readline.html#readline_readline_emitkeypressevents_stream_interface
readline.emitKeypressEvents(stdin);
// without this, we would only get streams once enter is pressed
@likev
likev / conrec.js
Created January 19, 2021 09:34 — forked from sdowsland/conrec.js
/**
* Copyright (c) 2010, Jason Davies.
*
* All rights reserved. This code is based on Bradley White's Java version,
* which is in turn based on Nicholas Yue's C++ version, which in turn is based
* on Paul D. Bourke's original Fortran version. See below for the respective
* copyright notices.
*
* See http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/ for the original
* paper by Paul D. Bourke.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8">
<title>国家卫星气象中心,风云四号卫星天气应用平台</title>
<link rel="icon" href="static/images/nsmc.png" type="image/x-icon">
<link rel="shortcut icon" href="static/images/nsmc.png" type="image/x-icon">
<link rel="bookmark" href="static/images/nsmc.png" type="image/x-icon">
@likev
likev / webmd-slideshow-to-single-page.js
Created November 9, 2020 10:17
webmd.com slideshow to single page
var newitem = $("<div class='owl-item'></div>")
var owl_items = $('.owl-item');
owl_items.each(function(index){
$('.slide>.caption>.slide-count',this).remove();
if(index !== owl_items.length-1) newitem.append($('.slide',this))
})
function ak(m, n) {
//console.log(`(${m}, ${n})`);
if (m < 0 || n < 0) return console.log('error');
else if (m === 0) return n + 1;
else if (m === 1) return n + 2;
else if (m === 2) return 2 * n + 3;
else if (m === 3) return (1 << (n + 3)) - 3;
else {//m > 0
if (n === 0) return ak(m - 1, 1);
@likev
likev / RationalPartitions.js
Created July 6, 2020 06:42
Rational Partitions
let log = console.log;
function lcm_two_numbers(x, y) {
if ((typeof x !== 'number') || (typeof y !== 'number'))
return false;
return (!x || !y) ? 0 : Math.abs((x * y) / gcd_two_numbers(x, y));
}
function gcd_two_numbers(x, y) {
x = Math.abs(x);