Skip to content

Instantly share code, notes, and snippets.

@chadwilcomb
chadwilcomb / find_malformed_geometries.js
Created May 4, 2017 18:55
Script to run through a Mongo collection with some malformed geometries and flag and unset the geometries
for (i = 0; i < 139; i++) {
db.basemap_clean.ensureIndex({ geometry: "2dsphere" })
db.basemap_features
.find({ clean: { $exists: 0 } }, { "geometry": 1 })
.limit(500000)
.forEach(function (feature) {
db.basemap_clean.insert(feature);
});
db.basemap_clean
.find()
@chadwilcomb
chadwilcomb / cip-api.md
Last active August 29, 2015 14:23
CIP 2.0 API Docs

Dashboards

List your dashboards

List dashboards for the authenticated user.

GET /user/dashboards
@chadwilcomb
chadwilcomb / bootstrap-collapse-simple.html
Created February 13, 2015 16:25
Simple Boostrap Collapse - individually collapsable
<div class="panel panel-default">
<div class="panel-heading" id="heading1" role="tab" data-toggle="collapse" data-target="#collapse1" aria-expanded="true" aria-controls="collapse1">
<h4 class="panel-title">
Collapsible Group Item #1
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading1">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainabl
@chadwilcomb
chadwilcomb / ajax-switch-case.js
Last active July 23, 2022 17:04
Ajax switch case
switch(App.LocationSearchType) {
case 'map':
return false;
case 'stretch':
if (onB7SC && fromB7SC && toB7SC) {
doAjax = true;
url = globals.virtualName + '/Geosupport/GetStretchLocations/';
data = {
onStreetCode: onB7SC,
fromStreetCode: fromB7SC,
@chadwilcomb
chadwilcomb / backbone-nested-view.js
Last active August 29, 2015 14:15
Backbone Nested Views
//[Taken from Sam Breed's talk at BackboneConf III] (http://youtu.be/QqSHrpro02g?t=21m15s)
//Parent View
App.Views.ParentView = Backbone.View.extend({
renderChildView: function (model) {
var view = this.children[model.cid];
if (view === undefined) {
view = this.children[model.cid] = new App.Views.ChildView({ model: model });
}
return view.render().$el;
@chadwilcomb
chadwilcomb / npm-debug.log
Last active August 29, 2015 14:14
karma-browserify install error log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'karma-browserify' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 warn package.json [email protected] No README data
6 warn package.json [email protected] No repository field.
@chadwilcomb
chadwilcomb / backbone-override-save.js
Last active August 29, 2015 14:01
Backbone.js: have server return partial view after model.save event
save: function () {
var _this = this;
this.model.save(null, {
error: function (model, response, options) {
//Backbone save goes to error if response is not JSON
if (response.status === 200) {
//check response code and then manually render view with response HTML
_this.$el.html(response.responseText);
}
}