Skip to content

Instantly share code, notes, and snippets.

[Test]
public void CreateClassProxyWithTarget_Uses_The_Provided_Options()
{
var proxyGenerator = new ProxyGenerator();
var options = new ProxyGenerationOptions();
options.AddMixinInstance(new SimpleMixin());
var target = new SimpleClassWithProperty();
var proxy = proxyGenerator.CreateClassProxyWithTarget(target, options);
@vbedegi
vbedegi / gist:984694
Created May 21, 2011 17:10
SimpleCursorAdapter - Android
String[] columns = new String[]{"columnA", "columnB", "columnC"};
int[] widgets = new int[]{R.id.widgetA, R.id.widgetB, R.id.widgetC};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.list_item, cursor, columns, widgets);
@vbedegi
vbedegi / Demo.cs
Created July 6, 2011 19:49
ReadLinesFromTextFile
@"c:\textfile.txt".ReadLinesFromTextFile().Where(x => x.Length > 10)
@vbedegi
vbedegi / BrokenSwitch.coffee
Created September 24, 2011 07:19
Web Workbench won't compile this code. Something about the switch
class SomeClass
someMethod: ->
x = 42
switch x
when 41
alert 'less'
when 43
alert 'more'
@vbedegi
vbedegi / some.cs
Created January 5, 2012 17:12
decompiled lambda expression
IQueryable<<>f__AnonymousType0<string>> <>f_AnonymousType0s = Expression[] expressionArray = new Expression[1].Select<string,<>f__AnonymousType0<string>>(Expression.Lambda<Func<string, <>f__AnonymousType0<string>>>(Expression.New(expressionArray[0] = parameterExpression, expressionArray, new MethodInfo[] { (MethodInfo)MethodBase.GetMethodFromHandle(Name, <>f__AnonymousType0<string>) }), new ParameterExpression[] { parameterExpression }));
@vbedegi
vbedegi / Example1.cs
Created March 5, 2012 21:04
A transactional, concurrent queue for .Net
var queue = new TransactionalConcurrentQueue<int>();
using (var scope = new TransactionScope())
{
queue.Enqueue(1);
// won't happen
queue.Dequeue(x => Console.WriteLine(x));
scope.Complete();
(use 'clojure.core.async)
;this is the function you want to use
(defn lazy-channels [chs]
(lazy-seq (cons (let [ [v _] (alts!! chs)] v) (lazy-channels chs))))
;now for the tesging
(def chs [ (chan) (chan) (chan) ]) ; the channels can come from anywhere, here we are using three channels for testing
@vbedegi
vbedegi / Main.sublime-menu
Created January 18, 2014 11:00
SublimeRepl user config for Clojure C:\Users\your-user-name\AppData\Roaming\Sublime Text 3\Packages\User\SublimeREPL\config\Clojure\Main.sublime-menu
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
@vbedegi
vbedegi / handler.clj
Created September 28, 2014 17:45
Qarth sample with Ring
(ns qartoy.handler
(:require [clojure.tools.logging :as log]
[ring.util.response :refer [redirect]]
[compojure.core :refer :all]
[compojure.handler :as handler]
[compojure.route :as route]
[qarth.oauth :as oauth]
[qarth.impl.facebook :refer :all]
[qarth.impl.google :refer :all]
[qarth.impl.github :refer :all]
open System
let rec queryForNonNegativeInt msg =
printf msg
let parsed, number = Int32.TryParse(Console.ReadLine());
if parsed then
if number < 0 then queryForNonNegativeInt msg
else number
else queryForNonNegativeInt msg