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 Todo.Core | |
@{} | |
<pre> | |
@Json(Query(db => db)) | |
</pre> |
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
void WriteToStream(object graph, Stream target) | |
{ | |
var formatter = new BinaryFormatter(); | |
formatter.Serialize(target, graph); | |
} | |
object ReadFromStream(Stream source) | |
{ | |
var formatter = new BinaryFormatter(); | |
return formatter.Deserialize(source); |
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 bool RemoveFeedById(int id) | |
{ | |
Feed feedToRemove; | |
bool feedExists = TryGetFeedById(id, out feedToRemove); | |
if (feedExists) | |
{ | |
_statistics.TotalFeeds--; | |
_statistics.TotalFeedItems -= feedToRemove.Items.Count; | |
_feeds[id-1] = 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
private void RemoveFeedFromSearchIndex(Feed feed) | |
{ | |
var searchTermsToRemove = new List<string>(); | |
var itemsToRemove = new HashSet<FeedItem>(feed.Items); | |
foreach (KeyValuePair<string, HashSet<IndexEntry>> kvp in _searchIndex) | |
{ | |
var searchTerm = kvp.Key; | |
var entrySet = kvp.Value; |
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 LocalEngineClient<TModel> : IEngine<TModel> where TModel : Model | |
{ | |
public readonly Engine<TModel> Engine; | |
public LocalEngineClient(Engine<TModel> engine) | |
{ | |
Engine = engine; | |
} |
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 Args : Dictionary<string,object>{} | |
public class MyIoc | |
{ | |
private Dictionary<Type, Dictionary<string, Func<Args, object>>> _registry | |
= new Dictionary<Type, Dictionary<string, Func<Args, object>>>(); | |
public void Register<T>(Func<Args, T> factory, string name = "") where T : class | |
{ | |
Type t = typeof(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
Microsoft Windows [Version 6.1.7601] | |
Copyright (c) 2009 Microsoft Corporation. All rights reserved. | |
C:\Users\Administrator>@powershell -NoProfile -ExecutionPolicy Unrestricted -Co | |
mand "iex ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/in | |
tall.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin | |
Mode LastWriteTime Length Name | |
---- ------------- ------ ---- | |
d---- 2014-03-20 16:11 chocInstall |
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 OrigoDB.Core; | |
[Serializable] | |
public class MyModel : Model | |
{ | |
Dictionary<string,object> _store = | |
new Dictionary<string,object>(); | |
public void Put(string key, object value) |
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
$ scriptcs start.csx -repl | |
scriptcs (ctrl-c to exit) | |
INFO: Loading preseeded script: start.csx | |
> db.Keys(); | |
[ | |
"hello" | |
] | |
> Enumerable.Range(1,100).ToList().ForEach(n => db.Put(n.ToString(),n*n)); | |
> db.Keys(); |
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
rofr@DELLCRAPPO /c/git/scriptcs/origo1 | |
$ scriptcs | |
scriptcs (ctrl-c to exit) | |
> using OrigoDB.Core; | |
> #r Todo.Core.dll | |
> using Todo.Core; | |
> var engine = Engine.Load<TodoModel>(); | |
> using OrigoDB.Core.Proxy; | |
> var db = engine.GetProxy(); |