Skip to content

Instantly share code, notes, and snippets.

var engine = IronPython.Hosting.Python.CreateEngine();
var scope = engine.CreateScope();
engine.Execute("import clr, System", scope);
Console.WriteLine(engine.Operations.Format(engine.Execute("System", scope)));
@jschementi
jschementi / binary.html
Created March 3, 2010 01:43
Processing binary data in the browser
<!--
Simple prototype of processing binary data with JavaScript.
Tested on IE8, FF3, and Chrome4.
Special thanks to http://emilsblog.lerch.org/2009/07/javascript-hacks-using-xhr-to-load.html
-->
<html>
<head>
<script language="vbscript">
Function BinaryArrayToAscCSV( aBytes )
@jschementi
jschementi / dom.py
Created March 1, 2010 07:31
Demo snippets from PyCon 2010
>>> dir(document)
[..., 'CreateElement', ...]
>>> div = document.CreateElement("div")
>>> div.innerHTML = "Hello from Python!"
>>> document.Body.AppendChild(div)
>>> div.id = "message"
>>> div.SetStyleAttribute("font-size", "24px")
>>> def say_ouch(o, e):
... o.innerHTML = "Ouch!"
...
@jschementi
jschementi / git-tfs.md
Created January 26, 2010 08:35
Using TFS and GIT together

Using TFS and GIT together

What if your team uses TFS, but you want offline support? You can have a Git repo as well, but then getting your changes to TFS is burdensome. Here’s where a GIT to TFS bridge would be handy.

Setting up your repo

Here’s how to keep a TFS repository foo, and a GIT repository bar, in sync. First step is you need to create a new TFS workspace:

cd \

tf workspace /new /noprompt Foo

require 'rubygems'
require 'ironruby_sqlserver'
### point to private copies of dbi, sqlserver-adapter, and a patch for it
require 'rubygems'
require 'active_record'
IRONRUBY_DBI_PATH = "#{File.dirname(__FILE__)}/../lib/ironruby-dbi"
SQLSERVER_ADAPTER_PATH = "#{File.dirname(__FILE__)}/../lib/sqlserver-adapter"
SQLSERVER_ADAPTER_PATCH_PATH = "#{File.dirname(__FILE__)}/../lib/sqlserver-adapter-patch"
###
$:.unshift "#{IRONRUBY_DBI_PATH}/src/lib"
$:.unshift "#{SQLSERVER_ADAPTER_PATH}/lib"
require 'activerecord-sqlserver-adapter'
@jschementi
jschementi / README.md
Created January 10, 2010 10:35
IronRuby and ActiveRecord using activerecord-sqlserver-adapter and ironruby-dbi
@jschementi
jschementi / ironruby-sqlserver-patch.rb
Created January 10, 2010 09:07
patch for SQLServerAdapter, enabling ADO and ADO.NET connections, with integrated security
# Monkey patch SQLServerAdapter. This should be moved into SQLServerAdapter itself in activerecord-sqlserver-adapter\lib\active_record\connection_adapters\sqlserver_adapter.rb
module ActiveRecord
class Base
def self.sqlserver_connection(config) #:nodoc:
config.symbolize_keys!
mode = config[:mode] ? config[:mode].to_s.upcase : 'ADO'
username = config[:username] ? config[:username].to_s : 'sa'
password = config[:password] ? config[:password].to_s : ''
database = config[:database]
host = config[:host] ? config[:host].to_s : 'localhost'
C:\Users\Jimmy\dev\ironruby\Merlin\Main\Bin\Debug>ir -S irb
irb(main):001:0> 2 + 2
=> 4
@jschementi
jschementi / gist:262246
Created December 23, 2009 01:34
Beginnings of a CSharp backend for Duby
jimmy-air:duby jimmy$ jruby test/test_csharp_source_compiler.rb
Loaded suite test/test_csharp_source_compiler
Started
...
Finished in 3.101 seconds.
3 tests, 3 assertions, 0 failures, 0 errors
jimmy-air:duby jimmy$ cat examples/hello_world.duby
puts 'Hello from Duby!'