let numUsers = 0;
for(let num = 0; num < 22; num++){
numUsers = numUsers+1;
}
console.log('Number of users are: '+ numUsers); //implicit coercison from number to string
This file contains 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
#!/usr/bin/env python | |
# coding: utf-8 | |
# In[ ]: | |
get_ipython().run_line_magic('pip', 'install -q beautifulsoup4') | |
# In[ ]: |
We can't make this file beautiful and searchable because it's too large.
This file contains 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
bookId,title,author,rating,description,language,isbn,bookFormat,edition,pages,publisher,publishDate,firstPublishDate,likedPercent,price | |
1,The Essentials of Artificial Intelligence from Scratch,Steve Wozniak,4.9,"The Essentials of Artificial Intelligence from Scratch provides a comprehensive overview of its subject matter. It delves into the intricacies of The Essentials of Artificial Intelligence from Scratch, making it accessible to both beginners and advanced readers. With thorough explanations and practical examples, it aims to equip you with the knowledge necessary to excel in this field.",English,978-0-804-6985-6,Paperback,3rd,891,Cambridge University Press,2020-11-06,1959-03-16,79,74.67 | |
2,The Future of Embedded Systems and Future Trends,Richard Stallman,4.6,"Discover the world of The Future of Embedded Systems and Future Trends through this enlightening book. It provides a detailed examination of critical theories and frameworks, helping readers to develop a robust understanding of the subject.",English |
This file contains 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
#!/usr/bin/env node | |
const {execSync} = require('child_process'); | |
const runCommand = command => { | |
try { | |
execSync(`${command}`, {stdio: 'inherit'}); | |
} catch (e) { | |
console.error(`Failed to execute ${command}`, e); | |
return false; |
This file contains 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
export const VideoPlayer = ({youtubeId}: VideoPlayerProps) => { | |
useEffect(() => { | |
const options = { | |
noCookie: false, | |
rel: 0, | |
showinfo: 1, | |
iv_load_policy: 3, | |
modestbranding: 1 | |
} | |
if (typeof document !== `undefined`) { |
This file contains 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
# First remove the app from `/Applications` | |
rm -rf ~/Library/Caches/IdeaIC201*; rm -rf ~/Library/Preferences/IdeaIC201*;rm -rf ~/.ivy2/cache |
This file contains 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
import * as admin from "firebase-admin"; | |
export const getFirebaseApp = (credentialsJsonFile, appName) => { | |
let fbAdmin = admin.initializeApp({ | |
credential: admin.credential.cert(credentialsJsonFile) | |
}, appName); | |
return fbAdmin.firestore(); | |
}; | |
This file contains 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
import java.io.File | |
import java.net.URL | |
// Note: This has dependency on apache commons-io | |
import org.apache.commons.io.FileUtils | |
object LoadFile extends App { | |
override def main(args: Array[String]): Unit = { | |
val fileName = "myfileJarFile.json" | |
val path: URL = getClass.getClassLoader.getResource("v410.all/" + fileName) |
These are in no particular order. I found them by researching what methods other developers use to understand codebases that they have not seen before.
- If the codebase has tests, read the tests
- Try to write tests for the part of codebase you are trying to understand. This helps in understanding the behavior and serve as documentation
- Get overview of project. See the overall picture. How many modules it has? What are the name of the modules? Pick one module and do deep dive into it.
- Writing documentation for source code. This is a good practice to understand the codebase. I tend to prefer writing tests over documentation since the source code and tests are truth, documentation decays over time, generally.
This file contains 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
import java.io.*; | |
import java.util.*; | |
/* | |
* To execute Java, please define "static void main" on a class | |
* named Solution. | |
* | |
* If you need more classes, simply define them inline. | |
*/ |
NewerOlder