Skip to content

Instantly share code, notes, and snippets.

View the-dvlpr's full-sized avatar
🎯
Focusing

Seph the-dvlpr

🎯
Focusing
View GitHub Profile
public void method(){
try {
// do stuff
return redirectUser(true);
} catch (Exception e) {
return redirectUser(false);
}
}
public PageReference redirectUser(Boolean success){
@the-dvlpr
the-dvlpr / json-deserialization.java
Last active December 23, 2021 19:45
Getting values out of a JSON list of objects with Apex code.
// JSON DESERIALIZATION (API RESPONSE OR OTHER)
// --------------------
// Deserialize and cast JSON string into single object
Map<String,Object> jsonObjectMap = (Map<String,Object>)JSON.deserializeUntyped('{"id":"001","email":"email@email.com"}');
String externalId = String.valueOf(jsonObjectMap.get('id'));
// --------------------
@the-dvlpr
the-dvlpr / unsubscribe.md
Last active January 29, 2020 17:50
An email opt out option for Salesforce via a reply email.

Use this to allow a user to unsubscribe from a newsletter via a reply email

// This is the updated code to be used for the Salesforce plugin: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N300000016YDZEA2
// Install the plubin.
// Changout all of the Apex installed in the unsubscribe class with updated code below. 
// Add the custom field hasOptedOutOfEmail__c (without the __c, salesforce will add that) to your Lead and Contact object.
// Create an email in Setup > Custom Code > Email Services (and make it active)
// Then just append ?subject=Unsubscribe to the end of the email and insert that link into any mailings.
// This allows a user to unsubscribe via email.
@the-dvlpr
the-dvlpr / atom-cheatsheet.md
Last active April 10, 2018 18:23
Atom Cheat Sheet

Navigation

Toggle between tree view
^0

Move tabs left or right
cmd + opt + <- (or ->)

Creation

@the-dvlpr
the-dvlpr / README.md
Created March 15, 2018 23:17
Setup Jenkins on Mac

Jenkins CI on OSX

Instructions on how to setup a secured Jenkins CI on a Mac.

Download & Install dependencies

All of these operations are done with your admin user.

Developer tools

Install the command line developer tools.

@the-dvlpr
the-dvlpr / Ryan-gosling-apology.md
Last active November 25, 2017 18:45
I was dating another developer and this is how I tried to win/take her back after a heated debate and me leaving - using github and Ryan Gosling gifs

Hey, I’m sorry.

Alt text

But you drive me crazy.

Alt text

and this is the part where I normally would bail

@the-dvlpr
the-dvlpr / host_your_rails_app_on_ec2.md
Last active May 21, 2019 13:01
Deploy and reroute traffic from your purchased domain name to your Rails app on a self-hosted EC2 server utilizing GitHub

Punchlist for Serving your Rails App on an EC2 Instance

Run through this list to setup your EC2 instance and host your rails app. This list makes a few assumptions (make changes as necessary)

  • You have github repo with a rails app pushed to it that we'll just pull down to the new server
  • You're using Rails 5.1

If not, see very bottom for steps to build a quick example app.

Launching EC2 instance

  • Use the basic Linux AMI distro: Amazon Linux AMI 2017.09.0 (HVM), SSD Volume Type - ami-8c1be5f6
  • Select a size: t2.micro is fine for this, unless you need larger for a production app