This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lists | |
// Most examples come from | |
// Functional Programming in Scala | |
// Seven Languages in Seven Weeks | |
// Programming In Scala | |
// Learn You A Haskell | |
object ListOperations { | |
def main(args: Array[String]) = { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd Documents | |
mkdir first | |
cd first | |
sudo apt-get install -y curl | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update && sudo apt-get install -y yarn | |
yarn init -y | |
yarn add express express-handlebars | |
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm package.json | |
rm -f package.json.original | |
rm -r node_modules | |
rm -r test | |
yarn init -y | |
yarn add ava browser-env -D | |
perl -0777 -i.original -pe 's/aaa/bbb/igs' package.json | |
perl -0777 -i.original -pe 's/"license": "MIT",/"license": "MIT",\n "scripts": \{\n "test": "ava --verbose"\n\n },\n "ava": \{\n "require": [\n ".\/setup-browser-env.js"\n ]\n },\n/igs' package.json | |
cat > setup-browser-env.js <<EOL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# custom loaders for webpack : taken from chriserin at: | |
# https://til.hashrocket.com/posts/6750cdfffd-custom-loaders-for-webpack | |
mkdir tmp | |
cd tmp | |
cat > index.html <<EOL | |
<body> | |
<script src="bundle.js"></script> | |
</body> | |
EOL | |
cat > main.js <<EOL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - | |
sudo apt-get update | |
sudo apt-get install -y nodejs | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update && sudo apt-get install -y yarn | |
yarn init -y | |
yarn add karma karma-jasmine karma-chrome-launcher jasmine-core | |
sudo yarn global add karma-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If this link doesn't work, go to next step: | |
https://github.com/jasmine/jasmine/releases | |
download latest version of standalone jasmine from that link or search Google for "standalone jasmine". | |
Follow this tutorial: | |
https://code.tutsplus.com/tutorials/testing-your-javascript-with-jasmine--net-21229 | |
Here's my version of the code: | |
// src/convert.js | |
function Convert(iAmount, sUnitFrom) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install -y python3.6 python3-pip virtualenv mongodb | |
sudo systemctl start mongodb | |
virtualenv -p /usr/bin/python3.6 --distribute myproject | |
source myproject/bin/activate | |
pip install --upgrade pip | |
python -m pip install pymongo | |
pip install PyZen | |
cat > test_mongo.py <<EOL | |
import unittest | |
from pymongo import MongoClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We'll create Scramble::Game and test it. | |
# Adapted from book "Perl Medic" (Chapter on Testing) | |
h2xs -AXn Scramble::Game | |
cd Scramble-Game | |
perl Makefile.PL | |
make test | |
mv t/Scramble-Game.t t/01_basics.t | |
sed -i '/t\/Scramble-Game.t/ d' MANIFEST # remove .t file from MANIFEST | |
perl -0777 -i.original -pe 's/\A.*use strict/#\/usr\/bin\/perl\nuse strict/igsm' t/01_basics.t | |
perl -0777 -i.original -pe 's/^###.*$//igsm' t/01_basics.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sources: | |
# Mastering Object-Oriented Perl Programming (OOP): Unleashing the Power of OOP in Perl (YouTube, last 2 minutes!!!!) | |
# Docs for Moose::Meta::Attribute::Native::Trait::Array | |
# probably at: https://metacpan.org/pod/Moose::Meta::Attribute::Native::Trait::Array | |
# GlobalStuff.pm in current directory | |
package GlobalStuff; | |
use Moose; | |
has 'name' => (is=>'ro' , isa=>'Str' , default=>''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MyRealArray; | |
use Moose; | |
use namespace::autoclean; | |
has 'arr' => ( | |
is => 'rw', | |
isa => 'ArrayRef', | |
default => sub { [] }, | |
); |
OlderNewer