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 System | |
// http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html | |
// estimated to take 5, done in 4 ;) | |
text = """ | |
Four score and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal… | |
""" | |
words = /\s+/.Split(text.Trim()) | |
currentLineLength = 0 |
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
elements, separator = argv | |
entries = elements.Split((separator,), System.StringSplitOptions.RemoveEmptyEntries) | |
for e in entries: print e | |
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 System.Text.RegularExpressions | |
while true: | |
heads = /changeset:\s+(?<revision>\d+)(.|\n)+?summary:\s+.+\n/.Matches(shell("hg", "heads")) | |
break if len(heads) < 2 | |
for head as Match in heads: | |
continue if /tag:\s+tip/.IsMatch(head.Value) | |
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 System.IO | |
import Boo.Lang.PatternMatching | |
targetFolder = argv[0] | |
changes = ((statusLine[:1], statusLine[2:]) for statusLine in /\n/.Split(shell("hg", "st")) if len(statusLine) > 0) | |
for status, file in changes: | |
targetFile = Path.Combine(targetFolder, file) | |
match status: | |
case "M" | "?": | |
Directory.CreateDirectory(Path.GetDirectoryName(targetFile)) |
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
IL_0000: ldarg.0 | |
IL_0001: ldfld class CompilerGenerated.__test_flakeDelegate$callable0$4_21__ test::flakeDelegate | |
IL_0006: ldnull | |
IL_0007: call bool class [mscorlib]System.MulticastDelegate::op_Inequality(class [mscorlib]System.MulticastDelegate, class [mscorlib]System.MulticastDelegate) | |
IL_000c: brfalse IL_0021 | |
IL_0011: ldarg.0 | |
IL_0012: ldfld class CompilerGenerated.__test_flakeDelegate$callable0$4_21__ test::flakeDelegate | |
IL_0017: callvirt instance void class CompilerGenerated.__test_flakeDelegate$callable0$4_21__::Invoke() | |
IL_001c: br IL_002b |
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 Boo.Lang.Compiler | |
import Boo.Lang.Compiler.Ast | |
import Boo.Lang.Compiler.TypeSystem | |
import Boo.Lang.Compiler.TypeSystem.Services | |
import Boo.Lang.Compiler.MetaProgramming | |
import Boo.Lang.Environments | |
macro delegate: | |
case [| delegate $field as $fieldType |]: | |
enclosingType = delegate.GetAncestor of TypeDefinition() |
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
public abstract class Base | |
{ | |
public Base(string s) {} | |
} | |
public class ChainToBase : Base | |
{ | |
public ChainToBase() : base("foo") {} | |
} |
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 UnityEngine | |
import UnityEditor | |
[MenuItem("Tools/Remove Unsupported Components")] | |
def RemoveUnsupportedComponents(): | |
unsupported = AudioChorusFilter, AudioDistortionFilter, AudioEchoFilter, AudioHighPassFilter, AudioLowPassFilter, AudioReverbFilter | |
for u in unsupported: | |
for o in GameObject.FindSceneObjectsOfType(u): | |
Debug.Log("destroying $o") | |
GameObject.DestroyImmediate(o) |
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 System.Xml; | |
function printAllTypes(file : String) { | |
var doc = new XmlDocument(); | |
doc.PreserveWhitespace = false; | |
doc.Load(file); | |
for (var text: XmlText in doc.SelectNodes("//element/type/text()")) { | |
print(text.Value); | |
} | |
} |
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
using UnityScript.Scripting; | |
namespace Evaluator | |
{ | |
public class Test | |
{ | |
private static EvaluationContext context = new EvaluationContext(); | |
public static void Run() | |
{ |