Skip to content

Instantly share code, notes, and snippets.

View ccoenraets's full-sized avatar

Christophe Coenraets ccoenraets

View GitHub Profile
public with sharing class SlackOpportunityPublisher {
private static final String slackURL = 'YOUR_WEBHOOK_URL';
public class Oppty {
@InvocableVariable(label='Opportunity Name')
public String opptyName;
@InvocableVariable(label='Stage')
public String stage;
}
import {OnInit} from 'angular2/core';
import {Page, NavController, NavParams} from 'ionic/ionic';
import {PropertyDetailsPage} from '../property-details/property-details';
import {PropertyService} from '../../services/property-service';
@Page({
templateUrl: 'build/pages/property-list/property-list.html'
})
export class PropertyListPage {
<html>
<body>
<h1>Real Time Page Views</h1>
<ul id="pageViews"></ul>
<script src="socket.io.min.js"></script>
<script src="jquery-1.8.2.min.js"></script>
<script>
var socket = io.connect('http://localhost:3000');
socket.on('connect', function () {
socket.on('pageview', function (msg) {
public with sharing class SlackOpportunityPublisher {
private static final String slackURL = 'YOUR_WEBHOOK_URL';
@InvocableMethod(label='Post to Slack')
public static void postToSlack(List<Id> opportunityId) {
Id oppId = opportunityId[0]; // If bulk, only post first to avoid overloading Slack channel
Opportunity opportunity = [SELECT Name, StageName from Opportunity WHERE Id=:oppId];
Map<String,Object> msg = new Map<String,Object>();
msg.put('text', 'The following opportunity has changed:\n' + opportunity.Name + '\nNew Stage: *'
@ccoenraets
ccoenraets / temp
Last active August 10, 2016 19:05
[
{
"category": "Cat 1",
"questions": [
{
"points": 100,
"question": "q1",
"answer": "a1"
},
{
@ccoenraets
ccoenraets / server.js
Created October 2, 2012 02:41
nodejs webserver
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(3000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3000/');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const PORT = process.env.PORT || 5000;
app.use(bodyParser.json());
app.use(express.static('www'));
app.get('/property', (req, res) => {
let sql = "SELECT * FROM salesforce.Property__c WHERE Status__c='Available'";
<aura:component controller="CandidateController" implements="force:appHostable">
<ltng:require styles="/resource/slick/slick.css,/resource/slick/slick-theme.css"
scripts="/resource/jquery,/resource/slick/slick.min.js"
afterScriptsLoaded="{!c.doInit}"/>
<aura:attribute name="contacts" type="Contact[]"/>
<div class="carousel">
<aura:iteration items="{!v.contacts}" var="contact">
var express = require('express'),
wine = require('./routes/wines');
var app = express();
app.configure(function () {
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
app.use(express.bodyParser());
});