Skip to content

Instantly share code, notes, and snippets.

{
"_id" : ObjectId("56dddbda8a09bc202b05fb47"),
"FIELD1" : "ASINC0000710793",
"HPD_SUBMITTER" : "blah",
"person_id" : "PPL000000021124",
"Resolved_date" : "2014-04-17 05:07:19.000",
"owner_group" : "Service Desk - Incident Management Team",
"submitter" : "blah",
"submit_date" : "2014-04-17 05:07:32.000",
"reported_date" : "2014-04-17 05:06:06.000",
if (Meteor.isClient) {
Template.chart.rendered = function () {
var yelp_data, ndx;
var template = this;
console.log('autorun is called');
template.subscribe("yelp", function(){
});
@eugene-goldberg
eugene-goldberg / gist:ee694ee7ee6121fbec46
Created June 27, 2015 03:17
update and/or insert a nested document
app.post('/salesforce_update', function(req, res){
console.log('Salesforce DC update Request Received');
console.log('request body: ' + req.body);
MongoClient.connect(url, function (err, db) {
if (err) {
console.log('Unable to connect to the mongoDB server. Error:', err);
} else {
@eugene-goldberg
eugene-goldberg / gist:be5701376cef0e70545f
Created June 23, 2015 13:58
PowerPoint slide layout
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div style="position: absolute; top: 5px;left:5px; height: 50px;width: 793px; background-color: #3c2a59;color: #efefef">Header</div>
<div style="position: absolute; top: 60px;left: 5px; height: 140px;width: 150px; background-color: #efefef"></div>
<div style="position: absolute; top: 210px;left: 5px; height: 40px;width: 150px; background-color: #3c2a59;color: #efefef"></div>
'use strict';
/**
* Module dependencies.
*/
var fs = require('fs'),
http = require('http'),
https = require('https'),
express = require('express'),
morgan = require('morgan'),
'use strict';
/**
* Module dependencies.
*/
var fs = require('fs'),
http = require('http'),
https = require('https'),
express = require('express'),
morgan = require('morgan'),
module.exports = function(grunt) {
// Unified Watch Object
var watchFiles = {
serverViews: ['app/views/**/*.*'],
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
clientViews: ['public/modules/**/views/**/*.html'],
clientJS: ['public/js/*.js', 'public/modules/**/*.js'],
clientCSS: ['public/modules/**/*.css'],
mochaTests: ['app/tests/**/*.js']
};
@eugene-goldberg
eugene-goldberg / gist:426dcca9ff98ec33ff0a
Created January 27, 2015 20:59
django rest framework
I have the following two models: Blueprint and Workload.
The Blueprint model instance should have a collection of Workloads associated with it.
Initially, bot the Blueprint and Workload instances should be allowed to be created independently.
A complete typical scenario as follows:
1) a new Blueprint instance is created
2) a new Workload instance is created
3) the created Workload instance is added to the Blueprint's 'workloads' collection
The python REPL version is this:
models:
class Blueprint(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=120)
description = models.TextField()
# workloads = models.ManyToManyField('Workload', db_constraint=False)
# workloads = models.ManyToManyField('self', null=True)
class Meta:
resources:
class BlueprintResource(ModelResource):
# workloads = ManyToManyField(Workload, 'workloads')
workloads = fields.ManyToManyField('catalog.api.WorkloadResource', attribute='workloads',
full=True, null=True)
def obj_create(self, bundle, request=None, **kwargs):
return super(BlueprintResource, self).obj_create(bundle, request)