https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

/** | |
* Changes XML to JSON | |
* Modified version from here: http://davidwalsh.name/convert-xml-json | |
* @param {string} xml XML DOM tree | |
*/ | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { |
from nonebot.adapters import Event, Message | |
from nonebot.params import EventPlainText, CommandArg | |
from nonebot.plugin.on import on_message, on_command | |
from nonebot.adapters.onebot.v11.message import MessageSegment | |
import os | |
import ast | |
import json | |
import shelve | |
import aiohttp |
/** | |
* Author: Michael Fields | |
* Source: http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/ | |
* Thanks a lot for the nice tweak | |
*/ | |
/** | |
* Define default terms for custom taxonomies in WordPress 3.0.1 | |
* |
//语言和编码 | |
<?php language_attributes(); ?> //语言属性 | |
//根据不同情况来读取 title | |
<?php | |
global $page, $pages; | |
wp_title( '|', true, 'right'); //在标题的左方或右方 | |
bloginfo( 'name' ); //博客的名称 | |
$site_description = get_bloginfo( 'description', 'Display' ); //博客的描述 | |
if( $site_description && ( is_home() || is_front_page() ) ) //如果是首页,则输出博客名称和描述 |
//A Kotlin object (singleton) that handles the copying with mulitple different arguments | |
object CopyBytes { | |
@Throws(IOException::class) | |
fun copy(input: InputStream, output: OutputStream) { | |
//Creating byte array | |
val buffer = ByteArray(1024) | |
var length = input.read(buffer) | |
//Transferring data |
/** | |
** 为KProperty0添加一个扩展函数addObserver(),用来监听当值发生变化的时候刷新observer代码块 | |
**/ | |
fun <T> KProperty0<T>.addObserver(observer: (T) -> Unit) { | |
(getDelegate(this) as ObservableProperty<T>?)?.addObserver(observer) | |
} | |
private fun <T> getDelegate(kProperty: KProperty0<T>) : Any? { | |
val owner = (kProperty as PropertyReference).owner |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class HTMLSpirit{ | |
public static String delHTMLTag(String htmlStr){ | |
String regEx_script="<script[^>]*?>[\\s\\S]*?<\\/script>"; //定义script的正则表达式 | |
String regEx_style="<style[^>]*?>[\\s\\S]*?<\\/style>"; //定义style的正则表达式 | |
String regEx_html="<[^>]+>"; //定义HTML标签的正则表达式 | |
Pattern p_script=Pattern.compile(regEx_script,Pattern.CASE_INSENSITIVE); |
/* | |
* Copyright 2017 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
// BSD License (http://lemurproject.org/galago-license) | |
package org.lemurproject.galago.utility.json; | |
public class JSONUtil { | |
public static String escape(String input) { | |
StringBuilder output = new StringBuilder(); | |
for(int i=0; i<input.length(); i++) { | |
char ch = input.charAt(i); | |
int chx = (int) ch; |