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 Property: | |
def __init__(self): | |
pass | |
class Fragment: | |
def __init__(self, text, property): | |
this.text = text | |
this.property = property | |
class ParsedText: | |
def __init__(self, fragments, property): | |
this.fragments = fragments |
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
import std.io; | |
import std.string; | |
import core.type; | |
type string = std.string; | |
var out = std.io.stdout; | |
type Cat { | |
func purr() -> string { return "purrr"; } | |
func speak() -> string { return "meow"; } |
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 Point: | |
def __init__(self, i, x, y): | |
self.i = i | |
self.x = x | |
self.y = y | |
def __repr__(self): | |
if self.i == -1: | |
return "[(%s, %s)]" % (self.x, self.y) | |
else: |
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
All dependencies seem to be present! | |
[jac@quetz prototype]$ python2 ./MapEditor.py | |
from OverworldParts.Cell import * | |
from OverworldParts.Map import * | |
Map.G = MapEdit.G | |
Map.addTempCell = MapEdit.addTempCell | |
Map.as_8_bit = MapEdit.as_8_bit | |
Map.clearTempCells = MapEdit.clearTempCells | |
Map.colourBytesToNumber = MapEdit.colourBytesToNumber | |
Map.compile = MapEdit.compile |
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
while True: | |
print("loop") | |
sleep(1) | |
function myLoop() { | |
console.log("loop"); | |
window.setTimeout(myLoop, 1000); | |
} |
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
int main(int argc, char **argv) { | |
Database db("sp_plus.db"); | |
Table t("users"); | |
t.columns.push_back({ "name", "varchar(32)", true, false }); | |
t.columns.push_back({ "posX", "int" }); | |
t.columns.push_back({ "posY", "int" }); | |
typedef tuple<string, int, int> UserRow; | |
cerr << t.formatCreate() << endl; |
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 smooth(world, location): | |
val = world[location[0]][location[1]] | |
for yo in range(-val, val): | |
if (location[0] + yo < 0) or (location[0] + yo >= len(world)): | |
continue | |
for xo in range(-val, val): | |
if (location[1] + xo < 0) or (location[1] + xo >= len(world[0])): | |
continue | |
if world[location[0] + yo][location[1] + xo] < val - max(abs(xo), abs(yo)): | |
world[location[0] + yo][location[1] + xo] < val - max(abs(xo), abs(yo)) |
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 fibonacci(): | |
a, b = 1, 1 | |
while True: | |
yield a | |
a, b = a + b, a | |
x = 0 | |
for f in fibonacci(): | |
print(f) | |
x += 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
// http://stackoverflow.com/questions/1542073/xdocument-or-xmldocument | |
// Customers is a List<Customer> | |
XElement customersElement = new XElement("customers", | |
customers.Select(c => new XElement("customer", | |
new XAttribute("name", c.Name), | |
new XAttribute("lastSeen", c.LastOrder) | |
new XElement("address", | |
new XAttribute("town", c.Town), | |
new XAttribute("firstline", c.Address1), | |
// etc |
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
string movie = "The last one"; | |
if(date < 300) | |
movie = "The penultimate one"; | |
if(date < 200) | |
movie = "The 2nd to last"; | |
if(date < 100) | |
movie = "The first one"; | |
cout << movie << endl; |