Skip to content

Instantly share code, notes, and snippets.

View drlongnecker's full-sized avatar
🎯
Working on everything and anything.

David R. Longnecker drlongnecker

🎯
Working on everything and anything.
View GitHub Profile
@drlongnecker
drlongnecker / R# 5 Patterns XML
Created May 25, 2010 15:24
R# 5.x Patterns XML to remove noise
<?xml version="1.0" encoding="utf-8" ?>
<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
<Pattern RemoveAllRegions="true">
<Entry />
</Pattern>
<Pattern>
<Match>
<Or Weight="100">
task GetBuildNumber {
$version = gc $base_directory\$solution_name\Properties\AssemblyInfo.cs | select-string -pattern "AssemblyVersion"
$version -match '^\[assembly: AssemblyVersion\(\"(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<revision>[0-9]+)\.(?<build>[0-9]+)\"\)\]' | Out-Null
"##teamcity[buildNumber '{0}.{1}.{2}.{3}']" -f $matches["major"],$matches["minor"],$matches["revision"],$matches["build"]
}
Processing ChartsBurndownController#index (for 10.6.104.43 at 2010-07-13 04:06:13) [GET]
Parameters: {"project_id"=>"pbr", "action"=>"index", "controller"=>"charts_burndown"}
NoMethodError (undefined method `parent_id' for #<Issue:0x7f9d3efedcc8>):
vendor/plugins/redmine_charts/app/controllers/charts_burndown_controller.rb:79:in `get_data_for_burndown_chart'
vendor/plugins/redmine_charts/app/controllers/charts_burndown_controller.rb:74:in `each'
vendor/plugins/redmine_charts/app/controllers/charts_burndown_controller.rb:74:in `get_data_for_burndown_chart'
vendor/plugins/redmine_charts/app/controllers/charts_burndown_controller.rb:8:in `get_data'
vendor/plugins/redmine_charts/app/controllers/charts_controller.rb:107:in `create_chart'
vendor/plugins/redmine_charts/app/controllers/charts_controller.rb:79:in `index'
@drlongnecker
drlongnecker / PowerShell and Json
Created December 12, 2010 04:25
Odd formatting with PowerShell and Json
Doesn't work:
$data = "`"{'message':{'body':'{0} - {1}'}}`"" -f $message, $url
Throws:
Error formatting a string: Input string was not in a correct format..
At Script.ps1:11 char:50
+ $data = "`"{'message':{'body':'{0} - {1}'}}`"" -f <<<< $message, $url
+ CategoryInfo : InvalidOperation: (System.Object[]:Object[]) [], RuntimeException
+ FullyQualifiedErrorId : FormatError
@drlongnecker
drlongnecker / PowerShell Profile for Git
Created April 6, 2011 21:04
Just parses the git command output for a swanky prompt
# when in a git directory, outputs:
# GIT [branch] +# ~# -# | C:\my\path
# when in any other directory, outputs:
# PS C:\my\other\path
function prompt {
Write-Host("")
$status_string = ""
# check to see if this is a directory containing a symbolic reference,
# fails (gracefully) on non-git repos.
@drlongnecker
drlongnecker / FindTODO.ps1
Created December 27, 2011 16:52
Finding TODOs and Reporting in PowerShell
#full details now available: http://tiredblogger.wordpress.com/2011/12/28/finding-todos-and-reporting-in-powershell/
param(
#this is appalling; there has to be a better way to get the raw name of "this" directory.
[string]$DirectoryMask = (get-location),
[array]$Include =
@("*.spark","*.cs","*.js","*.coffee","*.rb"),
[array]$Exclude =
@("fubu-content","packages","build","release"),
[switch]$Html,
@drlongnecker
drlongnecker / gist:1593302
Created January 11, 2012 06:05
Adding a Launcher icon in Ubuntu 11.10
gnome-desktop-item-edit ~/Desktop/ --create-new
#just so I don't forget... again.
@drlongnecker
drlongnecker / Set-PrinterByLocation.ps1
Created January 13, 2012 14:58
Setting the default printer based on network subnet.
$homeNet = "10.1.4.*", "OfficePrinter"
$remoteNet = "10.1.6.*", "W382_HP_Printer"
function Set-DefaultPrinter([string]$printerPath) {
$printers = gwmi -class Win32_Printer -computer .
Write-Host -fore cyan "Default Printer: $printerPath"
$dp = $printers | ? { $_.deviceID -match $printerPath }
$dp.SetDefaultPrinter() | Out-Null
}
@drlongnecker
drlongnecker / OracleSQLAliasToBeanTransformer.cs
Created January 13, 2012 21:34
Addressing issues in Oracle.DataAccess and AliasToBeanTransformer
[Serializable]
public class OracleSQLAliasToBeanTransformer : IResultTransformer
{
const BindingFlags Flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
readonly System.Type _resultClass;
ISetter[] _setters;
readonly IPropertyAccessor _propertyAccessor;
readonly ConstructorInfo _constructor;
readonly PropertyInfo[] _fields;
public OracleSQLAliasToBeanTransformer(Type resultClass)
@drlongnecker
drlongnecker / SendTo-Campfire.ps1
Created January 16, 2012 18:55
Posting to Campfire from PowerShell
param (
[string]$RoomNumber = (Read-Host "The room to post to (default: 123456) "),
[string]$Message = (Read-Host "The message to send ")
)
$defaultRoom = "123456"
if ($RoomNumber -eq "") {
$RoomNumber = $defaultRoom
}
$authToken = "YOUR AUTH TOKEN"