Skip to content

Instantly share code, notes, and snippets.

@wrschneider
wrschneider / App.java
Last active April 22, 2023 16:27
Spring Boot listener for Amazon SQS
package bill.boottest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.aws.messaging.listener.annotation.SqsListener;
import com.fasterxml.jackson.annotation.JsonCreator;
@wrschneider
wrschneider / D3BoxPlot.js
Created March 30, 2017 20:12
fix to Microstrategy D3BoxPlot.js
(function () {
if (!mstrmojo.plugins.D3BoxPlot) {
mstrmojo.plugins.D3BoxPlot = {};
}
mstrmojo.requiresCls(
"mstrmojo.CustomVisBase",
"mstrmojo.models.template.DataInterface"
);
@wrschneider
wrschneider / fizzbuzz.js
Created February 10, 2017 02:05
FizzBuzz in ES6 with no loops
// first version
var fizzBuzzN = n => {
if (n % 15 == 0) return "FizzBuzz";
if (n % 3 == 0) return "Fizz";
if (n % 5 == 0) return "Buzz";
return n;
}
// second version -- single divisibility test, no repeat of 3 and 5 cases
// 3 and 5
@wrschneider
wrschneider / qicharts.r
Created October 28, 2016 17:56
call R qicharts package from Microstrategy
#MICROSTRATEGY_BEGIN
#
#DESC This script takes a metric from MSTR as a vector, and passes it to qicharts. Then returns the LCL, CL or UCL as
# a metric for use in MSTR.
#DESC Revision A
#
#RVAR Metric -input -numeric -vector -repeat
#
#RVAR Chart -parameter StringParam8
#
@wrschneider
wrschneider / wordWrap.hs
Created February 7, 2016 15:24
wrap text with maximum number of chars per line
wordWrap :: String -> Int -> String
wordWrap "" _ = ""
wordWrap str limit =
let
helper [] result curLineLen = result
helper (curWord:remainder) result curLineLen
| ((length curWord) + curLineLen >= limit) = helper remainder (result ++ "\n" ++ curWord) (length curWord)
| otherwise = helper remainder (result ++ " " ++ curWord) (curLineLen + 1 + length curWord)
wordList = words str
var sql = require('node-sqlserver-unofficial');
var Promise = require('promise');
var connectStr = "Driver={SQL Server Native Client 11.0};Server=localhost;Database=AdventureWorksDW2012;Trusted_Connection=yes";
var testData = [
{id: 1, foo: 'asdf'},
{id: 2, foo: 'zxcv'},
{id: 3, foo: 'qwer'},
{id: 4, foo: 'skdjflgsljd'}