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
| # -*- coding: utf-8 | |
| __author__ = 'Charlie Qiu <qbowater@gmail.com>' | |
| import logging | |
| import urllib.parse | |
| import base64 | |
| import os | |
| import requests | |
| import yaml | |
| from django.conf import settings |
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
| package core | |
| import "io" | |
| import "encoding/binary" | |
| import "bufio" | |
| func WriteString(writer io.Writer, s string) (err error) { | |
| l := len(s) | |
| if l < 128 { | |
| err = binary.Write(writer, binary.BigEndian, byte(l)) |
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
| # -*- coding: utf-8 | |
| __author__ = 'Charlie Qiu <qbowater@gmail.com>' | |
| import time | |
| class TTLCache(object): | |
| _caches = {} | |
| _timeouts = {} |
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
| # -*- coding: utf-8 | |
| __author__ = 'Charlie Qiu <qbowater@gmail.com>' | |
| """ | |
| A implementation of singleton from stackoverflow. | |
| http://stackoverflow.com/questions/42558/python-and-the-singleton-pattern | |
| Example: | |
| @Singleton |
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
| NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; |
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
| module('signals',package.seeall) | |
| local oo = require "loop.base" | |
| Signal = oo.class{ | |
| name = '', | |
| slots = {} | |
| } |
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
| -- 使用CCSequence将多个action串起来 | |
| function sequenceActions(...) | |
| local actions = { ... } | |
| if #actions == 1 then | |
| return actions[1] | |
| end | |
| local pre_action = actions[1] | |
| for i = 2, #actions do | |
| pre_action = CCSequence:createWithTwoActions(pre_action, actions[i]) |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace LevelEditor | |
| { | |
| public sealed class Singleton<T> where T: new() | |
| { |
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
| module('greenlet',package.seeall) | |
| local _resume = coroutine.resume | |
| local _yield = coroutine.yield | |
| local _create = coroutine.create | |
| local _wrap = coroutine.wrap | |
| function create(func) | |
| function f(is_kill,...) |