This file contains hidden or 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
| class Proxy: | |
| __handler = None | |
| def __init__(self, handler:object): | |
| self.__handler = handler | |
| @classmethod | |
| def Cproxy(clz, opt:str, default_handler = None): | |
| def _handler(self, *args, **kwargs): | |
| handler = getattr(self.__handler, opt, default_handler if default_handler else clz.__defaultOpt) | |
| return handler(*args, **kwargs) | |
| return _handler |
This file contains hidden or 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
| class CallableWrapper: | |
| def __init__(self, wrap): | |
| self.wrap = wrap | |
| def __call__(self, f=None, *args, **kargs): | |
| if f == None: | |
| return self.wrap | |
| result = f(self.wrap, *args, **kargs) | |
| class __callable(type(result), Callable): | |
| pass | |
| return __callable(result, *args, **kargs) |
This file contains hidden or 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
| class Solution: | |
| prime_numbers = [2,3,5,7,11,13,17,19,23,29,31] | |
| def countPrimes(self, n: int) -> int: | |
| return Solution.countPrime(n) | |
| @staticmethod | |
| def countPrime(n: int): | |
| if n <= 2: return 0 | |
| m = Solution.prime_numbers[-1] | |
| while n > m: |
This file contains hidden or 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
| (defclass C1 nil | |
| ((a :type fixnum | |
| :reader get-a | |
| :writer set-a | |
| :initarg :a))) | |
| (defparameter *i1* (make-instance 'C1 :a 1)) | |
| (defparameter *i2* (make-instance 'C1 :a 2)) | |
| (defparameter *i3* (make-instance 'C1 :a 1)) |
This file contains hidden or 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
| from http.server import HTTPServer | |
| from http.server import BaseHTTPRequestHandler | |
| class MyHTTPRequestHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| print(self.path) | |
| print(self.command) | |
| self.wfile.write(b"Hello World") | |
| server = HTTPServer(("0.0.0.0",8000), MyHTTPRequestHandler) |
This file contains hidden or 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
| <form action=""> | |
| <input name="select[]" type="checkbox" value="01"/> | |
| <input name="select[]" type="checkbox" value="02"/> | |
| <input name="select[]" type="checkbox" value="03"/> | |
| <input name="select[]" type="checkbox" value="04"/> | |
| <input name="select[]" type="checkbox" value="05"/> | |
| <input name="pick_one" type="radio" value="01"/> | |
| <input name="pick_one" type="radio" value="02"/> | |
| <input name="pick_one" type="radio" value="03"/> |
This file contains hidden or 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
| Copyright (c) 2019, lagagain | |
| All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | |
| modification, are permitted provided that the following conditions are met: | |
| * Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | |
| * Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the |
This file contains hidden or 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
| (require 'abcl-contrib) | |
| (require 'abcl-asdf) | |
| (require 'jss) | |
| (defpackage id.lag.tesabcl | |
| (:use cl abcl-contrib abcl-asdf jss java)) | |
| (in-package id.lag.tesabcl) | |
| (jcall "println" #"java.lang.System.out" "Hello, World") |
This file contains hidden or 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
| b0d1630... 04/14/19 13:31 public | |
| + d9aa1d7... 04/13/19 23:14 public classmethod and staticmethod implement for python3.6 | |
| + d71a4fd... 04/12/19 09:33 public | |
| c2c8790... 03/21/19 11:12 public | |
| + 648c7e1... 03/12/19 23:06 public JAVA GUI / ABCL GUI | |
| 4f0b15e... 02/21/19 09:49 public | |
| 5be04a4... 02/08/19 18:13 private | |
| + 2d30a57... 02/08/19 18:11 private EOSIO-contract eoshop | |
| e1d8bdb... 12/11/18 20:40 public 自制@裝飾器 | |
| c145d35... 12/11/18 19:51 public [practice] [Common Lisp] CFFI - c-printf example (Common Lisp) |
This file contains hidden or 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
| def myClassmethod(m, *arg, **karg): | |
| def _m(cls, *arg, **karg): | |
| cls = cls if isinstance(cls, type(int)) else cls.__class__ | |
| return m(cls, *arg, **karg) | |
| return _m | |
| def myStaticmethod(m, *arg, **karg): | |
| def _m(*arg, **karg): | |
| if len(arg) > 0: | |
| if m.__name__ in dir(arg[0].__class__): |