This code provides a simple example of how to build an ImageData object from text art that can be used in a canvas.
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 Field: | |
def __init__(self, name=None, db_name=None, default=None, required=None, unique=None): | |
self.name = name | |
self.db_name = db_name | |
self.default = default | |
self.required = required | |
self.unique = unique | |
def to_mongo(self, value): |
The attached code shows how to create getters and setters for a JavaScript object against the object prototype.
The example shows a situation where I want to store the underlying data (an RGBA colour) as an array, but wish to allow access throough getters and setters: i.e. colour.red = 255.
Running the example produces the following result:
static void Main()
{
foreach (var block in "The quick brown fox jumped over the lazy dog".Split(' ').Buffer(4))
Console.WriteLine(string.Join(" ", block));
}
The code takes the sentence "The quick brown fox jumped over the lazy dog", splits it into words, buffers it into blocks of four words, then writes each block of words joined by spaces.
NewerOlder