Skip to content

Instantly share code, notes, and snippets.

@AndyPiddock
AndyPiddock / keybase.md
Last active November 30, 2022 10:24
keybase proof

Keybase proof//

I hereby claim:--

  • I am andypiddock on github.
  • I am andyp2108 (https://keybase.io/andyp2108) on keybase.
  • I have a public key ASB0jpqO7XidjFK-ZWunAjI1bJ-Q_8UoL9ZeRw88hh7XwQo

To claim this, I am signing this object:

@AndyPiddock
AndyPiddock / passurlparams.js
Last active November 30, 2022 12:02
Pass Url parameters to html input field
<script>
function getURLParameter(e) {
return decodeURI((new RegExp(e + "=(.+?)(&|$)").exec(location.search) || [, ""])[1]);
}
if (getURLParameter("search") === "") {
console.log("No URL param value found.");
} else {
@AndyPiddock
AndyPiddock / checkNetStatus.livecode #livecode
Last active November 30, 2022 12:13
Check Internet Connection
--place a text file on your server , contents "connected"
on checkNetStatus
local tNetCheck
put url ("yoururl/netcheck.txt") into tNetCheck
if word 1 of tNetCheck is "connected" then
answer "good connection." with "OK"
--do other stuff
else
@AndyPiddock
AndyPiddock / Unix timestamp to datetime items.livecode
Last active November 30, 2022 14:20
Unix timestamp to date/time items
function ConvDate pDate
convert pDate to dateitems
put item 1 of pDate into tDateY
put format("%02d",item 2 of pDate) into tDateM
put format("%02d",item 3 of pDate) into tDateD
put format("%02d",item 4 of pDate) into tDateH
put format("%02d",item 5 of pDate) into tDateMin
put format("%02d",item 6 of pDate) into tDateS
@AndyPiddock
AndyPiddock / MD5 Password Generator.livecode
Created August 28, 2018 14:50
MD5 Password Generator
--MD5 Password Generator
function hexDigest pvalue
put "" into tRes
put md5Digest(pValue) into tMD5
get binaryDecode("H*",tMD5,tRes)
return tRes
end hexDigest
@AndyPiddock
AndyPiddock / Runtime script Generated menu.livecode
Last active November 30, 2022 11:33
Runtime script Generated menu
--Runtime script Generated menu items ( mouse button 23 example)
on mouseDown pButton
if pButton = 2 then
put "Minimise" & return & "Help" & return & "Close Options" & return & "Exit" into tMenu
put tMenu into button "MenuMain"
popup btn "MenuMain"
end if
end mouseDown
@AndyPiddock
AndyPiddock / Drag image from LC app to ext app.livecode
Last active November 30, 2022 12:03
Drag image from LC app to another non LC app
--Drag image from LC app to another non LC app
--Place script into image
on dragstart
set the dragaction to "copy"
put specialfolderpath("temporary") & "/name for your image here.jpg" into tTempImage
put the text of img 1 into url("binfile:" & tTempImage)
set the dragdata["files"] to tTempImage
@AndyPiddock
AndyPiddock / Get colour at pixel.livecode
Last active November 15, 2022 11:04
Gets the colour of a pixel at a x,y co-ordinate #colour #color
--Gets the colour of a pixel at a x,y co-ordinate
--This uses the mouscolor command.
on mouseUp
put PixelColor(500,500)
end mouseUp
function PixelColor x,y
put the screenMouseLoc into tSaveLoc
@AndyPiddock
AndyPiddock / Check for program running.livecode
Created August 28, 2018 11:23
Check for program running - Windows
--Check for program running e.g. Notepad
on mouseUp
put empty into fld "myTaskList"
put shell ("TaskList") into fld "myTaskList"
if "notepad.exe" is among the tokens of fld "myTaskList" then
answer "Notepad is Running"
end if
end mouseUp
@AndyPiddock
AndyPiddock / Get Computer name.livecode
Last active November 30, 2022 12:14
Get Computer name
--OSX (and possibly linux distros):
put shell("echo $HOSTNAME")
--Windows:
put $COMPUTERNAME