Skip to content

Instantly share code, notes, and snippets.

@brenoferreira
brenoferreira / index.html
Created March 31, 2015 17:30
wkhtmltopdf js bug reproduction
<html>
<head>
<title>PDF</title>
<meta charset="UTF-8"/>
</head>
<body>
<div id="content">
</div>
XBuild Engine Version 12.0
Mono, Version 3.10.0.0
Copyright (C) 2005-2013 Various Mono authors
Build started 11/20/2014 2:14:44 PM.
__________________________________________________
/Users/brenocferreira/Documents/Developer/code-cracker/src/CodeCracker.Vsix/CodeCracker.Vsix.csproj: warning : Could not find project file /Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/xbuild/Microsoft/VisualStudio/v/VSSDK/Microsoft.VsSDK.targets, to import. Ignoring.
Project "/Users/brenocferreira/Documents/Developer/code-cracker/CodeCracker.sln" (default target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
//use read-only properties
class MyClass {
public int Prop1 { get; private set; }
public float Prop2 { get; private set; }
}
//GENERATED
class MyClass {
public int Prop1 { get; private set; }
@brenoferreira
brenoferreira / TDC2014.scala
Created August 20, 2014 21:12
Demo for presentation given at TDC2014 SP. Simply paste it into a Scala Worksheet.
import scala.util.{Try, Success, Failure}
def div = (x:Int, y:Int) => x / y
div(4, 2)
type Enumerable[T] = () => () => Option[T]
def empty[T]:Enumerable[T] = {
() => () => None
}
@brenoferreira
brenoferreira / propnotif
Created November 5, 2013 13:31
Resharper template for INotifyPropertyChanged class property
private $Type$ $FieldName$;
public $Type$ $PropertyName$
{
get
{
return $FieldName$;
}
set
{
@brenoferreira
brenoferreira / ShuffleIEnumerable.cs
Created November 4, 2013 18:19
Shuffle IEnumerable extension method using Fisher–Yates shuffle algorithm (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
public static class EnumerableEx
{
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> enumerable)
{
var array = enumerable.ToArray();
var random = new Random(DateTime.Now.Millisecond);
for (int i = array.Length - 1; i >= 1; i--)
{
class Async
{
static IEnumerable<Uri> uris = new List<Uri>()
{
new Uri("http://www.google.com"),
new Uri("http://www.bing.com"),
new Uri("http://www.yahoo.com")
};
public static void DownloadStringAsync()
static class EnumEx
{
public static IEnumerable<IEnumerable<T>> Split<T>(this IEnumerable<T> list, int maxItemsByPart)
{
return SplitImpl(list, maxItemsByPart, 0, new List<IEnumerable<T>>());
}
public static IEnumerable<IEnumerable<T>> SplitImpl<T>(
IEnumerable<T> list,
int maxItemsByPart,
@brenoferreira
brenoferreira / ResharperNUnitTestClassTemplate
Last active December 20, 2015 02:18
NUnit Test method and class template for Resharper
public class $ClassName$
{
[NUnit.Framework.Test]
public void $name$()
{
$END$
}
}
def test():
T = []
T.append("it is what it is")
T.append("what is it")
T.append("it is a banana")
ii = inverseIndex(T)
for i in ii:
print(i)