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
<?php | |
define("true ", false); | |
function doIt() { | |
define(" false", true); | |
define("maybe", rand() & 1); | |
} | |
function ($stupid="clever") { | |
if (assert_value($stupid)) { |
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.IO; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using Android.OS; | |
namespace Serialization | |
{ | |
public static class BundleSerializationExtensions | |
{ | |
public static void PutObject(this Bundle self, string key, object obj) |
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
class RecycledViewPool | |
{ | |
public delegate ViewHolder Factory(ViewGroup parent, int viewType); | |
// A stack has a O(1) add/remove, so better than a list | |
Dictionary<int, Stack<ViewHolder>> pool; | |
Factory factory; | |
public RecycledViewPool(Factory factory) | |
{ |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp1.1</TargetFramework> | |
<PackageTargetFallback>portable-net45+win8+wp8+wpa81</PackageTargetFallback> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="2.0.0" /> |
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 Monad; | |
namespace NightOut.Core.ViewModel.CheckIn.LocationSelector | |
{ | |
[Serializable] | |
partial class State | |
{ | |
public readonly Maybe<string> longitude = Nothing<string>.Default; | |
public readonly Maybe<string> latitude = Nothing<string>.Default; |
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
// Note: this also works for netstandard libraries. Just create the file and compile it. | |
using System.Runtime.CompilerServices; | |
[assembly:InternalsVisibleTo("NightOut.Core.Test")] |
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
+ <PropertyGroup> | |
+ <JavaMaximumHeapSize>1G</JavaMaximumHeapSize> | |
+ </PropertyGroup> |
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
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |
+ <DebugType>Full</DebugType> | |
+ </PropertyGroup> |
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
class Heap | |
def initialize | |
# @elements is an array representing the tree | |
# for each i: | |
# parent => @elements[i / 2] | |
# left => @elements[i * 2] | |
# right => @elements[i * 2 + 1] | |
@elements = [] | |
end |
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 class BundleExtensions | |
{ | |
const string SERIALIZED_KEY = "__JSONSERIALIZED__"; | |
static List<IMapItem> typesMapping; | |
//TODO: put in order of preference (cf string/charseq , serializable/parcelable, ...) because the for loop will stop at the first recognized type | |
static BundleExtensions() { | |
typesMapping = new List<IMapItem>{ | |
new TypeMap<IBinder> ((b, i, v) => b.PutBinder(i, v), (b, i) => b.GetBinder(i)), |