Skip to content

Instantly share code, notes, and snippets.

@hossambarakat
hossambarakat / GetEventStoreRepository.cs
Created July 3, 2016 02:10 — forked from jen20/GetEventStoreRepository.cs
Event Store implementation of the CommonDomain IRepository interface and integration tests
public class GetEventStoreRepository : IRepository
{
private const string EventClrTypeHeader = "EventClrTypeName";
private const string AggregateClrTypeHeader = "AggregateClrTypeName";
private const string CommitIdHeader = "CommitId";
private const int WritePageSize = 500;
private const int ReadPageSize = 500;
private readonly Func<Type, Guid, string> _aggregateIdToStreamName;
@hossambarakat
hossambarakat / XXTea.cs
Created November 29, 2015 22:31 — forked from lski/XXTea.cs
A c# implementation of XXTea encryption algorithm based on the javascript version by Chris Veness
using System;
using System.Text;
/// <summary>
/// A class for encrypting and decrypting a string into base64 format which makes it safe for transfer
/// between applications.
///
/// Reference:
/// Based upon the javascript implementation of xxtea by: Chris Veness
/// www.movable-type.co.uk/tea-block.html
using System;
namespace RsaKeyConverter.Converter
{
public static class BytesExtensions
{
public static string ToBase64(this byte[] bytes)
{
return Convert.ToBase64String(bytes);
}
@hossambarakat
hossambarakat / AnimationNavigationRenderer.cs
Last active August 31, 2015 13:12 — forked from alexlau811/AnimationNavigationRenderer.cs
A custom renderer to set custom animation for NavigationPage.PushAsync and NavigationPage.PopAsync on iOS with Xamarin Forms.
[assembly: ExportRenderer(typeof(NavigationPage), typeof(AnimationNavigationRenderer))]
class AnimationNavigationRenderer : NavigationRenderer
{
public override void PushViewController(UIViewController viewController, bool animated)
{
if (animated)
{
// Alternative way with different set of trannsition
/*
@hossambarakat
hossambarakat / build.fsx
Last active August 29, 2015 14:24 — forked from jacano/build.fsx
#r @"Tools/FAKE/tools/FakeLib.dll"
#load "Tools/build-helpers.fsx"
#load "Tools/hockey-app-helpers-mac.fsx"
open Fake
open System
open System.IO
open System.Linq
open System.Text.RegularExpressions
open BuildHelpers
module BuildHelpers
open Fake
open Fake.XamarinHelper
open System
open System.IO
open System.Linq
let Exec command args =
let result = Shell.Exec(command, args)
Function Set-ConnectionString{
[CmdletBinding(SupportsShouldProcess=$True)]
Param(
[string]$fileName="app.config",
[string]$connectionStringName,
[string]$connectionString
)
$config = [xml](Get-Content -LiteralPath $fileName)
using System;
using Xamarin.Forms;
using System.Collections;
namespace YourNamespace.Views.Controls {
public class BindablePicker : Picker
{
public BindablePicker()
{
this.SelectedIndexChanged += OnSelectedIndexChanged;
script type="text/javascript">
simpleAJAXLib = {
init: function () {
this.fetchViaJSONP('your_url_goes_here');
},
fetchViaJSONP: function (url) {
url += '?format=jsonp&jsonp_callback=simpleAJAXLib.handleResponse';
document.getElementsByTagName('body')[0].appendChild(this.jsTag(url));
},
@hossambarakat
hossambarakat / git.config
Created July 18, 2013 15:43 — forked from NickJosevski/git.config
Beyond Compare Git Config
## .gitconfig
[alias]
dt = difftool
mt = mergetool
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]