Skip to content

Instantly share code, notes, and snippets.

View jrgleason's full-sized avatar

Jackie Gleason jrgleason

View GitHub Profile
cf.save().success(function (cf) {
request(app)
.post('/crowdfunding/sendConfirmationEmail')
.send({
'id': cf.id,
'text': 'test text'
})
.end(function (err, res) {
assert.equal('PENDING', cf.state);
t.rollback();
function Animal(name) {
this.legs = [];
this.name = name;
console.log("Running Constructor " + name);
}
Animal.prototype.sayHello = function() {
var message = "Hello my name is " + this.name + " and I have " + this.legs.length + " legs"
return message;
}
function Dog(name) {
@jrgleason
jrgleason / gist:2fd0d73adca30bb349f8
Created August 5, 2014 17:43
Round negative decimal in Javascript
scope.roundETD = function(etd){
var start = (etd - scope.currentDate.now())/360000;
var fixed = start.toFixed(3);
var rounded = Math.round(fixed)
return Number(rounded+"e-1");
}
@jrgleason
jrgleason / Application.java
Created June 30, 2014 19:12
Example of Spring4 Websocket
package com.gleason.itext;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.PathVariable;
@jrgleason
jrgleason / gist:59ce7c0f02eebc789b23
Created June 25, 2014 18:39
Grails url with params...
<g:set var="myarray" value="[accountId: accountInfo.id,location: i]" />
<a href="${createLink(controller:'billingPreferences', action:'preferences', params:myarray)}">${it?.name?:"&nbsp;"}</a>
@jrgleason
jrgleason / Application.java
Last active August 29, 2015 14:02
Super simple Spring REST service, no Groovy but works with external server as well.
package com.gleason.itext;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.PathVariable;
package com.test.itext;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@jrgleason
jrgleason / javascript
Created May 5, 2014 00:38
Trying to get connect-roles working with my site
connectRule.use(function (req) {
if(typeof req.user !== 'undefined'){
req.user.role.active.contains('admin', function(found) {
console.log("Something was found "+found);
return found;
})
}
else{
return false;
}
exports.index = function(req, res){
db.list('category')
.then(function (result) {
var categories = result.body.results;
var catsArr = new Array();
console.log(JSON.stringify(categories));
for(var i=0,len=categories.length; i<len; i++){
console.log(i);
db.newGraphBuilder()
.get()
@jrgleason
jrgleason / gist:10797297
Created April 16, 2014 01:51
Trying to get Jade to do nice bootstrap rows
each product, pindex in category.products
if((pindex % 3) === 0)
.row
.col-sm-4
+product-sm
// should produce
<row>
<div class="col-sm-4>