This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enum GainTerm { | |
Short | |
Long | |
} | |
Enum GainLoss { | |
Gain | |
Loss | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Out-Numbers { | |
<# | |
.SYNOPSIS | |
Converts PowerShell Objects in CSV and opens in Numbers on macOS | |
.DESCRIPTION | |
Converts PowerShell Objects in CSV and opens in Numbers on macOS | |
TODO, maybe allow passing through a filename, an only using temp if not. | |
then allow certian parameters for export-csv like type, or no clobber or append.. | |
.PARAMETER InputObject | |
Object to output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class FirstdataE4Gateway < Gateway | |
# TransArmor support requires v11 or lower | |
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11' | |
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v11' | |
TRANSACTIONS = { | |
sale: '00', | |
authorization: '01', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class FirstdataE4V27Gateway < Gateway | |
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v27' | |
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v27' | |
TRANSACTIONS = { | |
sale: '00', | |
authorization: '01', | |
verify: '05', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class TryCatch | |
{ | |
public static T Expression<T>(Func<T> lamda, Action<Exception> onException) | |
{ | |
try | |
{ | |
return lamda(); | |
} | |
catch(Exception e) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Retry | |
{ | |
public static IEnumerable<T1> Expression<T1>( | |
int retries, | |
Func<IEnumerable<T1>> action) | |
{ | |
if (retries < 1) throw new Exception("must have 1 or more retries"); | |
var iterations = 1; | |
while (iterations <= retries) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T1> Batch2<T, T1>( | |
this IEnumerable<T> list, | |
int batchSize, | |
int maxParallelism, | |
Func<IEnumerable<T>, IEnumerable<T1>> action) | |
{ | |
int i = 0; | |
return ( | |
from item in list | |
group item by (int)i++ / batchSize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T1> Batch<T,T1>( | |
this IEnumerable<T> list, | |
int batchSize, | |
Func<IEnumerable<T>, IEnumerable<T1>> action, | |
bool processInParallel = false) | |
{ | |
int i = 0; | |
var grpqry = from item in list | |
group item by (int)i++ / batchSize | |
into part |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "mp3info" | |
require "csv" | |
chapterarray = [] | |
#Dir.glob("/Users/klumsy/Downloads/bible/01_Genesis/*.mp3") do |f| | |
Dir.glob("/Users/klumsy/Downloads/bible/**/*.mp3") do |f| | |
Mp3Info.open(f) do |mp3info| | |
title = mp3info.tag.title | |
puts title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rabbitserver = 'localhost:15672' | |
$cred = Get-Credential | |
iwr -ContentType 'application/json' -Method Get -Credential $cred "http://${rabbitserver}/api/queues" | % { | |
ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % { | |
iwr -method DELETE -Credential $cred -uri $("http://${rabbitserver}/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name) | |
} | |
iwr -Cr $cred "http://${rabbitserver}/api/queues" | % { ConvertFrom-Json $_.Content } | % { $_ } | % {iwr -me DELETE -Cr $cred $("http://${rabbitserver}/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)} | |
NewerOlder