Skip to content

Instantly share code, notes, and snippets.

View charltonAthletic's full-sized avatar

Andy Hitchings charltonAthletic

View GitHub Profile
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
@bussiere
bussiere / citations
Created December 24, 2010 10:16
citations quote informatic informatique quotes computer science
“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill
“In order to understand recursion, one must first understand recursion.” – Author Unknown
“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.” – Bjarne Stroustrup
“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.” – Mitch Ratcliffe
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -C.A.R. Hoare
“The gap between theory and practice is not as wide in theory as it is in practice.” – Author Unknown
“If builders built buildings the way progra
@richardvanhook
richardvanhook / ApexOrg2Org
Created September 27, 2011 13:43
Apex code demonstrating how to log in from one salesforce org to another
/*
======================================================================
The following apex code demonstrates logging into another salesforce
org via the SOAP/XML web service api and then using session id to
query the standard REST API as well as the Chatter REST API.
To run this code, simply copy and paste into execute anonymous,
then replace the value of the first three variables accordingly.
NOTES:
(1) You'll need to create a remote site setting for both the login
@abhinavguptas
abhinavguptas / streamingNotifications.html
Created February 12, 2012 13:34
Force.com Streaming API Chrome Desktop Notifications
<apex:page sidebar="false" tabStyle="Account">
<apex:includeScript value="{!URLFOR($Resource.comet, 'cometd.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.comet, 'jquery-1.5.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.comet, 'jquery.cometd.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.comet, 'json2.js')}"/>
<style type="text/css">
#chatterNotificationPanel {
display: none;
}
@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
@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",
@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';
@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/*",
@davfre
davfre / git_cheat-sheet.md
Last active February 12, 2025 06:24
git commandline cheat-sheet
@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