This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string objectName = 'Assessment__c'; // Usage: change the object name here | |
Map<String, Schema.SObjectType> gdesc = Schema.getGlobalDescribe(); | |
Sobject objectt = gdesc.get(objectName).newSObject(); | |
Schema.DescribeSObjectResult r = objectt.getSObjectType().getDescribe(); | |
Map<String,Schema.SObjectField> M = r.fields.getMap(); | |
for(String fieldName : M.keySet()) { | |
Schema.SObjectField field = M.get(fieldName); | |
Schema.DescribeFieldResult F = field.getDescribe(); | |
Boolean isFieldreq = F.isCreateable() && !F.isNillable() && !F.isDefaultedOnCreate(); | |
if (isFieldreq) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference - https://mongoosejs.com/docs/transactions.html | |
// "mongoose": "^5.11.2" | |
const assert = require("assert") | |
const mongoose = require("mongoose") | |
const case1 = () => { | |
// Expect Output: | |
// >>> case 1 catch error error.message | |
// >>> case1 finally |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
We want to know how are the companies doing during VOVID19 simply look at their stock price. | |
- scope: ASX companies. AKA comp_list. Based on a ASX official list. | |
1. get the comp_list | |
2. get the price data by requesting yahoo API | |
for comp in comp_list: | |
2.1 get the before_COVID_price | |
2.2 get the current_price | |
3. get the price_change_percentage by compare result of 1&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hello world | |
> A testing blog writen by gist.github.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj1 = {a:'a', b:'b'} | |
const obj2 = {...obj1, a:'new a'} | |
console.log(obj2); | |
// > Object { a: "new a", b: "b" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongoose | |
.connect("mongodb://localhost/dbname") | |
.then(() => console.log("Connected to MongoDB")) | |
.catch(err => console.log(`Fail to connect to MongoDB: ${err}`)); |