Uncle Bob 2013年3月6日
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 System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
namespace StringPerfomanceTest | |
{ | |
internal class Program | |
{ |
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 static object GetDefault(Type type) | |
{ | |
if(type.IsValueType) | |
{ | |
return Activator.CreateInstance(type); | |
} | |
return null; | |
} |
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
#!/usr/bin/ruby | |
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'oauth' | |
require "rexml/document" | |
class YouroomContent | |
def initialize (content, author, created_at, children) | |
@content = content |
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
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'oauth' | |
require 'JSON' | |
user = 'user' | |
pass = 'pass' | |
key = 'consumer_key' |
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
[System.Runtime.InteropServices.DllImport("gdi32.dll")] | |
public static extern bool DeleteObject(IntPtr hObject); | |
public static BitmapSource ToWPFBitmap(this System.Drawing.Bitmap bitmap) | |
{ | |
var hBitmap = bitmap.GetHbitmap(); | |
BitmapSource source; | |
try | |
{ |
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 class WinFormBitmapConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
var bitmap = value as Bitmap; | |
if (bitmap == null) | |
{ | |
return null; | |
} |
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
[System.Runtime.InteropServices.DllImport("gdi32.dll")] | |
public static extern bool DeleteObject(IntPtr hObject); | |
public static BitmapSource ToWPFBitmap(this System.Drawing.Bitmap bitmap) | |
{ | |
var hBitmap = bitmap.GetHbitmap(); | |
BitmapSource source; | |
try | |
{ |
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 static void ShowDialog(this Form dlg, int timeout) | |
{ | |
dlg.Shown += (sender, args) => Task.Factory.StartNew( | |
() => Thread.Sleep(timeout)).ContinueWith( | |
_ => dlg.Close(),TaskScheduler.FromCurrentSynchronizationContext()); | |
dlg.ShowDialog(); | |
} |
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
<Window | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" | |
x:Class="IroPf.MainWindow" | |
x:Name="Window" | |
Title="MainWindow" | |
Width="640" Height="480"> | |
<Window.Resources> | |
<Storyboard x:Key="speaking" AutoReverse="True" RepeatBehavior="Forever"> |