Skip to content

Instantly share code, notes, and snippets.

View meetzaveri's full-sized avatar

Meet Zaveri meetzaveri

View GitHub Profile

Script for .zip build

Paste this into package.json in scripts tag

"build": "zip -r listuserLambda.zip * -x *.zip"

Add-ons and config vars If an add-on is created for an application, it will typically create one or more config vars for that application. These config vars may be updated by the add-on - the exact values can change if the add-on service provider needs to change them.

See Add-on values can change to learn more about add-ons and how config vars are used.

Limits Config var data (the collection of all keys and values) is limited to 32kb for each app. Config var names should not begin with a double underscore (__). The HEROKU_ namespace is reserved for config vars set by the Heroku platform in order to offer functionality. Example

Helper Functions

ObjectToArray

function objectToArray(obj) {
  var keys = Object.keys(obj);
  var routeGeoJSON = keys.map(function(key) {
    return obj[key];
 });
const genRandomString = function(length){
return crypto.randomBytes(Math.ceil(length/2))
.toString('hex') /** convert to hexadecimal format */
.slice(0,length); /** return required number of characters */
};
const sha512 = function(password, salt){
var hash = crypto.createHmac('sha512', salt); /** Hashing algorithm sha512 */
hash.update(password);
var value = hash.digest('hex');
return {

Open Source projects I can work on

  • Write a Book (user can write,edit and download it via pdf).
  • Create a Book Sharing Business Model
@meetzaveri
meetzaveri / GlobalScopeInVue.md
Created March 23, 2018 08:01
Adding Instance Properties in Vue

Base Example

There may be data/utilities you’d like to use in many components, but you don’t want to pollute the global scope. In these cases, you can make them available to each Vue instance by defining them on the prototype:

Vue.prototype.$appName = 'My App'

Now $appName is available on all Vue instances, even before creation. If we run:

new Vue({
  beforeCreate: function() {
    console.log(this.$appName)

Diffing

first off there's no first class concept in vue of "navigating" to a component. There is a concept of "mounting" and "unmounting" components from the vdom tree, though. When reactive data changes, and vue rerenders the tree, it will do a diff of the old tree, to the new tree. At this point it may 1) unmount a component which does not appear in the new tree 2) mount a component that appears in the new tree, but not the old 3) rerender a component which is in both, but who's props have changed

Adding a key will make vue consider two vnodes as different

So the ultimate question is, will vue be mounting your component, and this totally depends on how your routes are setup. spock_vue1