Skip to content

Instantly share code, notes, and snippets.

@jschementi
jschementi / jquery-watermark.js
Created November 30, 2008 02:18
JQuery Watermark
$(document).ready(function() {
swapValues = []
$(".watermark").each(function(i) {
$(this).addClass("gray")
swapValues[i] = $(this).val()
$(this).focus(function() {
if($(this).val() == swapValues[i]) {
$(this).val("")
$(this).removeClass("gray")
}
@jschementi
jschementi / debugger.rb
Created February 10, 2009 21:34
debugger method
#
# IronRuby ruby-debug-like-debugger call for things that
# support System::Diagnostics::Debugger, like Visual Studio
#
def debugger
require 'mscorlib'
System::Diagnostics::Debugger.break if System::Diagnostics::Debugger.launch
end
@jschementi
jschementi / jimmysch.vssettings
Created February 17, 2009 22:49
Visual Studio Settings
<UserSettings>
<ApplicationIdentity version="9.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment">
<ToolsOptionsSubCategory name="Documents" RegisteredName="Documents" PackageName="Visual Studio Environment Package">
<PropertyValue name="ShowMiscFilesProject">false</PropertyValue>
<PropertyValue name="AutoloadExternalChanges">false</PropertyValue>
<PropertyValue name="CheckForConsistentLineEndings">false</PropertyValue>
<PropertyValue name="SaveDocsAsUnicodeWhenDataLoss">false</PropertyValue>
<PropertyValue name="InitializeOpenFileFromCurrentDocument">true</PropertyValue>
@jschementi
jschementi / PythonEngine.cs
Created March 27, 2009 06:39
PythonEngine class used in Calculator Scripting blog post
public class PythonEngine {
private ScriptEngine _engine;
private ScriptScope _scope;
public PythonEngine() {
var setup = DynamicApplication.CreateRuntimeSetup();
setup.DebugMode = true;
var runtime = new ScriptRuntime(setup);
_engine = Python.GetEngine(runtime);
_scope = null;
// After adding assembly references to IronPython*
// and Microsoft.Scripting.*, add the following
// using statements to the top of Page.xaml.cs
using Microsoft.Scripting.Hosting;
using Microsoft.Scripting.Silverlight;
using IronPython.Hosting;
@jschementi
jschementi / AddToApp.xaml.cs
Created March 27, 2009 07:21
Add this to your Silverlight app to run tests
// Add the following to your App.xaml.cs's
// Application_Startup method.
var queryString = HtmlPage.Document.QueryString;
if (queryString.ContainsKey("test")) {
var xap = new Uri(
"eggs.xap", UriKind.Relative
);
WebClient wcXap = new WebClient();
wcXap.OpenReadCompleted +=
new OpenReadCompletedEventHandler(
// Add the following methods to the calculator's
// Page.xaml.cs Page class
// Execute the script code in the Functions buffer,
// and add buttons to the UI to call the function
// if it doesn't exist.
public void Functions_TextChanged(object sender, TextChangedEventArgs e) {
FunctionDefinitions.Children.Clear();
try {
object result = _engine.Execute(Functions.Text.ToString());
<!-- replace Page.xaml with this markup -->
<UserControl x:Class="CalculatorTestApp.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:calculator="clr-namespace:CalculatorProject;assembly=Calculator"
Width="440" Height="320">
<Border BorderBrush="Gray" BorderThickness="5" CornerRadius="8" Background="LightGray" Padding="3">
<Grid x:Name="LayoutRoot">
<Grid.ColumnDefinitions>
<ColumnDefinition />
# eggs_config.rb
Eggs.config(
:tests => [
:sample
]
)
<!--
the following goes in the <httpHandler> section
in a ASP.NET application's web.config file
-->
<add verb="*" path="*.xap" validate="false" type="Chiron.XapHttpHandler,Chiron" />