Skip to content

Instantly share code, notes, and snippets.

View dbouwman's full-sized avatar
😎
Hubbin it up @ Esri

Dave Bouwman dbouwman

😎
Hubbin it up @ Esri
View GitHub Profile
@dbouwman
dbouwman / arcgis-pages.scss
Created February 18, 2016 23:58
pages scss - minor changes to brighten it up and make it more legible
.arcgis-pages {
width: 250px;
padding: 15px;
background-color: $Calcite_Gray_100;
outline:1px solid #ccc;
.form-group {
margin-bottom: 2px;
.form-control, .form-control[readonly], .dropdown-menu, .btn-default {
border: 1px solid $gray-light;
@dbouwman
dbouwman / app.scss
Created February 18, 2016 15:59
admin namespacing scss
/* Vars that are needed in some of the other imports and
would normally come from calcite, but we are not including it
in this site */
$Calcite_Gray_050: #ffffff; // white
$Calcite_Gray_700: #323232; // 80%, previously Esri_Gray160
/* set the output folder for fonts */
body{
@dbouwman
dbouwman / PATCH-payload.json
Last active February 16, 2016 23:39
Example payload to /api/v2/sites/:id
{
"data": {
"attributes": {
"draft": "{\"layout\":{\"cards\":[{\"x\":0,\"y\":0,\"width\":12,\"height\":5,\"component\":{\"name\":\"jumbotron-card\",\"minWidth\":12,\"editor\":\"jumbotron-card-editor\",\"settings\":{\"header\":\"Hello World!\",\"subheader\":\"This is our Open Data website\",\"imageUrl\":\"http://cdn.playbuzz.com/cdn/32046b2f-38d4-4a82-8634-e1a72dd8f6ac/3bd0af20-55a4-48d7-84ea-7ffb29680186.jpg\",\"showLocation\":true}}},{\"x\":0,\"y\":9,\"width\":6,\"height\":10,\"component\":{\"name\":\"markdown-card\",\"settings\":{\"markdown\":\"# Hello World \\n Lets not be stupid about this. But we need images and other things of goodness \\n \\n <img src=\\\"http://assets.pokemon.com/assets/cms2/img/pokedex/full/025.png\\\"/><hr>\\n### And Lists \\n - of good things\\n- and bad\"}}},{\"x\":4,\"y\":5,\"width\":6,\"height\":4,\"component\":{\"name\":\"placeholder-card\"}}],\"header\":{\"title\":\"My Super Site\",\"logoUrl\":\"http://omgnikki.com/wp-content/uploads/2015/03/sm-icon_pin.png\",\"ful
{
"version": "2",
"header": {
"title": "VizWit",
"description": "Lorem ipsum dolor sit amet"
},
"cards": [
{
"x": 0,
"y": 0,
@dbouwman
dbouwman / vizwit-test.json
Created January 5, 2016 20:22
Hacking with VizWit
{
"version": "2",
"header": {
"title": "VizWit",
"description": "Lorem ipsum dolor sit amet"
},
"cards": [
{
"x": 0,
"y": 0,
@dbouwman
dbouwman / logUiEvent.js
Created January 28, 2014 03:33
logUiEvent method
/**
* Wrapper to send Events to Google Analytics
* @param {string} action Action we are logging. lower-case
* @param {string} category standardized event categories
* @param {string} label optional description
*/
logUiEvent: function(action, category, label){
var lb = label || '';
//check for google analytics
if(window.ga){
@dbouwman
dbouwman / logPageView.js
Created January 28, 2014 03:30
logPageView method
/**
* Wrapper that allows us to log pageviews
* in our SPA
*/
logPageView: function(route){
//check if google analytics is loaded
if(window.ga){
//send the pageview details
ga('send','pageview', route);
}
@dbouwman
dbouwman / App-Navigate.js
Created January 28, 2014 03:28
Application.navigate function with logging
//App.navigate should be called over direct calls to the Backbone.history object
navigate: function(route, options){
//log the pageview
this.logPageView(route);
var ops = options || {};
//store the previous route
this._previousRoute = this.getCurrentRoute();
//call the underlying backbone method
Backbone.history.navigate(route, ops);
},
@dbouwman
dbouwman / constructor.spec.js
Created January 12, 2014 14:49
Testing a constructor
describe('constructor', function () {
it('throws without an id', function() {
//this is sligtly obtuse formatting, but expect() requires a function
//and new Something is not a function, so we wrap it.
expect(function(){var m = new Composer.Models.Dataset();}).toThrow();
});
it('does not throw with an id', function() {
var f = function(){
@dbouwman
dbouwman / ajax-mock.spec.js
Created January 12, 2014 14:34
Using a mock to test the full fetch method, without a server
describe('loads itself from the service', function () {
beforeEach(function() {
json = getJSONFixture('entities/Dataset/dataset.json');
var response = {
status: 200,
responseText: JSON.stringify(json)
};
jasmine.Ajax.useMock();
model = new Composer.Models.Dataset({id:json.data.id});
model.fetch();