Skip to content

Instantly share code, notes, and snippets.

View peter-kehl's full-sized avatar
🏠
Working from home

Peter Kehl peter-kehl

🏠
Working from home
View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active May 7, 2024 22:35
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:

Google Apps Script Gmail Utilities

##sendAndLabel(recipient, subject, body, options, label)##

An alternative to GmailApp.sendEmail(), which applies a label to the message thread in the sender's account.

Sends an email message with optional arguments. The email can contain plain text or an HTML body. The size of the email

So I had this situation where I needed to delete an object from the database, if it existed. This is what I wrote:

Ruby Option 1

obj = get_object(1)
obj.destroy if obj

And as I wrote this, it seemed a bit awkward to me. We always said Ruby had a really elegant syntax, but I guess I've come to the place where I find it a little grating. The thing about this example is the asymmetry of it. Conceptually I feel like the if check goes with the assignment, but it's separated from it in a strange way.

Ruby Option 2

@getify
getify / ex1-prototype-style.js
Last active January 7, 2024 11:58
OLOO (objects linked to other objects) pattern explored (with comparison to the prototype style of the same code)
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,"Bar:" + who);