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 / DeployTo.ps1
Created February 10, 2012 16:32
DeployTo PowerShell build backup and deployment script.
param (
[string]$Deploy,
[switch]$SkipBackup,
[string]$Settings = "settings.xml"
)
$success = $false
function writeError($message) {
Write-Host $message -Foreground Red
break;
@drlongnecker
drlongnecker / deploy.xml
Created February 10, 2012 16:34
DeployTo PowerShell xml configuration file
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<common>
<release>.\release</release>
<web.config>
<appsettings>
</appsettings>
</web.config>
</common>
@drlongnecker
drlongnecker / rift.ahk
Created March 23, 2012 22:08
RIFT Melee Tab-Out Prevention!
#IfWinActive, RIFT
!Tab::
send {tab}
return
#Tab::
send {tab}
return
#IfWinActive
@drlongnecker
drlongnecker / lazymerge.ps1
Created July 25, 2012 15:48
Lazy Git Merge
# for when you're just too lazy to type out the merge command
# and change branches
function merge([string] $target, [string] $source) {
if ($source -eq "") {
$symbolicref = git symbolic-ref HEAD
$source = $symbolicref.substring($symbolicref.LastIndexOf("/") +1)
}
write-host "Merging $source into $target" -for white -ba red
git checkout $target; git merge $source; git checkout $source
@drlongnecker
drlongnecker / group_child_by_date.js
Last active August 29, 2015 13:56
Counting child documents by full date in MongoDB
// grab article.comments, group by date (roll times up to full days), count up instances to get full counts per day.
// gotta be a better way...
db.Article.aggregate(
{$unwind: '$Comments'},
{$group: { _id: '$Comments.DateCreated', count : {$sum: 1 }}},
{$match: { '_id' : { $gte: ISODate('2014-02-21 00:00:00'), $lte: ISODate('2014-02-28 23:59:59') } }},
{$project: { _id: 0, count: 1, 'date': '$_id', h: { $hour: '$_id' }, m: { $minute: '$_id'}, s: { $second: '$_id' }, ml: {$millisecond: '$_id'} } },
{$project: { count: 1, 'dt': { "$subtract" : [ "$date", { "$add" : [ "$ml", { "$multiply" : [ "$s", 1000 ] }, { "$multiply" : [ "$m", 60, 1000 ] }, { "$multiply" : [ "$h", 60, 60, 1000 ] } ] } ] } }},
{$group: { _id: '$dt', count: { $sum: '$count' } } },
@drlongnecker
drlongnecker / macrochanger.lua
Created March 23, 2018 16:49
macrochanger.lua
-- A quick rewrite of the Windower addon for Ashita v3 that swaps your macro pallette on job change.
-- Yes, I'm lazy.
_addon.name = 'MacroChanger'
_addon.author = 'Derahine'
_addon.version = '1.0.0.0'
require 'common'
jobs = {