Skip to content

Instantly share code, notes, and snippets.

@denza
denza / make test
Created May 8, 2018 09:46
make test
==> Checking that code complies with gofmt requirements...
go test -i $(go list ./... |grep -v 'vendor') || exit 1
echo $(go list ./... |grep -v 'vendor') | \
xargs -t -n4 go test -timeout=30s -parallel=4
go test -timeout=30s -parallel=4 github.com/terraform-providers/terraform-provider-profitbricks github.com/terraform-providers/terraform-provider-profitbricks/profitbricks
? github.com/terraform-providers/terraform-provider-profitbricks [no test files]
ok github.com/terraform-providers/terraform-provider-profitbricks/profitbricks 0.006s
@denza
denza / tagging.yml
Created January 8, 2018 20:58
Ansible tagging tests
---
- hosts: localhost
connection: local
gather_facts: false
vars:
ssh_public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
vars_files:
- vars.yml
@denza
denza / git-walk
Created July 3, 2016 23:28
git-walk
#!/usr/bin/env ruby
# Walks up and down revisions in a git repo.
# Usage:
# git walk next
# git walk prev
case ARGV[0]
when "next"
rev_list = `git rev-list --children --all`
refs = rev_list.scan(/[a-z0-9]{40}(?= )/)
refs.unshift(rev_list[/[a-z0-9]{40}/])
public class Accessor<S>
{
public static Accessor<S, T> Create<T>(Expression<Func<S, T>> memberSelector)
{
return new GetterSetter<T>(memberSelector);
}
public Accessor<S, T> Get<T>(Expression<Func<S, T>> memberSelector)
{
return Create(memberSelector);
public class MyBag : DynamicObject
{
private readonly Dictionary<string, dynamic> _properties = new Dictionary<string, dynamic>( StringComparer.InvariantCultureIgnoreCase );
public override bool TryGetMember( GetMemberBinder binder, out dynamic result )
{
result = this._properties.ContainsKey( binder.Name ) ? this._properties[ binder.Name ] : null;
return true;
}
public interface IMyCustomProvider:IDependecy
{
object DoSomething(object param);
}
public class MyService
{
private readonly IMyCustomProvider _myProvider;
private readonly IWorkContextAccessor _workContextAccessor;
CREATE FUNCTION XmlReadString (@value NVARCHAR(MAX))
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @result NVARCHAR(MAX)
SET @result = @value
SET @result = REPLACE(@result,'&','&amp;')
SET @result = REPLACE(@result,'>','&gt;')
@denza
denza / ClassMeta
Last active December 24, 2015 07:28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;
namespace ClassHelpers
{
public class ClassMeta
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;
namespace NovoVrijeme.Rest.Infrastructure
{
public sealed class ServiceLocator
class Program
{
static void Main( string[] args )
{
var connString = @"Data Source=localhost\sqlexpress;Initial Catalog=Document_Review;Integrated Security=True";
var runScript = new ExecSQL( connString, new string[] { "Table_Create.sql" } );
runScript.Execute( @"E:\root\LSI.BusinessServices\DocumentServices\Projects\DBScriptsReview\Databases\Document\Tables" );
}