Skip to content

Instantly share code, notes, and snippets.

View alucidwolf's full-sized avatar

Brandon alucidwolf

View GitHub Profile
import { LightningElement, wire, track } from "lwc";
import { getRecord } from "lightning/uiRecordApi";
import USER_ID from "@salesforce/user/Id";
import CONTACT_ID from "@salesforce/schema/User.ContactId";
import CONTACT_NAME from "@salesforce/schema/Contact.Name";
import ENCLOSURE_SAP from "@salesforce/schema/Contact.Enclosures_SAP__c";
const FIELDS = [CONTACT_NAME, ENCLOSURE_SAP];
<div class="slds-form-element__control slds-m-bottom--small">
<input data-id="templateList" id="templateList" name="selectedTemplate"
list="templateLookupList"
placeholder="Select Template"
class="slds-input"
value={selectedTemplate}
onchange={updateValueByInputName}
type="text"/>
<datalist data-id="templateLookupList" id="templateLookupList">
<template for:each={templateTypeOptions} for:item='item'>
@alucidwolf
alucidwolf / downloadsTable.js
Last active May 14, 2020 16:09
LWC Datatable extension
import LightningDatatable from 'lightning/datatable';
import linkColumn from './linkColumn.html';
export default class X7sDownloadsTable extends LightningDatatable {
static customTypes = {
linkColumn: {
template: linkColumn,
typeAttributes: ['releaseCode', 'id', 'releaseType', 'releaseName']
}
};
<template>
<div>
<input accept=".xlsx" data-id="xlsx-file-upload" type="file" />
<button onclick={addState}>add state to home page</button>
<button onclick={fileReader}>Upload</button>
</div>
</template>
@alucidwolf
alucidwolf / swap-key-values.js
Last active March 20, 2020 23:05
Swapping assignment of key value pairs
// OBJECTIVE //
// You want to take the value of the [key] for each object and assign it as the [key]
// You also want to take the value of the [value] for each object and assign it as the value
// Example
// HAVE
// const saveData = [
// {
// key: "Description_Checking_And_Savings",
// value: "desc"
@alucidwolf
alucidwolf / manipulating-data.js
Last active February 28, 2020 03:49
Manipulating Data in Objects and Arrays
const testObj = {
clientAccount: "Client Account Name",
settlementType: "Settlement Type Name",
templateType: "Template Type Name",
bankToBank1: "Bank 1",
bankToBank2: "Bank 2",
banks: [
{
key: "bankToBank1",
value: "Bank 3",
server {
location / {
root /var/www/html;
try_files $uri $uri/ /index.html;
}
}
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
# Create the container from the alpine linux image
FROM alpine:3.7
# Add nginx and nodejs
RUN apk add --update nginx nodejs
# Create the directories we will need
RUN mkdir -p /tmp/nginx/vue-single-page-app
RUN mkdir -p /var/log/nginx
RUN mkdir -p /var/www/html
@alucidwolf
alucidwolf / numbers-start-end.js
Created June 7, 2018 14:29
2 functions for getting start/end number in a string
// start number
var startingNumber = ( "asd4567 stuff is fun4you 2.12 67"
.match(/\d+\.\d+|\d+\b|\d+(?=\w)/g) || [] )
.map(function (v) {return +v;}).shift(); //=> 4567
console.log(startingNumber);
// end number
var endingNumber = ( "4567 stuff is fun4you 2.12 67asda"
.match(/\d+\.\d+|\d+\b|\d+(?=\w)/g) || [] )