Skip to content

Instantly share code, notes, and snippets.

Time taken: 23.347s (response = 535 model objects, ran immediately after opening Database)
t1 = Time.now
$dbListPaths=""
def walk(moc)
moc.each do |mo|
$dbListPaths += mo.path + "\n"
walk(mo.children)
end
end
@sancarn
sancarn / ActivityWatcher.AHK
Last active April 2, 2018 18:38
Activity Watcher - This application monitors the windows you visit on your computer, and how long you visit them for. It was built due to my frustration with inability to remember what to put on my timesheets.
SetTimer, ActivityWatcher, 150
return
ActivityWatcher:
if !CurrentTitle
{
WinGetTitle, CurrentTitle, A
QPC(1)
}
@sancarn
sancarn / ReturnedErrors.txt
Last active May 5, 2018 19:02
Runs in ISE, Doesn't run in powershell
At C:\Users\sancarn\AppData\Local\Temp\script.ps1:20 char:20
+ $parent = [System.Windows.Forms.TreeNode]$global:database.Ite ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Windows.Forms.TreeNode].
At C:\Users\sancarn\AppData\Local\Temp\script.ps1:27 char:36
+ ... [void]$node.nodes.add([System.Windows.Forms.TreeNode]::new(" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Windows.Forms.TreeNode].
At C:\Users\sancarn\AppData\Local\Temp\script.ps1:33 char:45
+ ... PSCustomObject]IWDBGetChildren([System.Windows.Forms.TreeNode]$node) ...
@sancarn
sancarn / .Infoworks-ICM-BetterTreeview.md
Last active May 8, 2018 08:45
A better Powershell treeview for ICM

Test

def proxy__enwrap(obj)
isClass = obj.is_a?(Class)
oldClass = isClass ? obj : obj.class
sNewClass = "Proxy#{oldClass.to_s}"
code = <<-EOF
class #{sNewClass}
include InstanceProxy
def self.__cinit__(obj)
@@__cobj__ = obj
end
Alter Table S104 (Add CAB Logical, KST Logical, PLT Logical)
select * from S104 where Adoption_Date <> "" into qNoBlank
select * from qNoBlank where Adoption_Date < CurDate() into qCAB
select * from qNoBlank where Adoption_Date >= CurDate() into qKST1
select * from S104 where Adoption_Date = "" into qBlank
select * from qBlank where Date_Confirmation < CurDate() or dwellings(DWF_Total_m3_per_sec) < 50 into qKST2
select * from qBlank where Date_Confirmation > CurDate() and dwellings(DWF_Total_m3_per_sec) >= 50 into qPLT

Ruby IDispatch

A way of dispatching Ruby classes and objects as COM OLE objects, via win32ole.

Uses

Useful for IE intergration:

require 'win32ole'
@sancarn
sancarn / .ClassAndMethodsReport.md
Last active July 2, 2018 13:54
Retrieve all Classes and Methods in Ruby.

Ruby - Class and Methods Report

Attempts to produce a list of all available classes and methods available in the current Ruby instance.

Issues

Currently does not retrieve methods of Object class and it's ancestors (e.g. BasicObject) - Perhaps this should be added

Infoworks ICM - GUIs with Ruby (Part 2)

In the last part of this series we explored how we could use the Windows Forms .NET framework from Ruby using an intermediate Powershell script. This time we will go down a completely different route. Today we will build GUIs using the popular web technologies - HTML, CSS and JavaScript.

Why web technologies?

Web technologies over the years have improved greatly. Open source JavaScript engines have become faster at processing data and HTML and CSS have greatly improved to provide clean interfaces for the ever growing market of the web. JavaScript, executed from Chrome's V8 Engine, is currently one of the fastest interpreted languages on the market. This is largely due to the fact that there is a huge demand for bigger, faster webpages.

Recently there has been an emerging trend of web technologies being used for desktop applications. Frameworks such as, Electron and NW.js make this not only possible, but both easy t

@sancarn
sancarn / Ruby enum windows.md
Last active July 15, 2018 20:14
How to call enum windows (and other win32 functions) using dl / fiddle, in a clean manor.