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
#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
using System; | |
using Prism.Ioc; | |
namespace ProjectName | |
{ | |
// NOTE | |
// We should not register services that falls under these categories: | |
// 1. Implementation is platform-specific | |
// 2. Implementation requires a certain dependency which doesn't caters all use cases, e.g: Crash Analytics Service |
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
[{"i":0,"j":1,"buy":1,"sell":2,"profit":1,"id":0,"children":[{"i":2,"j":3,"buy":3,"sell":4,"profit":1,"id":7,"children":[]},{"i":2,"j":4,"buy":3,"sell":5,"profit":2,"id":8,"children":[]},{"i":3,"j":4,"buy":4,"sell":5,"profit":1,"id":9,"children":[]}]},{"i":0,"j":2,"buy":1,"sell":3,"profit":2,"id":1,"children":[{"i":3,"j":4,"buy":4,"sell":5,"profit":1,"id":9,"children":[]}]},{"i":0,"j":3,"buy":1,"sell":4,"profit":3,"id":2,"children":[]},{"i":0,"j":4,"buy":1,"sell":5,"profit":4,"id":3,"children":[]},{"i":1,"j":2,"buy":2,"sell":3,"profit":1,"id":4,"children":[{"i":3,"j":4,"buy":4,"sell":5,"profit":1,"id":9,"children":[]}]},{"i":1,"j":3,"buy":2,"sell":4,"profit":2,"id":5,"children":[]},{"i":1,"j":4,"buy":2,"sell":5,"profit":3,"id":6,"children":[]},{"i":2,"j":3,"buy":3,"sell":4,"profit":1,"id":7,"children":[]},{"i":2,"j":4,"buy":3,"sell":5,"profit":2,"id":8,"children":[]},{"i":3,"j":4,"buy":4,"sell":5,"profit":1,"id":9,"children":[]}] |
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
[{"i":1,"j":2,"buy":1,"sell":5,"profit":4,"id":0,"children":[{"i":3,"j":4,"buy":3,"sell":6,"profit":3,"id":5,"children":[]},{"i":3,"j":5,"buy":3,"sell":4,"profit":1,"id":6,"children":[]}]},{"i":1,"j":3,"buy":1,"sell":3,"profit":2,"id":1,"children":[]},{"i":1,"j":4,"buy":1,"sell":6,"profit":5,"id":2,"children":[]},{"i":1,"j":5,"buy":1,"sell":4,"profit":3,"id":3,"children":[]},{"i":2,"j":4,"buy":5,"sell":6,"profit":1,"id":4,"children":[]},{"i":3,"j":4,"buy":3,"sell":6,"profit":3,"id":5,"children":[]},{"i":3,"j":5,"buy":3,"sell":4,"profit":1,"id":6,"children":[]}] |
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 BindableProperty <insert the object nameof(Property) here> + Property = CreateProperty<T>(nameof(<insert the object nameof(Property) here>)); | |
public T <insert the object nameof(Property) here> | |
{ | |
get => (T)GetValue(<insert the object nameof(Property) here> + Property); | |
set => SetValue(<insert the object nameof(Property) here> + Property, value); | |
} | |
// TODO put this under Utility folder | |
public static BindableProperty CreateProperty<T>(string propertyName, T defaultValue = default, BindingMode mode = BindingMode.TwoWay) |
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 CustomTimer(private val millisInFuture: Long, private val countDownInterval: Long) { | |
private var millisUntilFinished: Long = millisInFuture | |
private var timer = InternalTimer(this, millisInFuture, countDownInterval) | |
private var isRunning = false | |
var onTick: ((millisUntilFinished: Long) -> Unit)? = null | |
var onFinish: (() -> Unit)? = null | |
private class InternalTimer( |
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
ffmpeg -ss 0 -t 70 -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif | |
# the 0 -t 70 means range in seconds | |
#ffmpeg -i input.mp4 -pix_fmt rgb8 output.gif |
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
items.forEach { item -> | |
for(map in mapList) { | |
if (map.id == item.mapId) { | |
map.score = item.score | |
break | |
} | |
} | |
} |
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
// This one throws | |
buildColorPicker().apply { | |
enableAutoClose() | |
setCallback { color -> | |
model.map.color = color | |
mapView.invalidate() | |
} | |
show() | |
} |