Skip to content

Instantly share code, notes, and snippets.

@sauloefo
sauloefo / .my-terminal-custom-settings
Last active November 24, 2019 13:03
My Terminal Customizations
# my-prompt-customizations
# 1. Setup my prompt
# 1.1. get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
@sauloefo
sauloefo / change-committer.sh
Created January 2, 2019 21:10
Change the username and email of all commits that match the value of OLD_EMAIL var.
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="put old email here"
CORRECT_NAME="put new name here"
CORRECT_EMAIL="put new email here"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@sauloefo
sauloefo / create-github-repo.sh
Created January 7, 2019 22:59
Create a GihHub repository from terminal
# %1 GitHub username
# %2 Repository name
# %3 Make repository private. User true or false
curl -u '%1' https://api.github.com/user/repos -d '{"name":"%2","private":"%3"}'
@sauloefo
sauloefo / gist:5ffeec553b42f28743ee21e8cacee32f
Last active April 25, 2019 10:48
Enable ES6 option in jsbin.com with a comment
//jshint esnext:true
@sauloefo
sauloefo / regex-xml-remove.txt
Last active December 6, 2022 11:22
REGEX to remove references from xml files based on the outter xml node and a value to match
```
\n\s*<flowAccesses>\n([\S ]*\n){1}[\S ]*Play_Changed<[\S ]*\n([\S ]*\n){0}[\S ]*</flowAccesses>
```
{1} : number of lines *between* the outter open element and the line with the text to match;
< at the end of `Play_Changed<` : terminator to avoid matching text that starts with Play_Changed;
{0} : number of lines *between* the line with the text to match and the outter close element;
@sauloefo
sauloefo / aliases.sh
Last active January 21, 2022 13:57
Shell script aliases for git and sfdx commands
#!/bin/sh
# git
alias g='git'
alias gs='git status'
alias gc='git add . && git commit -m'
alias ga='git add . && git commit --amend --no-edit'
alias gl='git log --oneline'
alias gpush='git push'
alias gpull='git pull'
@sauloefo
sauloefo / aliases.ps1
Last active February 15, 2023 09:15
Powershell aliases for git and sfdx commands
# git
Set-Alias -Name g -Value git -Option ReadOnly
Function Git-Status { git status $args }
Set-Alias -Name gs -Value Git-Status -Option ReadOnly
Function Git-Commit {
git add .
git commit -m $args
}
public class ExpensesSelector {
public static Map<Id, Expense> selectAll() {
return dataService.selectAll();
}
private static ExpensesDataService dataService {
get {
if (null == dataService) {
// use with sharing by default
List<Case> cases = new List<Case>{
new Case(Subject = 'Mild problem', Origin = 'Phone', Escalated__c = false, Status = 'Closed')
, new Case(Subject = 'Problem 1', Origin = 'Web', Escalated__c = true, Status = 'Closed')
, new Case(Subject = 'Problem 2', Origin = 'Web', Escalated__c = true, Status = 'In Progress')
, new Case(Subject = 'Problem 3', Origin = 'Email', Escalated__c = true, Status = 'Open')
};
class MildCase extends CaseEntity {
protected override Edl.Expression identityExpression() {
return subject().isEqualTo('Mild problem');
@sauloefo
sauloefo / .eslintrc
Created March 2, 2023 09:12
eslintrc for my salesforce projects
{
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"babelOptions": {
"parserOpts": {
"plugins": ["classProperties", ["decorators", { "decoratorsBeforeExport": false }]]
}
}
},