Skip to content

Instantly share code, notes, and snippets.

View charltonAthletic's full-sized avatar

Andy Hitchings charltonAthletic

View GitHub Profile
@KorbenC
KorbenC / LoC.cls
Created October 3, 2014 13:14
Counts the lines of apex code in org, combined both class and triggers.
Integer classLines = 0;
Integer triggerLines = 0;
for(ApexClass a : [Select Body From ApexClass]){
List<String> lines = a.Body.split('\n');
classLines += lines.size();
}
for(ApexTrigger a : [Select Body From ApexTrigger]){
List<String> lines = a.Body.split('\n');
@etoxin
etoxin / git.md
Last active April 2, 2025 04:54
GIT Bash Commands

search (regex)

git grep "regex"

list all branches

git branch -a
@jeffdonthemic
jeffdonthemic / httparty.rb
Last active October 9, 2024 19:03
HTTParty Examples
options = { :body =>
{ :username => 'my',
:password => 'password'
}
}
results = HTTParty.post("http://api.topcoder.com/v2/auth", options)
##
## example for post with papertrail and basic auth
##
@Todd-HPRelate
Todd-HPRelate / CreatePDFControllerExtension.cls
Created June 24, 2014 21:03
Example Visual Force Page and Apex code to create a button in Salesforce that will automate the PDF creation using the 'Account' standard object in HP Relate.
<!------------------------------------------------------------------------------------
CreatePDFControllerExtension.cls
Example Apex code to create a button in Salesforce that will automate the PDF creation using the 'Account' standard bject
(c) Copyright 2014 HEWLETT-PACKARD COMPANY
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warrant of any
kind, to the fullest extent permitted by law. Both Hewlett-Packard Company and I do not warrant or
@raineorshine
raineorshine / bash-essentials.sh
Created March 31, 2014 18:03
Bash Cheat Sheet: Just the Essentials (13 Commands). See https://gist.github.com/6927510 for more.
man COMMAND # Look up help for the given command
pwd # Print working directory
cd MYDIR # Change directory to MYDIR
cd ~/ # Change directory to user root (/Users/USERNAME)
cd .. # Change directory up a level
mkdir NEWDIR # Create a new directory in the current folder called NEWDIR
cp FROM_FILE TO_FOLDER # Copy FROM_FILE into TO_FOLDER
cp -r FROM_DIR TO_FOLDER # Copy FROM_DIR into TO_FOLDER
@davfre
davfre / git_cheat-sheet.md
Last active February 12, 2025 06:24
git commandline cheat-sheet
@keirbowden
keirbowden / Streaming.component
Last active July 23, 2017 10:30
Visualforce component to display browser notifications when a case is updated that is owned by the currently logged in user
<apex:component >
<apex:attribute name="topic" description="The topic name" type="String" required="true"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/cometd.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/jquery-1.5.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/json2.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.streaming, 'streaming/jquery.cometd.js')}"/>
<script type="text/javascript">
(function($){
$(document).ready(function() {
$.cometd.addListener("/meta/*",
@joshbirk
joshbirk / 1_streaming.cls
Last active July 23, 2017 10:25
A Streaming API / jQuery example
//clear old ones out
List<PushTopic> pts = [SELECT ID, Name From PushTopic WHERE Name = 'Merchandise'];
delete pts;
PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'Merchandise';
pushTopic.Description = 'All records for the Account object';
pushtopic.Query = 'SELECT Id, Name, Quantity__c FROM Merchandise__c WHERE Quantity__c < 50';
pushTopic.ApiVersion = 26.0;
pushTopic.NotifyForOperations = 'All';
@tdreyno
tdreyno / airports.json
Created December 13, 2012 18:50
JSON data for airports and their locations
This file has been truncated, but you can view the full file.
[
{
"code": "AAA",
"lat": "-17.3595",
"lon": "-145.494",
"name": "Anaa Airport",
"city": "Anaa",
"state": "Tuamotu-Gambier",
"country": "French Polynesia",
"woeid": "12512819",
@mbostock
mbostock / .block
Last active March 20, 2025 03:48
Force-Directed Graph
license: gpl-3.0
height: 600
redirect: https://observablehq.com/@d3/d3-force-directed-graph