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
| -- Add this line to the main hardoncollider/init.lua file around line 136 | |
| -- to allow you to add preconstructed shapes. | |
| function HC:addExistingShape(shape) | |
| return new_shape(self, shape) | |
| end |
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
| function love.load() | |
| -- Load our repeating texture | |
| local img = love.graphics.newImage("dirt.png") | |
| -- Points for our polygon | |
| local vertices = {12,0, 396,7, 500,375, 195,520, 78,377} | |
| texturedPoly = newTexturedPoly(vertices, img) | |
| end |
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
| # Iterate through pre-parsed KNP output stored in a file. Useful for processing a batch of | |
| # sentences offline, and then dealing with them later. | |
| use strict; | |
| use warnings; | |
| use KNP::File; | |
| # File is the result of "juman | knp -tab > knp.out" | |
| my $knp_file = new KNP::File( file => $ARGV[0], encoding => 'utf-8' ) | |
| or die "Couldn't make KNP from file $!"; |
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
| from mwlib.refine import compat | |
| raw = """ | |
| =Sup= | |
| Je suis le voyageur dans le baked beans. | |
| """ | |
| parsed = compat.parse_txt(raw) |
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
| from mwlib.refine import compat,core | |
| from mwlib.parser import nodes | |
| import pprint | |
| def main(): | |
| pp = pprint.PrettyPrinter(indent=2) | |
| raw = """ | |
| =Cake= | |
| Modern cake, especially layer cakes, normally contain a |
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
| <entry> | |
| <ent_seq>1000220</ent_seq> | |
| <k_ele> | |
| <keb>明白</keb> | |
| <ke_pri>ichi1</ke_pri> | |
| <ke_pri>news1</ke_pri> | |
| <ke_pri>nf10</ke_pri> | |
| </k_ele> | |
| <r_ele> | |
| <reb>めいはく</reb> |
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
| #!/usr/local/bin/perl | |
| use strict; | |
| use warnings; | |
| use XML::LibXML; | |
| use encoding "utf-8"; | |
| my $file = $ARGV[0]; | |
| my $parser = XML::LibXML->new(); | |
| my $doc = $parser->parse_file($file); |
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
| # Print the entire tree of a Wiki article using mwlib | |
| from mwlib import wiki | |
| from mwlib.parser import nodes | |
| def print_tree(node, indent): | |
| tabs = indent * " " | |
| print tabs + node.__class__.__name__ | |
| indent += 1 | |
| for child in node.children: | |
| print_tree(child, indent) |
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
| from mwlib import wiki | |
| from mwlib.parser import nodes | |
| env = wiki.makewiki('/home/ben/wiki/simple/wikiconf.txt') # wiki Environment object | |
| a = env.wiki.getParsedArticle('cheese') | |
| for child in a.allchildren(): | |
| if isinstance(child, nodes.Section): # Yay global function | |
| print "Section title: " + child.children[0].asText() | |
| if isinstance(child, nodes.LangLink): |
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
| <?xml version="1.0"?> | |
| <root> | |
| <list> | |
| <item> | |
| <name>Magical stuff</name> | |
| <identifier>private.magical</identifier> | |
| <!-- Need this explicitly, otherwise the forward delete thing doesn't work --> | |
| <autogen> | |
| --KeyToKey-- | |
| KeyCode::SEMICOLON, ModifierFlag::NONE, |