Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Ceronio mydoghasworms

View GitHub Profile
@mydoghasworms
mydoghasworms / boggle.rb
Created Sep 8, 2018
Boggle Solver in Ruby
View boggle.rb
class Trie < Hash
def initialize
super
end
def build(string)
string << '.' #Terminator indicating end of a complete word
string.chars.inject(self) do |h, char|
h[char] ||= { }
end
@mydoghasworms
mydoghasworms / ex1.st
Created Jul 13, 2017
Snippets for Pharo Smalltalk tutorial
View ex1.st
Transcript show: 'Hello Pharo!'
View logo_turtle.red
Red [needs: view]
turtle: #()
win: layout [ panel [
tfield: base 500x500 white draw []
origin tfield/offset tlayer: base 500x500 255.255.255.255 draw [] ]
panel [
text "History" return history: text-list 200x350 data [] return
panel [ button "Save" [save request-file history/data]
View logred.red
Red [needs: view]
turtle: #()
win: layout [ tfield: base 500x500 white draw []
panel [
text "History" return history: text-list 180x350 data [] return
panel [ button "Save" [save request-file history/data]
button "Load" [commands: load request-file foreach cmd commands [process-cmd cmd]] ]
]
View ZLIB_REGISTRY.abap
*&---------------------------------------------------------------------*
*& Include ZLIBREGISTRY
*&---------------------------------------------------------------------*
* Implementation of a registry for storing arbitrary values (similar
* to the MS Windows registry)
* Author: Martin Ceronio (2015), http://ceronio.net
* Released under MIT License: http://opensource.org/licenses/MIT
class lcx_registry_err definition inheriting from cx_dynamic_check.
endclass. "lcx_registry_err DEFINITION
@mydoghasworms
mydoghasworms / account_search.json
Last active Jun 26, 2016
Sample Elasticsearch responses and parsing in ABAP - code to accompany http://ceronio.net/2015/03/yet-another-abap-json-parser-and-some-other-stuff/
View account_search.json
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1000,
@mydoghasworms
mydoghasworms / json_parser.abap
Last active Mar 11, 2020
ABAP JSON parser and mapper
View json_parser.abap
*&---------------------------------------------------------------------*
*& Include ZTEMPJSON_INCL
*&---------------------------------------------------------------------*
* A clean, reliable and compliant JSON parser and mapper to ABAP data;
* the kind your mother would have encouraged you to hang out with.
*----------------------------------------------------------------------*
* CLASS json_error DEFINITION
*----------------------------------------------------------------------*
class json_error definition inheriting from cx_static_check.
public section.
@mydoghasworms
mydoghasworms / zslsord_extr_to_es.abap
Last active Oct 2, 2018
Proof-of-concept ABAP Program to extract sales order data to an Elasticsearch server as seen on http://ceronio.net
View zslsord_extr_to_es.abap
*--------------------------------------------------------------------*
* Example program to extract data to Elasticsearch
*--------------------------------------------------------------------*
* Be sure to read the accompanying article:
* http://ceronio.net/2015/02/sap-business-intelligence-with-elasticseach-and-kibana/
*&---------------------------------------------------------------------*
*& WARNING!: This program is just a proof of concept. For a proper
*& production-quality extraction program, you would:
*& 1. Use a database cursor for selection
*& 2. Do bulk updates to Elasticsearch for better performance
@mydoghasworms
mydoghasworms / turbol.reb
Last active Sep 12, 2017
Little Rebol program that demonstrates using 'parse' to interpret some rudimentary Logo commands with a turtle and visual interface
View turbol.reb
REBOL [
title: "Rudimentary implementation of Logo Turtle"
date: 2015-02-16
author: "Martin Ceronio"
]
{ Load the turtle image; you can find the original at https://edu.kde.org/images/icons/kturtle_32.png Thanks, KTurtle! }
turtle-img: do to-string debase
{bWFrZSBpbWFnZSEgWzMyeDMyICN7CjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAKMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDAwNjdBMDcwNjdBMDcwNjdBMDcwNjdBMDcKMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwCjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAowMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDAwNjdBMDcwNjdBMDcKMDY3QTA3MDY3QTA3MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD
@mydoghasworms
mydoghasworms / index.html
Last active Aug 29, 2015
Indexing and searching SAPI PI message payloads with a Ruby retrieval script and an HTML page
View index.html
<!DOCTYPE html>
<html>
<!--
This provides a simple, single-purpose search front-end for the an Elasticsearch index containing
SAP PI message payloads that were indexed with the accompanying script. For more information, visit
http://ceronio.net/2014/08/sap-pi-message-payload-search-using-elasticsearch/
-->
<head>