Skip to content

Instantly share code, notes, and snippets.

View kkozmic's full-sized avatar
🎯
Focusing

Krzysztof Kozmic kkozmic

🎯
Focusing
View GitHub Profile
RIoUNCp6nf$jVZdDiV8LK03!5wtpFwB2rOw3sbYG
@kkozmic
kkozmic / gist:10523774
Created April 12, 2014 07:54
Trivial example of an experiment to create a GulpJs inspired build system for .NET using ScriptCS
#load "sip.csx"
var sip = Sip();
var log = Sip<SipLog>();
sip.Src("/**/*.csx")
.To(log)
.To(sip.Dest("/out"));
// this works
var result = session.Query<MemberProfile>().Statistics(out stats).Skip(index).Take(200)
.Select(p => new
{
InvestorId = p.Id,
SendPushNotification = p.NotificationSubscriberIds.Any()
}).ToArray();
//this fails, with the following error message:
// Could not understand how to translate 'p.NotificationSubscriberIds.Any()' to a RavenDB query.
@kkozmic
kkozmic / AppSettingsAttribute.cs
Last active June 12, 2020 13:41
Strongly typed configuration using Castle DictionaryAdapter requires castle.core nuget package
[AttributeUsage(AttributeTargets.Interface,AllowMultiple = false)]
public class AppSettingsAttribute : KeyPrefixAttribute, IDictionaryPropertyGetter, IPropertyDescriptorInitializer
{
public AppSettingsAttribute(string keyPrefix) : base(keyPrefix)
{
}
public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue,
PropertyDescriptor property, bool ifExists)
{
public class Foo
{
public int Id { get; set; }
public Bar Bar { get; set; }
// this is what I refer to as 'FK ID property'
public int BarId { get; set; }
}
@kkozmic
kkozmic / gist:4034987
Created November 7, 2012 22:36
Windsor automatic dependencies from appSettings section of app.config
public class AppConfigDependencies : IContributeComponentModelConstruction
{
private readonly ParameterModelCollection parameters;
public AppConfigDependencies(NameValueCollection appSettings)
{
parameters = new ParameterModelCollection();
foreach (var key in appSettings.AllKeys)
{
parameters.Add(key, appSettings[key]);
@kkozmic
kkozmic / AgileFailManifesto.md
Created October 12, 2012 04:22 — forked from MiguelMadero/AgileFailManifesto.md
AgileFail Manifesto

#Manifesto for Agile Software Development

We were in a rush to uncover better ways of developing software. Agile is supposed to be fast, so we did an Agile implementation of Agile and we skipped all the values and focused on the practices. Through this work we have come to value:

Daily Standups over Individuals and Interactions

Demos over Working Software

Planning Meetings over Customer Collaboration

GET http://srv.symbolsource.org/pdb/Public/kkozmic/dehv7BL8CAFGhSw74gHwT0K5h2A=/index2.txt HTTP/1.1
Accept-Encoding: gzip
User-Agent: Microsoft-Symbol-Server/6.12.0002.633
Host: srv.symbolsource.org
Connection: Keep-Alive
Pragma: no-cache
HTTP/1.1 404 Not Found
Date: Sat, 18 Feb 2012 08:39:54 GMT
var application = Application.Current as ExpressionApplication;
if (application == null) return;
container.Register(Component.For<IProjectManager>().UsingFactoryMethod(_ => application.Services.GetService<IProjectManager>(), managedExternally: true).LifestyleTransient());
say I want to escape C# string: @"http://somesite.com/?arg=value&foo=bar"
HtmlEncode does:
http://somesite.com/?arg=value&amp;foo=bar
JavaScript escape is:
http:\x2F\x2Fsomesite.com\x2F?arg=value\&foo=bar