Skip to content

Instantly share code, notes, and snippets.

View mdhorine's full-sized avatar

Matthew Horine mdhorine

  • Teach For All
  • London
View GitHub Profile
@mdhorine
mdhorine / Assignment1.R
Created May 30, 2018 22:17
SNA - Assignment 1
###################################
## Social Network Analysis ##
## Module 1 Assignment ##
## Author: mhorine ##
###################################
# Load the igraph library
library(igraph)
# Load the edgelist and examine the data
@mdhorine
mdhorine / Google Stacked Bar Chart Example
Created September 5, 2016 09:30
Example of a stacked bar chart to replicate a funnel chart.
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load the Visualization API and the material barchart package.
google.charts.load('current', {'packages':['corechart', 'bar']});
// Set a callback to run when the Google Visualization API is loaded.
@mdhorine
mdhorine / Email Affiliated Contacts
Created January 28, 2015 13:50
Email Affiliated Contacts button for use with Salesforce NPSP
/**************************************************
/ Button: Email Affiliated Contacts /
/ Author: Matt Horine /
/ Client: Step Up to Serve /
/ Date: 28 January 2015 /
/ /
/ Description: Button on Affiliated Contacts /
/ related list to allow selection and email of /
/ affiliated contacts from the Account Page in /
/ the same way the Send an Email button allows /
@mdhorine
mdhorine / Duplicate Trigger Test Class
Created August 15, 2014 10:13
Test class for the Duplicate Trigger
@isTest
private class DuplicateTriggerTest {
@isTest static void testDuplicateTrigger() {
/* This test class creates 200 test contacts, creates a second list which is copy
copy of the first, and then inserts both into the database. The second insert
uses Database calls to get the IDs of the inserted contacts (which should all
be duplicates). Then we make a SOQL call to the database to get the duplicate
flag for those contacts and make sure it was set to true prior to insert.
@mdhorine
mdhorine / Duplicate Trigger (before insert)
Last active August 29, 2015 14:05
Sample code for an Apex trigger that checks for duplicates before insert and setting a duplicate flag if a duplicate exists in the database.
trigger DuplicateCheckTrigger on Contact (before insert) {
/* For this example, we will search by name and a unique ID prior
to a new contact being inserted. If a contact is found, the
duplicate flag is set and the contact is then inserted into the
database.
*/
/* For before insert triggers, you are intercepting a group of contact
records to be inserted and then modifying the data. At the end of
the trigger all records in trigger.new are inserted into the database,