Skip to content

Instantly share code, notes, and snippets.

{
"name": "can-admin-app",
"version": "0.1.1",
"lockfileVersion": 1,
"dependencies": {
"@types/express": {
"version": "4.0.36",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.0.36.tgz",
"integrity": "sha512-bT9q2eqH/E72AGBQKT50dh6AXzheTqigGZ1GwDiwmx7vfHff0bZOrvUWjvGpNWPNkRmX1vDF6wonG6rlpBHb1A==",
"dev": true
@green3g
green3g / app.html
Created July 5, 2017 15:08
Promise hide show bug
<script type="text/stache" id="component">
{{#if show}}
{{#each data as obj}}
<p>{{obj.value}}</p>
{{/each}}
<p ($click)="refresh">refresh</p>
{{#if promise.isPending}}is pending{{else}}not pending{{/if}}
{{#if data}}<p>we have data {{data.length}}</p>{{/if}}
identify (event) {
this.view.popup.features = [];
// map existing popup promises to es6 promises, so we can use promise.all
const promises = this.view.popup.promises.map((p) => {
return new Promise((resolve) => {
p.then(resolve);
});
});
<!DOCTYPE html>
<html class="no-js" lang="">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
@green3g
green3g / decorateAccessor.js
Created October 20, 2017 13:36
Decorate an esri/core/Accessor with canjs observable symbols
import canSymbol from 'can-symbol';
import observation from 'can-observation';
import get from 'can-util/js/get/get';
/**
* Decorate esri's observable type with canjs methods
* @param {esri/core/Accessor} obj the current object being accessed
* @param {esri/core/Accessor} parent the root parent accessor object
* @param {String} path the path to the value of the object from the parent
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>CanJS</title>
<style>
html,
body,
#viewDiv {
@green3g
green3g / canjs-canjs-deps.js
Last active October 26, 2017 15:20 — forked from phillipskevin/_codemods
codemods
// latest versions from canjs/canjs - make sure `npm install can` first
const canjs = require('can/package.json');
function updateVersions(deps, canjs) {
const newDeps = {};
Object.keys(deps).forEach((key) => {
// if dep exists in canjsDeps, set it to that version
// otherwise, keep existing version
newDeps[key] = canjs[key] || deps[key];
@green3g
green3g / update.js
Last active October 26, 2017 16:21
Landscaper code mod to update canjs dependencies to can-package
// latest versions from canjs/canjs - make sure `npm install can` first
const canjs = require('can/package.json');
const semver = require('semver');
function clean(version){
return version.replace(/\^/, '');
}
/**
* Update packages to canjs core versions, if the canjs version is greater than the current version.
Uncaught RangeError: Maximum call stack size exceeded
at Object.live.html (html.js:50)
at Text.branchRenderer (mustache_core.js:384)
at Text.HTMLSection.targetCallback (html_section.js:120)
at hydrateCallbacks (can-view-target.js:257)
at Object.hydrate (can-view-target.js:276)
at eval (html_section.js:99)
at eval (can-observation.js:589)
at eval (can-stache.js:438)
at eval (html_section.js:51)
@green3g
green3g / stack trace.txt
Created January 12, 2018 20:53
Donejs Errors
index.stache:224 Promise Error
at Promise.promiseThen [as then] (http://localhost:3030/node_modules/can-zone/lib/zones/globals.js:86:26)
at renderInZone (http://localhost:3030/src/index.stache:235:6)
at eval (http://localhost:3030/src/index.stache:91:17)
at Task.run (http://localhost:3030/node_modules/can-zone/lib/zone.js:41:17)
at Zone.run (http://localhost:3030/node_modules/can-zone/lib/zone.js:205:26)
at reattachWithZone (http://localhost:3030/src/index.stache:89:6)
at eval (http://localhost:3030/src/index.stache:326:6)
at tryCatchReject (http://localhost:3030/node_modules/steal/steal.js:1183:30)
(anonymous) @ index.stache:224