Skip to content

Instantly share code, notes, and snippets.


Charles Koppelman-Milstein ckoppelman

View GitHub Profile
ckoppelman / commit-msg
Last active Dec 18, 2015
Githook for requiring a JIRA issue in the commit message like [REALM-1234]. Place this in .git/hooks/
View commit-msg
message=`cat $1`
prevLang=`echo $LANG` # this will get reset once we're done here
# The Portable-Git that comes with Github for Windows has a bash version of 3.1.0,
# so it doesn't understand regex matching. Use pattern matching instead.
# regex="(\[[A-Z]{2,5}-[0-9]{1,6}\]|\[NO-ISSUE\])"
ckoppelman / .gitconfig
Created Aug 11, 2015
A filter for .gitconfig to ignore logos in the application files (Salesforce)
View .gitconfig
# it's quite annoying to change from sandbox to production
# in the same directory unless you have this filter installed
# To make use of it, add the following line to your .gitattributes file:
# *.app filter=ignore_logo
[filter "ignore_logo"]
clean = sed '/<logo>/'d
smudge = cat
ckoppelman / sandbox-pill.css
Last active Nov 16, 2015
Creates a floating pill of the Sandbox name or else the environment. To be used with Stylish
View sandbox-pill.css
@namespace url(;
@-moz-document domain("") {
* this is where SFDC keeps the "Sandbox: xxx" message.
* the .messages element is empty if it's not a sandbox
#phHeader .messages .pageMsg.textOnly.normalImportance,
#phHeader .messages:empty::after {
ckoppelman / A.markdown
Last active Mar 24, 2016 — forked from larrybotha/A.markdown
Fix SVGs not scaling in IE9, IE10, and IE11
View A.markdown

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

IE9, IE10, and IE11 don't properly scale SVG files added with img tags when viewBox, width and height attributes are specified. View this codepen on the different browsers.

Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.

ckoppelman / salesforce_version.rb
Last active Jul 5, 2016
Find the "API version" for an arbitrary Salesforce release name and vice versa.
View salesforce_version.rb
to_version_string=->v{%w{spring summer winter}[v.to_i%3] + ' ' + (2005+(v.to_i-2)/3).to_s}
no_apostrophe = s.sub(?', '20')
season, year = no_apostrophe.split(' ')
(2+(year.to_i-2005)*3 + %w{wi sp su}.index(season.downcase[0,2])).to_s + '.0'
View TriggerUtilities.cls
public class TriggerUtilities {
private TriggerUtilities() {
public static Boolean hasAnyFieldChanged(SObject newObj, Map<Id, SObject> oldMap, List<Schema.SObjectField> flds) {
for (Schema.SObjectField fld : flds) {
if (hasFieldChanged(newObj, oldMap, fld)) {
return true;
import nltk
from nltk.tokenize.treebank import TreebankWordTokenizer
class TreebankSpanTokenizer(TreebankWordTokenizer):
def __init__(self):
self._word_tokenizer = TreebankWordTokenizer()
def span_tokenize(self, text):
View interactionlog.js
var lastIdList = [];
var getAllCallData = function (idList, knownData, callback) {
var deferreds = (id) {
var matchedEl = null;
if (knownData) {
matchedEl = knownData.find(function (el) { return === id; });
if (matchedEl) {
return matchedEl;
View SchemaUtils.cls
public class SchemaUtils {
static final Set<String> UNCHANGEABLE_FIELDS = new Set<String>{
'CreatedById', 'CreatedDate',
'LastModifiedById', 'LastModifiedDate',
'SystemModstamp', 'IsDeleted'
static final String TOOLING_API_QUERY_FORMAT = (
' SELECT Id, Metadata ' +
' FROM FieldDefinition ' +
View git-rmhunk
# Stages modified hunks matching passed in regex
if [ -z "$PATHS" ]
git diff -U1 | grepdiff "$SEARCH" --output-matching=hunk | git apply --cached