This file contains 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
// 你的主题名 | |
.dark { | |
background-color: #212121; // 背景颜色 | |
color: white; // 字体颜色 | |
} |
This file contains 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
const renderer = new marked.Renderer() | |
let originParagraph = renderer.paragraph.bind(renderer) | |
renderer.paragraph = (text) => { | |
const blockRegex = /\$\$[^\$]*\$\$/g | |
const inlineRegex = /\$[^\$]*\$/g | |
let blockExprArray = text.match(blockRegex) | |
let inlineExprArray = text.match(inlineRegex) | |
for (let i in blockExprArray) { | |
const expr = blockExprArray[i] | |
const result = renderMathsExpression(expr) |
This file contains 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
#! /bin/python | |
import os, math | |
import Image | |
import ImageDraw | |
def cut_circle(source, target): | |
image = Image.open(source).convert("RGBA") | |
size = image.size | |
r2 = min(size[0], size[1]) | |
if size[0] != size[1]: |
This file contains 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
/* | |
* Rolling Checksum from | |
* http://www.cs.cmu.edu/~15-749/READINGS/required/cas/tridgell96.pdf | |
* | |
*/ | |
'use strict'; | |
module.exports = { | |
last: null, | |
checksum: function (data, isNotRolling) { |
This file contains 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
// The demo comes from <<JavaScript:The Good Parts>>. | |
var memoizer = function (memo, formula) { | |
var recur = function (n) { | |
var result = memo[n]; | |
if (typeof result !== 'number') { | |
result = formula(recur, n); | |
memo[n] = result; | |
} | |
return result; | |
}; |
This file contains 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
#lang web-server/insta | |
; A blog is a (listof post) | |
; and a post is a (post title body) | |
(struct post (title body)) | |
; BLOG: blog | |
; The static blog. | |
(define BLOG | |
(list (post "Second Post" "This is anther post") |