├── textualContent ├── content │ ├── Archive-1 │ │ ├── 133.md │ │ ├── 1.md │ │ ├── 48.md │ │ ├── 80.md │ │ ├── 51.md │ │ ├── 76.md │ │ ├── 96.md │ │ ├── 46.md │ │ ├── 50.md │ │ ├── 83.md │ │ ├── 49.md │ │ ├── 67.md │ │ ├── 60.md │ │ ├── 95.md │ │ ├── 52.md │ │ ├── 79.md │ │ ├── 62.md │ │ ├── 85.md │ │ ├── 93.md │ │ ├── 59.md │ │ ├── 55.md │ │ ├── 61.md │ │ ├── 77.md │ │ ├── 78.md │ │ ├── 58.md │ │ ├── 81.md │ │ ├── 45.md │ │ ├── 57.md │ │ ├── 47.md │ │ ├── 72.md │ │ ├── 97.md │ │ ├── 87.md │ │ ├── 53.md │ │ ├── 68.md │ │ ├── 64.md │ │ ├── 66.md │ │ ├── 92.md │ │ ├── 56.md │ │ ├── 54.md │ │ ├── 86.md │ │ ├── 88.md │ │ ├── 73.md │ │ ├── 82.md │ │ ├── 65.md │ │ ├── 99.md │ │ ├── 89.md │ │ ├── 84.md │ │ ├── 98.md │ │ ├── 71.md │ │ ├── 74.md │ │ ├── 69.md │ │ ├── 94.md │ │ ├── 43.md │ │ ├── 90.md │ │ ├── 63.md │ │ ├── 75.md │ │ ├── 44.md │ │ ├── 100.md │ │ ├── 70.md │ │ └── 91.md │ ├── 190.md │ ├── Archive-2 │ │ ├── 147.md │ │ ├── 111.md │ │ ├── 124.md │ │ ├── 139.md │ │ ├── 130.md │ │ ├── 125.md │ │ ├── 113.md │ │ ├── 126.md │ │ ├── 107.md │ │ ├── 103.md │ │ ├── 146.md │ │ ├── 118.md │ │ ├── 121.md │ │ ├── 101.md │ │ ├── 114.md │ │ ├── 110.md │ │ ├── 108.md │ │ ├── 122.md │ │ ├── 149.md │ │ ├── 117.md │ │ ├── 106.md │ │ ├── 131.md │ │ ├── 109.md │ │ ├── 115.md │ │ ├── 150.md │ │ ├── 119.md │ │ ├── 120.md │ │ ├── 135.md │ │ ├── 141.md │ │ ├── 132.md │ │ ├── 138.md │ │ ├── 116.md │ │ ├── 148.md │ │ ├── 112.md │ │ ├── 133.md │ │ ├── 140.md │ │ ├── 145.md │ │ ├── 142.md │ │ ├── 128.md │ │ ├── 104.md │ │ ├── 143.md │ │ ├── 136.md │ │ ├── 137.md.skipped │ │ ├── 144.md │ │ ├── 129.md │ │ ├── 105.md │ │ ├── 134.md │ │ ├── 127.md │ │ ├── 102.md │ │ └── 123.md │ ├── 176.md │ ├── 156.md │ ├── 158.md │ ├── 171.md │ ├── 159.md │ ├── 168.md │ ├── 169.md │ ├── 164.md │ ├── 154.md │ ├── 160.md │ ├── 157.md │ ├── 192.md │ ├── 180.md │ ├── 173.md │ ├── 179.md │ ├── 155.md │ ├── 170.md │ ├── 175.md │ ├── 172.md │ ├── 174.md │ ├── 151.md │ ├── 152.md │ ├── 153.md │ ├── 161.md │ ├── 165.md │ ├── 177.md │ ├── 166.md │ ├── 167.md │ ├── 162.md │ ├── 191.md │ ├── 163.md │ ├── 178.md │ └── package-lock.json ├── content_old │ ├── 5_week │ │ ├── 19_npm.png │ │ ├── 20_npm.png │ │ ├── 21_npm.png │ │ ├── 22_npm.png │ │ ├── 18_refactor.PNG │ │ ├── _5_javascript.png │ │ └── _7_javascript.png │ ├── 1_week │ │ ├── 1_javascript.png │ │ ├── 2_javascript.png │ │ ├── 4_javascript.png │ │ ├── 3_0_javascript.png │ │ ├── 5_0_javascript.png │ │ └── 3_1_frameworks.txt │ ├── 2_week │ │ ├── 6_javascript.png │ │ ├── 8_frameworks.PNG │ │ ├── 10_javascript_proxy.png │ │ └── 9_javascript_proxy.png │ ├── 3_week │ │ ├── 12_js_proxy.png │ │ ├── 13_js_proxy.png │ │ ├── 14_js_proxy.png │ │ ├── 15_js_regex.png │ │ └── 11_javascript_proxy.png │ ├── 4_week │ │ ├── 17_js_reduce.png │ │ ├── 16_0_microsoft.PNG │ │ └── 16_1_js_reduce.PNG │ ├── http_header_conten-disposition.png │ └── src.json └── daily-mini-treats │ ├── rough.md │ └── README.md ├── Scripts ├── .conf.json ├── README.md ├── package.json ├── HTTPHeaders.xml └── index.js ├── README.md └── LICENSE /textualContent/content/Archive-1/133.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/1.md: -------------------------------------------------------------------------------- 1 | ## test 2 | 3 | it will work -------------------------------------------------------------------------------- /textualContent/content/190.md: -------------------------------------------------------------------------------- 1 | github cli 2 | https://cli.github.com/manual/ 3 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/147.md: -------------------------------------------------------------------------------- 1 | html - Highlight text 2 | The Sorting 3 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/111.md: -------------------------------------------------------------------------------- 1 | header health check tool for your site 2 | 3 | securityheader.io 4 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/124.md: -------------------------------------------------------------------------------- 1 | To add business string to your java class, 2 | use Formattable interface 3 | -------------------------------------------------------------------------------- /textualContent/content/176.md: -------------------------------------------------------------------------------- 1 | NonNullable # 2 | Constructs a type by excluding null and undefined from T 3 | 4 | 5 | -------------------------------------------------------------------------------- /textualContent/content/156.md: -------------------------------------------------------------------------------- 1 | advanced git diff 2 | 3 | git diff HEAD 4 | shows both staged and unstage files 5 | 6 | 7 | -------------------------------------------------------------------------------- /textualContent/content/158.md: -------------------------------------------------------------------------------- 1 | windows command line args documentation with examples 2 | https://ss64.com/nt://ss64.com/nt/ 3 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/139.md: -------------------------------------------------------------------------------- 1 | Effective Code - 3 D's 2 | Remove : 3 | - Duplication 4 | - Duplication 5 | - Duplication 6 | -------------------------------------------------------------------------------- /textualContent/content_old/5_week/19_npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/19_npm.png -------------------------------------------------------------------------------- /textualContent/content_old/5_week/20_npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/20_npm.png -------------------------------------------------------------------------------- /textualContent/content_old/5_week/21_npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/21_npm.png -------------------------------------------------------------------------------- /textualContent/content_old/5_week/22_npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/22_npm.png -------------------------------------------------------------------------------- /textualContent/content/171.md: -------------------------------------------------------------------------------- 1 | UseReducer() 2 | 3 | alternative to useState() 4 | 5 | flow: 6 | dispatcher -> action -> redcer -> newState 7 | 8 | 9 | -------------------------------------------------------------------------------- /textualContent/content_old/1_week/1_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/1_week/1_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/1_week/2_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/1_week/2_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/1_week/4_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/1_week/4_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/2_week/6_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/2_week/6_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/2_week/8_frameworks.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/2_week/8_frameworks.PNG -------------------------------------------------------------------------------- /textualContent/content_old/3_week/12_js_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/3_week/12_js_proxy.png -------------------------------------------------------------------------------- /textualContent/content_old/3_week/13_js_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/3_week/13_js_proxy.png -------------------------------------------------------------------------------- /textualContent/content_old/3_week/14_js_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/3_week/14_js_proxy.png -------------------------------------------------------------------------------- /textualContent/content_old/3_week/15_js_regex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/3_week/15_js_regex.png -------------------------------------------------------------------------------- /textualContent/content_old/4_week/17_js_reduce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/4_week/17_js_reduce.png -------------------------------------------------------------------------------- /textualContent/content_old/5_week/18_refactor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/18_refactor.PNG -------------------------------------------------------------------------------- /textualContent/content_old/1_week/3_0_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/1_week/3_0_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/1_week/5_0_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/1_week/5_0_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/4_week/16_0_microsoft.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/4_week/16_0_microsoft.PNG -------------------------------------------------------------------------------- /textualContent/content_old/4_week/16_1_js_reduce.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/4_week/16_1_js_reduce.PNG -------------------------------------------------------------------------------- /textualContent/content_old/5_week/_5_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/_5_javascript.png -------------------------------------------------------------------------------- /textualContent/content_old/5_week/_7_javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/5_week/_7_javascript.png -------------------------------------------------------------------------------- /textualContent/content/159.md: -------------------------------------------------------------------------------- 1 | auto complete in vim 2 | 3 | words - ctrl+p and ctrl+n 4 | lines - ctrl+x and ctrl+l 5 | get file path - ctrl+x and ctrl+f 6 | 7 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/48.md: -------------------------------------------------------------------------------- 1 | ## Git VCS ⚡️⚡️ 2 | ### That Tip 3 | 4 | > $ git branch 5 | 6 | Lists all local branches in the current repository 7 | 8 | >#48 -------------------------------------------------------------------------------- /textualContent/content_old/2_week/10_javascript_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/2_week/10_javascript_proxy.png -------------------------------------------------------------------------------- /textualContent/content_old/2_week/9_javascript_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/2_week/9_javascript_proxy.png -------------------------------------------------------------------------------- /textualContent/content_old/3_week/11_javascript_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/3_week/11_javascript_proxy.png -------------------------------------------------------------------------------- /textualContent/content/Archive-1/80.md: -------------------------------------------------------------------------------- 1 | ![fb_img_1534819312440](https://user-images.githubusercontent.com/13570866/44580001-f10ed380-a7b5-11e8-8eb2-4bbc89ee55fb.jpg) 2 | 3 | > #80 -------------------------------------------------------------------------------- /textualContent/content_old/http_header_conten-disposition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/makaravind/ALBTY/HEAD/textualContent/content_old/http_header_conten-disposition.png -------------------------------------------------------------------------------- /textualContent/content/Archive-1/51.md: -------------------------------------------------------------------------------- 1 | ## Git VCS ⚡️⚡️ 2 | ### That Tip 3 | 4 | > $ git diff --staged 5 | 6 | Shows file changes between staging and the last file version 7 | 8 | >#51 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/130.md: -------------------------------------------------------------------------------- 1 | Oracle sql 2 | 3 | -- Creating dummy rows of date in a calender 4 | 5 | select date '2017-04-30'+level dte from dual connect by level <= 31; 6 | 7 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/125.md: -------------------------------------------------------------------------------- 1 | Very important Functional interfaces 2 | 3 | UnaryOperator 4 | BinaryOperator 5 | Perdicate 6 | Function 7 | Supplier 8 | Consumer 9 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/113.md: -------------------------------------------------------------------------------- 1 | Websites like hotframeworks.com, trends.builtwith.com, and trends.google.com can help you to understand where various technologies stand, in terms of popularity over time. 2 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/126.md: -------------------------------------------------------------------------------- 1 | Best way to create Singleton in Java is using Enum 2 | 3 | ``` 4 | public enum Singleton { 5 | INSTANCE; 6 | } 7 | ``` 8 | 9 | Enum is a full featured classes 10 | -------------------------------------------------------------------------------- /textualContent/content/168.md: -------------------------------------------------------------------------------- 1 | HTML tags 2 | 3 | 4 | ``` 5 |
6 | Details 7 | Something small enough to escape casual notice. 8 |
9 | ``` 10 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/107.md: -------------------------------------------------------------------------------- 1 | ## GIT ⚡⚡️ 2 | ### To revert to a commit in the remote branch 3 | 4 | ``` 5 | > git reset --hard 6 | > git push -f origin 7 | ``` 8 | 9 | > #107 10 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/103.md: -------------------------------------------------------------------------------- 1 | ## Recommended Secure coding - Methods ⚡⚡️ 2 | 3 | **Return an empty array or collection instead of a null value for methods that return an array or collection (period)** 4 | 5 | > #103 6 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/146.md: -------------------------------------------------------------------------------- 1 | How large should image files be? 2 | For ecommerce images, a good rule of thumb is to try to keep your image file size below 70 kb. That can be difficult at times, especially for larger images. 3 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/76.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | 3 | You may have seen __proto__ used before to get an instances’ prototype. That’s a relic of the past. 4 | 5 | Instead, use Object.getPrototypeOf(instance) 6 | 7 | > #76 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/96.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous - Cygwin 2 | ### linux like console in windows 3 | Check out this video to completely set-up cygwin in windows 4 | [video](https://www.youtube.com/watch?v=Wv7Bs5dRoK8) 5 | 6 | > #96 7 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/118.md: -------------------------------------------------------------------------------- 1 | ## Oracle SQL - Pagination ⚡⚡️ 2 | ### Oracle 12 and above 3 | 4 | ``` 5 | select * from table_1 6 | order by _date desc 7 | offset 5 rows fetch first 5 rows only; 8 | ``` 9 | 10 | > #118 11 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/121.md: -------------------------------------------------------------------------------- 1 | linux sort command - sort any list 2 | 3 | Useful options: 4 | -n : sort numbers 5 | -r : reverse 6 | -k : sort using nth column 7 | 8 | usage: 9 | ls -l /home/$USER | sort -nk5 10 | -------------------------------------------------------------------------------- /textualContent/content/169.md: -------------------------------------------------------------------------------- 1 | React - Hooks 2 | Rules 3 | 4 | - Never call hooks from a loop 5 | - never call hooks from a nested function 6 | - hooks always sit at top level 7 | - only call from a functional component or another custom hook 8 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/101.md: -------------------------------------------------------------------------------- 1 | ## Oh God! OAuth! 2 | 3 | The following diagram shows the Sign-in flow with Google 4 | ![101](https://user-images.githubusercontent.com/25049495/48690915-7e679580-ebf6-11e8-9f58-eb6945ea4d6c.png) 5 | 6 | > #101 7 | -------------------------------------------------------------------------------- /textualContent/content/164.md: -------------------------------------------------------------------------------- 1 | position: fixed 2 | The positioned (green) box does its own thing because its containing block will always be the viewport. With offset values of right: 0 and top: 0 it will always be in the top right corner of the whole page. 3 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/114.md: -------------------------------------------------------------------------------- 1 | ## Oracle SQL ⚡⚡️ 2 | ### Getting integers from dual effectively without any IO 3 | 4 | ``` 5 | select level from dual connect by level <= 5; 6 | ``` 7 | 8 | ``` 9 | output: 1 2 3 4 5 10 | ``` 11 | 12 | > #114 13 | 14 | -------------------------------------------------------------------------------- /textualContent/content/154.md: -------------------------------------------------------------------------------- 1 | find pattern in files of a directory 2 | 3 | grep -Rl 4 | 5 | -R: recursively search in directories (symbolinks as well, unlike -r) 6 | 7 | example: 8 | find string "find me" in current directory. 9 | grep -Rl "find me" . 10 | 11 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/110.md: -------------------------------------------------------------------------------- 1 | ## Security Headers ⚡⚡️ 2 | 3 | ``` 4 | Strict-Transport-Security: max-age=10886400; 5 | ``` 6 | 7 | Makes your browser call HTTPS version of the site even if there is HTTP version available. This is a response header 8 | 9 | > #110 10 | -------------------------------------------------------------------------------- /textualContent/content/160.md: -------------------------------------------------------------------------------- 1 | Java 9 2 | 3 | 4 | List list4 = List.of("One", "Two", "Three", "Four"); // ListN 5 | 6 | 7 | is same as 8 | 9 | 10 | List units= Arrays.asList(“One”, “Two”, “Three”, “Four”); 11 | units = Collections.unmodifiableList(units); 12 | 13 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/46.md: -------------------------------------------------------------------------------- 1 | ## Cache Buster ⚡️⚡️ 2 | ### A great tool to find more about your app including cache content information 3 | [redbot.org](https://redbot.org) 4 | 5 | ![46](https://user-images.githubusercontent.com/13570866/42724833-f869e5aa-8796-11e8-994c-e45fdb76e127.PNG) -------------------------------------------------------------------------------- /textualContent/content/Archive-1/50.md: -------------------------------------------------------------------------------- 1 | ## Git VCS ⚡️⚡️ 2 | ### That Tip 3 | 4 | > $ git merge / 5 | 6 | Combines remote branch into current local branch 7 | 8 | [more about remote tracking here](https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches) 9 | 10 | >#50 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/83.md: -------------------------------------------------------------------------------- 1 | add this to notify user that he may have unsaved data before closing the browser/tab 2 | 3 | ```javascript 4 | window.onbeforeunload = function (e) { 5 | e.preventDefault(); 6 | return ''; 7 | }; 8 | ``` 9 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/108.md: -------------------------------------------------------------------------------- 1 | ## HTTP HEADERS ⚡⚡️ 2 | 3 | If you want something not be **cached by the browser**, This is the most milmalist way of doing it. 4 | Add this is as part of response header 👍 5 | 6 | ``` 7 | Cache-Control: private, no-store 8 | ``` 9 | 10 | > #108 11 | -------------------------------------------------------------------------------- /Scripts/.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "GITHUB_API_URL": "https://api.github.com", 3 | "USERNAME": "[GITHUB_USERNAME]", 4 | "PASSWORD": "[GITHUB_PASSWORD]", 5 | "TOKEN": "[GITHUB-TOKEN WITH REPO PERMISSION]", 6 | "SRC": "[SRC JSON file]", 7 | "REPO": "[GITHUB REPO NAME]", 8 | "ISSUE_NUMBER": "[ISSUE NUMBER]" 9 | } -------------------------------------------------------------------------------- /textualContent/content/Archive-1/49.md: -------------------------------------------------------------------------------- 1 | ## Git VCS ⚡️⚡️ 2 | ### That Tip 3 | 4 | > $ git reset --keep 5 | 6 | Reset your HEAD pointer to a previous commit and preserve uncommitted local changes 7 | 8 | > $ git reset --hard 9 | 10 | It throws away all your uncommitted changes. 11 | 12 | >#51 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/67.md: -------------------------------------------------------------------------------- 1 | ## Audio On Web ⚡️⚡️ 2 | ### Web Audio API 3 | 4 | For advanced audio applications, use Web Audio API 5 | 6 | check out these links 7 | 8 | - https://webaudio.github.io/web-audio-api/ 9 | - https://www.w3.org/TR/webaudio-usecases/ 10 | 11 | > #67 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/122.md: -------------------------------------------------------------------------------- 1 | linux command - cut 2 | 3 | split the input using a delimiter and selects the field by index of the split array. 4 | 5 | syntax: cut -d -f 6 | eg: ls | cut -d. -f2 7 | op: md js js 8 | 9 | Other interesting options: 10 | -b1-10 11 | 12 | -------------------------------------------------------------------------------- /textualContent/content/157.md: -------------------------------------------------------------------------------- 1 | bash scripting 2 | use can open a windows explorer in WSL or git bash using linux file path style 3 | # opens windows explorer 4 | open() { 5 | line=$(sed -e 's#/#\\#g' <<< "$1") 6 | echo "opening $line" 7 | explorer.exe "$line" 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Scripts/README.md: -------------------------------------------------------------------------------- 1 | # Automate scripts 2 | NodeJS script to post a new comment/issue at specified time 3 | 4 | # SetUp 5 | 1. npm i 6 | 2. copy-paste .conf.json and rename to conf.json 7 | 3. update conf.json with valid information 8 | 4. npm start 9 | 10 | # Additional 11 | http://github-tools.github.io/github/docs/3.1.0 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/149.md: -------------------------------------------------------------------------------- 1 | Java - Generics 2 | 3 | Intersection types - used to create several intersection or dummy types 4 | 5 | 6 | 7 | here we are creating a generic type T which is of type both class A and B 8 | 9 | use with caution - because it has little readability overhead 10 | -------------------------------------------------------------------------------- /textualContent/content/192.md: -------------------------------------------------------------------------------- 1 | ## Linux : bash shell 2 | 3 | the backspace key works just as you would expect: it deletes 4 | the character in front of the cursor. The following chords are also available 5 | to us: 6 | Delete back one character (backspace) 7 | Delete back one word 8 | Delete back to start of line 9 | -------------------------------------------------------------------------------- /textualContent/content/180.md: -------------------------------------------------------------------------------- 1 | Linux - fold 2 | 3 | Text with no, or very few, newline characters in it will be too wide to comfortably read in the terminal window. That’s annoying, but it is do-able. 4 | 5 | ``` 6 | fold -w 50 -s moby-dick.txt 7 | ``` 8 | 9 | options 10 | w - width 11 | s - space (words are adjused delimited by space) 12 | -------------------------------------------------------------------------------- /textualContent/content/173.md: -------------------------------------------------------------------------------- 1 | ## Typescript 2 | Utility types 3 | 4 | Readonly 5 | 6 | ``` 7 | interface Todo { 8 | title: string; 9 | } 10 | 11 | const todo: Readonly = { 12 | title: 'Delete inactive users', 13 | }; 14 | 15 | todo.title = 'Hello'; // Error: cannot reassign a readonly property 16 | 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /textualContent/content/179.md: -------------------------------------------------------------------------------- 1 | typescript tips and tricks 2 | 3 | tsconfig - strictNullChecks : true 4 | since all types are nullable and undefined by default it may cause some run time errors which are not caught in compile time. If you are developing lets a angular or react project from inception on typescript its better to turn on this flag. 5 | 6 | 7 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/117.md: -------------------------------------------------------------------------------- 1 | ## Oracle SQL - Memory usage information for sql 2 | 3 | gives stats of sorting and memory operations are going in memory, disk. Check the diff before and after 4 | 5 | `` 6 | create global temporary table QUERY_BEFORE 7 | on commit preserve rows as 8 | select * from V$SQL_WORKAREA_HISTOGRAM; 9 | ``` 10 | -------------------------------------------------------------------------------- /textualContent/content/155.md: -------------------------------------------------------------------------------- 1 | advanced git 2 | 3 | 1. git rev-parse commit/ref-log HEAD@{1} 4 | git rev-parse HEAD~5 : 5 commits before head 5 | to get the hash value 6 | 7 | 2. git ref-log 8 | check steps of commands happened 9 | 10 | 3. if you want to reset a merge (merge -> master) . only before pushing 11 | use ref log to find the hash use reset hard 12 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/60.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | 3 | Are you all about reducing number of lines of code ? Here is a tip for you. 4 | 5 | ```javascript 6 | if (foo) { 7 | bar(); 8 | baz(); 9 | } 10 | ``` 11 | 12 | Above snippet can be turned into just a single line 💪 13 | 14 | ```javascript 15 | foo&&(bar(),baz()) 16 | ``` 17 | > #60 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/95.md: -------------------------------------------------------------------------------- 1 | ## JavaScript Gym 2 | 3 | JavaScript doesn't specify anything about I/O in its spec. That's defined by the host environment. 4 | 5 | for example, setTimeout isn't in the JavaScript source code. setTimeout is provided by the JavaScript engine. It is part of the browser or part of node and not part of JavaScript itself. 6 | 7 | > #95 8 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/52.md: -------------------------------------------------------------------------------- 1 | ## Dev Stuff ⚡️⚡️ 2 | ### TypeScript 3.0 released ! 3 | Here are the new features 4 | - Tuples in rest parameters and spread expressions 5 | - New unknown top type 6 | - Support for defaultProps in JSX 7 | 8 | check out in-depth explanation [here](https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript) 9 | 10 | > #52 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/79.md: -------------------------------------------------------------------------------- 1 | ## Go Go ⚡⚡️ 2 | 3 | ### length vs capacity properties in Go slices 4 | 5 | The length is the number of elements referred to by the slice. 6 | 7 | The capacity is the number of elements in the underlying array (beginning at the element referred to by the slice pointer). 8 | 9 | A slice cannot be grown beyond its capacity 10 | 11 | > #79 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/106.md: -------------------------------------------------------------------------------- 1 | ## GIT ⚡⚡️ 2 | ### Git internally uses the hash-object command like so: 3 | 4 | ``` 5 | $ git hash-object helloworld.js 6 | > a0423896973644771497bdc03eb99d5281615b51 7 | ``` 8 | 9 | Yes, it’s the same hash we see under the .git/objects folder. 10 | [source](https://medium.freecodecamp.org/how-not-to-be-afraid-of-git-anymore-fe1da7415286) 11 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/131.md: -------------------------------------------------------------------------------- 1 | ``` 2 | Map> map = /....; 3 | List vals = map.get(key); 4 | if(vals == null) { 5 | vals = new ArrayList<>(); 6 | map.put(key, vals); 7 | } 8 | vals.add(value); 9 | 10 | ``` 11 | 12 | java 8 we can rewrite this as 13 | 14 | ``` 15 | map.computeIfAbsent(key, k -> new ArrayList<>()) 16 | .add(value); 17 | ``` 18 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/62.md: -------------------------------------------------------------------------------- 1 | ## Naughty Node ⚡️⚡️ 2 | 3 | ### Node debugging made easy 4 | 5 | Debugging nodejs code was always tricky and most often console.log used to be best way debug. 6 | There is a good news! Here is the most easiest way to setup debugger and debug you code using this NPM module "ndb" 7 | 8 | https://github.com/GoogleChromeLabs/ndb 9 | 10 | > #62 11 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/109.md: -------------------------------------------------------------------------------- 1 | ## Security Headers ⚡⚡️ 2 | ### How do you prohibit someone from including your website in an iFrame? 3 | 4 | ``` 5 | X-Frame-Options HTTP Header 6 | ``` 7 | 8 | The value is almost always set to **'sameorigin'** 9 | 10 | But there is an even better way, 11 | 12 | ``` 13 | Content-Security-Policy: frame-ancestors 'self' 14 | ``` 15 | 16 | > #109 17 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/85.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | 🔥 Arrow functions don't have their own "this". Subsequently, they can't be used as constructors and will throw an error when invoked with the "new" keyword. Also, they don't have a ".prototype" property. 3 | 4 | ![dmrkog7xsaahqja](https://user-images.githubusercontent.com/13570866/45076966-83459e80-b109-11e8-82f6-33e8be9fe58d.jpg) 5 | 6 | > #84 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/93.md: -------------------------------------------------------------------------------- 1 | ## Riddle Me ⚡⚡️ 2 | ### Simulating a goto statement in Java 3 | 4 | This is way one to look at it! 5 | 6 | ```java 7 | public void jumpForward() { 8 | try { 9 | // some code 1 10 | throw new MyException(); 11 | // some code 2 12 | } catch(MyException ex) { 13 | // some code 3 14 | } 15 | } 16 | ``` 17 | 18 | > #93 19 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/115.md: -------------------------------------------------------------------------------- 1 | ## Oracle SQL - WITH clause ⚡⚡️ 2 | ### Use 'with' to generate a table to use it in the query like another table 3 | 4 | ``` 5 | with dept_salaries as ( 6 | select * from table_1 7 | ), 8 | 9 | avg_sal as ( 10 | select avg(dept_sal) from dept_salaries 11 | ), 12 | ``` 13 | 14 | ``` 15 | select * from dept_salaries, avg_sal where something.. 16 | ``` 17 | 18 | > #115 19 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/150.md: -------------------------------------------------------------------------------- 1 | Today's applications deal with two kinds of data: transactional 2 | data and instant data. Transactional data is held in a traditional 3 | disk-based database; instant data resides in memory to provide 4 | the best possible application performance. Over the years, Redis, 5 | consistently voted the most-loved database, has become the de 6 | facto standard for instant data. 7 | 8 | #150 9 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/59.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | 3 | JavaScript modules are now supported in all major browsers! 4 | 5 | You may have used a userland JavaScript module system in the past. Maybe you used CommonJS like in Node.js, or maybe AMD, or maybe something else. 6 | 7 | ### Using JS modules in the browser 8 | ```javascript 9 | 10 | ```` 11 | 12 | > #59 -------------------------------------------------------------------------------- /textualContent/content/170.md: -------------------------------------------------------------------------------- 1 | useEffect(() => { 2 | // initial and all subsequent renders 3 | }) 4 | 5 | useEffect(() => { 6 | // Initial render only 7 | }, []); 8 | 9 | useEffect(() => { 10 | // Initial render and when id or name value changes 11 | }, [id, name]); 12 | 13 | useEffect(()A => { 14 | subscribe(userName); 15 | return () => unsubscribe(userName); //cleaning up: invoked when components unmounts 16 | }, [userName]); 17 | -------------------------------------------------------------------------------- /textualContent/content/175.md: -------------------------------------------------------------------------------- 1 | Pick # 2 | Constructs a type by picking the set of properties K from T. 3 | 4 | Example # 5 | interface Todo { 6 | title: string; 7 | description: string; 8 | completed: boolean; 9 | } 10 | 11 | type TodoPreview = Pick; 12 | 13 | const todo: TodoPreview = { 14 | title: 'Clean room', 15 | completed: false, 16 | }; 17 | ### similarity, Omit 18 | 19 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/119.md: -------------------------------------------------------------------------------- 1 | ## Oracle - Null 2 | 3 | Oracle deviates from the SQL standard in implicitly treating an empty, zero-length string as a surrogate for NULL. 4 | 5 | ### NULL HAS NO EQUIVALENTS 6 | 7 | No other value is same as NULL. not even NULL 8 | Hence this would not work 9 | 10 | ``` 11 | select * 12 | from hr.employees 13 | where commission_pct = null 14 | ``` 15 | 16 | aLWAYs use IS NULL or IS NOT NULL 17 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/55.md: -------------------------------------------------------------------------------- 1 | ## Web API's ⚡️⚡️ 2 | ### Online State API 3 | 4 | ```javascript 5 | console.log(navigator.online? 'online': 'offline'); 6 | ``` 7 | 8 | Listening for offline/ online state change 9 | 10 | ```javascript 11 | window.addEventListener('offline', () => console.log('just went offline')) 12 | window.addEventListener('online', () => console.log('just came back online')) 13 | ``` 14 | 15 | >#55 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/120.md: -------------------------------------------------------------------------------- 1 | ## Git and OS line ending ⚡⚡️ 2 | windows line ending is different from the Linux file line ending. If you ever come across an error where when you clone a git repo and your vim editor shouts that ^M is not valid. 3 | 4 | Just remember to set git automatic line ending conversion using the following command before cloning. 5 | 6 | ``` 7 | git config --global core.autocrlf false 8 | ``` 9 | 10 | > #120 11 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/61.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | 3 | Here is a pretty clever use of **bit operator** to make your code more **elegant** 🥇 4 | 5 | ```javascript 6 | var str = 'rawr'; 7 | var searchFor = 'a'; 8 | 9 | // This is alternative way of typing if (-1*str.indexOf('a') <= 0) 10 | if (~str.indexOf(searchFor)) { 11 | // searchFor is in the string 12 | } else { 13 | // searchFor is not in the string 14 | } 15 | ``` 16 | > #61 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/77.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | What happens when you say ? **_new function ... _** 3 | 4 | ```javascript 5 | function Animal (name, energy) { 6 | // const this = Object.create(Animal.prototype) 7 | 8 | this.name = name 9 | this.energy = energy 10 | 11 | // return animal 12 | } 13 | ``` 14 | 15 | The commented out lines are what happens behind the scenes when you use the new keyword on a function. 16 | 17 | > #77 18 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/78.md: -------------------------------------------------------------------------------- 1 | ## Go Go ⚡⚡️ 2 | ### Difference between c and go arrays 3 | 4 | Go's arrays are values. An array variable denotes the entire array; it is not a pointer to the first array element (as would be the case in C). This means that when you assign or pass around an array value you will make a copy of its contents. 5 | 6 | note: To avoid the copy you could pass a pointer to the array, but then that's a pointer to an array, not an array. 7 | 8 | > #78 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/135.md: -------------------------------------------------------------------------------- 1 | ## Javascript Jazz ⚡⚡️ 2 | ### Avoid Side Effects 3 | ### Primitives are passed by value and objects/arrays are passed by reference. In t 4 | 5 | Bad: 6 | ```javascript 7 | const addItemToCart = (cart, item) => { 8 | cart.push({ item, date: Date.now() }); 9 | }; 10 | ``` 11 | 12 | Good: 13 | ```javascript 14 | const addItemToCart = (cart, item) => { 15 | return [...cart, { item, date: Date.now() }]; 16 | }; 17 | ``` 18 | 19 | > #135 20 | -------------------------------------------------------------------------------- /Scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "albty-scripts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node index" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "bluebird": "^3.5.1", 14 | "cli-input": "^0.2.0", 15 | "github-api": "^3.0.0", 16 | "prompt": "^1.0.0", 17 | "request": "^2.87.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/141.md: -------------------------------------------------------------------------------- 1 | javascript (ES19) ⚡⚡️ 2 | #### Object.fromEntries 3 | 4 | The Object.fromEntries() method transforms a list of key-value pairs into an object. 5 | 6 | ``` 7 | const obj = {x: 2, y: 3, abc: 10}; 8 | const result = Object.fromEntries( 9 | Object.entries(obj) 10 | .filter(([key, value]) => key.length === 1) 11 | .map(([key, value]) => [key, value * 2]) 12 | ); 13 | 14 | // result -> {x: 4, y:6} 15 | ``` 16 | 17 | > #141 18 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/58.md: -------------------------------------------------------------------------------- 1 | ## Network Information API 2 | 3 | The Network Information API provides information about the system's connection in terms of general connection type (e.g., 'wifi', 'cellular', etc.) 4 | 5 | ```javascript 6 | let preloadVideo = true; 7 | var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; 8 | if (connection) { 9 | if (connection.type === 'cellular') { 10 | preloadVideo = false; 11 | } 12 | } 13 | ``` -------------------------------------------------------------------------------- /textualContent/content/Archive-1/81.md: -------------------------------------------------------------------------------- 1 | ## Stylish CSS ⚡⚡️ 2 | 3 | ### What is cascading means in cascading style sheets ? 4 | It means that styles are passed down from top to bottom. 5 | 6 | For example 7 | 8 | ```css 9 | p { 10 | font-size: 30px 11 | } 12 | 13 | p { 14 | color: red 15 | } 16 | ``` 17 | 18 | In the above example, A css sheets is read from top - to - bottom. 19 | All the P elements gets both font-size and color. This is what cascading means at the basic. 20 | 21 | > #81 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/132.md: -------------------------------------------------------------------------------- 1 | ## TDD ⚡ ⚡️ 2 | ## Practical Testing priorites 3 | 4 | 1. Code that you fear 5 | 2. A distant corner in the logic 6 | 3. A bug (before fixing it) 7 | 4. for/ if/ while 8 | 5. Thrown exception 9 | 6. A method that just calls two others 10 | 7. Trivial code ```a.setName(b.getName())`` 11 | 8. Legacy code with 0 bugs, 0 changes 12 | 13 | ![tdd-1](https://user-images.githubusercontent.com/13570866/60258109-1bf41780-98f2-11e9-936d-93b82e3f4508.png) 14 | 15 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/138.md: -------------------------------------------------------------------------------- 1 | ## Effective coding 2 | 3 | ### Remove 3C's 4 | 5 | - **clutter** - anything that does not add value to the code 6 | 7 | - **complexity** 8 | 9 | 1. Bad names 10 | 11 | 2. Long methods 12 | 13 | 3. Deep conditionals 14 | 15 | 4. Magic numbers 16 | 17 | 5. Improper variable scoping 18 | 19 | 6. Missing encapsulation 20 | 21 | 7. Obscure code blocks 22 | 23 | - **cleverness** 24 | 25 | 26 | 27 | > #138 28 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/45.md: -------------------------------------------------------------------------------- 1 | ## Cache Buster ⚡️⚡️ 2 | ### "Site Performace Is A Feature", One way is setting up caching 3 | 4 | _Caching’s Ugly Secret: **It Gets Stale**_ 5 | 6 | #### Popular Methods 7 | 1. Last-Modified [Illustation here](https://maravindblog.wordpress.com/2018/07/05/http-headers-last-modified-if-modified-since/) 8 | 2. ETag 9 | 3. Expires 10 | 4. Max-Age 11 | 12 | [source](https://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/) 13 | 14 | >#45 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/57.md: -------------------------------------------------------------------------------- 1 | ## That Thing ⚡️⚡️ 2 | ### Vibration API 3 | 4 | - Most modern mobile devices include vibration hardware, which lets software code provide physical feedback to the user by causing the device to shake. 5 | - The Vibration API offers Web apps the ability to access this hardware, if it exists, and does nothing if the device doesn't support it. 6 | 7 | ```javascript 8 | window.navigator.vibrate(200); 9 | window.navigator.vibrate([200]); 10 | ``` 11 | 12 | >#57 -------------------------------------------------------------------------------- /textualContent/content/172.md: -------------------------------------------------------------------------------- 1 | # Typescript 2 | # Utility types 3 | 4 | 1. Partial 5 | Constructs a type with all properties of T set to optional. This utility will return a type that represents all subsets of a given type. 6 | 7 | ``` 8 | interface Todo { 9 | title: string; 10 | description: string; 11 | } 12 | 13 | 14 | function iCareAboutTitle(t: Partial) { 15 | return t.title; 16 | } 17 | 18 | iCareAboutTitle({title: 'hoho'}) // no error even if description is missing 19 | ``` 20 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/116.md: -------------------------------------------------------------------------------- 1 | ## Oracle SQL - Pagination 2 | 3 | ``` 4 | -- getting first n rows orederd 5 | select * from ( 6 | -- your query 7 | ) where rnum <= n; 8 | 9 | ``` 10 | 11 | 12 | oracle 12 and above 13 | 14 | ``` 15 | select * from table_1 order by date desc 16 | fetch first 5 rows only; 17 | ``` 18 | 19 | ``` 20 | SELECT * 21 | FROM (SELECT A.*, rownum rn 22 | FROM (SELECT * 23 | FROM your_table 24 | ORDER BY col) A 25 | WHERE rownum <= :limit) 26 | WHERE rn >= :offset 27 | ``` 28 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/148.md: -------------------------------------------------------------------------------- 1 | html - editable content 2 | 3 | In HTML, any element can be editable. By using some JavaScript event handlers, you can transform your web page into a full and fast rich text editor. 4 | 5 |

Editing page content

6 | 7 |
8 | You can edit me...and add as much ye wish! 9 |
10 | 11 | Check out this article to find out more on how to create rich text editor. 12 | https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content 13 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/112.md: -------------------------------------------------------------------------------- 1 | ## Secure Coding ⚡⚡️ 2 | ### Beware while allowing a zip file upload for your projects. 3 | 4 | **A zip bomb**, also known as a zip of death or decompression bomb, is a malicious archive file designed to crash or render useless the program or system reading it. It is often employed to disable antivirus software, in order to create an opening for more traditional viruses. 5 | 6 | #### Always employ some tools to scan the files before processing any zipped file uploads. 7 | 8 | > #113 9 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/47.md: -------------------------------------------------------------------------------- 1 | ## Cache Buster ⚡️⚡️ 2 | ### That Tip 3 | 4 | If you are a web develper, the worst thing that could happen is wasting your whole day refreshing your browser wanting to see the changes. _I understand_ 5 | 6 | This little tip can save your precious time and money. Yeah you can buy me a coffee sometime. 7 | 8 | ![47](https://user-images.githubusercontent.com/13570866/42724947-5d977efe-8799-11e8-95bf-6369cacbad61.PNG) 9 | 10 | Check the _disable cache_ option in chrome network tab. 11 | 12 | >#47 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/133.md: -------------------------------------------------------------------------------- 1 | ## Javascript Jazz ⚡⚡️ 2 | ### May be a better way to write functions with lots of parameters 3 | 4 | #### Bad: 5 | ``` 6 | function createMenu(title, body, buttonText, cancellable) { 7 | // ... 8 | } 9 | ``` 10 | 11 | #### Good: 12 | 13 | ``` 14 | function createMenu({ title, body, buttonText, cancellable }) { 15 | // ... 16 | } 17 | 18 | createMenu({ 19 | title: "Foo", 20 | body: "Bar", 21 | buttonText: "Baz", 22 | cancellable: true 23 | }); 24 | ``` 25 | > #133 26 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/140.md: -------------------------------------------------------------------------------- 1 | Javascript Jazz ⚡⚡️ 2 | ### Private class fields (Stage 3 proposal) 3 | #### Similar feature is already available in Typescript. 4 | 5 | ```js 6 | class incrementCounter { 7 | #count = 0; 8 | increment() { 9 | this.#count++; 10 | } 11 | } 12 | ``` 13 | 14 | **Notice the # in front of _count_? It denotes that count is a private field** 15 | 16 | ```js 17 | incrementCounter.#count // -> syntax error 18 | ``` 19 | 20 | Similarly, private class methods can also be created. 21 | 22 | > #140 23 | -------------------------------------------------------------------------------- /textualContent/content/174.md: -------------------------------------------------------------------------------- 1 | Record # 2 | Constructs a type with a set of properties K of "type" T. This utility can be used to map the properties of a type to another type. 3 | 4 | ``` 5 | interface PageInfo { 6 | title: string; 7 | } 8 | 9 | type Page = 'home' | 'about' | 'contact'; 10 | 11 | const x: Record = { // create an object with keys only 'home', 'about', 'contact' 12 | about: { title: 'about' }, 13 | contact: { title: 'contact' }, 14 | home: { title: 'home' }, 15 | }; 16 | 17 | ``` 18 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/145.md: -------------------------------------------------------------------------------- 1 | ## Linux - head and tail command ⚡⚡️ 2 | ### Usage 3 | 4 | - Get top 4 directories/ files in the path 5 | ``` ls -l | head -n4 ``` 6 | 7 | - Get top 4 lines in the file 8 | ``` head -n4 largefile.txt ``` 9 | 10 | - Get last 4 directories/ files in the path 11 | ``` ls -l | tail -n4 ``` 12 | 13 | - Get last 4 lines in the file 14 | ``` tail -n4 largefile.txt ``` 15 | 16 | ### There are a plethora of options you can check out for these commands!! Try 17 | ``` man head ``` ``` man tail ``` 18 | 19 | > #145 20 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/72.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | ### Property Descriptors - Getter and Setter (ES6) 3 | 4 | I personally do not use getter-setters but this example is quite relatable and useful. 5 | 6 | ```javascript 7 | const obj = { 8 | realAge: 0, 9 | get age() { 10 | return this.realAge 11 | }, 12 | set age(value) { 13 | this.realAge = Number(value) // changing the string to number to realAge 14 | } 15 | } 16 | 17 | console.log(obj.age) // 0 18 | obj.age = '32' 19 | console.log(obj.age) // 32 20 | ``` 21 | 22 | > #72 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/97.md: -------------------------------------------------------------------------------- 1 | ## Recommended Secure coding - Preventing SQL injections 2 | 3 | ### A classic example of bad code practices. When using a traditional SQL Db 4 | 5 | TL'DR, here are the few things to watch out for 6 | 1. Always use Prepared Statment 7 | 2. Use parameter query to execute your queries 8 | 3. Do some kind of sanitation checks before passing as parameter 9 | 4. Java specific: Use character array for storing password 10 | 11 | [source](https://wiki.sei.cmu.edu/confluence/display/java/IDS00-J.+Prevent+SQL+injection) 12 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/87.md: -------------------------------------------------------------------------------- 1 | ## All-New Web API 2 | 3 | New API to Bring Augmented Reality to the Web 4 | 5 | We’re entering a new phase of work on JavaScript APIs here at Mozilla, that will help everyone create and share virtual reality (VR) and augmented reality (AR) projects on the open web. 6 | 7 | Experimentation continues with a new JavaScript API called the [WebXR Device API](https://immersive-web.github.io/webxr/). 8 | 9 | [source](https://hacks.mozilla.org/2018/09/webxr/?utm_source=dev-newsletter&utm_medium=email&utm_campaign=sept13-2018&utm_content=webxr) -------------------------------------------------------------------------------- /textualContent/content/Archive-2/142.md: -------------------------------------------------------------------------------- 1 | javascript - Intl (all new) 2 | 3 | Intl.relativeTimeFormat 4 | 5 | ``` 6 | const rtf = new Intl.RelativeTimeFormat('en', {numeric: 'auto'}) 7 | 8 | rtf.format(-1, 'day') 9 | ``` 10 | 11 | Intl.ListFormat 12 | 13 | ``` 14 | const lfFormat = Intl.ListFormat('en'); 15 | lfFormat.format(['hello', 'hi']) 16 | 17 | // result -> hello, hi 18 | ``` 19 | 20 | ``` 21 | const ldFormat = Intl.ListFormat('en', {type: 'disjuction'}); 22 | lfFormat.format(['hello', 'hi', 'hey']); 23 | 24 | // result -> hello, hi or hey 25 | ``` 26 | 27 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/53.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | ## Implementing *none* utility function 3 | 4 | Returns true if the provided predicate function returns false for all elements in a collection, false otherwise. 5 | 6 | Use Array.some() to test if any elements in the collection return true based on fn. Omit the second argument, fn, to use Boolean as a default. 7 | 8 | ```javascript 9 | const none = (arr, fn = Boolean) => !arr.some(fn); 10 | 11 | // examples: 12 | // none([0, 1, 3, 0], x => x == 2); true 13 | // none([0, 0, 0]); true 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/68.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | ### Performance on Javascript(ES6) 3 | While one can add as many dynamically named properties to an Object as they like, for performance and security reasons it’s better to use a **Map** 4 | 5 | Since objects as “complex” key/value stores, Each property has meta information tied to it, interactions require lookups in the prototype chain, etc. These each have performance considerations and may not be beneficial to your particular situation which is again why a **Map** is often better for dynamic collections of data. 6 | 7 | > #68 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/64.md: -------------------------------------------------------------------------------- 1 | ## Browser Blast ⚡️⚡️ 2 | ### Why you have to make write async programs ? 3 | 4 | In case of intensive applications, Once your browser starts processing so many tasks in the Call Stack, Since javascript is a single threaded. 5 | It may stop being responsive for quite a long time. 6 | 7 | And **most browsers take action by raising an error**, asking you whether you want to terminate the web page. 8 | 9 | ![snap_2017 02 01_23h28m39s_001](https://user-images.githubusercontent.com/13570866/44322304-5e46ff80-a46a-11e8-83b8-0c4f162633f3.jpg) 10 | 11 | > #64 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/128.md: -------------------------------------------------------------------------------- 1 | ## Oracle - Handling files ⚡ ⚡️ 2 | 3 | For the applications where it is not feasible to store LOBs in the database, you can use BFILES. 4 | A BFILE is a data type whose metadata is stored in the database, but whose actual content is stored in 5 | operating system files outside of the database. 6 | 7 | In essence, a BFILE object is a pointer to an operating system file. 8 | 9 | This is a great resource to understand how to work with BFILE or LOBs in general: 10 | https://docs.oracle.com/cd/B28359_01/java.111/b31224/oralob.htm 11 | 12 | > #128 13 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/104.md: -------------------------------------------------------------------------------- 1 | ## Javascript Jazz ⚡⚡️ 2 | ### Creating a simple **generator** in JS 3 | 4 | Generator functions are a special kind of function in JavaScript which is declared with the _function*_ syntax. Generator functions are used to create iterator objects (ones with a .next() method) but in a much clearer and more concise way. 5 | 6 | Below is a finite generator that creates an equivalent iterator: 7 | 8 | ```javascript 9 | const createIterator = function* () { 10 | let x = 0; 11 | while (x < 4) { 12 | yield x; 13 | x += 1; 14 | } 15 | }; 16 | ``` 17 | 18 | > #104 19 | -------------------------------------------------------------------------------- /textualContent/content/151.md: -------------------------------------------------------------------------------- 1 | tion, Spring provides the @Component annotation. Applying this annotation to class informs Spring that the class is a component and an object of this class can be instantiated and injected into another component. The @Component interface is applied to a class in the following manner: 2 | 3 | ```java 4 | 5 | @Component 6 | public class FooComponent {} 7 | 8 | ``` 9 | lthough the @Component annotation suffices to inform Spring of the injectability of a bean; Spring also provides specialized annotations that can be used to create components with more meaningful contextual information. 10 | 11 | -------------------------------------------------------------------------------- /textualContent/content/152.md: -------------------------------------------------------------------------------- 1 | n general, the concept of service in enterprise applications is vague, but in the context of a Spring application, a service is any class that provides methods to interact with domain logic or external components without maintaining state that changes the overall behavior of the service. For example, a service may act on behalf of an application to obtain documents from a database or obtain data from an external REST API. 2 | 3 | ```java 4 | @Service 5 | public class FooService {} 6 | ``` 7 | 8 | In practice, @Service and @Component are often used interchangeably due to the all-encompassing definition of a service. 9 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/66.md: -------------------------------------------------------------------------------- 1 | ## Audio On Web ⚡️⚡️ 2 | ### Creating your HTMLAudioElement entirely in javascript 3 | 4 | ```javascript 5 | var flush = new Audio('toilet_flush.wav'); 6 | flush.play(); 7 | ``` 8 | 9 | Some of the more commonly used properties of the audio element includes 10 | **src, currentTime, duration, paused, muted and volume**. 11 | 12 | ```javascript 13 | var flush = new Audio('toilet_flush.wav'); 14 | flush.addEventListener('loadeddata',() => { 15 | var duration = flush.duration; // the duration variable now holds the duration (in seconds) of the audio clip 16 | }) 17 | ``` 18 | 19 | > #66 -------------------------------------------------------------------------------- /textualContent/content/153.md: -------------------------------------------------------------------------------- 1 | 2 | i/ start few async tasks with varying prmework treats beans annotated with @Repository with special exception processing. To maintain a consistent data interface, Spring can translate the exceptions thrown by native repositories — such as SQL or Hibernate implementations — into general exceptions that can be handled uniformly. To include exception translation for classes annotated with @Repository, we instantiate a bean of type PersistenceExceptionTranslationPostProcessorocessing times, two last with callback handlers 3 | 4 | 5 | https://dzone.com/articles/5-spring-annotations-every-java-developer-should-k 6 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/143.md: -------------------------------------------------------------------------------- 1 | ```js 2 | function range(left, right) { 3 | return { 4 | [Symbol.iterator]: () => { 5 | let x = left; 6 | return { 7 | next: () => { 8 | if(x <= right) { 9 | return {done: false, value: x++} 10 | } else { 11 | 12 | return {done: true} 13 | } 14 | } 15 | } 16 | } 17 | } 18 | } 19 | 20 | 21 | for(let x of range(10, 1500)) { 22 | console.log(x) 23 | } 24 | 25 | ``` 26 | 27 | Getter getters abstraction. JS detects that there is symbola and it returns object awith next. it calls next for every iteration. that allows us to use for of loop 28 | 29 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/92.md: -------------------------------------------------------------------------------- 1 | ## Riddle Me ⚡⚡️ 2 | ### Return in a finally Block 3 | 4 | Consider this java code snippet, what is the output? 5 | 6 | ```java 7 | public String doSomething() { 8 | String name = "David"; 9 | try { 10 | throw new IOException(); 11 | } finally { 12 | return name; 13 | } 14 | } 15 | ``` 16 | 17 | In this case, even though the try block throws a new IOException, we use return in the finally block, ending it abruptly. This causes the try block to end abruptly due to the return statement, and not the IOException, essentially dropping the exception in the process. 18 | 19 | > #92 20 | -------------------------------------------------------------------------------- /textualContent/content/161.md: -------------------------------------------------------------------------------- 1 | Example class implemenation conforming encapsulation 2 | notice setters and getters 3 | ``` 4 | public class MyClass { 5 | private final List myStrings = new ArrayList<>(); 6 | public void setMyStrings(Collection s) { 7 | this.myStrings.clear(); 8 | if (s != null) { 9 | this.myStrings.addAll(s); 10 | } 11 | } 12 | public List getMyStrings() { 13 | return new ArrayList<>(this.myStrings); 14 | } 15 | public void addString(String s) { 16 | this.myStrings.add(s); 17 | } 18 | public void removeString(String s) { 19 | this.myStrings.remove(s); 20 | } 21 | // And maybe a few more helpful methods... 22 | }`` 23 | 24 | ``` 25 | -------------------------------------------------------------------------------- /textualContent/content_old/1_week/3_1_frameworks.txt: -------------------------------------------------------------------------------- 1 | ##### Approximations for GZipped versions 2 | 3 | Name | Size 4 | ------------- | ------------- 5 | Ember 2.2.0 | 111K 6 | Ember 1.13.8 | 123K 7 | Angular 2 | 111K 8 | Angular 2 + Rx | **143K** 9 | Angular 1.4.5 | 51K 10 | React 0.14.5 + React DOM | 40K 11 | React 0.14.5 + React DOM + Redux | 42K 12 | React 15.3.0 + React DOM | 43K 13 | React 16.2.0 + React DOM | 31.8K 14 | Vue 2.4.2 | **20.9K** 15 | Inferno 1.2.2 | 20K 16 | Preact 7.2.0 | **4kb** 17 | Aurelia 1.0.2 | 63K 18 | 19 | --- 20 | 21 | Also take a look at this awesome tool https://cost-of-modules.herokuapp.com created by @pastelsky -------------------------------------------------------------------------------- /textualContent/content/Archive-2/136.md: -------------------------------------------------------------------------------- 1 | ## Java 8 ⚡⚡️ 2 | ### Use Java.util.StringJoiner to join string intuitively 3 | 4 | #### Example 1 5 | ```java 6 | StringJoiner sj = new StringJoiner(','); 7 | sj.add('one').add('two'); 8 | sj.toString() 9 | 10 | // output - one, two 11 | ``` 12 | No need to use for loop and remove the last delimiter 13 | 14 | #### Example 2 15 | ```java 16 | StringJoiner myDate = new StringJoiner("-", "{", "}"); 17 | myDate.add("1985"); 18 | myDate.add("11"); 19 | myDate.add("22"); 20 | String birthDate = myDate.toString(); 21 | log("2. StringJoiner with Prefix and Suffix: " + birthDate); 22 | // output - {1985-11-22} 23 | ``` 24 | 25 | > #136 26 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/56.md: -------------------------------------------------------------------------------- 1 | ## That Thing ⚡️⚡️ 2 | ### Introducing Android 9 Pie 🐷 3 | 4 | The silence is broken, Andriod P is officially called Andriod Pie. 5 | 6 | Here are the top features, 7 | 1. Adaptive Battery 8 | 2. Slices 9 | - Slices can help users perform tasks faster by enabling engagement outside of the fullscreen app experience. 10 | 3. App Actions 11 | - App Actions is a new way to raise the visibility of your app and drive engagement. 12 | 4. Text Classifier and Smart Linkify (_this is helpful_) and many more... 13 | 14 | For complete details visit the official blog post [post](https://android-developers.googleblog.com/2018/08/introducing-android-9-pie.html) 15 | 16 | >#56 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/54.md: -------------------------------------------------------------------------------- 1 | ## Web API's ⚡️⚡️ 2 | ### Page Visibility API 3 | ```javascript 4 | function handleVisibilityChange() { 5 | if (document.hidden) { 6 | pauseSimulation(); 7 | } else { 8 | startSimulation(); 9 | } 10 | } 11 | 12 | document.addEventListener("visibilitychange", handleVisibilityChange, false); 13 | ``` 14 | 15 | ## Use cases 16 | 1. An application showing a dashboard of information doesn't want to poll the server for updates when the page isn't visible 17 | 2. A page wants to detect when it is being prerendered so it can keep accurate count of page views 18 | 3. A site wants to switch off sounds when a device is in standby mode (user pushes power button to turn screen off) 19 | 20 | >#54 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/86.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ - Riddle 2 | 3 | ### Implement Animal in such a way that regardless of if Animal is invoked with the new keyword, it’ll still works 4 | 5 | ```javascript 6 | var animal_normal = new Animal() 7 | var animal_abnormal = Animal() 8 | 9 | console.log(animal_normal instanceof Animal); // true 10 | console.log(animal_abnormal instanceof Animal); // true 11 | ``` 12 | 13 | > #85 14 | 15 | 16 | ```javascript 17 | function Animal (name, energy) { 18 | if (this instanceof Animal === false) { 19 | return new Animal(name, energy) 20 | } 21 | 22 | this.name = name 23 | this.energy = energy 24 | } 25 | ``` 26 | 27 | Now regardless of if Animal is invoked with the new keyword, it’ll still work properly. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Stars counter
2 |

A-Little-Better-Than-Yesterday 😇

3 | 4 | A new way to subscribe on [Little-Better-Than-Yesterday](https://github.com/makaravind/LBTY) to get great curated, mini treats daily of developer news, updates, best practices and everything in between. Updates come as [GitHub notifications]. 5 | 6 | #### Direct Links 7 | - [Daily Mini Treats](https://github.com/makaravind/ALBTY/issues/1) 🍬 🍭 8 | 9 | #### okay I'm intrigued ! How can I get treats straight to my mail ? 📣 10 | ![ezgif com-video-to-gif](https://user-images.githubusercontent.com/13570866/39958276-8454df70-561e-11e8-8e8a-57aad6dd71dc.gif) 11 | 12 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/88.md: -------------------------------------------------------------------------------- 1 | ## Java Jam 2 | 3 | ### Check out this code snippet! 4 | 5 | ```java 6 | public File getFile(String url) throws FileNotFoundException { 7 | // some code 8 | throw new FileNotFoundException(); 9 | } 10 | ``` 11 | 12 | No return ? still a valid java code! here is how... 13 | 14 | We are required to mark our method signature with a throws clause. A method can add as many exceptions as needed in its throws clause, and can throw them later on in the code, but doesn't have to. This method doesn't require a return statement, even though it defines a return type. This is because it throws an exception by default, which ends the flow of the method abruptly. The return statement, therefore, would be unreachable and cause a compilation error. 15 | 16 | > #89 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/137.md.skipped: -------------------------------------------------------------------------------- 1 | But that doesn’t work now, because $watch is looking for the watched property inside the $scope, 2 | and you don’t directly bind that property to $scope. Instead watched property is binded to this. 3 | The correct way to do it now is as shown in the following example: 4 | 5 | app.controller('Ctrl', function ($scope) { 6 | this.name = 'name'; 7 | 8 | $scope.$watch(function () { 9 | return this.title 10 | }.bind(this), function (newVal, oldVal) { 11 | 12 | }); 13 | }); 14 | Alternative is using angular.bind: 15 | 16 | app.controller('Ctrl', function ($scope) { 17 | this.name = 'name'; 18 | 19 | $scope.$watch(angular.bind(function () { 20 | return this.title 21 | }), function (newVal, oldVal) { 22 | 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/73.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | ### Types of property descriptors 3 | 4 | A particular property descriptor needs to be either an Accessor Property or a Data Property, they can’t be combined 5 | 6 | ```javascript 7 | const obj1 = { 8 | a: 1 9 | } 10 | 11 | console.log(Object 12 | .getOwnPropertyDescriptor(obj1, 'a')) 13 | 14 | { 15 | value: 1, 16 | writable: true, 17 | enumerable: true, 18 | configurable: true 19 | } // (e.g. Data Property) 20 | ``` 21 | 22 | 23 | ```javascript 24 | const obj2 = { 25 | get b() { } 26 | } 27 | 28 | console.log(Object 29 | .getOwnPropertyDescriptor(obj2, 'b')) 30 | 31 | { 32 | get: Function, 33 | set: undefined, 34 | enumerable: true, 35 | configurable: true 36 | } // (e.g. Accessor Property) 37 | 38 | ``` 39 | 40 | > #73 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/82.md: -------------------------------------------------------------------------------- 1 | ## Stylish CSS ⚡⚡️ 2 | ### Specificity 3 | 4 | ```css 5 | p { 6 | color: red 7 | } 8 | 9 | p { 10 | color: blue 11 | } 12 | ``` 13 | 14 | Since the CSS sheet is read from top to bottom. Only the second style is applied. All the P elements gets blue color. 15 | 16 | This behaviour can be modified by adding more specific selectors like classes and Ids. 17 | 18 | ```css 19 | p.specificClass { 20 | color: red 21 | } 22 | 23 | p { 24 | color: blue 25 | } 26 | ``` 27 | 28 | Now, The P with 'specificClass' class gets the red color and rest blue color. This property if called specificity. 29 | 30 | Following the increasing order of specificity 31 | 32 | ```javascript 33 | /* 34 | *[wild-card] (0) < tag selector(1) < class(10) < ID(100) < inline-styles(1000) 35 | */ 36 | ``` 37 | > #81 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/65.md: -------------------------------------------------------------------------------- 1 | ## Browser Blast ⚡️⚡️ 2 | 3 | ### This is a list of popular projects that are implementing a JavaScript engine: 4 | 5 | V8 — open source, developed by Google, written in C++ 6 | Rhino — managed by the Mozilla Foundation, open source, developed entirely in Java 7 | SpiderMonkey — the first JavaScript engine, which back in the days powered Netscape Navigator, and today powers Firefox 8 | JavaScriptCore — open source, marketed as Nitro and developed by Apple for Safari 9 | KJS — KDE’s engine originally developed by Harri Porten for the KDE project’s Konqueror web browser 10 | Chakra (JScript9) — Internet Explorer 11 | Chakra (JavaScript) — Microsoft Edge 12 | Nashorn, open source as part of OpenJDK, written by Oracle Java Languages and Tool Group 13 | JerryScript — is a lightweight engine for the Internet of Things. 14 | 15 | > #65 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/99.md: -------------------------------------------------------------------------------- 1 | ## Recommended Secure coding - Canonicalize path names before validating them 2 | 3 | The user can specify a file outside the intended directory by entering an argument that contains ../ sequences. Which is a valid path in a directory in linux. 4 | 5 | File.getCanonicalPath() method, introduced in Java 2, which fully resolves the argument and constructs a canonicalized path. Special file names such as dot dot (..) are also removed so that the input is reduced to a canonicalized form before validation is carried out. An attacker cannot use ../ sequences to break out of the specified directory when the validate() method is present. 6 | 7 | For example, the path /img/../etc/passwd resolves to /etc/passwd. 8 | 9 | [source](https://wiki.sei.cmu.edu/confluence/display/java/FIO16-J.+Canonicalize+path+names+before+validating+them) 10 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/89.md: -------------------------------------------------------------------------------- 1 | 2 | ```java 3 | public String readFirstLine(String url) throws FileNotFoundException { 4 | try { 5 | Scanner scanner = new Scanner(new File(url)); 6 | return scanner.nextLine(); 7 | } catch(FileNotFoundException ex) { 8 | throw ex; 9 | } 10 | } 11 | ``` 12 | try-with-resources Statement 13 | The previously complex and verbose block can be substituted with: 14 | 15 | 16 | ```java 17 | 18 | static String readFirstLineFromFile(String path) throws IOException { 19 | try(BufferedReader br = new BufferedReader(new FileReader(path))) { 20 | return br.readLine(); 21 | } 22 | } 23 | ``` 24 | 25 | This way, you don't have to concern yourself with closing the resources yourself, as the try-with-resources block ensures that the resources will be closed upon the end of the statement. -------------------------------------------------------------------------------- /textualContent/content/Archive-1/84.md: -------------------------------------------------------------------------------- 1 | ## Immediately Invoked Async Function Expressions 2 | 3 | ### Sometimes, it’d be nice if you could use await at the top level of a module or script. Alas, it’s only available inside async functions. You therefore have several options. 4 | 5 | You can either create an async function main() and call it immediately afterwards: 6 | 7 | ```javascript 8 | 9 | async function main() { 10 | console.log(await asyncFunction()); 11 | } 12 | main(); 13 | ``` 14 | 15 | Or you can use an Immediately Invoked Async Function Expression: 16 | 17 | ```javascript 18 | (async function () { 19 | console.log(await asyncFunction()); 20 | })(); 21 | ``` 22 | 23 | Another option is an Immediately Invoked Async Arrow Function: 24 | 25 | ```javascript 26 | (async () => { 27 | console.log(await asyncFunction()); 28 | })(); 29 | ``` 30 | 31 | > #84 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/98.md: -------------------------------------------------------------------------------- 1 | Recommended Secure coding - Normalize strings before validating them 2 | 3 | first things first, is Normalization different form validations? Yes 4 | 5 | "Normalization is important because in Unicode, the same string can have many different representations. According to the Unicode Standard [Davis 2008], annex #15" 6 | 7 | "...The most suitable normalization form for performing input validation on arbitrarily encoded strings is KC (NFKC) ." 8 | 9 | For example in Java, The Normalizer.normalize() method transforms Unicode text into the standard normalization forms described in Unicode Standard Annex #15 Unicode Normalization Forms. 10 | ```java 11 | 12 | // Normalize 13 | s = Normalizer.normalize(s, Form.NFKC); 14 | 15 | ``` 16 | [source](https://wiki.sei.cmu.edu/confluence/display/java/IDS01-J.+Normalize+strings+before+validating+them ) 17 | 18 | > #98 19 | -------------------------------------------------------------------------------- /textualContent/content/165.md: -------------------------------------------------------------------------------- 1 | Minimalism — The most undervalued development skill 2 | 3 | onerror is a special browser event that fires whenever an uncaught JavaScript error has been thrown. It’s one of the easiest ways to log client-side errors and report them to your servers. It’s also one of the major mechanisms by which Sentry’s client JavaScript integration (raven-js) works. 4 | 5 | ``` 6 | window.onerror = function(msg, _path, line, column, error) { 7 | fetch('/errors', { 8 | error: error ? error.stack : '', 9 | column: column, 10 | line: line, 11 | msg: msg 12 | }) 13 | return false 14 | } 15 | 16 | ``` 17 | This is all we need. Works perfectly and gets the job done. 18 | 19 | note: It is does not work in chrome console. 20 | source : https://volument.com/blog/minimalism-the-most-undervalued-development-skill 21 | https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror 22 | -------------------------------------------------------------------------------- /textualContent/content/177.md: -------------------------------------------------------------------------------- 1 | reduce alternative code 2 | more readable 3 | 4 | # example 1 5 | ``` 6 | numbers.reduce( 7 | (max, number) => Math.max(max, number), 8 | 0 9 | ) 10 | 11 | // alternative 12 | Math.max(...numbers); 13 | ``` 14 | 15 | #example 2 16 | ``` 17 | const graph = 18 | edges.reduce((g, edge) => { 19 | const [u, v] = edge; 20 | if(!g.has(u)) g.set(u, []); 21 | if(!g.has(v)) g.set(v, []); 22 | g.get(u).push(v); 23 | return g; 24 | }, new Map()); 25 | 26 | // alternative - just use loop - more readable 27 | const g = new Map(); 28 | for(const [u,v] in edges) { 29 | if(!g.has(u)) g.set(u, []); 30 | if(!g.has(v)) g.set(v, []); 31 | g.get(u).push(v); 32 | } 33 | ``` 34 | 35 | # example 3 36 | ``` 37 | arr.reduce((final, ele) => { 38 | if(Array.isArray(ele)) 39 | return [...final, ...ele]; 40 | return [...final, ele] 41 | }, []); 42 | 43 | // alternative 44 | arr.flat(); 45 | ``` 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/71.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | ### Property descriptors - Writable and Configurable 3 | 4 | While value and enumerable deal with reading properties, writable and configurable deal with writing properties 5 | 6 | If a property has writable set to false then that property’s value cannot be reassigned another value. 7 | 8 | If a property has configurable set to false then it cannot be deleted and it cannot have its property descriptor changed again. 9 | 10 | 11 | ```javascript 12 | const obj = Object.defineProperty({}, 'foo', { 13 | value: 'hello', 14 | writable: false, // reassignable? 15 | configurable: false // deletable/redefinable? 16 | }) 17 | obj.foo = 'bye' 18 | console.log(obj.foo) // 'hello' 19 | delete obj.foo 20 | console.log(obj.foo) // 'hello' 21 | Object.defineProperty(obj, 'foo', { 22 | value: 1 23 | }) // TypeError: Cannot redefine property: foo 24 | 25 | ``` 26 | 27 | > #71 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/74.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | ### Solve this riddle 3 | 4 | ```javascript 5 | // What code could lead to this outcome? 6 | if (typeof obj.p === 'number' && obj.p > 10) { 7 | console.log(obj.p) // outputs the string 'lies!' 8 | } 9 | ``` 10 | 11 | ### wait for the answer tomorrow 12 | > #74 13 | 14 | answer: 15 | 16 | ```javascript 17 | let accesses = 0 18 | const obj = Object.defineProperty({}, 'p', { 19 | get: () => { 20 | if (accesses++ >= 2) { 21 | return 'lies!' 22 | } 23 | return 12 24 | } 25 | }) 26 | ``` 27 | 28 | This situation can be prevented by reading the value from the object a single time, assigning the result of that read to an intermediary value 29 | 30 | ```javascript 31 | 32 | const p = obj.p // read object properties once 33 | if (typeof p === 'number' && p > 10) { 34 | console.log(p) // 12 35 | } 36 | ``` 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /textualContent/content/166.md: -------------------------------------------------------------------------------- 1 | this is a very interesting read on how bioinformatics and AI is evolving. 2 | http://www.wiringthebrain.com/2020/01/how-much-innate-knowledge-can-genome.html   3 | snippets from article: 4 | "In a recent debate between Gary Marcus and Yoshua Bengio about the future of Artificial Intelligence, the question came up of how much information the genome can encode. This relates to the idea of how much innate or prior “knowledge” human beings are really born with, versus what we learn through experience. This is a hot topic in AI these days as people debate how much prior knowledge needs to be pre-wired into AI systems, in order to get them to achieve something more akin to natural intelligence." 5 | " Being amazed that you can make a human with only 20,000 genes is thus like being amazed that Shakespeare could write all those plays with only 26 letters. It’s totally missing where the actual, meaningful information is and how it is decoded. " 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/69.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡️⚡️ 2 | ### Property Descriptors 3 | 4 | _property descriptors let you lie_ 5 | 6 | ```javascript 7 | Object.defineProperty( 8 | obj, 9 | propertyName, 10 | descriptors 11 | ) 12 | ``` 13 | 14 | In this example, obj is an Object which you want to define a property on. propertyName is a string name of the property. Finally, descriptors is an object describing the property descriptors. Let’s now take a look at the different types of descriptors which can be set. 15 | 16 | example: 17 | ```javascript 18 | const obj = {} 19 | Object.defineProperty(obj, 'foo', { 20 | value: 'hello', // the property value 21 | enumerable: false // property will not be listed 22 | }) 23 | console.log(obj) // {} 24 | console.log(obj.foo) // 'hello' 25 | console.log(Object.keys(obj)) // [] 26 | console.log(Reflect.ownKeys(obj)) // [ 'foo' ] 27 | console.log('foo' in obj) // true 28 | ``` 29 | 30 | > #69 31 | 32 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/94.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym 2 | 3 | ## Create React App 2.0 4 | It brings a year’s worth of improvements in a single dependency update. Here’s a short summary of what’s new in this release: 5 | • More styling options: you can use Sass and CSS Modules out of the box. 6 | • Updated to Babel 7, including support for the React fragment syntax and many bugfixes. 7 | • Updated to webpack 4, which automatically splits JS bundles more intelligently. 8 | • Updated to Jest 23, which includes an interactive mode for reviewing snapshots. 9 | • Added PostCSS so you can use new CSS features in old browsers. 10 | • You can use Apollo, Relay Modern, MDX, and other third-party Babel Macros transforms. 11 | • You can now import an SVG as a React component, and use it in JSX. 12 | • You can try the experimental Yarn Plug’n’Play mode that removes node_modules. 13 | • You can now plug your own proxy implementation in development to match your backend API. 14 | source : reactjs.org 15 | 16 | > #94 17 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/43.md: -------------------------------------------------------------------------------- 1 | ## Cache Buster ⚡️⚡️ 2 | ### What is server-side caching? 3 | 4 | ![43](https://user-images.githubusercontent.com/13570866/42724829-f025d43a-8796-11e8-90ea-ce19663d9db2.PNG) 5 | 6 | In the image above, A caching proxy is a server that stores the static files that are used to respond to common requests. A caching proxy will intercept common requests and quickly deliver a response. It prevents those requests from stressing your main web servers. 7 | 8 | The caching proxy will have different files that have been cached at different times, and it needs to decide whether it should still serve these files. This will depend on your _caching policy_. 9 | 10 | Whole bunch of these situated across the world forms, what's called as **CDN** 11 | 12 | Some common CDN providers include **Rackspace, Akamai, and Amazon Web Services.** 13 | 14 | [source](https://dev.to/kbk0125/web-caching-explained-by-buying-milk-at-the-supermarket-9k4?utm_source=mybridge&utm_medium=blog&utm_campaign=read_more) 15 | 16 | > #43 -------------------------------------------------------------------------------- /textualContent/content/Archive-1/90.md: -------------------------------------------------------------------------------- 1 | ## Clean Code ⚡⚡️ 2 | ### Best Exception Handling Practices - 1 3 | 4 | Avoid Exceptional Conditions 5 | Sometimes, by using simple checks, we can avoid an exception forming altogether: 6 | 7 | ```java 8 | public Employee getEmployee(int i) { 9 | Employee[] employeeArray = {new Employee("David"), new Employee("Rhett"), new 10 | Employee("Scott")}; 11 | 12 | if(i >= employeeArray.length) { 13 | System.out.println("Index is too high!"); 14 | return null; 15 | } else { 16 | System.out.println("Employee found: " + employeeArray[i].name); 17 | return employeeArray[i]; 18 | } 19 | } 20 | } 21 | 22 | ``` 23 | Calling this method with a valid index would result in: 24 | 25 | Employee found: Scott 26 | But calling this method with an index that's out of bounds would result in: 27 | 28 | Index is too high! 29 | In any case, even though the index is too high, the offending line of code will not execute and no exception will arise. 30 | 31 | > #90 32 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/63.md: -------------------------------------------------------------------------------- 1 | ## Hot HTML ⚡️⚡️ 2 | 3 | ```javascript 4 |
9 | ... 10 |
11 | ``` 12 | 13 | HTML5 is designed with extensibility in mind for data that should be associated with a particular element but need not have any defined meaning. data-* attributes allow us to store extra information on standard, 14 | 15 | to get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that dashes are converted to camelCase). 16 | 17 | ### Issues 18 | 1. The main issues to consider are Internet Explorer support and performance. Internet Explorer 11+ provides support for the standard, but all earlier versions do not support dataset. To support IE 10 and under you need to access data attributes with getAttribute() instead. 19 | 2. Also, the performance of reading data-attributes compared to storing this data in a regular JS object is poor. 20 | 21 | > #63 22 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/75.md: -------------------------------------------------------------------------------- 1 | ## Javascript Gym ⚡⚡️ 2 | 3 | ### Whenever you have a method that is specific to a class itself, but doesn’t need to be shared across instances of that class, you can add it as a static property of the class. 4 | 5 | ```javascript 6 | class Animal { 7 | constructor(name, energy) { 8 | this.name = name 9 | this.energy = energy 10 | } 11 | eat(amount) { 12 | console.log(`${this.name} is eating.`) 13 | this.energy += amount 14 | } 15 | sleep() { 16 | console.log(`${this.name} is sleeping.`) 17 | this.energy += length 18 | } 19 | play() { 20 | console.log(`${this.name} is playing.`) 21 | this.energy -= length 22 | } 23 | static nextToEat(animals) { 24 | const sortedByLeastEnergy = animals.sort((a,b) => { 25 | return a.energy - b.energy 26 | }) 27 | 28 | return sortedByLeastEnergy[0].name 29 | } 30 | } 31 | ``` 32 | 33 | Now, because we added nextToEat as a static property on the class, it lives on the Animal class itself (not its prototype) 34 | 35 | > #75 -------------------------------------------------------------------------------- /textualContent/content/167.md: -------------------------------------------------------------------------------- 1 | java Nested Class 2 | A nested class refers to the idea of defining one class inside another class. The scope of the nested class is bounded by the scope of the enclosing classes. That means if Pearl is a class defined within, say, the Oyster class, the object of Pearl cannot exist without the existence of an Oyster object and the class within the class, Pearl, can access all the members of the Oyster class, including private members. But, the external class, such as Oyster, cannot access the members of Pearl class. 3 | ![java-nested-class](https://user-images.githubusercontent.com/13570866/71957539-0a31ec00-3214-11ea-9f34-af134bffb783.png) 4 | 5 | Now, the nested class can be of two types, a static nested class and a non-static nested class. A nested class, Pearl, which is declared static with the static modifier, cannot access the members of the enclosing class Oyster directly because the nested class Pearl is now static. As a result, it needs an object of the Oyster class to access the members of its enclosing class. Static nested classes are very rarely used. 6 | -------------------------------------------------------------------------------- /textualContent/content/Archive-2/144.md: -------------------------------------------------------------------------------- 1 | Database Sharding ⚡⚡️ 2 | Temporal sharding of relation DBs 3 | Sharding is taking a single logical data model and partitioning it into disjoint subsets, ideally so that relationships between records in the data model do not span a single "shard". 4 | 5 | In practice, a shard is often an independent database instance. A simple example would be sharding a database of people by the last name such that names that start with "a" are on shard 1, "b" are on shard 2, etc. 6 | 7 | Distributed hash tables are a special case of sharding; all records can be sharded but there will be no common relationship between records on a particular shard. 8 | 9 | Flaws: 10 | Load balancing - Most of the old machines didn't get any traffic because people are interested in what is happening now, especially with Twitter. If data is sharded on poor fields. 11 | Expensive - They filled up one machine, with all its replication slaves, every three weeks, which is an expensive setup. 12 | Logistically complicated - Building a whole new cluster every three weeks is a pain for the DBA team. 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 aravind m 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/44.md: -------------------------------------------------------------------------------- 1 | ## Cache Buster ⚡️⚡️ 2 | ### Client-Side Caching - browser 3 | 4 | People across the country (or the world) can get responses quickly through CDN. There’s just one issue — they have no way to store it. Your customers still need to request for the resources incase of refresh. 5 | 6 | The solution? Client-Side Caching 7 | 8 | ![44](https://user-images.githubusercontent.com/13570866/42724831-f52d0a84-8796-11e8-9b6b-66a6ece28452.png) 9 | 10 | Separate location for storing static assets since it is on the client-side, or on the same computer as the browser. 11 | 12 | This is great for sites like Facebook or Amazon that you might frequently visit. It’s great for their server costs too, since they can reduce the number of requests they need to handle. 13 | 14 | How does your browser know when to request new files from the server? Otherwise, you would never experience updated versions of these local files. Well, just like milk producers put a date on their milk packaging, servers will add some sort of identifier within the HTTP response header. 15 | 16 | [source](https://dev.to/kbk0125/web-caching-explained-by-buying-milk-at-the-supermarket-9k4?utm_source=mybridge&utm_medium=blog&utm_campaign=read_more) 17 | 18 | > #44 -------------------------------------------------------------------------------- /textualContent/content/Archive-2/129.md: -------------------------------------------------------------------------------- 1 | ```java 2 | 3 | Observable ints = 4 | Observable.create(subscriber -> { 5 | log("Create"); 6 | subscriber.onNext(42); 7 | subscriber.onCompleted(); 8 | } 9 | ); 10 | log("Starting"); 11 | ints.subscribe(i -> log("Element A: " + i)); 12 | ints.subscribe(i -> log("Element B: " + i)); 13 | log("Exit"); 14 | 15 | /* 16 | main: Starting 17 | main: Create 18 | main: Element A: 42 19 | main: Create 20 | main: Element B: 42 21 | main: Exit 22 | */ 23 | ``` 24 | 25 | cache() does is stand between subscribe() and our custom Observable. When the first subscriber appears, cache() delegates subscription to the underlying Observable and forwards all notifications (events, completions, or errors) downstream. However, at the same time, it keeps a copy of all notifications internally. When a subsequent subscriber wants to receive pushed notifications, cache() no longer delegates to the underlying Observable but instead feeds cached values. With caching, the output for two Subscribers is quite different: 26 | 27 | ```java 28 | main: Starting 29 | main: Create 30 | main: Element A: 42 31 | main: Element B: 42 32 | main: Exit 33 | ``` 34 | -------------------------------------------------------------------------------- /textualContent/content/Archive-1/100.md: -------------------------------------------------------------------------------- 1 | ## Recommended Secure coding - Specify an appropriate locale when comparing locale-dependent data 2 | 3 | consider the following java code snippet 4 | 5 | ```java 6 | 7 | public static void processTag(String tag) { 8 | if (tag.toUpperCase().equals("SCRIPT")) { 9 | return; 10 | } 11 | // Process tag 12 | } 13 | 14 | 15 | ``` 16 | 17 | This noncompliant code example uses the locale-dependent String.toUpperCase() method to convert an HTML tag to uppercase to check it for further processing. The code must ignore