Skip to content

Instantly share code, notes, and snippets.

View Evgenus's full-sized avatar
🇺🇦
Ukraine

Eugene Chernyshov Evgenus

🇺🇦
Ukraine
View GitHub Profile
from collections import deque
from functools import partial
from weakref import proxy
class Scheduler(object):
def __init__(self):
self.queue = deque()
def add(self, callable, *args, **kwargs):
print 'scheduling', callable, args, kwargs
self.queue.append(partial(callable, *args, **kwargs))
@Evgenus
Evgenus / gist:1107020
Created July 26, 2011 15:28
Coordinators 0.1
import sys
import time
from collections import deque, defaultdict
from functools import partial
from weakref import proxy
from PyQt4 import QtCore, QtGui
class Scheduler(object):
def __init__(self):
@Evgenus
Evgenus / gist:1110700
Created July 28, 2011 00:55
Reactors
import sys
import time
class Reactor(object):
timeout = 0.01
def __init__(self, callback):
self.callback = callback
def run(self):
raise NotImplementedError()
@Evgenus
Evgenus / mixercore.js
Created August 23, 2011 09:27
some natural color mixer
// Paint Colour Mixer
// copyright Stephen Chapman, 18th April 2006
// you may copy this code but please keep the copyright notice as well
var baseC = '256,256,256';
var redC = '-2,-8,-8';
var blueC = '-8,-8,-2';
var yellowC = '0,0,-8';
var orangeC = '1,1,0';
var greenC = '-4,0,-3';
var purpleC = '1,0,1';
float-field-1: 1.0
float-field-2: float > 1
a-list:
1
int > 2
float > 3
string > 4
" some string with spaces "
raw string line with any characters will be stripper during parsing
@Evgenus
Evgenus / gist:2930848
Created June 14, 2012 14:57
YAML Schema Draft #1
Field: !Mapping
fields:
type: # <--- that is name
type:
- string
- TypesList
optional: False # some explicid definition
optional:
type: boolean
optional: True
@Evgenus
Evgenus / gist:2950503
Created June 18, 2012 20:25
YAML Schema Draft #2
!Schema
Schema: !Mapping
patterns: !PatternsList
- !PatternPair
key: Identifier
value: Rule
Rule: !Mapping
fields: !FieldsMap
2659119772153226779682489404387918594905342200269924300660432789497073559873882909121342292906175583032440682826506723425601635775590279389642612611093020398930347774460613894425379600874662147884229022133853819192905427915750759274952935109319020362271989830578539328807633196834507090639946131138999460277671978289412532212329252032960511820487913640083895490443657920956267126291922289224609441034849578266461219690879675039920051391388174525259443193865041630348000323295729231692725808120388628956451330203199414186213654593812478970390749485268614971964248428562782648720818548493937299025693132719165544060431069136029010640558959534212123746079660766983306735060532482925553082121188696097199078085563246046013216102655431476452400396602364732664246252767374593256582134654265209220042370143240456646479703878634028476799516301302320589620637994623895999962376530625874148998609130106933187937209476887496871311072138713943694894357288061061557708461902289692063089736008186036231141171109877425423962410946849388972
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using UnityEngine;
namespace Asynko
{
#region Interfaces
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 400000}