Skip to content

Instantly share code, notes, and snippets.

Avatar

Danny Kendrick dkendrick

  • Inspire Group
  • New Zealand
View GitHub Profile
View gist:b46acfd465e5814915f14e748f1b35cd
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"copy_with_empty_selection": true,
"ensure_newline_at_eof_on_save": true,
"index_files": true,
"rulers":
[
79
],
View boxstarter.txt
# base from https://gist.github.com/benoit74/7d98ed4b958804cac4d8
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
# Basic setup
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
@dkendrick
dkendrick / _google_analytics.html.erb
Created Apr 23, 2018
Google analytics only in production - rails
View _google_analytics.html.erb
<% if Rails.env == "production" %>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-000000000-1');
</script>
@dkendrick
dkendrick / git_kdiff_setup.cmd
Created Nov 2, 2017
Setup git to use kidff3 as default merge tool and diff tool
View git_kdiff_setup.cmd
git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add mergetool.kdiff3.trustExitCode false
git config --global --add diff.guitool kdiff3
git config --global --add difftool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add difftool.kdiff3.trustExitCode false
@dkendrick
dkendrick / CSVPrinter.js
Last active Sep 7, 2019
Print mongo result to CSV
View CSVPrinter.js
/*globals db*/
db.system.js.save({
_id : 'CSVPrinter',
value : function CSVPrinter() {
var firstRun = true;
function checkFirstRun(record){
if (firstRun) {
firstRun = false;
@dkendrick
dkendrick / powershell-bg-task
Created Nov 4, 2014
Run tasks in the background with powershell. This was inspired by the "&" functionality of bash.
View powershell-bg-task
function bg()
{
if ($args.length -lt 0)
{
Write-Output "No parameters specified";
return;
}
if ($args.length -gt 1)
{
@dkendrick
dkendrick / test2.cs
Created Aug 13, 2012
Unit test to ensure all methods of factory run correctly 2
View test2.cs
public delegate ITransaction MyDelegate();
[TestFixture]
public class BlogExampleTests
{
private static readonly TransactionFactory Factory = new TransactionFactory();
private static object[] delegates = new[]
{
new MyDelegate(Factory.GetTransactionA),
new MyDelegate(Factory.GetTransactionB),
@dkendrick
dkendrick / test1.cs
Created Aug 13, 2012
Unit test to ensure all methods of factory run correctly 1
View test1.cs
[TestFixture]
public class BlogExampleTests
{
private TransactionFactory factory;
[SetUp]
public void SetUp()
{
factory = new TransactionFactory();
}
@dkendrick
dkendrick / generatedtest.cs
Created Aug 13, 2012
Unit test to ensure all methods of factory run correctly
View generatedtest.cs
[TestFixture]
public class BlogExampleTests
{
private TransactionFactory factory;
private static readonly Type FactoryType = typeof(TransactionFactory);
[SetUp]
public void SetUp()
{
var parameters = new Type[0];
@dkendrick
dkendrick / psniffing2.sql
Created Aug 12, 2012
Parameter sniffing working around example SQL Server
View psniffing2.sql
CREATE PROCEDURE Customer_Search
@FirstName varchar(100),
@LastName varchar(100)
AS
BEGIN
-- Variables added to prevent problems that were occuring with parameter sniffing
DECLARE
@FName VARCHAR(100),
@LName VARCHAR(100)