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
var fs = require("fs") | |
var ssl_options = { | |
key: fs.readFileSync('privatekey.pem'), | |
cert: fs.readFileSync('certificate.pem') | |
}; | |
var port = process.env.PORT || 3000; | |
var express = require('express'); | |
var ejs = require('ejs'); | |
var passport = require('passport') |
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
#!/usr/bin/env python | |
def gmail_checker(username,password): | |
import imaplib,re | |
i=imaplib.IMAP4_SSL('imap.gmail.com') | |
try: | |
i.login(username,password) | |
x,y=i.status('INBOX','(MESSAGES UNSEEN)') | |
messages=int(re.search('MESSAGES\s+(\d+)',y[0]).group(1)) | |
unseen=int(re.search('UNSEEN\s+(\d+)',y[0]).group(1)) | |
return (messages,unseen) |
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
global with sharing class WarehouseUtil implements Database.Batchable<sObject>, Schedulable { |
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
<apex:component controller="WarehouseChartController"> | |
<apex:attribute name="invoiceID" type="ID" description="The ID of the Invoice holding the Line Items" assignTo="{!invoiceID}"/> | |
<apex:chart data="{!data}" height="400" width="500" background="#F5F5F5"> | |
<apex:legend position="left"/> | |
<apex:pieSeries labelField="name" dataField="data" donut="10"> | |
<apex:chartLabel display="middle" orientation="vertical" font="bold 18px Helvetica"/> | |
</apex:pieSeries> | |
</apex:chart> | |
</apex:component> |
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
public with sharing class SpeedTestController { | |
@AuraEnabled | |
public static List< SpeedTest__c > getData() { | |
List<SpeedTest__c> speeds = [SELECT ID, TimeString__c,Download__c,Upload__c from SpeedTest__c LIMIT 1000]; | |
return speeds; | |
} | |
} |
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
/* | |
In the Programmers workbook there is a tutorial on creating a basic REST endpoint using Apex. A common scenario with these | |
endpoints is needing to enhance the message that gets sent down to client. You can do this easily within Apex by defining | |
a custom class to use as a response, which will be converted to JSON by the platform. | |
To complete this extra credit: | |
1. Create a class from the code below | |
2. Update the POST and DELETE endpoints to use the RESTMessage class | |
3. Test the new endpoint with unit test in the next class | |
*/ |
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
trigger MonkeyChatter on FeedItem (after insert) { | |
//Get the key prefix for the Opportunity object via a describe call. | |
String keyPrefix = Monkey__c.sObjectType.getDescribe().getKeyPrefix(); | |
List<Id> relatedIds = new List<Id>(); | |
for(FeedItem f : Trigger.new) { | |
if(String.valueOf(f.parentId).startsWith(keyPrefix)) { //is a Monkey | |
if(f.body.contains('#givebanana')) { | |
relatedIds.add(f.parentId); | |
} |
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
var sfStrategy = new ForceDotComStrategy({ | |
clientID: CF_CLIENT_ID, | |
clientSecret: CF_CLIENT_SECRET, | |
callbackURL: CF_CALLBACK_URL, | |
authorizationURL: SF_AUTHORIZE_URL, | |
tokenURL: SF_TOKEN_URL | |
//the current sample lists the first param as "Token", but it's really an OAuth object Look at the params field on it. | |
}, function(oauth, refreshToken, profile, done) { | |
// asynchronous verification, for effect... |
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
global class PageHitsController implements Messaging.InboundEmailHandler { | |
public PageHitsController() { | |
} | |
public Document document { | |
get { | |
if (document == null) | |
document = new Document(); |
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
global class RSSHandler implements Schedulable { | |
global RSSHandler() { | |
} | |
global void execute(SchedulableContext c) { | |
updateDeveloperBlog(); | |
} | |
NewerOlder