Skip to content

Instantly share code, notes, and snippets.

View rapsacnz's full-sized avatar
🏠
Working from home

Caspar Harmer rapsacnz

🏠
Working from home
View GitHub Profile
@akihikodaki
akihikodaki / README.en.md
Last active October 28, 2024 15:20
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@toanshulverma
toanshulverma / DataDisplayController.cls
Last active June 20, 2024 23:13
Sample Code to Generate PDF from Lightning components with in-memory data
public class DataDisplayController {
public String PDFData {get; set;}
public DataDisplayController(){
PDFData = '';
}
public PageReference downloadPDF(){
System.PageReference pageRef = new System.PageReference('/apex/PDFGenerator');
@okram999
okram999 / sfdx command list
Created November 19, 2017 19:32
sfdx force:doc:commands:list
$ sfdx force:doc:commands:list
=== Commands
force:alias:list # list username aliases for the Salesforce CLI
force:alias:set # set username aliases for the Salesforce CLI
force:apex:class:create # create an Apex class
force:apex:execute # execute anonymous Apex code
force:apex:log:get # fetch a debug log
force:apex:log:list # list debug logs
force:apex:test:report # display test results
force:apex:test:run # invoke Apex tests
@enreeco
enreeco / quickAction.cmp
Last active May 17, 2019 04:05
Salesforce Ligthning QuickAction popup automatic close
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
Loading data, please wait. . .
</aura:component>
@afawcett
afawcett / WidgetRecordEdit.cmp
Created May 30, 2017 02:15
Lightning Component for Lightning Edit Action Override
<aura:component implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName">
<aura:attribute name="record" type="Object" />
<aura:attribute name="componentRecord" type="Object" />
<aura:attribute name="recordError" type="String" />
<force:recordData
aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="FULL"
global class XmlToJson {
// Try to determine some data types by pattern
static Pattern
boolPat = Pattern.compile('^(true|false)$'), decPat = Pattern.compile('^[-+]?\\d+(\\.\\d+)?$'),
datePat = Pattern.compile('^\\d{4}.\\d{2}.\\d{2}$'),
timePat = Pattern.compile('^\\d{4}.\\d{2}.\\d{2} (\\d{2}:\\d{2}:\\d{2} ([-+]\\d{2}:\\d{2})?)?$');
// Primary function to decode XML
static Map<Object, Object> parseNode(Dom.XmlNode node, Map<Object, Object> parent) {
// Iterate over all child elements for a given node
for(Dom.XmlNode child: node.getChildElements()) {
@kylewelsby
kylewelsby / promise-when.js
Created September 23, 2015 18:45
wait until condition is met before resolving promise.
// setup
var value = false;
setTimeout(function(){
value = true;
}, 1998);
// code
function promiseWhen(condition, timeout){
if(!timeout){
@miguelmota
miguelmota / text-offset.js
Created March 21, 2015 19:56
Get offset position of text in JavaScript
var characters = document.querySelector('.characters'); // div with text
var charactersText = characters.textContent;
var charAtIndex = 25;
var offsetPosition;
characters.textContent = '';
for (var i = 0; i < charactersText.length; i++) {
var textNode = document.createTextNode(charactersText[i]);
characters.appendChild(textNode);
if (i === charAtIndex) {
@yuval-a
yuval-a / js-micro.js
Last active October 9, 2024 13:09
Javascript micro-optimizations
NOTE: This document is OLD - and most of the tips here are probably outdated, since newer versions of Javascript have been
released over the years - with newer optimizations and more emphasis on optimizing newly supported syntax.
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
@ilyazub
ilyazub / excel_xml_spreadsheet_example.md
Last active January 4, 2023 03:47
Excel 2003 XML Spreadsheet example

Excel 2003 XML Spreadsheet example

Example

image

spreadsheet.xml

Solved errors

Problem During Load because of wrong ss:ExpandedRowCount.