Skip to content

Instantly share code, notes, and snippets.

@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
@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'
# 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 / 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
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
# The API designer (library author) exposes these types
interface ISeek:
def seek(offset as int)
def foo(stream as ISeek):
stream.seek(0)
# The API consumer (library user) wants to use the API but
# doesn't want to (or cannot) use the type hierarchy defined
#!/usr/bin/env python
#-*- coding: utf-8 -*-
u"""
Created on May 15, 2013
@author: pablito56
@license: MIT
@contact: [email protected]

Boo Succinctly Revealed (second edition)

By Rolly Noel, Copyright 2013

THIS DOCUMENT DOESN'T COVER ANYTHING THAT NEEDS AN IMPORT (except for System) FIRST DEFINITION OF BOO LANGUAGE ITEMS IS IN BOLD IN THIS DOCUMENT, LINES OF DESCRIPTION (NOT CODE) START WITH "#", AND ARE CONTINUED WITH " "

print'ACompleteBooprogram' # O/Ps(outputs)'ACompleteBooprogram'
namespace consoleApplication1
import System
import System.IO
class ParserClass:
public CurrentCommand as string:
get:
return self._currentCommand
@drslump
drslump / async-await.boo
Created November 29, 2012 07:40
PDI DEVCON1 - BooJs code examples
import Async
[async] def foo():
print 'start'
try:
for i in range(3):
print i
for delay in (1000ms, 5s):
print "Waiting $delay..."