Skip to content

Instantly share code, notes, and snippets.

@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;
@hiroshi-maybe
hiroshi-maybe / bubbleSort.js
Created January 26, 2013 11:57
Bubble sort implemented with Javascript.
var bubbleSort = function(array) {
for (var i=0, length=array.length; i<length; i+=1) {
for (var j=0; j<array.length-i-1; j+=1) {
if (array[j]>array[j+1]) {
var smallNum = array[j+1];
array[j+1]=array[j];
array[j]=smallNum;
}
}
}