Skip to content

Instantly share code, notes, and snippets.

View heijmerikx's full-sized avatar

Rutger Heijmerikx heijmerikx

View GitHub Profile
recordUpdated : function(component, event, helper) {
// Your custom functionality here
alert(‘I have changed’);
}
<script>
// replace the current flow New_Guest_Appointment_Flow with the api name of your own flow
// replace the current URL with your ownSite URL
$Lightning.use("runtime_appointmentbooking:lightningOutGuest",
() => {
console.log('lightning out loaded');
try {
$Lightning.createComponent(
"lightning:flow", // top-level component of your app
<head>
// replace the current URL with your ownand add “/lightning/lightning.out.js” after the Site URL
<script type="text/javascript" src="   https://live-demo-developer-edition.eu26.force.com/lightning/lightning.out.js"></script> 
<script type="text/javascript" src="index.js"></script>
</head> 
<body> 
// the FlowContainer div is where the flow will be displayed 
<div id="FlowContainer"></div>
</body>
@heijmerikx
heijmerikx / reset.sql
Created February 12, 2022 08:36 — forked from tbarbugli/reset.sql
reset all sequences on a postgres db
SELECT 'SELECT SETVAL(' ||quote_literal(S.relname)|| ', MAX(' ||quote_ident(C.attname)|| ') ) FROM ' ||quote_ident(T.relname)|| ';'
FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C
WHERE S.relkind = 'S'
AND S.oid = D.objid
AND D.refobjid = T.oid
AND D.refobjid = C.attrelid
AND D.refobjsubid = C.attnum
ORDER BY S.relname;
esphome:
name: "air-quality-indoor"
platform: ESP32
board: "featheresp32"
wifi:
ssid: "YOUR WIFI NETWORK NAME"
password: "YOUR WIFI PASSWORD"
logger:
MyFunctionRequest req = new MyFunctionRequest();
req.inputPropertyOne = false;
req.inputPropertyTwo = ’String value’;
String jsonconfig = JSON.serialize(req);
Functions.Function myFunction = Functions.Function.get('MyNamespace.myFunction');
Functions.FunctionInvocation invocation = myFunction.invoke(jsonconfig);
String jsonResponse = invocation.getResponse();
/**
* Register for messages sent by hosting component
*/
LCM.addMessageHandler((message) => {
if(message !== null){
//Do Something
}
});
/**
const LCM = {
   sendMessage : function(userMessage) {
       if (typeof LCC !== "undefined" && typeof LCC.onlineSupport !== "undefined") {       LCC.onlineSupport.sendMessage("containerUserMessage", {payload: userMessage});       }
   },
   addMessageHandler : function(handler) {
       if (typeof LCC !== "undefined" && typeof LCC.onlineSupport !== "undefined") {
           LCC.onlineSupport.addMessageHandler(handler);
       }
   },
}
<lightning:container aura:id="TestApp"
src="{!$Resource.Test + '/index.html'}"
onmessage="{!c.handleMessage}"
onerror="{!c.handleError}" />
({
sendMessage : function(component, event, helper) {     
const msg = {
name: "Test",
value: 1
};
component.find("TestApp").message(msg);
},
handleMessage: function(component, message, helper) {
const payload = message.getParams().payload;