Skip to content

Instantly share code, notes, and snippets.

View 5alamander's full-sized avatar

ForgiveMyAwfulEngilsh 5alamander

View GitHub Profile
@5alamander
5alamander / DecoratorEditor.cs
Last active April 17, 2024 00:25 — forked from liortal53/DecoratorEditor.cs
Unity, Custom Menu, decorate the build in editor
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
/// <summary>
/// A base class for creating editors that decorate Unity's built-in editor types.
/// </summary>
public abstract class DecoratorEditor : Editor
@5alamander
5alamander / MyHierarchyMenu.cs
Created September 5, 2016 06:25
Unity, Custom Menu, in Hierarchy
using UnityEngine;
using UnityEditor;
using System.Collections;
public class MyHierarchyMenu
{
[MenuItem("Window/Test/a")]
static void Test()
{
}
@5alamander
5alamander / NetworkManagerHud.cs
Created September 10, 2016 12:00
Unity, Customize NetworkManagerHud
#if ENABLE_UNET
namespace UnityEngine.Networking
{
[AddComponentMenu("Network/NetworkManagerHUD")]
[RequireComponent(typeof(NetworkManager))]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public class NetworkManagerHUD : MonoBehaviour
{
public NetworkManager manager;
(*
ParserLibrary.fsx
Final version of a parser library.
Related blog post: http://fsharpforfunandprofit.com/posts/understanding-parser-combinators-3/
*)
module TextInput =
open System
@5alamander
5alamander / authorize_job_poster_1.ex
Created April 21, 2017 14:48 — forked from mileszs/authorize_job_poster_1.ex
Use new fun toys or not?
defmodule ElixirJobBoard.Plugs.AuthorizeJobPoster do
import Plug.Conn
import Phoenix.Controller, only: [put_flash: 3, redirect: 2]
alias ElixirJobBoard.Repo
alias ElixirJobBoard.User
alias ElixirJobBoard.Job
def init(opts), do: opts
@5alamander
5alamander / template.clj
Created March 13, 2017 09:42
A cool template in clojure
(ns console-demo.template)
(def delimiters ["<%" "%>"])
(def parser-regex
(re-pattern
(str "(?s)\\A"
"(?:"
"(.*?)" (first delimiters) "(.*?)" (last delimiters)
")?"
@5alamander
5alamander / csp.cs
Last active February 15, 2017 14:12
初版csp_for_unity。TODO: 1,处理异常时,在unity线程和系统线程处理方式不一致,2.系统线程中无法使用 timeout,3.外部无法手动停止系统线程中的某个coroutine,4.只使用了1个外部线程。更新:使用linkedlist替代queue,闲置时挂起线程。
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading;
namespace Sa1 {
/// <summary>
/// ins: do not use timeout in the csp.subthread
@5alamander
5alamander / nanomsg.org
Last active January 7, 2017 15:23
nanomsg examples

nanomsg

Pipeline

Code

@5alamander
5alamander / server.ex
Created November 20, 2016 17:06 — forked from adnils/server.ex
Elixir TCP echo server
defmodule Echo.Server do
def start(port) do
tcp_options = [:binary, {:packet, 0}, {:active, false}]
{:ok, socket} = :gen_tcp.listen(port, tcp_options)
listen(socket)
end
defp listen(socket) do
{:ok, conn} = :gen_tcp.accept(socket)
spawn(fn -> recv(conn) end)
@5alamander
5alamander / js_csp.d.ts
Created November 9, 2016 10:40
typescript: this is a dts file for js-csp
declare module 'js-csp' {
namespace Boxes {
class Box<T> {
value: T
constructor(value: T)
}
class PutBox<T> {
handler: Handlers.HandlerType
value: T