Skip to content

Instantly share code, notes, and snippets.

use core::ops::RangeInclusive;
pub fn integral<F: Fn(f64) -> f64>(range: &RangeInclusive<f64>, f: F, err: f64) -> f64 {
let memo = [trapezoid_area(range, &f)];
romberg(range, &f, 2, err, &memo)
}
fn romberg<F: Fn(f64) -> f64>(
range: &RangeInclusive<f64>,
@kaorun343
kaorun343 / nhk.ts
Created February 8, 2018 01:50
NHKのAPI
import * as http from 'http'
interface List {
/** 番組 */
readonly list: {
readonly [key: string]: Program
}
}
interface DescriptionList {
@kaorun343
kaorun343 / OMIM.py
Created May 10, 2017 02:22
OMIMにアクセス
import json
import urllib.parse
import urllib.request
class OMIM:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = "http://api.omim.org/api/"
def entry(self, mim_number, params = {}):
// Type definitions for vuejs 1.0.21
// Project: https://github.com/vuejs/vue
// Definitions by: odangosan <https://github.com/odangosan>, kaorun343 <https://github.com/kaorun343>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Array<T> {
$remove(item: T): Array<T>;
$set(index: any, val: T): T;
}
// Type definitions for p2.js v0.7.1
// Project: https://github.com/processing/p5.js
// Definitions by: kaorun343 <https://github.com/kaorun343>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare namespace p5js {
interface p5Prototype {
// core/constants.js
// GRAPHICS RENDERER
P2D: string;
memory[55001] -> 1
n -> 0
while n < 10000
memory[n] -> 0
n -> n + 1
background()
memory[55000] -> 0
@kaorun343
kaorun343 / vue.d.ts
Last active September 8, 2017 09:17
interface Array<T> {
$remove(item: T): Array<T>;
$set(index: number, val: T): T;
}
declare namespace vuejs {
interface PropOption {
type?: any;
required?: boolean;
set number
set title
set ambiwidth=double
set tabstop=4
set expandtab
set shiftwidth=4
set smartindent
set list
set listchars=tab:»-,trail:-,eol:↲,extends:»,precedes:«,nbsp:%
set nrformats-=octal
@kaorun343
kaorun343 / index.jade
Last active October 6, 2015 12:52
yNQWGP
div#app.container
.panel.panel-default
.panel-heading
h3.panel-title YouTube API
.panel-body
youtube(v-repeat="list")
.panel-footer
button.btn.btn-default(type="button", v-on="click: check") add