This file contains 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 bitap_search(text, pattern): | |
""" | |
Returns position of pattern in text or -1 if it wasn't found. | |
text and pattern are strings. | |
>>> bitap_search("test text", "tex") | |
5 | |
>>> bitap_search("test text", "z") | |
-1 |
This file contains 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
//global | |
"ZreknarF":["cdn.frankerfacez.com/channel/global/ZreknarF.png"], | |
"LilZ":["cdn.frankerfacez.com/channel/global/LilZ.png"], | |
"BeanieHipster":["cdn.frankerfacez.com/channel/global/BeanieHipster.png"], | |
"ManChicken":["cdn.frankerfacez.com/channel/global/ManChicken.png"], | |
"YellowFever":["cdn.frankerfacez.com/channel/global/YellowFever.png"], | |
"YooHoo":["cdn.frankerfacez.com/channel/global/YooHoo.png"], | |
//00greenbean00 | |
"BeanAhab":["cdn.frankerfacez.com/channel/00greenbean00/BeanAhab.png"], | |
"BeanHori":["cdn.frankerfacez.com/channel/00greenbean00/BeanHori.png"], |
This file contains 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
""" Dice rolling simulator, will ask user to press Enter to roll. | |
Will print a random number between 1 to 6. Will ask user if they want to roll again. """ | |
import random | |
print "Welcome to the Dice Rolling Simulator!\n" | |
print "Press Enter to roll the dice." | |
begin = raw_input("") | |
""" function where random numbers are generated """ |
This file contains 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
import json | |
from collections import defaultdict | |
def parse_config(conf): | |
def Tree(): | |
return defaultdict(Tree) | |
data = Tree() |
This file contains 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
#ifndef NSMALLPOSINTS | |
#define NSMALLPOSINTS 257 | |
#endif | |
#ifndef NSMALLNEGINTS | |
#define NSMALLNEGINTS 5 | |
#endif | |
#if NSMALLNEGINTS + NSMALLPOSINTS > 0 | |
/* References to small integers are saved in this array so that they | |
can be shared. | |
The integers that are saved are those in the range |
This file contains 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
In [87]: re.compile(r'[A-Z]{2,}(?:\s+[A-Z]{2,})+', re.DEBUG) | |
max_repeat 2 65535 | |
in | |
range (65, 90) | |
max_repeat 1 65535 | |
subpattern None | |
max_repeat 1 65535 | |
in |
This file contains 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
import direct.directbase.DirectStart | |
from panda3d.core import * | |
vertex = ''' | |
#version 330 | |
in vec4 p3d_Vertex; | |
in vec2 p3d_MultiTexCoord0; | |
uniform mat4 p3d_ModelViewProjectionMatrix; |
This file contains 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
import direct.directbase.DirectStart | |
from direct.gui.OnscreenText import OnscreenText | |
from panda3d.core import * | |
loadPrcFileData("", "dump-generated-shaders 1") | |
base.setBackgroundColor(0.5, 0.5, 0.5) | |
t = OnscreenText(text='asdallaskjf', scale=0.5) |
This file contains 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 A(object): | |
def x(cls): | |
return cls.x.y | |
x.y = 123 | |
x = classmethod(x) |
This file contains 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 A(object): | |
def x(self): | |
return self.x.y | |
x.y = 123 | |
class B(object): | |
def x(self): | |
return B.x.y | |
x.y = 123 |
NewerOlder