Skip to content

Instantly share code, notes, and snippets.

fe1cf5d allow explicit casts from enum to floating point numbers
42f91ab AST implementation relying on ctor instead of FormatterServices.GetUninitializedObject
72ad7f2 Use Boo.Lang.Compiler.Ast.ExceptionHandler explicitly. It conflicts with System.Reflection.Emit.ExceptionHandler in .NET 4.5
6be232a Use ctor instead of FormatterServices.GetUninitializedObject since this is not supported on some platforms also, do not try to instantiate abstract classes
28859cb Include readme file for booi new features
5b050d4 Refactored booi to use the command line parser from Boo.Lang.Useful
397ce62 fix handling of callable expressions operands in conditional expressions
59169f8 fall back to regular reflection when accessing literal fields (fixes case 506498)
cf075f1 fix handling of generators that yield null (fixes case 494359)
7f53947 freeze AssemblyVersion at 2.0.9.5 to avoid breaking backwards compatibility with existing binaries
@drslump
drslump / diags.boo
Created October 28, 2013 02:53
Proposal for a diagnostics system in the Boo compiler
"""
Diagnostics system based on the one from clang
http://clang.llvm.org/diagnostics.html
http://clang.llvm.org/docs/InternalsManual.html#the-diagnostics-subsystem
http://clang.llvm.org/doxygen/Diagnostic_8h_source.html
A DiagsEngine will be associated with the the CompilerContext and made
available to all the compiler components, including meta programming
extension points (macros, ast attributes, ..). The idea is that an
# Registers a hook when changing directory to find out the
# local pyenv version in it. Exporting it as PYENV_LOCAL_VERSION.
#
# Note that it's meant to only detect those directories using a .python-version
#
update-pyenv-local-version() {
# This will return something like "my-version (set by /path/to/.python-version)"
local version="`pyenv version`"
if [[ $version == *.python-version* ]]; then
@drslump
drslump / prompt_drslump_setup
Last active December 26, 2015 21:09
custom prompt for Prezto (.zprezto)
#
# DrSlump custom theme.
#
# Authors:
# Iván -DrSlump- Montes <[email protected]>
#
# Define functions for ZLE that activate on mode change
function zle-line-init zle-keymap-select {
local iterm_vert='\e]50;CursorShape=1\x7'
@drslump
drslump / pyenv-mktmp
Created October 29, 2013 17:33
Place this file in your path and give it executable permissions
#!/bin/sh
pyenv virtualenv "$1"
echo "Entering a new shell session with version '$1'"
echo "Press ctrl+d or exit to terminate it"
export PYENV_VERSION="$1"
$SHELL
import Boo.Lang.Compiler.Ast
def Method1(x, y):
print 'Method1', x, y
def Method2(x, y, z):
print 'Method2', x, y, z
macro BindArg(expr as Expression):
for fn in ('Method1', 'Method2'):
@drslump
drslump / cfg-parser.py
Last active December 28, 2015 17:29
Simple hand coded parser for alarms config
class CfgParser:
def __init__(self, src):
self.src = src
self.idx = 0
def rowcol(self, ofs=None):
ofs = self.idx if ofs is None else ofs
lines = self.src.split('\n')
accum = 0
@drslump
drslump / Protocol.boo
Created November 20, 2013 20:52
proof of concept for a Nailgun server in .Net
"""
Protocol should be compatible with Nailgun (http://www.martiansoftware.com/nailgun/protocol.html)
"""
namespace boodaemon
from System import UInt32
from System.IO import BinaryReader, BinaryWriter
from System.Net.IPAddress import NetworkToHostOrder, HostToNetworkOrder
from System.Text import ASCIIEncoding
@drslump
drslump / RectanglePacking.php
Created December 25, 2013 22:53
rectangle packing in PHP for Metin Gür
<?php
class RectanglePacking {
private $root = array();
private $usedHeight = 0;
private $usedWidth = 0;
function __construct($width, $height) {
@drslump
drslump / djb2.boo
Created February 18, 2014 07:34
djb2 hash implementation
def djb2(data as string):
""" Computes a 32bit hash using the djb2 algorithm """
payload = System.Text.Encoding.ASCII.GetBytes(data)
result as uint = 5381
for ch in payload:
unchecked:
result = result * 33 + ch
return result & 0xffffffff