Skip to content

Instantly share code, notes, and snippets.

View iamsonal's full-sized avatar
🕶️

Sonal iamsonal

🕶️
View GitHub Profile
@iamsonal
iamsonal / Mac Setup ZSH.txt
Last active June 13, 2021 22:27
Mac Setup ZSH
sudo spctl --master-disable
https://github.com/ohmyzsh/ohmyzsh
How to Install Zsh/ zsh-autosuggestions/ oh-my-zsh in Linux
https://varunmanik1.medium.com/how-to-install-zsh-zsh-autosuggestions-oh-my-zsh-in-linux-65fa01cc038d
@iamsonal
iamsonal / Git Tips.txt
Last active March 20, 2024 14:26
Git Tips
URL:https://sethrobertson.github.io/GitFixUm/fixup.html
Checkout evHeroHeader.html file from "feature/events/events-record-list" branch to your working branch:
git checkout feature/events/events-record-list force-app/events/main/default/lwc/evHeroHeader/evHeroHeader.html
Pull all the files from master branch to your working branch:
git pull origin master
Reset a branch
@iamsonal
iamsonal / main.rs
Last active March 3, 2020 06:01
Rust Syntax
fn main() {
let i: i32 = 255;
println!("{}", i);
// Tuples
let tup = (1, 'c', true);
println!("{} {}", tup.0, tup.1);
println!("{:?}", tup);
// Destructuring
@iamsonal
iamsonal / server.js
Created February 3, 2020 01:24
Various express scenarios
/**
* ***** A basic express example *****
*/
const express = require("express");
const dotenv = require("dotenv");
/**
* Load environment variables
*/
dotenv.config({
@iamsonal
iamsonal / server.js
Last active February 3, 2020 00:01
Node HTTP Module
const http = require("http");
const todos = [
{ id: 1, text: "Todo one" },
{ id: 2, text: "Todo two" },
{ id: 3, text: "Todo three" }
];
const server = http.createServer((req, res) => {
const { method, url } = req;
//Install Node: https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
nvm install node
which node
node -v
npm install serverless -g
sls -v
// Optional
@iamsonal
iamsonal / index.js
Created December 26, 2019 21:52
Array.from() and Array.of()
// Array.from() will take something aray-ish and convert it into an array
// *** Example 1: If we have DOM like below
{
/* <div class="people">
<p>John</p>
<p>Kait</p>
<p>Snickers</p>
</div> */
}
@iamsonal
iamsonal / Salesforce DX Commands List.txt
Last active February 13, 2023 16:01
SFDX Commands
--targetusername = -u (To specify a non-default scratch org)
--targetdevhubusername = -v (To specify a non-default Dev Hub org)
--setdefaultdevhubusername = -d
--setdefaultusername = -s
--instanceurl = -r
--setalias = -a
@iamsonal
iamsonal / package.xml
Created December 15, 2018 00:51
Package.xml to retrieve all metadata from salesforce org
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ActionLinkGroupTemplate</name>
</types>
<types>
<members>*</members>
<name>AnalyticSnapshot</name>
</types>
// AccountAfterUpdate.trigger
trigger AccountAfterUpdate on Account (after update) {
if (!Territory2Controller.inFutureContext) {
List<Id> accountIds = new List<Id>();
for (Account acc : Trigger.new) {
accountIds.add(acc.Id);
}
Territory2Controller.runTerritoryRules(accountIds, UserInfo.getSessionId());
}
}