Skip to content

Instantly share code, notes, and snippets.

View superfell's full-sized avatar
🐶
Say hi to your dog for me

Simon Fell superfell

🐶
Say hi to your dog for me
View GitHub Profile
@superfell
superfell / update.chatter
Created February 26, 2011 04:35
A git update hook that will post commit messages to a salesforce.com chatter feed, rename this to update (and add beatbox.py & xmltramp.py) into .git/hooks and off you go
#!/usr/bin/env python
from subprocess import Popen
from subprocess import PIPE
import sys
import beatbox
# credentials to login to salesforce.com with
username = "user@example.org"
password = "Password[And Security Token If Needed]"
@superfell
superfell / gist:1287653
Created October 14, 2011 16:52
deserialize json to map with Apex
String j = '{ "bob": "bobby" }';
Map<String, String> b = (Map<String,String>) JSON.deserialize(j, Map<String,String>.class);
System.debug(b);
public class Data {
public Boolean installed;
public String id;
}
public class Paging {
public String next;
}
public class Root {
//
// Generated by JSON2Apex http://json2apex.herokuapp.com/
//
public class JSON2Apex {
public class TagDimensions_Z {
public Pro Pro;
}
@superfell
superfell / gist:11231957
Created April 23, 2014 20:51
SObject == issue in apex
Account a1 = new Account(name = 'woop');
Account a2 = new Account(name = 'woop');
Account a3 = (Account)JSON.deserialize('{"name" : "woop"}', Account.class);
Account a4 = (Account)JSON.deserialize(JSON.serialize(a1), Account.class);
System.debug( a1 == a2 ); // true
System.debug( a1 === a2); // false
System.debug( a3 == a1 ); // true
System.debug( a4 == a1 ); // false but should be true
System.debug( a3 == a4 ); // false but should be true
@superfell
superfell / main.go
Created July 22, 2015 17:15
raft election
package main
import (
"fmt"
"io"
"net"
"os"
"path/filepath"
"strconv"
"time"
Process: Fitbit Connect Menubar Helper [3804]
Path: /Applications/Fitbit Connect.app/Contents/MacOS/Fitbit Connect Menubar Helper.app/Contents/MacOS/Fitbit Connect Menubar Helper
Identifier: com.fitbit.GalileoMenubar
Version: 2.0.1.6761 (2.0.1.6761)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Fitbit Connect Menubar Helper [3804]
User ID: 501
Date/Time: 2016-10-15 15:26:02.723 -0700
package main
import (
"bytes"
"flag"
"fmt"
"log"
"os"
"sync"
"time"
@superfell
superfell / sketch.ino
Created March 4, 2018 19:46
ESP2866 triggering a WiFi LED Controller
#include <ESP8266WiFi.h>
//////////////////////
// WiFi Definitions //
//////////////////////
const char WiFiName[] = "<a network>";
const char WiFiPwd[] = "<a password>";
///////////////////////////
// LED Light Controller //
@superfell
superfell / sketch.ino
Created March 5, 2018 02:55
ESP2866 trigger LED Light Controller on button push, Stays in low power/deepSleep mode until button is pressed.
#include <ESP8266WiFi.h>
//////////////////////
// WiFi Definitions //
//////////////////////
const char WiFiName[] = "<network>";
const char WiFiPwd[] = "<password>";
///////////////////////////
// LED Light Controller //