Skip to content

Instantly share code, notes, and snippets.

View cassking's full-sized avatar

cassi king cassking

  • San Juan, Puerto Rico
View GitHub Profile
@cassking
cassking / delete-postmaster.pid.md
Created April 6, 2018 13:19 — forked from zulhfreelancer/delete-postmaster.pid.md
Postgres.app: How to delete postmaster.pid file?
$ cd ~/Library/Application\ Support/Postgres/var-10
$ rm -f postmaster.pid
@cassking
cassking / gmail-to-slack-filtered-email.gs
Created January 26, 2016 15:54
sending filtered gmail messages to slack google script
/*
The intent of this script is for posting filtered Gmail messages to Slack.
This script could be used on its own with manually-marked messages, but it
is most useful it when combined with a Gmail filter. The script assumes that
target messages have had a specific label set on them and have been starred.
The Apps Script can then be set to run periodically.
2015/02 cmyers, rush
@cassking
cassking / basic-send-googledoc-to-slack.gs
Created January 26, 2016 15:11
Send Google Doc to Slack Google Script
function createAndSendDocument() {
// Create a new Google Doc named 'Hello, world!'
var doc = DocumentApp.create('Hello, world!');
// Access the body of the document, then add a paragraph.
doc.getBody().appendParagraph('This document was created by Google Apps Script.');
// Get the URL of the document.
var url = doc.getUrl();
@cassking
cassking / send-gmail-to-slack-google-script.gs
Last active January 26, 2016 15:13
Send Gmail to Slack
// You will also need to create a gmail filter to add the 'send-to-slack' label
// to any emails you want sent to slack
function sendEmailsToSlack() {
var label = GmailApp.getUserLabelByName('send-to-slack');
var messages = [];
var threads = label.getThreads();
for (var i = 0; i < threads.length; i++) {
messages = messages.concat(threads[i].getMessages())
@cassking
cassking / post-to-slack-from-wp.php
Created January 26, 2016 15:09
Post to Slack from WordPress
<?php
/**
* Post a message to Slack from WordPress
*
* @param string $message the message to be sent to Slack
* @param string $channel the #channel to send the message to (or @user for a DM)
* @param string $username the username for this bot eg : WordPress bot
* @param string $icon_emoji the icon emoji name for this bot eg :monkey:
*
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-type" /><!-- speak the same language -->
<meta content="width=device-width, initial-scale=1" name="viewport" /><!-- correctly relate screen size to CSS -->
<meta name="HandheldFriendly" content="true" /><!-- BlackBerry, please don't f*** with my page -->
<meta name="apple-mobile-web-app-capable" content="yes"><!-- iPhone save-to-home-screen-able -->
<link rel="icon" href="/images/favicon.png"><!-- bookmarking/favoriting image -->
<meta name="msapplication-TileColor" content="#ffffff"/><!-- Windows 8/Windows phone -->
<meta name="msapplication-TileImage" content="/images/favicon.png"/><!-- Windows 8/Windows phone -->