Skip to content

Instantly share code, notes, and snippets.

View gimmi's full-sized avatar

Gian Marco Gherardi gimmi

View GitHub Profile
@gimmi
gimmi / BuildSetupPackage.js
Created August 9, 2011 12:46
Addins jsmake
// Example: buildSetup('src/Solution.sln', 'Project', 'Release', 'AnyCPU');
function buildSetup(sln, vdproj, configuration, platform) {
sys.createRunner(jsmake.Fs.combinePaths(sys.getEnvVar('DevEnvDir', null), 'devenv.exe'))
.args(sln)
.args('/Build', [ configuration, platform ].join('|'))
.args('/Project', vdproj)
// .args('/Out', 'devenv_errors.txt')
.run();
}
@gimmi
gimmi / gist:1170427
Created August 25, 2011 10:52
qx mixin initialization error
qx.Class.define("MyClass", {
extend: qx.core.Object,
include: [qx.ui.core.MBlocker],
construct: function () {
this.base(arguments);
this.setBlockerColor("#D5D5D5"); // method from mixin
this.setBlockerOpacity(0.5); // method from mixin
}
@gimmi
gimmi / Lazy
Created September 17, 2011 08:00
Windsor 3 scoped disposing
[Test]
public void Should_resolve_lazy_components()
{
var container = new WindsorContainer();
container.Register(Component.For<LazyOfTComponentLoader>());
container.Register(Component.For<A>().LifeStyle.Transient);
var a = container.Resolve<A>(); // Ok
var lazyA = container.Resolve<Lazy<A>>(); // Fail
@gimmi
gimmi / gist:1240891
Created September 25, 2011 17:51
Ext.Direct with MVC
/*
First problem: referencing direct action in proxies/FormPanels
When using Ext.Direct with either Ext.data.proxy.Direct or Ext.form.Basic, you have to specify the function directly, so the function MUST previously be defined by calling Ext.direct.Manager.addProvider. This is a problem because normally the call to addProvider comes after the config evaluation.
For example
*/
Ext.create('Ext.data.proxy.Direct', {
api: {
@gimmi
gimmi / gist:1245381
Created September 27, 2011 15:30
JSMake Git
jsmake.git = {};
jsmake.git.GitUtils = {
getLastCommitInfo: function (gitRepoPath) {
var git = new org.eclipse.jgit.api.Git(new org.eclipse.jgit.storage.file.FileRepository(jsmake.Fs.combinePaths(gitRepoPath, '.git')));
var commit = git.log().call().iterator().next();
return {
message: commit.getFullMessage(),
sha1: commit.getName(),
date: new Date(1000 * commit.getCommitTime())
};
@gimmi
gimmi / Main.java
Created September 30, 2011 20:04
Invoking Rhino Javascript from Java
package com.github.gimmi.jsmake;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextAction;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.commonjs.module.Require;
import org.mozilla.javascript.tools.ToolErrorReporter;
import org.mozilla.javascript.tools.shell.Global;
import org.mozilla.javascript.tools.shell.QuitAction;
import org.mozilla.javascript.tools.shell.ShellContextFactory;
@gimmi
gimmi / jsmake.svn.SvnUtils.js
Created November 16, 2011 08:24
JSMake examples
jsmake.svn = {};
jsmake.svn.SvnUtils = function () {
this._svnVersionPath = 'svnversion';
};
jsmake.svn.SvnUtils.prototype = {
isWorkingFolderClear: function (path) {
var version = this._svnVersion(path);
return !(version.modified || version.switched || version.partial || version.mixed);
},
@gimmi
gimmi / IDataRecord to POCO
Created November 21, 2011 21:31
IDataRecord to POCO
private static T DefaultConverter<T>(IDataRecord rec)
{
var obj = Activator.CreateInstance<T>();
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);
for(int i = 0; i < rec.FieldCount; i++)
{
PropertyDescriptor property = properties.Find(rec.GetName(i), true);
object value = rec.GetValue(i);
if(property != null && value != DBNull.Value)
{
@gimmi
gimmi / .gitignore
Last active December 19, 2015 10:59
Python build script
*.pyc
import os, glob, shutil, subprocess
base_path = os.path.join(os.getcwd(), 'GesDB')
pkgs_path = os.path.join(base_path, 'packages')
os.path.relpath('c:\sviluppo\dir\packages', 'c:\sviluppo\dir')
for sln_path, directories, files in os.walk(base_path):
if not [f for f in files if f.lower().endswith(".sln")]: continue