View IntRangeArg.py
import argparse | |
class IntRangeArg: | |
def __init__(self, start=None, stop=None): | |
assert start is None or stop is None or start < stop | |
self.start = start | |
self.stop = stop | |
def __contains__(self, value): |
View extension.js
const LM = imports.ui.main.layoutManager; | |
let _updateHotCorners; | |
function _noop() { } | |
function _destroyHotCorners() { | |
LM.hotCorners.forEach(corner => { | |
if (corner) { | |
corner.destroy(); |
View App.cs
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Input; | |
public partial class App : Application | |
{ | |
protected override void OnStartup(StartupEventArgs e) | |
{ | |
base.OnStartup(e); | |
RegisterClassHandlers(); |
View MainWindow.xaml
<Window x:Class="MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<CheckBox IsChecked="{Binding A}"> | |
<i:Interaction.Behaviors> | |
<local:UncheckOnSignalBehavior Signal="{Binding None}" /> | |
</i:Interaction.Behaviors> | |
Option A | |
</CheckBox> | |
<CheckBox IsChecked="{Binding B}"> |
View BufferedTraceListener.cs
using System; | |
using System.Diagnostics; | |
using System.Text; | |
using System.Threading; | |
public class BufferedTraceListener : TraceListener | |
{ | |
private SynchronizationContext context; | |
private StringBuilder buffer; | |
private object bufferLock; |
View LoggingCommand.cs
using System.Data; | |
public class LoggingCommand : IDbCommand | |
{ | |
private static void Log(string message) | |
{ | |
// ... | |
} | |
private IDbCommand @base; |
View TwoWayDictionary.cs
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class TwoWayDictionary<T1, T2> : ICollection<Tuple<T1, T2>> | |
{ | |
private static Tuple<T1, T2> ToTuple(T1 item1, T2 item2) | |
{ | |
return Tuple.Create(item1, item2); |
View InterlockedBoolean.cs
using System; | |
using System.Threading; | |
public class InterlockedBoolean | |
{ | |
private int value; | |
public bool Value | |
{ | |
get { return Convert.ToBoolean(value); } |
View Base64Extensions.cs
using System; | |
using System.IO; | |
using System.Runtime.Serialization; | |
using System.Runtime.Serialization.Formatters.Binary; | |
public static class Base64Extensions | |
{ | |
private static IFormatter GetFormatter() | |
{ | |
return new BinaryFormatter(); |
NewerOlder