Skip to content

Instantly share code, notes, and snippets.

import Foundation
public class FSM<StateType: Equatable, EventType: Equatable> {
public struct StateTransition: CustomStringConvertible {
var event: EventType
var state: StateType
var target: () -> StateType?
init(event: EventType, state: StateType, target: @escaping () -> StateType?) {
#!/bin/bash
function modifyOrAdd(){
# 匹配符
str=$1
# 结果字符串
dst=$2
# 文件路径
file=$3
result=`sed -n "/${str}/p" ${file}`
@hocgin
hocgin / index.html
Created November 20, 2017 05:55
网页预加载动画
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>加载动画</title>
<link rel="stylesheet" href="loading.css">
<script type="text/javascript" src="libs/jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function () {
$(window).on('load', function () {