Skip to content

Instantly share code, notes, and snippets.

View seanbamforth's full-sized avatar

Sean Bamforth seanbamforth

View GitHub Profile
@seanbamforth
seanbamforth / ParseJson.pkg
Created February 17, 2014 11:27
Pure VDF JSON Parser
//*****************************************************************************
//*** json.pkg ***
//*** ***
//*** Author: Sean Bamforth ***
//*** SELECT Computer Systems Ltd ***
//*** April / May 2011 ***
//*** ***
//*** Purpose: ***
//*** JSON Client interface for talking to JSON / restful services. ***
//*** ***
@seanbamforth
seanbamforth / emailLibrary.pkg
Created February 22, 2014 11:29
Using the SELECT email Libraries.
Use Windows
Use cSelectMailer.pkg
Use emailAudit.pkg
//register a new SELECT emailer. This knows how to send emails.
//But we also need to tell it how to audit those emails and read system flags.
Object oChilkatMailer is a cSELECTMailer
//ghEmailObject is a global variable for your convenience. It's used as a bridge between
//global emailing functions and the emailing option.
param (
[string]$from = "selectcs-backup",
[string]$to = $(get-location).ToString()
)
#todo:if no parameters, then show instructions
#todo:mirror option that deletes items that don't exist
#todo:aws details need to be in the environment.
param (
[string]$from = $(get-location).ToString(),
[string]$to = "selectcs-backup",
[switch]$mirror
)
#$DebugPreference = "Continue"
#todo:if no parameters, then show instructions
#todo:mirror option into own function
@seanbamforth
seanbamforth / cDictionary-native.pkg
Created August 8, 2014 10:50
cDictionary - using Native Arrays
Struct tKeyValue
String sKey
String sValue
End_Struct
Class cDictionary is a cObject
Procedure construct_object
Forward Send Construct_Object
Property tKeyValue[] pDictionary
End_Procedure
@seanbamforth
seanbamforth / cDictionary - ActiveX
Last active August 29, 2015 14:05
cComDictionary - using ActiveX Object
// Visual DataFlex COM proxy classes generated from C:\Windows\SysWOW64\scrrun.dll
Use FlexCom20.pkg
Define OLECompareMethod for Integer
Define OLEBinaryCompare for 0
Define OLETextCompare for 1
Define OLEDatabaseCompare for 2
Define OLEIOMode for Integer
@seanbamforth
seanbamforth / reopenDataflexFiles.pkg
Created August 18, 2014 15:50
Reopen all files in a new data folder
Use cApplication.pkg
Procedure ReopenAll Integer hWorkspace
//first we need to reset the workspace. this can be different
//for clubwise because we do not use standard workspace objects.
//And we're still on 11. try it though.
Set psDataPath of hWorkspace to "c:\new\data"
Set psFileList of hWorkspace to "c:\new\data\filelist.cfg"
@seanbamforth
seanbamforth / happy.rb
Last active August 29, 2015 14:09
Happiness Kata
#test.rb
#happy number checking
def nextPlace(testNum)
testNum.to_s.each_char.inject(0) { |sum, c| sum + c.to_i**2 }
end
def is_happy?(testNum)
a = b = testNum
while (a!=1) && (b!=1) do
@seanbamforth
seanbamforth / MariaDB ODBC Connector
Created November 16, 2014 17:04
Crashes MariaDB
Dim ad
Dim sql_query
Dim objFSO, objOutFile
Dim intCount, i
sql_query = "show databases"
sConnect = "Driver={MariaDB ODBC 1.0 Driver};Server=localhost;Uid=root;pwd=password"
@seanbamforth
seanbamforth / collation.sql
Created February 24, 2015 11:51
change collation on all tables in sql server (mssql)
SELECT 'ALTER TABLE [' + SYSOBJECTS.Name + ']' + ' ' + ' COLLATE Latin1_General_CI_AS '
FROM SYSOBJECTS
WHERE SYSOBJECTS.TYPE = 'U'
GO