This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Zen Of Javascript | |
Build functionality, not architecture. | |
Build small things that work | |
and glue them together to make big things. | |
Clear is better than clever, | |
but graceful beats both. | |
Comments are good, even if you're Dutch. | |
Asychronous is better than synchronous | |
except for when it isn't |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//a quick example of how to use actual 'if' statements inside template literals, | |
//without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals. | |
//data param is passed in via render(template(data), this) - if not using lit-html, could be any function | |
template = (data) => html` | |
<div id="job_edit" class="modal"> | |
<div class="modal-content"> | |
${ | |
//we're just going to wrap an anonymous inline function here and then call it with some data | |
(job => { //job here, is just an example, it could be anything, it's passed in below in (data.job) | |
if(job) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this grabs 1000 messages at a time from the history of a specific channel | |
//it spins through each message and compares it with the user id | |
//if it matches, it'll delete the message. | |
//there's a throttle of 1 delete per second so you don't bump against rate limits | |
let Slack = require('slack'); | |
let API_KEY =''; //your API key - get it here: https://api.slack.com/custom-integrations/legacy-tokens | |
let CHANNEL_ID =''; //the channel id you want to delete from. This can be found in the url | |
let USER_ID = ''; //the user id for the user you want to delete. Easiest way to get this is to go to your profile and look in the url. Can also grab it from network traffic in debugger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Create lit-html Web Component Skeleton": { | |
"prefix": "webc", | |
"body": [ | |
"import {html, render} from 'lit-html';", | |
"", | |
"export default class ${1:AppComponent} extends HTMLElement {", | |
" constructor() {", | |
" super();", | |
" }", |