Skip to content

Instantly share code, notes, and snippets.

Avatar

Rutger Heijmerikx heijmerikx

View GitHub Profile
View controller.js
recordUpdated : function(component, event, helper) {
// Your custom functionality here
alert(‘I have changed’);
}
View scheduler.js
<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
View index.html
<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 Feb 12, 2022 — forked from tbarbugli/reset.sql
reset all sequences on a postgres db
View reset.sql
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;
View esphome-co2-sensor-mhz19.yaml
esphome:
name: "air-quality-indoor"
platform: ESP32
board: "featheresp32"
wifi:
ssid: "YOUR WIFI NETWORK NAME"
password: "YOUR WIFI PASSWORD"
logger:
View sf-function.js
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();
View register.handler.js
/**
* Register for messages sent by hosting component
*/
LCM.addMessageHandler((message) => {
if(message !== null){
//Do Something
}
});
/**
View f.js
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);
       }
   },
}
View test.html
<lightning:container aura:id="TestApp"
src="{!$Resource.Test + '/index.html'}"
onmessage="{!c.handleMessage}"
onerror="{!c.handleError}" />
View testcontroller.js
({
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;