Skip to content

Instantly share code, notes, and snippets.

@kstenson
kstenson / gist:796724
Created January 26, 2011 14:03
extjs grid override getCellEditor
var store = new Ext.data.SimpleStore({
data: [
['Value 1', 'text', 'text'],
['Value 2', 'number', 1],
['Value 3', 'date', new Date()]
],
fields: ['name', 'type', 'value']
});
var comboStore = new Ext.data.SimpleStore({
id: 0,
@kstenson
kstenson / gist:6216952
Created August 13, 2013 01:16
Log all events fired in a page on the console
$(document).on("click mousedown mouseup focus blur keydown change",function(e){
console.log(e);
});
@kstenson
kstenson / delete.sql
Created September 3, 2012 15:15
clear all tables in db
-- disable all constraints
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
-- delete data in all tables
EXEC sp_MSForEachTable "DELETE FROM ?"
-- enable all constraints
exec sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"
@kstenson
kstenson / HealthMonitor
Created July 26, 2012 09:17
Clients is null
namespace MC.Bureau.Adaptation.Service
{
public class HealthMonitor :IWantToRunAtStartup
{
private string url = "http://localhost:8081/";
private Server _server;
private HealthMonitorHub _healthMonitor;
public ITransport Transport { get; set; }
@kstenson
kstenson / gist:3047511
Created July 4, 2012 14:03
Autofac intercepter setup
//this class registers the two interceptors in the container with a name for each
public class InterceptorsModule: Module
{
protected override void Load(ContainerBuilder builder)
{
builder.Register(x => new LoggingInterceptor()).Named<IInterceptor>("Logger");
builder.Register(x => new TimingInterceptor()).Named<IInterceptor>("Timing");
}
}
@kstenson
kstenson / gist:3040235
Created July 3, 2012 14:55
Log4Net interceptor
public class LoggingInterceptor: IInterceptor
{
private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void Intercept(IInvocation invocation)
{
try
{
StringBuilder sb = null;
@kstenson
kstenson / gist:3040253
Created July 3, 2012 14:58
Using modules with autofac
builder.RegisterModule(new DataModule()
{
AssemblyMapper = typeof(AcquireConfig).Assembly,
BuildSchema = true,
ConnectionString = Properties.Settings.Default.DataAcquisitionStoreConnection,
Web = false
});
public class DataModule : Module
{
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Exova.LIMS.Contract.Entities">
<class name="Client, Exova.LIMS.Contract" writeTable="" replicationTable="[Sales].[Client]" table="[Sales].[Client_View]">
</class>
</hibernate-mapping>
@kstenson
kstenson / explaination
Last active August 29, 2015 14:21
Boolean field score inside query should
{
"value":3.722785,
"description":"weight(services.Phone.freeCalls.Daytime:T in 2786) [PerFieldSimilarity], result of:",
"details":[
{
"value":3.722785,
"description":"score(doc=2786,freq=1.0 = termFreq=1.0 ), product of:",
"details":[
{
"value":0.51985043,
### Keybase proof
I hereby claim:
* I am kstenson on github.
* I am kstenson (https://keybase.io/kstenson) on keybase.
* I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( );
}
To claim this, I am signing this object: