Using json.dump() with Python 2, indent argument is limited to number of spaces only - no ability for tabs use.
Class JSONTabIndentFileWriter provides a file-like object which will rewrite json.dump() output indending from spaces to tabs.
Using json.dump() with Python 2, indent argument is limited to number of spaces only - no ability for tabs use.
Class JSONTabIndentFileWriter provides a file-like object which will rewrite json.dump() output indending from spaces to tabs.
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| /* | |
| * JSUtil already has some utility functions, Some more utility functions. | |
| * Written by [email protected] | |
| * Re-written for Service Now from underscore.js: http://underscorejs.org/ | |
| * | |
| */ | |
| var JSUtil2 = Class.create(); |
Console output too chatty?
Set com.glide.util.Log.developer_filter = true to cut down on non-interactive console log entries such as scheduled workers. (Don't forget to remove it when you're done!)
Note: Fast! These don't need a database.
| /** | |
| * @description Converts between JSON Objects and GlideRecords | |
| * @namespace | |
| * @type {Class} | |
| */ | |
| var JSONtoGlide = Class.create(); | |
| JSONtoGlide.prototype = { | |
| /** | |
| * @description Converts an object into a new GlideRecord | |
| * @param {Object} json A json object |
A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.
There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.
Libraries are sorted by github popularity.
| /** | |
| * Remove all specified keys from an object, no matter how deep they are. | |
| * The removal is done in place, so run it on a copy if you don't want to modify the original object. | |
| * This function has no limit so circular objects will probably crash the browser | |
| * | |
| * @param obj The object from where you want to remove the keys | |
| * @param keys An array of property names (strings) to remove | |
| */ | |
| function removeKeys(obj, keys){ | |
| var index; |