Skip to content

Instantly share code, notes, and snippets.

View StephenOTT's full-sized avatar
:shipit:
...

Stephen Russett StephenOTT

:shipit:
...
View GitHub Profile
@StephenOTT
StephenOTT / script.js
Last active October 26, 2020 18:44
Camunda Nashorn Script for getting call activity sub process variables using a script
function getCallActivitiesInstanceVariables(targetActivityId, collectionElementVariableName, ignoreVariables) {
return execution.getProcessEngineServices()
.getHistoryService().createHistoricActivityInstanceQuery()
.processInstanceId(execution.getProcessInstanceId())
.activityId(targetActivityId)
.list()
.stream()
.collect(
java.util.stream.Collectors.toMap(
function (i) {
@StephenOTT
StephenOTT / CreateFilter.java
Created April 5, 2018 17:12 — forked from meyerdan/CreateFilter.java
camunda Filter Service
// create a taskQuery
TaskQuery myTasksQuery = taskService.createTaskQuery().taskAssignee("daniel.meyer").active();
// save taskQuery as filter
Filter myTasksFilter = filterService.newTaskFilter("My Tasks");
myTasksFilter.setOwner("daniel.meyer");
myTasksFilter.setQuery(myTasksQuery);
String filterId = filterService.saveFilter(myTasksFilter);
// execute the filter
[
{"timestamp":"2018-01-15T00:10:38.795+0000","historyClass":"HistoricProcessInstanceEventEntity","historyEvent":{"id":"6","processInstanceId":"6","executionId":"6","processDefinitionId":"historyGeneration:1:3","processDefinitionKey":"historyGeneration","processDefinitionName":"-","processDefinitionVersion":"-","caseInstanceId":"-","caseExecutionId":"-","caseDefinitionId":"-","caseDefinitionKey":"-","caseDefinitionName":"-","eventType":"start","sequenceCounter":0,"durationInMillis":"-","startTime":"2018-01-15T00:10:38.783+0000","endTime":"-","businessKey":"-","startUserId":"-","superProcessInstanceId":"-","superCaseInstanceId":"-","deleteReason":"-","endActivityId":"-","startActivityId":"StartEvent_1","tenantId":"-","state":"ACTIVE","durationRaw":"-"}},
{"timestamp":"2018-01-15T00:10:38.854+0000","historyClass":"HistoricActivityInstanceEventEntity","historyEvent":{"id":"StartEvent_1:20","processInstanceId":"6","executionId":"6","processDefinitionId":"historyGeneration:1:3","processDefinitionKey":"historyGener
@StephenOTT
StephenOTT / controller.js
Created June 22, 2016 23:18 — forked from travist/payment.html
Form.io + Stripe Payment Processing
/**
* First create a form with the following fields.
* - Credit Card Number - Key = creditCardNumber
* - CVC - Key = cvc
* - Expiry Month - Key = expMonth
* - Expiry Year - Key = expYear
* - Token - Key = token
* - **** ANY OTHER FIELDS YOU WANT ***
*/
angular.module('yourApp')
@StephenOTT
StephenOTT / create.js
Created June 22, 2016 23:08 — forked from travist/create.js
Form.io Server-to-Server User Creation and Authentication
var request = require("request");
// The api key is generated within the Form.io project settings.
var apiKey = '23kj2k3jhkj2h3';
// Create a new user.
request({
method: 'POST',
url: 'https://example.form.io/user',
headers: {
@StephenOTT
StephenOTT / date_conversion.rb
Created March 26, 2015 05:10
Date Conversion for MongoDB
Here is a way to deal with this issue:
def convertIssueDatesInMongo (issues)
issues.each do |y|
y["created_at"] = DateTime.strptime(y["created_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
y["updated_at"] = DateTime.strptime(y["updated_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
end
return issues
end
@StephenOTT
StephenOTT / qless zscan.rb
Created May 8, 2014 05:33
Ruby Redis example of using ZSCAN and ZSCAN Match to get a specific DateTime for a Job ID in a QLess scheduled job
require "redis"
redis = Redis.new
puts redis.zscan("ql:q:testing-scheduled", 5, {match: "7f81bbe64bcd4599b565c95c817cf363"})
@StephenOTT
StephenOTT / time_difference.rb
Created May 1, 2014 23:54
Example of using Chronic gem and TimeDifference gem to get the duration between two statements
require 'chronic'
require 'time_difference'
humanStatement1 = "this tuesday 1pm"
humanStatement2 = "this tuesday 3pm"
humanStatement1Parsed = Chronic.parse(humanStatement1)
humanStatement2Parsed = Chronic.parse(humanStatement2)
@StephenOTT
StephenOTT / Missing Dates.rb
Created April 18, 2014 07:48
Find Missing Dates between a Date Range
a = []
output.each do |x|
a << x["converted_date"]
end
b = (output.first["converted_date"]..output.last["converted_date"]).to_a
zeroValueDates = (b.map{ |date| date.strftime("%b %Y") } - a.map{ |date| date.strftime("%b %Y") }).uniq
zeroValueDates.each do |zvd|
zvd = DateTime.parse(zvd)
output << {"repo"=> repo , "state"=>"closed", "closed_year"=>zvd.strftime("%Y").to_i, "closed_month"=>zvd.strftime("%m").to_i, "count"=>0, "converted_date"=>zvd}
@StephenOTT
StephenOTT / GitHub Search Repo Parameter Limit.rb
Last active August 29, 2015 13:57
Determine what the Max number of Repo parameters that GitHub Search API supports
require 'octokit'
require 'pp'
class GHSearchTest
def gh_authenticate(username, password)
@ghClient = Octokit::Client.new(
:login => username.to_s,
:password => password.to_s,