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
#include <iostream> | |
#include <cstdint> | |
#include <map> | |
#include <vector> | |
#include <set> | |
#include <iomanip> | |
#include <exception> | |
#include <climits> | |
template<class T> |
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 ValidationService : IValidationService | |
{ | |
private BindableBase bindableBase; | |
private object ruleCollection; | |
private MethodInfo methodInfo; | |
public event EventHandler<ValidationResultArgs> PropertyInvalid; | |
public RuleCollection<VM> For<VM>(VM bindableBase) where VM : BindableBase | |
{ |
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
var hasMoved: Boolean = false | |
get() { | |
if (initialTouchPosition == null) | |
return false | |
if (lastTouchPosition == null) | |
return false | |
val xDiff = abs(initialTouchPosition!!.x - lastTouchPosition!!.x) | |
val yDiff = abs(initialTouchPosition!!.y - lastTouchPosition!!.y) | |
val epsilon = 0.1 | |
return xDiff > epsilon || yDiff > epsilon |
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
private class LayoutObserver(private val view: View, private val callback: (Size) -> Unit) : ViewTreeObserver.OnGlobalLayoutListener { | |
init { | |
if (!view.viewTreeObserver.isAlive) | |
throw IllegalArgumentException("Go fuck yourself") | |
view.viewTreeObserver.addOnGlobalLayoutListener(this) | |
} | |
override fun onGlobalLayout() { |
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 IDictionary<string, object> AsDictionary(this object source, BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance) | |
{ | |
return source.GetType().GetProperties(bindingAttr).ToDictionary | |
( | |
propInfo => propInfo.Name, | |
propInfo => propInfo.GetValue(source, 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
// Entity | |
Product(id) | |
{ | |
Id | |
Name | |
Price | |
} | |
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
// Data | |
{ | |
"Latitude": 12.123, | |
"Longitude": 123.13 | |
} | |
Point(latitude, longitude) | |
{ | |
Latitude |
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
0xdead .classA ; Class B | |
0xdeae :ToString | |
0xdeaf mov ax, al | |
0xdeb0 ... | |
0xbeef .classB ; Class A | |
0xbef0 :ToString | |
0xbef1 mov ax, al | |
0xbef2 ... |
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
namespace Flight | |
{ | |
class Route | |
{ | |
public Route(Fix departure, Fix destination) | |
{ | |
Departure = departure; | |
Destination = destination; | |
} | |
public Fix Departure { get; set; } |
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
package com.msharp.Test | |
use System.Types | |
use System.Math | |
// Defining a constants | |
config A = 0 | |
config B = 0 | |
config LocalConfig { // enum |