Skip to content

Instantly share code, notes, and snippets.

View robbieferrero's full-sized avatar

Robbie Ferrero robbieferrero

View GitHub Profile
@robbieferrero
robbieferrero / gist:5892231
Created June 29, 2013 18:55
record deletion test
it('should notify Record Deleted on deletion', function() {
spyOn(UserNotification, 'notifyShort');
spyOn(Utility, 'prompt').andReturn(resolveDummyPromiseAsync());
var task = new Task({
id: '1',
activitydate: moment().add('months', 1).format("YYYY-MM-DD")
});
var test = ListHelper.editFormFor(task, 'Test Deletion');
var form = $('#modal-edit-form');
form.find('.delete-object').trigger('vclick');
@robbieferrero
robbieferrero / gist:5776511
Last active December 18, 2015 11:29
angular widont filter
filter('widont', function() {
return function(text) {
return text.replace(/([^\s])\s+([^\s]+)\s*$/, "$1 $2")
}
});
@robbieferrero
robbieferrero / dice.js
Created September 30, 2012 20:32
Dice notation roller
var dice = function(d) {
var a = d.split('d'),
result = 0,
num = (typeof (a[0]-0) === 'number') ? a[0] : 1,
op = (a[1].match(/[\-\+]/)),
max = (op === null) ? a[1] : a[1].split(op[0])[0],
mod = (op !== null) ? op[0] + ' ' + a[1].split(op[0])[1] : '';
for (var i = num; i >= 0; i--) {
result += (Math.floor(Math.random() * (max)) + 1)
}
@robbieferrero
robbieferrero / dabblet.css
Created March 6, 2012 20:06
image replacement technique
p {
background: url(http://www.google.com/images/errors/robot.png) no-repeat 0 0;
height: 400px;
width: 300px;
font: 0/0 a;
color: transparent;
text-shadow: none
}