Skip to content

Instantly share code, notes, and snippets.

View VirtueMe's full-sized avatar

Benny Thomas VirtueMe

View GitHub Profile
@VirtueMe
VirtueMe / gist:15f62eb5ec84603ea888
Last active September 8, 2015 13:18
Clean code, but I don't think someone would accept a PR based on this .-)
// I see this often done,
// It repeats code and it looks like something from a lisp dialect
// it doesnt look so bad, but I don't like it.
this.state = realOptions.withProps
? Base.calculateState(null, props)
: Base.calculateState(null, undefined);
// In my world this seems more straight to the case
this.state = Base.calculateState(null, realOptions.withProps ? props : undefined);
//modinput.js
//this variant introduces an Argument class to make the syntax terser.
var splunk = require('splunk-sdk');
var DataType = splunk.modularInput.DataType;
var RequiredOnCreate = splunk.modularInput.Argument.RequiredOnCreate;
exports.getScheme = function() {
var scheme = {
name: 'Random Numbers',
//modinput.js
var splunk = require('splunk-sdk');
var DataType = splunk.modularInput.DataType;
exports.getScheme = function() {
var scheme = {
'Random Numbers',
'Streams events containing a random number',
['name', 'description', 'type', 'requiredOnCreate'],
[
@VirtueMe
VirtueMe / app.js
Last active December 28, 2015 19:09
My r.js grunt config section
define(['aura/aura'], function(Aura) {
'use strict';
var aura = new Aura({
sources: {
'default': 'aura_components'
},
debug: {
enable: true
}
@VirtueMe
VirtueMe / gist:7247404
Created October 31, 2013 10:20
A sample how to use watch with the retire task
grunt.initConfig({
retire: {
files: ['app/src/*'], /** Scan js-files in app/src/ directory. **/
options: {
jsOnly: true
}
},
watch: {
retire: {
files: '<%= retire.files %>',
@VirtueMe
VirtueMe / gist:7215410
Last active December 26, 2015 21:19
How to keep your controller DRY with generic methods.
public class ConferenceController : Controller
{
private readonly ISession _session;
private readonly IMediator _mediator;
public ConferenceController(ISession session, IMediator mediator)
{
_session = session;
_mediator = mediator;
}
@VirtueMe
VirtueMe / Definition for complex table
Created October 21, 2010 06:33
This is the table I want to read with fluentnHibernate
CREATE TABLE [dbo].[TF_MISSION_CODE_CENTRAL_DISCOUNT](
[TF_MISSION_CODE_CENTRAL_DISCOUNT_ID] [int] IDENTITY(1,1) NOT NULL, -- Not Really needed
-- Composite Key start
[TF_CENTRAL_ID] [int] NOT NULL,
[TF_MISSION_CODE_ID] [int] NOT NULL,
-- Composite Key end
-- Period start <== Natural hash key/bag index
[TF_MISSION_CODE_CENTRAL_DISCOUNT_DATE_FROM] [datetime] NOT NULL,
[TF_MISSION_CODE_CENTRAL_DISCOUNT_DATE_TO] [datetime] NULL,
-- Period end
C:\private\test\HelloCucumber>cucumber
C:/Ruby191/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/feature_file.rb:
5:in `require': no such file to load -- gherkin/i18n_lexer (LoadError)
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/fea
ture_file.rb:5:in `<top (required)>'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/cli
/main.rb:11:in `require'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/lib/cucumber/cli
/main.rb:11:in `<top (required)>'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/cucumber-0.8.5/bin/cucumber:5:i