Merge pull request #395 from itsHobbes/master

feat: Make spotlight formatting consistent across articles
This commit is contained in:
Jean-Philippe Sirois
2021-04-02 09:50:26 -04:00
committed by GitHub
13 changed files with 137 additions and 138 deletions
+28 -28
View File
@@ -1,9 +1,9 @@
### What is Ansible?
## What is Ansible?
Ansible is an open-source software provisioning, configuration management, and application deployment tool enabling Infrastructure as code. It handles configuration management, application deployment, cloud provisioning, ad-hoc task execution, network automation, and multi-node orchestration.
### What are the advantages of Ansible over other configuration management tools such as Chef or cfengine?
## What are the advantages of Ansible over other configuration management tools such as Chef or cfengine?
A big problem with other configuration management systems was that they relied on an agent to manage their systems, this creates a new problem of "managing the management" because the agents must be bootstrapped and kept updated which adds complexity. Ansible however is agentless. Ansible takes advantage of existing remote management systems like ssh and winrm to do its execution and not require managing another agent. While incoming ssh and winrm are never enabled by default in these operating systems, ansible is also a provisioning tool, which means it can provision systems with those two enabled. Rules can be set to ensure restarting these daemons if they crash, or restoring the state of the system in case ansible cant reach them, further reducing the need of human intervention.
@@ -12,7 +12,7 @@ Another important advantage of ansible over chef is the “source of truth”. A
Another big advantage Ansible has over other Configuration Management systems is the ability to use dynamic inventory. With Chef, for example, you have to manually configure what system is being managed by Chef. With Ansible, you can poll data from an external source. This external source can be a system managed by Ansible itself, with ansible itself providing the data for when a new system is provisioned in the private or public cloud, making ansible self-reliant.
### Why use Ansible when I can just use bash & perl?
## Why use Ansible when I can just use bash & perl?
Ansible provides five major advantages to using bash & perl.
@@ -27,22 +27,22 @@ Ansible provides five major advantages to using bash & perl.
**5.** Ansible comes with the ultimate oh shit button. Paid support.
### How do I get ansible?
## How do I get ansible?
You can get Ansible as a control node on most major platforms except Windows. Windows can be managed by Ansible, but it cannot be a control node.
On Fedora:
```
```sh
$ sudo dnf install ansible
```
On RHEL/CentOS:
```
```sh
$ sudo yum install ansible
```
On Ubuntu:
```
```sh
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo apt-add-repository --yes --update ppa:ansible/ansible
@@ -50,27 +50,27 @@ $ sudo apt install ansible
```
On Gentoo:
```
```sh
$ merge -av app-admin/ansible
```
On FreeBSD:
```
```sh
$ sudo pkg install py36-ansible
```
Instructions to install on other targets can be found on https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html.
### How do I use ansible?
## How do I use ansible?
Running an ansible playbook is simple.
```
```sh
$ ansible -i inventory playbook.yml
```
`-i` is to give the inventory, or the hosts where this playbook would run. This file contains the hostname/ip of the machine.
An example inventory file:
```
```yml
[all:vars]
ansible_user=tph_admin
ansible_ssh_pass=hunter2
@@ -104,14 +104,14 @@ To explain, `[all:vars]` are the default variables for all nodes in this invento
Examples of ansible playbooks are in the section right below this section.
In your working directory, you can create a file named .ansible.cfg, and list this inventory there. By doing that, you dont have to provide an inventory file each time.
```
```sh
$ cat .ansible.cfg
[defaults]
Inventory = /path/to/inventory
```
This simplifies your commands a little. Now you can do things such as:
```
```sh
$ ansible web --list-hosts
$ ansible web, ansible --lists-hosts
$ ansible node* --list-hosts
@@ -120,7 +120,7 @@ $ ansible all --list-hosts
If you dont set the inventory variable in .ansible.cfg file you can still do the same but you need to prepend the inventory.
```
```sh
$ ansible -i inventory all --list-hosts
```
@@ -128,13 +128,13 @@ From this point we assume you have already set up .ansible.cfg file but you don
Sometimes you just want to run a single module against all your hosts, such as maybe pinging all your machines to ensure those are alive. Writing a playbook for this is easy but also overkill. Instead, you can do:
```
```sh
$ ansible web -m ping
```
Remember, you dont have to run a command over a group. You can also run it over a node.
```
```sh
$ ansible node1 -m ping
```
@@ -142,18 +142,18 @@ Ping is a module that comes built into ansible. We specify it will be a module u
Sometimes modules might not exist for your command. Maybe you are using a custom thing. In that case you can run ad-hoc commands over ansible.
```
```sh
$ ansible node1 -m command -a “ping”
```
In this case command is a module and `-a` is followed by the command that will be run.
### Examples of Ansible Playbooks
## Examples of Ansible Playbooks
Ansible playbooks are yaml files. They have their own syntax, however the syntax is so dead simple, you can figure it out after a couple hours, we will try to provide examples to make it easy to understand, but you are recommended to read ansible documentation on writing playbooks since writing the same content from that over here is unnecessary.
A playbook to install cockpit on your CentOS web server.
```
```yml
---
- name: Cockpit is installed
hosts: web # can be a single node as well
@@ -172,14 +172,14 @@ A playbook to install cockpit on your CentOS web server.
YAML is a pain to write and syntax errors can occur. However, ansible comes with a tool to ensure theres no syntax error. Check your playbook with:
```
```sh
$ ansible-playbook --syntax-check playbook.yml
```
In fact, that playbook is incorrect. Run that command to see where its incorrect!
Then you can run it using:
```
```sh
$ ansible-playbook playbook.yml
```
@@ -188,7 +188,7 @@ You can also use the previous command we listed in the previous section and do t
Note, since ansible is stateless we just tell ansible what to do. If the cockpit is already there it doesnt care and just says ok. If its not there, itll install a cockpit. If its not the latest version, it will update it. Ansible playbooks are for most parts declarative, meaning you tell it what to do, and not how to do it. Sometimes there is no module and you have to tell it exactly what to do using commands.
A playbook to ensure certain users are present in a node.
```
```yml
---
- name: Ensure Users are present
hosts: web
@@ -206,7 +206,7 @@ A playbook to ensure certain users are present in a node.
```
Create a VM on vsphere ESXi from a template.
```
```yml
---
- name: Create a VM from a template
hosts: localhost
@@ -233,15 +233,15 @@ We also have a playbook that we use for provisioning virtual storage clusters on
Theres a lot more you can do with it, so go on and experiment with things you do daily and see what you can automate!
### When should I not use ansible?
## When should I not use ansible?
When its trivial to do something with a couple lines of bash or perl. Say opening a zip file, exporting all the test data from it to make a graph. This might seem like a stupid thing to point out, but people do it all the time.
### Resources
## Resources
https://docs.ansible.com/
### Ansible AWX & Tower
## Ansible AWX & Tower
Ansible comes with a web dashboard, and it is highly recommended you install it. Its mindlessly easy to install, and makes using ansible a breeze. It exposes a REST API, that you can use to automate ansible even further. You shouldnt be using Ansible without it!
@@ -251,7 +251,7 @@ After you have installed Ansible, to install AWX you need to install some depend
To set up awx:
```
```sh
$ git clone https://github.com/ansible/awx
$ cd awx/installer/
$ ansible-playbook -i inventory install.yml
+1 -1
View File
@@ -35,7 +35,7 @@ A bot account.
- Click **Add Bot** and then **yes, do it**
- Copy the **token** and make a note of it. You'll need that later too.
##### TOKEN WARNING
#### TOKEN WARNING
Do not share this token, anywhere. Ever. Do not commit it to github. Keep it private.
If you do accidentally share it on github or alike its important that you regenerate it ASAP.
+5 -5
View File
@@ -1,19 +1,19 @@
**What is Docker?**
## What is Docker?
Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. Containers allow for total application and environment isolation which makes it much easier to ensure an application runs with any necessary dependencies.
**Why should I use Docker?**
## Why should I use Docker?
The simplest use case for Docker is packaging an application into an image and then running it on any machine running the Docker platform. Think running your API locally on Windows, on your OSX laptop, or on a Linux server in a cloud without making any changes to your codebase, all with the same command.
For more complex deployments consisting of multiple containers, Docker provides a tool called docker-compose. This will read a configuration of one or more Docker containers and run them for you and manage them as a single application.
Another benefit is using it to perform builds or development on local machines to avoid needing to set up a development environment. As dependencies can be a nightmare in situations like this, requiring things like npm or virtualenv and other isolation techniques, containerization can greatly simplify things and shorten the time it takes for someone to get set up on a project. You can even pull down a container containing a language runtime and just start writing code immediately, for languages with REPLs you can use docker to launch a REPL shell for any language without needing to go install a runtime on your machine.
**What's the difference between Docker and a VM?**
## What's the difference between Docker and a VM?
VMs have been widely used to solve these problems. The key difference between VMs and containers is that containers are not a virtual OS. All containers running on a host share the same parent kernel. Container technology is enabled by core Linux kernel features for isolating applications. When you run a Linux container on a Windows machine using Docker for Windows, a single Linux VM must run as the host for the Linux containers, but when running natively on a Linux machine, no VM is required, and container applications run inside an isolated process, just like any other application.
The advantage to this approach is that it's very lightweight since it doesn't require the overhead of a virtual guest operating system and virtual access to resources through a hypervisor.
**Examples**
## Examples
You can get a fully functional ubuntu machine by just running
```sh
@@ -68,7 +68,7 @@ OK
"1234"
```
**Resources**
## Resources
- The official get-started guide: https://docs.docker.com/get-started/
- The public Docker registry: https://hub.docker.com/explore/
+10 -10
View File
@@ -1,19 +1,19 @@
**What is Elixir?**
## What is Elixir?
Elixir is a dynamically typed, functional programming language, with an emphasis on concurrency.
Elixir, despite being a young language, has grown quite rapidly, and has surprisingly fleshed out libraries and documentation.
On a surface level, the language was inspired by ruby in terms of syntax, but the way the language works is quite different.
Elixir leverages concurrency via the "actor model", where many lightweight processes (not OS processes) are run at the same time, and manage diferent aspects of a program.
To do this, Elixir compiles to the BEAM / Erlang VM, which was built with this kind of distributed programming model in mind. Elixir is very similar in features to Erlang.
**What is Erlang?**
## What is Erlang?
Erlang is a much older programming language, for which the Erlang VM was designed. Erlang was initially conceived of at Ericsson, for use in telecommunications. They needed to be able to handle many different calls at once, and so needed a programming model that support many different workers, or "actors" running concurrently.
The Erlang VM leverages the actor model to do this.
**How is Elixir different from Erlang?**
## How is Elixir different from Erlang?
Elixir has an arguably friendlier syntax, but for the most part is very similar to erlang in terms of language constructs.
One major addition to the language however is metaprogramming. Elixir has a rich and easy to use macro system, and an almost homiconic syntax, somewhat reminiscent of Lisp, but without the parens. Elixir also comes with a somewhat richer standard library. Another big advantage of Elixir is very easy interop with Erlang: calling an Erlang function is as simple as calling an Elixir one, and Erlang users can also use Elixir functions with little pain.
**What is the actor model?**
## What is the actor model?
We've mentioned the actor model a few times, but what exactly is it?
The actor model is 2 things
@@ -22,22 +22,22 @@ The actor model is 2 things
In elixir / erlang, we can run millions of processes concurrently with no worry at all. Each process has its own memory and resources, and to share these, they must communicate. Communication via processes is done via "message passing" where a process A will send a message to another process B, ready to receive and respond to that message. The only way to share data is by communicating, no 2 processes can hold onto the same piece of memory. This model avoids many problems arising from shared concurrent state (though not all, mind you).
**How do I learn more about Elixir?**
## How do I learn more about Elixir?
There's quite a few resources on Elixir, including a few books https://elixir-lang.org/learning.html#books.
A good place to start if you're interested is the website itself: https://elixir-lang.org/ which includes a lot of information about the language, including a guide to installing and getting started with it, as well as a large tutorial guiding you through most of the language's constructs.
Another tutorial series that goes a bit more in depth is: https://elixirschool.com/en/, which I used when learning the language myself.
**Code Examples**
## Code Examples
**A Simple Hello World**
### A Simple Hello World
```elixir
IO.puts "Hello World from Elixir!"
```
**Various ways of summing a lists**
### Various ways of summing a lists
The first works via recursion and pattern matching on the shape of a list, the second works by using a function defined in the Enum module.
```elixir
@@ -55,7 +55,7 @@ defmodule Sums do
end
```
**Concurrent Processes**
### Concurrent Processes
A simple example how simple processes can delegate work between eachother. The different processes here are running in parallel after being spawned.
```elixir
@@ -83,7 +83,7 @@ defmodule Dialogue do
end
```
**A concurrent Key/Value store**
### A concurrent Key/Value store
```elixir
defmodule Store do
+10 -10
View File
@@ -1,10 +1,10 @@
**What is GraphQL?**
## What is GraphQL?
GraphQL is a query language for APIs, meant to challenge and replace REST. At its core, GraphQL enables declarative data fetching where a client can specify exactly what data it needs from an API. Put bluntly, a lot of people claim GraphQL to be REST 2.0.
**Why does GraphQL exist?**
## Why does GraphQL exist?
GraphQL was created internally by Facebook in 2012, mainly to optimize the network load for mobile devices. Interestingly, other companies like Netflix or Coursera were working on comparable ideas to make API interactions more efficient. When Facebook announced GraphQL, Coursera abandoned their efforts and jumped on GraphQL.
**What makes GraphQL better than REST?**
## What makes GraphQL better than REST?
1. GraphQL resolves the issues of underfetching, and overfetching of REST. For example, if you were to retrieve a user, its name, and the title of his posts, REST would end up over and under fetching this :
@@ -76,7 +76,7 @@ query user(id: "5") {
3. Strong-typing. Contrary to working with JSON responses limited to string and numeric, and the discrepancy between front-end (JS) and any back-end language being lost in translation.
**Core concepts**
## Core concepts
GraphQL has three types of operations:
- queries (fetching data),
@@ -138,10 +138,10 @@ becoming:
http://myapi/graphql?query={me{name}}
```
**How can I start using GraphQL?**
## How can I start using GraphQL?
While it is possible to convert an existing REST endpoint to GraphQL, either through automated tools, or manually, the best case scenario would be on an entirely new project.
**Common misconceptions**
## Common misconceptions
- Because the query is explicit, a lot of people think that GraphQL is unsafe, making all of the data available to anyone. GraphQL is bound to the same safety procedures that a regular API would: permissions are defined by the backend.
@@ -149,10 +149,10 @@ While it is possible to convert an existing REST endpoint to GraphQL, either thr
- When it was first announced by Facebook, a lot of people thought it was React exclusive! This is not true. GraphQL can work on any tech stack (although some languages have more complete tooling than others)
**Closing notes**
## Closing notes
Today, GraphQL is used in production by lots of different companies such as GitHub, Twitter, Yelp and Shopify - to name only a few. We are seeing month after month, small and large companies converting to it.
**Related projects and libraries**
## Related projects and libraries
- Apollo (GraphQL server + client) <https://www.apollographql.com/>
- Relay (GraphQL client) <https://facebook.github.io/relay/>
@@ -162,7 +162,7 @@ Today, GraphQL is used in production by lots of different companies such as GitH
- GraphCMS <https://graphcms.com/>
- Graphene JS & Python <http://graphene-js.org/> <http://graphene-python.org/>
**Attached resources**
## Attached resources
- Full-stack introduction to GraphQL: <https://www.howtographql.com/>
- Zero to GraphQL in 30m: <https://www.youtube.com/watch?v=UBGzsb2UkeY>
@@ -170,7 +170,7 @@ Today, GraphQL is used in production by lots of different companies such as GitH
- GraphQL intro: <https://graphql.org/learn/>
- Awesome GraphQL: <https://github.com/chentsulin/awesome-graphql>
**Example codebase**
## Example codebase
- Airbnb Clone server (NodeJS): <https://github.com/prismagraphql/graphql-server-example>
- E-commerce full-stack (React+NodeJS) <https://github.com/KATT/shop>
+3 -3
View File
@@ -1,8 +1,8 @@
**What is Haskell?**
## What is Haskell?
"Haskell is a computer programming language. In particular, it is a polymorphically statically typed, lazy, purely functional language, quite different from most other programming languages. The language is named for Haskell Brooks Curry, whose work in mathematical logic serves as a foundation for functional languages. Haskell is based on the lambda calculus, hence the lambda we use as a logo." - Haskell Wiki
The above being said, if you perceive yourself to be "bad" at math, don't feed into it. If you are interested in using it and you apply yourself it will work out.
**Why should I use Haskell?**
## Why should I use Haskell?
Haskell is a general purpose programming language. So you can use it for anything, from scripting to game development - that being said, it provides you with some rather unique and cool benefits not found in many other places.
- Haskell code tends to be very short and clear (See code examples below)
@@ -11,7 +11,7 @@ Haskell is a general purpose programming language. So you can use it for anythin
- The type system is exceptionally good. Certain types of errors cease to exist (e.g. no Null pointer exception) (See here: https://softwareengineering.stackexchange.com/questions/279316/what-exactly-makes-the-haskell-type-system-so-revered-vs-say-java?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa )
- Purity. Haskell _does not allow for side affects_. In other languages, a "getMember" function might get you a member, might not. But it might also scrape a key up the side of your car. This kind of problem is not possible in Haskell thanks to purity. (See here: https://wiki.haskell.org/Functional_programming#Purity)
**Code Examples**
## Code Examples
Fizzbuzz
+8 -8
View File
@@ -1,11 +1,11 @@
**What is Julia?**
## What is Julia?
Julia is a high-level dynamic programming language for numerical computing. It is free and open-source: under the MIT license.
Although Julia is still in its youth (the current release is v1.2), Julia provides a lot of support for mathematical analysis and data science.
**How hard is Julia to learn?**
## How hard is Julia to learn?
Julia is a fairly complex language but has some very simple behaviors which are easy to pick up. It is mainly used for data science and mathematical analysis, so those complexities come with it. You must understand some mathematical principles to use the language well. Julia uses certain expressions differently from other languages as well making it a bit harder to pick up; however, it makes sense. For example, string concatenation is done with \*, and not +. Julia is heavily documented and low-level, so learning the standard syntax is easy to do by following the tutorial along with other resources.
**What's so great about Julia?**
## What's so great about Julia?
- Multiple dispatch: providing ability to define function behavior across many combinations of argument types
- Dynamic type system: types for documentation, optimization, and dispatch
@@ -22,13 +22,13 @@ Julia is a fairly complex language but has some very simple behaviors which are
- Elegant and extensible conversions and promotions for numeric and other types
- Efficient support for Unicode, including but not limited to UTF-8
**What platforms can Julia run on?**
## What platforms can Julia run on?
Julia can run on most popular platforms such as MacOSX, most Linux builds, Windows, and others. This is due to it compiling to a native binary. However, it does not have broad support for front-end development, but there is a library for Qt bindings.
**CLI**
## CLI
The Julia download comes with a CLI environment. With the CLI you can try out Julia functions and expressions in the command line. (Binary languages rarely have a CLI, so this is pretty cool)
**Code Examples:**
## Code Examples:
Hello world:
```julia
@@ -52,7 +52,7 @@ mean([1, 3, 5, 7]) # 4
middle([1, 3, 5]) # 3
```
**Syntax and Operation Features:**
## Syntax and Operation Features:
Matrices in Julia are easy and fun!
@@ -132,7 +132,7 @@ for x=0:4:11
end
```
**Resources:**
## Resources:
Julia documentation: <https://docs.julialang.org>
Try it out online! <https://juliabox.com>, and <https://www.tutorialspoint.com/execute_julia_online.php>
+14 -14
View File
@@ -1,17 +1,17 @@
**What is kotlin?**
## What is kotlin?
Kotlin is a statically typed programming language that runs on the JVM (Java Virtual Machine).
**Why does kotlin exist?**
## Why does kotlin exist?
Kotlin exists as a modern roll of Java - Java was built from the ground up to suit OOP, and that's a task that it does pretty well. Later, functional programming was added in, by contrast, kotlin was made with both paradigms in mind, picking the good, easy to adopt parts up and adding them all into one neat language. Kotlin also had a requirement: Allow interop with Java code - to which it does (works great on android!)
**How hard is kotlin to learn?**
## How hard is kotlin to learn?
Well, that depends a lot on where you are coming from. If you already know Java, it'll be exceptionally easy to pick up. Everything has a very "right" feeling to it compared to the older style, it's almost like a natural progression.
If you don't know Java, that's a bit trickier to answer. You can certainly learn it, as a first language either, but there are some Java things you will need to know. If I were learning it as a first language, I'd try to heavily rely on the documentation and understand each feature that exists in kotlin, and why they exist. The most important is the concept of nullable types.
Java will allow anything to be null, but in kotlin there is a distinct separation. a `String` is very different to a `String?` - the second one can have a value of null, the first cannot. When interoping with Java code, it's always best to assume anything can be null.
**What are some key features of kotlin?**
## What are some key features of kotlin?
If you're a Java user, here is a comparison list made by Jetbrains: <https://kotlinlang.org/docs/reference/comparison-to-java.html>
Some key ones to point out of this list:
@@ -20,19 +20,19 @@ Some key ones to point out of this list:
- Delegation properties (Lazy evaluation, observables and more !!)
- Extension functions - great for fixing up a library class that is missing a method. No pretty print function? That's cool, just define it yourself. `LibraryClass.newFunction() = ...` (Yes, like C#)
**What platforms can kotlin run on?**
## What platforms can kotlin run on?
Anything and everything. Let's break that down:
**The JVM**
## The JVM
This is primary compile target, the JVM as a piece of kit allows you to write some code and have it work without separate compilations on Windows, Mac and Linux - so you've got all of your bases covered there.
**Android**
## Android
Yea, it's also a first class language on android, the only other language supported by google: <https://youtu.be/d8ALcQiuPWs>
**Native**
## Native
If you don't like the JVM and you're not an android dev, well, you can just target native: <https://kotlinlang.org/docs/reference/native-overview.html>
**JavaScript**
## JavaScript
Yea, you can make kotlin compile to JavaScript, see here: <https://kotlinlang.org/docs/tutorials/javascript/kotlin-to-javascript/kotlin-to-javascript.html>
Here are some extra points that don't fit into any of the headings above
@@ -43,7 +43,7 @@ Here are some extra points that don't fit into any of the headings above
- Kotlin is fairly unopinionated, so if you're more a functional person you can go down that route most of the way, and the same for OOP, think of it as the Jack of all trades
- Kotlin allows building through both maven and gradle, two very mature build systems with a lot of libraries available - that means that you don't need to suffer the problems associated with small languages (No tools or libraries, it already has a great set of tools (intellij, maven, gradle) and a great ecosystem (it steals from Java!))
**Learning resources**
## Learning resources
- Language reference: <https://kotlinlang.org/docs/reference/>
- Introduction to kotlin <https://youtu.be/X1RVYt2QKQE>
@@ -52,7 +52,7 @@ Here are some extra points that don't fit into any of the headings above
- Try it out online <https://try.kotlinlang.org/#/Examples/Hello,%20world!/Simplest%20version/Simplest%20version.kt>
- **Awesome** kotlin - <https://github.com/KotlinBy/awesome-kotlin> Many great resources and libraries here
**Hello, world!**
## Hello, world!
```kotlin
fun main(args : Array<String>) {
@@ -60,7 +60,7 @@ fun main(args : Array<String>) {
}
```
**FizzBuzz**
## FizzBuzz
```kotlin
fun main(args: Array<String>) {
@@ -70,7 +70,7 @@ fun main(args: Array<String>) {
}
```
**Generate some nice HTML**
## Generate some nice HTML
```kotlin
//declarations here `https://kotlinlang.org/docs/reference/type-safe-builders.html`
@@ -107,7 +107,7 @@ fun result(args: Array<String>) =
}
```
**Create some SQL tables and do some CRUD operations with kotlin exposed (link here: <https://github.com/JetBrains/Exposed>)**
## Create some SQL tables and do some CRUD operations with kotlin exposed (link here: <https://github.com/JetBrains/Exposed>)
```kotlin
// Declare the table structure
+21 -22
View File
@@ -1,13 +1,12 @@
**What is Lisp?**
## What is Lisp?
Originally specified in 1958, Lisp is the second oldest high level programming language in use today. (Only younger than FORTRAN by one year!). There have been many different dialects of Lisp that have come and gone over the ages. In the modern day, some of the most known and used Lisp dialects (lisps) are Common Lisp, Clojure/ClojureScript, Racket and Scheme. The name "Lisp" was derived from "LISt Processor", and the list data structure is at the core of the language. Many recognizable language features were first developed in Lisp; dynamic typing, garbage collection, the read-eval-print loop, and more.
**How hard are Lisps to learn?**
## How hard are Lisps to learn?
The basics are not very difficult (especially because there aren't that many basics to learn). Experience with functional programming translates well. Most Lisps have a very small set of keywords and syntax rules, and rich libraries constructed atop those simple essentials. A lot of newcomers to Lisps are initially put off by a lot of parentheses, but most of those newcomers come to accept, and in some cases, admire the simplicity provided by, those parens. For example, Lisps usually have no concept of 'operator precedence' - the innermost parens are evaluated first.
If you know python, this document may be of particular interest to you: http://norvig.com/python-lisp.html. Even if you don't know python, the second paragraph under the heading "Introducing Python" explains some Lisp philosophy of use.
**What are some key features?**
## What are some key features?
- Homoiconicity: Lisps treat data and code similarly - that is to say, the code you write is in the form of lisp data structures (arbitrarily nested lists) that the lisp interpreter reads and evaluates. While this can feel awkward at first, it allows for what might be the simplest metaprogramming constructs.
- Macros: Macros let you expand and redefine the syntax of the language itself. Think of it as having a hook into the interpreter... you get to write what feel like functions that return lisp expressions, and the interpreter will expand those macros, and then evaluate the code that the macro expands to. This is only possible because lisp code is written as s-expressions (lists enclosed in parens). As a result, you don't find any grunt-work in lisp. No need to type semi-similar chunks of code over and over again when you can just invent new syntax for it. How powerful are macros? As one example, Clojure's function and macro definition operators are both macros that use the 'special form' (roughly a keyword) "def".
@@ -36,7 +35,7 @@ If you know python, this document may be of particular interest to you: http://n
- Racket:
- Promotes itself as a "programming-language programming language", provides facilities for defining other languages (general purpose or domain specific) through Racket, and then writing programs in those languages to be compiled by Racket
**Build systems, repos, notable libraries and other operational tooling:**
## Build systems, repos, notable libraries and other operational tooling:
- Common Lisp:
@@ -60,15 +59,15 @@ If you know python, this document may be of particular interest to you: http://n
- Racket:
- Racket ships with raco, a build tool that creates modules, standalone executables, documentation, etc
**What platforms can Lisps run on?**
## What platforms can Lisps run on?
- Common Lisp: Various implementations, interpreted, compiles to native.
- Clojure(Script): JVM/JS/CLR.
- Racket: Runs on Windows, MacOS, and Linux, by building native binaries
**Learning resources, blogs, sources of information:**
## Learning resources, blogs, sources of information:
- Common Lisp:
### Common Lisp:
- Practical Common Lisp (book available online): http://www.gigamonkeys.com/book/
- Land of Lisp: http://landoflisp.com/
- Common Lisp Hyperspec: http://clhs.lisp.se/
@@ -82,7 +81,7 @@ If you know python, this document may be of particular interest to you: http://n
- Lisp subreddit: https://www.reddit.com/r/lisp/
- Wikipedia article on CAR and CDR (a central concept in lisp lists): https://en.wikipedia.org/wiki/CAR_and_CDR
- http://random-state.net/files/nikodemus-cl-faq.html
- Clojure(Script):
### Clojure(Script):
- "Clojure for the Brave and True", a book somewhat akin to 'Automate the boring stuff', but aimed at Clojure: https://www.braveclojure.com/
- Clojure Homepage: https://clojure.org/api/cheatsheet
- Clojure GitHub: https://clojure.github.io/clojure/
@@ -92,16 +91,16 @@ If you know python, this document may be of particular interest to you: http://n
- Clojure subreddit: https://www.reddit.com/r/Clojure/
- Stand up a simple web app in Clojure: http://clojure-doc.org/articles/tutorials/basic_web_development.html
- An article explaining the basics of laziness available in Clojure: http://clojure-doc.org/articles/language/laziness.html
- Scheme:
### Scheme:
- Probably the de facto guide to Scheme is known as SICP - "Structure and Interpretation of Computer Programs". This is a book written by a couple of MIT professors, which was used as a textbook for introductory programming courses. It uses Scheme to teach principals of programming. It should probably be noted that this book and these courses are not focused on teaching Scheme (they cover the majority of the Scheme language in the first lecture/chapter) - they're focused on teaching computer programming concepts, and Scheme is just the language used to express those concepts.
- The SICP book online (freely available): https://mitpress.mit.edu/sites/default/files/sicp/index.html
- 2004 MIT SICP course playlist (higher quality, standalone video): https://www.youtube.com/playlist?list=PL7BcsI5ueSNFPCEisbaoQ0kXIDX9rR5FF
- The 2010 UC Berkeley SICP course (recorded in classroom, somewhat lower fidelity): https://www.youtube.com/playlist?list=PLhMnuBfGeCDNgVzLPxF9o5UNKG1b-LFY9
- Racket:
### Racket:
- The jumping-off point for Racket info (documentation, tools, getting started, etc) is https://racket-lang.org/.
- IDEs/editors:
### IDEs/editors:
- Lisps in general: Emacs - Emacs has been called "a great operating system, lacking only a decent editor". The Emacs community has a lot of lispers, partially because Emacs plugin are written mostly in ELisp - a dialect of Lisp that is at the core of Emacs' extendability. As such, many Lisps have Emacs packages for editing, running, debugging, project maintenance, etc, and Emacs has packages for version control, file/directory management, and even things like personal organization (basically all done in text buffers).
@@ -111,15 +110,15 @@ If you know python, this document may be of particular interest to you: http://n
- Racket: By default, Racket comes with DrRacket, an IDE with extensive documentation of the language
**Other resources:**
## Other resources:
- A couple of talks given by Rich Hickey, creator of Clojure
- Simple Made Easy - an examination of the definitions of simple, easy, and complex, and some of the powers of simplicity: https://www.infoq.com/presentations/Simple-Made-Easy
- Clojure, Made Simple - a talk about shortcomings and incidental complexity associated with OO programming, and Clojure's responses to them: https://www.youtube.com/watch?v=VSdnJDO-xdg
**Code examples:**
## Code examples:
- Hello World
### Hello World
Common Lisp:
@@ -160,7 +159,7 @@ begin
end
```
- Take two numbers as input, add them, and format an output string
### Take two numbers as input, add them, and format an output string
Common Lisp:
@@ -196,7 +195,7 @@ Racket:
(printf "The sum of ~s and ~s is ~s" first second (+ first second)))
```
- A very basic macro in Clojure
A very basic macro in Clojure:
```clojure
;; definition - we'll take an expression, evaluate it once, print the formatted string, and then return the result
@@ -213,7 +212,7 @@ Racket:
;; and returns 45
```
- A really simple Clojure web site using the ring and compojure libraries
A really simple Clojure web site using the ring and compojure libraries:
```clojure
;; define a namespace for our functions, and import routing and default request handling functions
@@ -232,7 +231,7 @@ Racket:
(wrap-defaults app-routes site-defaults))
```
- Memoizing pure functions in Clojure
Memoizing pure functions in Clojure:
```clojure
(defn expensive
@@ -255,7 +254,7 @@ Racket:
(println "Memoization caches the output of functions, so that expensive pure functions can be computed once.")))
```
- Lazy sequences in Clojure
Lazy sequences in Clojure:
```clojure
(defn fib-seq
@@ -271,7 +270,7 @@ Racket:
(println "The first 20 fibonacci numbers, obtained from a lazy sequence:" (take 20 (fib-seq))))
```
- Collatz sequence in Scheme
Collatz sequence in Scheme:
```clojure
(define (collatz n)
@@ -282,7 +281,7 @@ Racket:
```
- FizzBuzz from 1 to n using lazy evaluation in Racket
FizzBuzz from 1 to n using lazy evaluation in Racket:
```clojure
#lang lazy
+9 -9
View File
@@ -1,34 +1,34 @@
**What is Redis?**
## What is Redis?
Redis is an in-memory datastore. It supports on-disk persistence, cache eviction, various data structures, Pub/Sub, scripting, and other features that put it in a middle ground between simple key-value store, and a more complex database.
**When should I use Redis?**
## When should I use Redis?
While Redis can be used in place of any persistent datastore, it's strongest when you need a speedy, easy cache. Because Redis keeps all data in memory, it's able to respond very quickly.
**When shouldn't I use Redis?**
## When shouldn't I use Redis?
If you need data relations, that's typically better served by a traditional SQL-based database. If you have huge amounts of data, having enough RAM to allow Redis to work with all of it may prove expensive, or prohibitive. Redis also only writes its data to disk on an interval, so if Redis is killed before it can write to disk, you may lose data between the time it was killed, and the last time it wrote to disk. (Although Redis offers different, configurable persistence strategies.)
**About Redis' Persistence Strategies**
## About Redis' Persistence Strategies
Redis includes several persistence strategies. RDB, AOF, and AOF fsync.
**RDB**
## RDB
RDB is a snapshot format, where it will provide an entire snapshot of your data at any point of time. This also is the fastest time-to-restart format for Redis with large datasets. However, because syncing the entire collection to disk is taxing on both the CPU and disk writing, it's impractical to do a full snapshot with every write. Exactly when a snapshot is produced is configurable, based on time passed, and the number of writes against the data set.
**AOF**
## AOF
AOF is short for Append-Only File. This writes every command and transaction sent to Redis to a file, and reconstructs the data by replaying the file at startup. When the file becomes too large, Redis automatically creates a new one in the background by reading all in-memory data, and dumping it to a new AOF-formatted file. The cost to this is restarts with large datasets/many commands are slower than reloading a comparable RDB file, due to replaying the commands.
**AOF fsync**
## AOF fsync
AOF fsync is simply how often AOF is flushed to disk. You can use it without fsync at all, leaving it up to the operating system to flush your disk writes automatically, which depends on the operating system's configuration. You can also set it to fsync every second, meaning it will flush changes to disk every second, which is the default configuration. Finally, you can set it to flush to disk with every single write, which sacrifices speed for ensuring data is always written to disk.
It's not uncommon to use both RDB and AOF together to take advantage of the increased speed and durability of AOF, with the easily backed-up, quicker-to-restart RDB.
**Examples**
## Examples
The simplest operation in Redis is `GET`/`SET`.
@@ -235,7 +235,7 @@ A subscribed client would recieve the following:
Redis supports a lot more features, like clustering, transactions, scripting, and more datatypes like HyperLogLogs and Streams, this is just a taste of Redis' usefulness. In addition, Redis' functionality can be extended via scripts and modules.
**More Resources**
## More Resources
- https://redis.io/commands
- https://try.redis.io/
+10 -10
View File
@@ -1,4 +1,4 @@
**What is Rust?**
## What is Rust?
"Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety."
In other terms, Rust is a language that offers the performance of C or C++ along with some higher level constructs
@@ -8,7 +8,7 @@ memory, or yield odd results because of race conditions in your code. Rust, simi
are called "Zero-cost" abstractions, which in essence means that the idiomatic/ pretty way of writing a piece
of code will be as performant as writing your own code.
**How is Rust safe?**
## How is Rust safe?
Rust adds an extra layer of safety by having a concept of ownership at the type level, and by
strongly distinguishing mutability over immutability. By keeping track of where a resource is owned,
@@ -23,7 +23,7 @@ out when to safely drop resources. Unlike in C, where you could leak memory by f
some resource, or crash your program by using memory that has already been freed, Rust avoids errors like
these by keeping track of who owns what resource at compile time.
**What high level constructs does Rust offer?**
## What high level constructs does Rust offer?
Rust comes with a very good standard library, if you're not building on an embedded platform, of course.
The standard library allows you to work with vectors and arrays using concise .maps and .filters instead
@@ -41,17 +41,17 @@ you can match on a hashmap with a certain value at a certain key.
One of the external aspects that makes the language easy to work with is the build tool "Cargo". Cargo
makes fetching dependencies for a project and building a project a breeze!
**Where do I get Rust?**
## Where do I get Rust?
Installation instructions can be found here: https://www.rust-lang.org/en-US/install.html
**Where do I learn more?**
## Where do I learn more?
Rust has a great book for learning the language, that can be found here (online book): https://doc.rust-lang.org/book/second-edition/index.html
**Code Examples**
## Code Examples
**Hello World**
### Hello World
```rust
fn main() {
@@ -59,7 +59,7 @@ fn main() {
}
```
**Pattern Matching Example**
### Pattern Matching Example
```rust
fn main() {
@@ -73,7 +73,7 @@ fn main() {
}
```
**Sum of Squared Odd Numbers under 1000**
### Sum of Squared Odd Numbers under 1000
```rust
fn is_odd(n: u32) -> bool {
@@ -113,7 +113,7 @@ fn main() {
}
```
**Traits Example**
### Traits Example
```rust
pub trait Summary {
+10 -10
View File
@@ -1,19 +1,19 @@
**What is Svelte?**
## What is Svelte?
Svelte is a front-end technology similar in use to React, Vue, Angular, and the like. However, instead of loading a framework on the client-side, Svelte wires everything up during the build step, meaning it doesn't have to interpret any additional information at runtime. However, it's still in its relative infancy.
**When should you use Svelte?**
## When should you use Svelte?
- If you want to try out a framework that builds into an app, rather one that uses a framework at runtime.
- If you feel like React, Vue, Angular, etc. might be too "heavy".
- If you like trying new things.
**When should you not use Svelte?**
## When should you not use Svelte?
- If you need an extremely battle-tested, extremely community supported framework.
- If you don't need interactivity/data binding.
**Examples**
Styling a component:
## Examples
### Styling a component
```html
<style>
@@ -29,7 +29,7 @@ Styling a component:
https://svelte.dev/examples#styling
Bound Text Input:
### Bound Text Input
```js
<script>
@@ -42,7 +42,7 @@ Bound Text Input:
https://svelte.dev/examples#text-inputs
Reactive statement on a button:
### Reactive statement on a button
```js
<script>
@@ -65,7 +65,7 @@ Reactive statement on a button:
https://svelte.dev/examples#reactive-statements
CSS class bindings:
### CSS class bindings
```html
<script>
@@ -98,7 +98,7 @@ CSS class bindings:
https://svelte.dev/examples#classes
Built-in animation transitions:
### Built-in animation transitions
```html
<script>
@@ -120,7 +120,7 @@ Built-in animation transitions:
https://svelte.dev/examples#in-and-out
**Other resources**
## Other resources
- https://svelte.dev/
- https://svelte.dev/tutorial/basics
+8 -8
View File
@@ -1,10 +1,10 @@
### What is Symfony
## What is Symfony
Symfony is an Open Source full stack PHP framework for web applications and a set of reusable PHP libraries. Thousands of web sites and applications rely on Symfony as the foundation of their web services. And most of the leading PHP projects, such as Drupal and Laravel use Symfony components to build their applications.
Symfony aims to speed up the creation and maintenance of web applications and to replace repetitive coding tasks. It's also aimed at building robust applications in an enterprise context and aims to give developers full control over the configuration.
### Why should I use Symfony
## Why should I use Symfony
- Modularity, the core of Symfony is really small but as your needs grow you can easily install more components without having to refactor anything.
- Flexible architecture, you can customize pretty much anything ranging from folder structure to foreign libraries.
- Scalability, thanks to Symfonys architecture no matter how big your application grows you can always keep extending it without having to worry about having to refactor your whole codebase.
@@ -15,21 +15,21 @@ Symfony aims to speed up the creation and maintenance of web applications and to
- Good documentation, everything you need to know is explained in steps in the documentation. It is filled to the brim with code snippets and explanations.
- Developing in Symfony is actually fun. Instead of writing low level code all day long you write relatively high level code without losing customizability and you will see your app progress really quickly without having to spend too much time thinking about things like folder structure, design patterns, naming conventions, etc since most of those things are taken care off already or can be found in the documentation.
### How does Symfony compare to other solutions from a business perspective
## How does Symfony compare to other solutions from a business perspective
Symfony is not the solution with the most raw performance, this however does not mean it is slow by any means. However for most businesses cost effectiveness is more important. For robust enterprise applications Symfony is ahead in being more cost effective to host, maintain and develop which is one of the main reasons why it is chosen over other major full stack frameworks.
### What previous experience do you need before making optimal use of Symfony
## What previous experience do you need before making optimal use of Symfony
It is expected that you already know the basics of PHP, HTML, CSS and JS before starting a Symfony project. If you dont know the basics of one of the 4 mentioned above you should first learn those before checking out Symfony. Advancing without any knowledge of these basics will hinder your experience with Symfony.
### What kind of functionality can you expect from Symfony
## What kind of functionality can you expect from Symfony
Symfony is a framework that works via a MVC pattern (https://en.wikipedia.org/wiki/Modelviewcontroller). Which means that you can define a route and after visiting that route a function in a controller class is called that returns a response.
You write the controller functions yourself and you are free to write whatever functionality needed, as long as it returns a response which can be anything like html, json or even a file.
Some of the core components of Symfony are the: templating engine, ORM, mailer, logger, form generator, dummy data generator, PHPUnit for test, security component, yaml parser, the validator and Webpack Encore which is webpack with Symfony integration for all of your frontend dependencies. With Webpack Encore it is even possible to integrate Vue or React into your project by mounting it on a Twig template. If you decide to do this you will have to choose between using frontend routing or using Symfonys own controller routing.
### Symfony as a backend framework
## Symfony as a backend framework
It is not required to use Symfonys fullstack capabilities if you want to use Symfony. In fact, thanks to Symfonys modularity you dont even have to have the frontend components installed. If you want to make a REST API using Symfony then API Platform (https://api-platform.com/) will help you set one up really fast thanks to its good integration with Symfony. It integrates with the ORM and the validator. Everything is fully customizable if you decide to go for API Platform but you can still write your own endpoints manually if you need custom actions.
### Required tools you need to have set up before starting a Symfony project
## Required tools you need to have set up before starting a Symfony project
First off, it is required that you have Composer installed. Composer is a package manager for PHP, if you have never heard about it Id strongly recommend you first study it up a bit before reading any further. You can download composer at https://getcomposer.org/download/, but you will first have to have a PHP executable before being able to install Composer. By using XAMPP you will get all the other tools you need to run a PHP web server, it comes bundled with Apache, MariaDB which is an open source fork of MySQL and PhpMyAdmin which is a database viewer and a couple of other handy tools for later. You can view what is included at their site: https://www.apachefriends.org/download.html, make sure you download the version for PHP 7.4. At the time of writing this spotlight PHP 8 is still rather new and a lot of important dependencies are not yet compatible with this version.
@@ -37,7 +37,7 @@ Now that we have the basic requirements installed for setting up any PHP project
- The first thing we need to install would be the Symfony CLI (command line interface) which gives you commands that you will need when starting and running your project locally, it can be downloaded at: https://symfony.com/download.
- The second most important thing that makes life really easy when working with Symfony is PhpStorm. If you are familiar with Jetbrains you might already know of this IDE. There are designated plugins for Symfony in PhpStorm that make working with Symfony really comfortable. If you are a student you should be able to get a student license for free, if not you will get a 30 days free trial and after that you can always buy it if you like it. You can download it at https://www.jetbrains.com/phpstorm/download/. It is fine to use a different IDE like VS Code, but keep in mind that PhpStorm will be used in the tutorials linked below.
### Learning resources
## Learning resources
Official documentation: https://symfony.com/doc/current
Official learning videos: https://symfonycasts.com/screencast/symfony