Skip to content

Instantly share code, notes, and snippets.

View charltonAthletic's full-sized avatar

Andy Hitchings charltonAthletic

View GitHub Profile
@svierk
svierk / utam-examples.spec.js
Last active July 14, 2023 02:08
UTAM test for the creation of an account record in Salesforce
import ObjectHomeDesktop from 'salesforce-pageobjects/force/pageobjects/objectHome';
import RecordActionWrapper from 'salesforce-pageobjects/global/pageobjects/recordActionWrapper';
import RecordHomeTemplateDesktop from 'salesforce-pageobjects/global/pageobjects/recordHomeTemplateDesktop';
import FormattedText from 'salesforce-pageobjects/lightning/pageobjects/formattedText';
import DesktopLayoutContainer from 'salesforce-pageobjects/navex/pageobjects/desktopLayoutContainer';
import { logInSalesforce } from './utam-helper';
describe('utam-examples', () => {
beforeEach(async () => {
await logInSalesforce();
@tsalb
tsalb / sigh.cls
Last active August 26, 2020 20:35
Sanity check your org's CRUD
String DEBUG_TEMPLATE = 'C:[C] R:[R] U:[U] D:[D] MA:[MA] RA:[RA] | [PROFILE_NAME] | [OBJECT_NAME]';
String TRUE_TEMPLATE = '[X]'; // do not use space, horizontal char alignment will be off
String FALSE_TEMPLATE = '[_]'; // same
Integer PROFILE_NAME_MAX_LENGTH;
// Grab the max chars of each, so we can get an evenly formatted / spaced output later
List<Integer> nameLengths = new List<Integer>();
for (Profile profile : [SELECT Name FROM Profile]) {
nameLengths.add(profile.Name.length());
}
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 11, 2025 21:13
Online Resources For Web Developers (No Downloading)
<aura:application extends="force:slds" controller="AccountListFilterByCity">
<aura:attribute name="cities" type="List" default="[]" />
<aura:attribute name="allAccounts" type="List" default="[]" />
<aura:attribute name="filterAccounts" type="List" default="[]" />
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<lightning:layout>
<lightning:layoutItem size="3">
<aura:iteration items="{!v.cities}" var="cityValue">
@brianmfear
brianmfear / filter.app
Created January 26, 2018 17:22
Lightning Add/Filter List
<aura:application extends="force:slds">
<!-- All items added to the list -->
<aura:attribute name="data" type="List" default="[]" />
<!-- The list of currently viewable items -->
<aura:attribute name="filteredData" type="List" default="[]" />
<!-- Input for a new item -->
<aura:attribute name="newItem" type="String" />
<!-- Input for the filter text -->
<aura:attribute name="filter" type="String" />
@dwerdo
dwerdo / server.js
Created January 10, 2018 07:34
Node scraper
const puppeteer = require('puppeteer');
const VIN_SELECTOR = '#page > div > div.pane-content-constrain > main > div > div > div > div > section.side > aside > p.extra-info > span:nth-child(3)';
let vins = [];
async function run() {
let browser = await puppeteer.launch({
headless: false
});
@eneko
eneko / list-of-curl-options.txt
Last active May 6, 2025 09:40
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@jadeallencook
jadeallencook / instalike.js
Last active October 6, 2024 11:49
instagram autolike script
let likes = 0;
setInterval(() => {
const heart = document.querySelector('svg[aria-label="Like"][width="24"]');
const arrow = document.querySelector('svg[aria-label="Next"]');
if (heart) {
heart.parentNode.parentElement.click()
likes++;
console.log(`You've liked ${likes} post(s)`);
}
arrow.parentElement.parentElement.click();
@cmditch
cmditch / regex.txt
Created November 17, 2017 21:11 — forked from nerdsrescueme/regex.txt
Common Regex
Perl and PHP Regular Expressions
PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters.
All Major Credit Cards
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa.
//All major credit cards regex
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/'
@wadewegner
wadewegner / devhub.sh
Created July 27, 2017 16:38
A bash script that uses the Salesforce CLI to determine if the org has the dev hub enabled
# specify your username or alias
usernameOrAlias="[email protected]"
# return a json result of
org="$(sfdx force:org:display -u ${usernameOrAlias} --json)"
# parse response
result="$(echo ${org} | jq -r .result)"
accessToken="$(echo ${result} | jq -r .accessToken)"
instanceUrl="$(echo ${result} | jq -r .instanceUrl)"