Skip to content

Instantly share code, notes, and snippets.

View kkozmic's full-sized avatar
🎯
Focusing

Krzysztof Kozmic kkozmic

🎯
Focusing
View GitHub Profile
E:\mEE_Work\twisqs>bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.5)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.5)
Using erubis (2.6.6)
Using rack (1.2.1)
@kkozmic
kkozmic / gist:835542
Created February 20, 2011 00:22
internal types in System.Web.Mvc.dll
System.Web.Mvc (Quick Project) (analysis done 1 day ago, Sat 19 Feb 10:16 most recent)
SELECT TYPES FROM ASSEMBLIES "System.Web.Mvc" WHERE IsInternal
ORDER BY NbMethods DESC
102 items
--------------------------------------------------+--------------+
types |# Methods |
--------------------------------------------------+--------------+
Class Info
public abstract class Controller : ControllerBase, IActionFilter, IAuthorizationFilter, IDisposable, IExceptionFilter, IResultFilter, IController
- { } System.Web.Mvc
- System.Web.Mvc, v3.0.0.0
# IL instructions: 1 022
# lines of code (LOC): N/A because the assembly's corresponding PDB file N/A at analysis time
# lines of comment: N/A because the assembly's corresponding PDB file N/A at analysis time
public class MvcInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.AddFacility<MvcFacility>(f => f.RegisterControllers());
}
}
Order.transaction do
(1..100).each do |i|
Order.create(:name => "Customer #{i}", :address => "#{i} main street", :email => "customer-#{i}@gmail.com", :pay_type => "Check")
end
end
e:\test>rails runner script/some_script.rb
d:/dev/rb/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/runner.rb:50:in `eval': undefined local variable or
method `script' for main:Object (NameError)
from d:/dev/rb/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/runner.rb:50:in `eval'
from d:/dev/rb/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/runner.rb:50:in `<top (required)>'
from d:/dev/rb/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:39:in `require'
from d:/dev/rb/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
@kkozmic
kkozmic / multithreadeddisposal.cs
Created December 11, 2010 04:12
Is this 100% thread safe way of making sure base.Release is only ever *ever* called once?
private Object instance;
public override void Dispose()
{
var localInstance = instance;
if (localInstance == null)
{
return;
}
// we're trying to atomically replace the instance with null.
// in your IContributeComponentModelConstruction
protected virtual void CollectFromConfiguration(ComponentModel model)
{
if(Something())
{
var options = ProxyUtil.ObtainProxyOptions(model, true);
options.Selector = new ComponentReference<IInterceptorSelector>("someIdOrType");
}
}
public class AsyncHelper
{
private volatile bool allDone = false;
private volatile int doneCount = 0;
private int actionsCount;
private ICollection<Exception> exceptions = new List<Exception>();
public bool ExecuteInParallel(params System.Action[] actions)
{
if (actions == null || actions.Length == 0) return false;
@kkozmic
kkozmic / gist:659225
Created November 2, 2010 03:21
list of things I will be talking about at CodeCampOz conference
patterns and antipatterns of IoC container usage (in broad, broad strokes)
- antipatterns
service locator
static dependencies
xml programming