Skip to content

Instantly share code, notes, and snippets.

View douglascayers's full-sized avatar

Doug Ayers douglascayers

View GitHub Profile
@douglascayers
douglascayers / github-copy-labels.sh
Last active December 22, 2023 08:16
Export and import GitHub labels between projects by running bash script with jq and curl. Uses GitHub REST API. Requires personal access token.
# This script uses the GitHub Labels REST API
# https://developer.github.com/v3/issues/labels/
# Provide a personal access token that can
# access the source and target repositories.
# This is how you authorize with the GitHub API.
# https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
GH_TOKEN="YOUR_TOKEN"
# If you use GitHub Enterprise, change this to "https://<your_domain>/api/v3"
@douglascayers
douglascayers / github-export-labels.js
Last active September 14, 2023 15:30
Export and import GitHub labels between projects by running JavaScript in the browser console to automate clicks.
/**
* Inspired by @MoOx original script: https://gist.github.com/MoOx/93c2853fee760f42d97f
* Adds file download per @micalevisk https://gist.github.com/MoOx/93c2853fee760f42d97f#gistcomment-2660220
*
* Changes include:
* - Get the description from the `title` attribute instead of `aria-label` (doesn't exist anymore)
* - Use style.backgroundColor and parse the rgb(...) to hex (rather than regex parsing of 'style' string)
* - Downloads labels to a JSON file named after the webpage to know which GitHub repo they came from.
*
* Last tested 2019-July-27:
@bjesuiter
bjesuiter / filter-async.ts
Created August 22, 2018 11:59
An rxjs 6 pipe operator which filters the data based on an async predicate function returning promise<boolean>
/**
* An operator which filters the data based on an async predicate function returning promise<boolean>
*
* NOTE:
* By using **concatMap**, the order of original data events is preserved and the filter runs sequentially for each data event
* If you want to run the filter in parallel without preserving order, use **flatMap**
* See the accepted answer at: https://stackoverflow.com/questions/28490700/is-there-an-async-version-of-filter-operator-in-rxjs
* @param predicate
* @param thisArg
*/
@wadewegner
wadewegner / wadewegner.zsh-theme
Last active February 11, 2020 00:06
My ZSH theme that includes some stuff for SFDX
# wadewegner.zsh-theme
prompt_fn() {
config="$(cat .sfdx/sfdx-config.json 2> /dev/null)";
globalConfig="$(cat ~/.sfdx/sfdx-config.json)";
defaultusername="$(echo ${config} | jq -r .defaultusername)"
defaultdevhubusername="$(echo ${config} | jq -r .defaultdevhubusername)"
globaldefaultusername="$(echo ${globalConfig} | jq -r .defaultusername)"
@mshanemc
mshanemc / cleanScratchInfo.cls
Created November 29, 2017 23:24
cleaning up old scratch orgs from your dev hub with SFDX
// ScratchOrgInfo is an object in your dev hub
delete [select id from ScratchOrgInfo where Status = 'Deleted'];
@douglascayers
douglascayers / UploadFile.html
Last active April 18, 2021 14:48
JavaScript snippet for uploading fille to Salesforce as ContentVersion and sharing to record as ContentDocumentLink via jsforce and jquery.
<apex:page>
<head>
<script src="{!$Resource.jquery224}"></script> <!-- https://jquery.com/ -->
<script src="{!$Resource.jsforce170}"></script> <!-- https://jsforce.github.io/ -->
<script>$j = jQuery.noConflict();</script>
</head>
<body>
<form>
@madmax983
madmax983 / ltngDataServiceFun.cmp
Last active October 28, 2016 09:18
Fun with Lightning Data Service
<aura:component >
<aura:attribute name="recordIds"
type="List"
access="public"
description="An array of Ids"/>
<aura:attribute name="records"
type="Map"
description="The records!"
default="{}"/>
<aura:attribute name="errors"
@afawcett
afawcett / AddressFinder.cmp
Last active November 25, 2022 08:58
Salesforce London World Tour 2016: Lightning Out: Components on Any Platform
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
controller="AddressFinderController" access="global">
<aura:attribute name="accounts" type="Account[]"/>
<aura:attribute name="contacts" type="Contact[]"/>
<aura:registerEvent name="AddressInfo" type="c:AddressInfo"/>
<div class="slds-form--stacked">
<div class="slds-form-element">
<label class="slds-form-element__label" for="inputSample2">Account Search</label>
@cdcarter
cdcarter / QuickData.java
Last active May 29, 2016 04:31
QuickData
public class QuickData {
/* QuickData inserts your Mockaroo Schema, no questions asked. Remote Site needed.
* USAGE: QuickData.createRecords('MOCKAROOAPIKEY','20689c00',20,List<Lead>.class);
* Creates 20 leads using the schema at https://www.mockaroo.com/20689c00 */
public static List<SObject> createRecords(String a, String s, Integer c, Type t) {
String fmtStr = 'https://www.mockaroo.com/{1}/download?count={2}&key={0}';
List<String> reqDetails = new List<String>{a,s,String.valueOf(c)};
string requestString = String.format(fmtStr,reqDetails);
HttpRequest req = new HttpRequest();
req.setEndpoint(requestString);
@p3t3r67x0
p3t3r67x0 / openssl_commands.md
Last active February 3, 2024 18:53
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl