This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - | |
| echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |
| sudo apt-get update | |
| sudo apt-get install -y mongodb-org | |
| sudo systemctl daemon-reload | |
| sudo systemctl start mongod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const debounce = (f, delay) => { | |
| let timer = null; | |
| return a=> { | |
| if(!timer) { | |
| timer = setTimeout(a=>f(a), delay); | |
| }else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { match } from 'afpl/lib/control/Match'; | |
| import { Suspend, Return, liftF } from 'afpl/lib/monad/Free'; | |
| import { Maybe, fromAny } from 'afpl/lib/monad/Maybe'; | |
| import { IO, safeIO, wrapIO } from 'afpl/lib/monad/IO'; | |
| import { Free } from 'afpl/lib/monad/Free'; | |
| import { Functor } from 'afpl/lib/data/Functor'; | |
| import { identity, compose } from 'afpl/lib/util'; | |
| import { SharedBuffer } from 'afpl/lib/async/SharedBuffer'; | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function outer (int $outerArg) { //this could also be a custom type | |
| return function (int $innerArg) { // closure function | |
| return $outerArg+$innerArg; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Add the following lines to theme's html code right before </head> --> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
| <script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
| <script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script> | |
| <!-- | |
| Usage: just add <div class="gist">[gist URL]</div> | |
| Example: <div class="gist">https://gist.github.com/1395926</div> | |
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func outer (outerArg int) func(int) { //this could also be a custom type | |
| return func (innerArg int) int { // closure func | |
| return outerArg+innerArg; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function outer (outerArg) { | |
| return function (innerArg) { // closure function | |
| return outerArg+innerArg; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Does this work? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //One of the popular concepts in OOP style programming is the concept of loose coupling. | |
| //Your objects should have everything they need to carry out their duties from the time you instansiate them (new Object). | |
| //Failing that, you should be able to inject any missing dependecies into your classes whenever necessary. | |
| //This does not mean you go and create a whole bunch of setters. | |
| //Wrong! | |
| dog = new Animal(); | |
| dog.setColor('blue'); |
NewerOlder