Skip to content

Instantly share code, notes, and snippets.

View awilson28's full-sized avatar

Ayana Wilson awilson28

  • United States
View GitHub Profile
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion
export PATH=/usr/local/bin:$PATH
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("sk_test_lgbvEqHnmqpoLJ8ZwBjded8X");
// Token is created using Stripe.js or Checkout!
// Get the payment token submitted by the form:
var token = request.body.stripeToken; // Using Express
// Create a Customer:
stripe.customers.create({
function changeStuff(num, obj1, obj2){
num = num * 10; // num is the value 10; once passed to the function, it has no relation to the variable `num` outside the function
obj1.item = “changed”;
obj2 = {item: “changed”};
}
var num = 10;
var obj1 = {item: “unchanged”};
var obj2 = {item: “unchanged”};
var a = [1, 2, 3];
var c = a;
function doSomething(b){
// b is a copy of a reference to the array a
b.push(4);
console.log(b) // [1, 2, 3, 4]
}
doSomething(a);
var a = [1, 2, 3];
function doSomething(b){ // the parameter `b` that corresponds to the argument `a` is a copy of a reference to the array a
b = [2]; //if we change b via reassignment inside a function or outside of the function, that reassignment does not affect a
console.log(b) // [2]
}
doSomething(a);
console.log(a) // [1, 2, 3]
function changeStuff(num, obj1, obj2){
num = num * 10;
obj1.item = “changed”;
obj2 = {item: “changed”};
}
var num = 10;
var obj1 = {item: “unchanged”};
var obj2 = {item: “unchanged”};
function changeStuff(num, obj1, obj2){
num = num * 10;
obj1.item = “changed”;
obj2 = {item: “changed”};
}
var num = 10;
var obj1 = {item: “unchanged”};
var obj2 = {item: “unchanged”};
@awilson28
awilson28 / 0_reuse_code.js
Created March 16, 2016 21:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

ADD JS-DATA TO FSG

npm i js-data npm i js-data-angular add scripts to index html

`<script src="/js-data/dist/js-data.js"></script>`

<script src="/js-data-angular/dist/js-data-angular.js"></script>

add to app.js

'use strict';
var crypto = require('crypto');
var mongoose = require('mongoose'),
extend = require('mongoose-schema-extend');
var Schema = mongoose.Schema;
/*
Example of how to use mongoose-schema extend
User documents and AuthUser documents will be in the same collection/table