Skip to content

Instantly share code, notes, and snippets.

View zachelrath's full-sized avatar

Zach McElrath zachelrath

View GitHub Profile
@nmn
nmn / VerExBabelPlugin.js
Last active January 21, 2016 03:40
A work in progress to make a Babel plugin that compiles VerbalExpression (nice library to create RegEx) into proper RegEx's at compile time
import VerEx from 'verbal-expressions';
const eventualCallIs = name => {
// FOR PERF
const boundCheck = node =>
node.type === 'Identifier' && node.name === name ||
node.type === 'MemberExpression' && boundCheck(node.object) ||
node.type === 'CallExpression' && boundCheck(node.callee)
return boundCheck;
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@amphro
amphro / RunNSTests.js
Last active December 30, 2015 23:49
Run an org's namespace tests from the developer console. Just open the browser's Javascript console and past the code in. Update: Will now use an unsupported servlet instead of the Tooling API to prevent compilation if the SymbolTables are not in the cache. To use the Tooling API, change line 115/116.
function runNamespacedTest(namespace) {
var thisOrgsNs = SfdcDevConsole.hasNamespace() ? SfdcDevConsole.namespace : '';
var ns = namespace || thisOrgsNs;
function log(msg) {
if (console && console.log) console.log(msg);
}
function showErrorMessage() {
Ext.Msg.alert('Running namespaced tests failed', 'Please look at the javascript console for more information.');