All Projects → evmorov → lang-compare

evmorov / lang-compare

Licence: MIT license
Side-by-side language comparison

Programming Languages

java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language
coffeescript
4710 projects
python
139335 projects - #7 most used programming language
PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to lang-compare

Middlemanapp.com
Documentation for Middleman
Stars: ✭ 264 (+1100%)
Mutual labels:  middleman
Middleman Search
LunrJS-based search for Middleman
Stars: ✭ 57 (+159.09%)
Mutual labels:  middleman
Manager For Upyun
又拍云资源管理器
Stars: ✭ 163 (+640.91%)
Mutual labels:  middleman
Bh
Bootstrap Helpers for Ruby
Stars: ✭ 834 (+3690.91%)
Mutual labels:  middleman
Awesome Docs With Static Site Generators
Pointers to all templates and implementations based on static site generators
Stars: ✭ 44 (+100%)
Mutual labels:  middleman
Middleman Google Analytics
📈 A @middleman plugin to handle generating your Google Analytics tracking code.
Stars: ✭ 91 (+313.64%)
Mutual labels:  middleman
middleman-ogp
middleman-og is an extension for the Middleman static site generator that adds Open Graph helper.
Stars: ✭ 37 (+68.18%)
Mutual labels:  middleman
git-split-diffs
GitHub style split diffs in your terminal
Stars: ✭ 2,423 (+10913.64%)
Mutual labels:  side-by-side
Middleman Thumbnailer
Thumbnailer for middleman
Stars: ✭ 52 (+136.36%)
Mutual labels:  middleman
Middleman Casper
👻 Casper theme (Ghost) for Middleman-Blog
Stars: ✭ 128 (+481.82%)
Mutual labels:  middleman
Middleman
Hand-crafted frontend development
Stars: ✭ 6,812 (+30863.64%)
Mutual labels:  middleman
My Raspberry Pi Site
Middleman-based site for my RaspberryPi
Stars: ✭ 41 (+86.36%)
Mutual labels:  middleman
Middleman Zurb Foundation
Middleman Skeleton For Zurb Foundation
Stars: ✭ 97 (+340.91%)
Mutual labels:  middleman
Middleman Blog
Middleman : Blog Engine Extension
Stars: ✭ 317 (+1340.91%)
Mutual labels:  middleman
Staticman
💪 User-generated content for Git-powered websites
Stars: ✭ 2,098 (+9436.36%)
Mutual labels:  middleman
mariusz.cc
Personal website, powered by Middleman
Stars: ✭ 40 (+81.82%)
Mutual labels:  middleman
Middleman Template
The base Middleman application used at thoughtbot, ready to deploy to Netlify.
Stars: ✭ 80 (+263.64%)
Mutual labels:  middleman
middleman-directory
Directory of Middleman extensions, templates and services
Stars: ✭ 30 (+36.36%)
Mutual labels:  middleman
middleman-snippets
⚡ Library of commonly used snippets for Middleman websites
Stars: ✭ 27 (+22.73%)
Mutual labels:  middleman
Middleman Autoprefixer
Autoprefixer integration with Middleman
Stars: ✭ 114 (+418.18%)
Mutual labels:  middleman

Compare syntax of programming languages

The web app provides side-by-side examples of syntax differences between programming languages. You can use it as a cheatsheet or as a learning material to learn one of them through another. Creating these examples I tried to use the most used and the cleanest solutions.

All examples are executable. You can copy and launch them without changes. It helps to understand what the code is doing easily.

View web app here.

Created with:

Notes

All languages:

  • It's possible to achieve anything with any language (especially with a library). However when a solution is really long and difficult to read it's better to not provide it
  • Every task can be solved in different ways but it's preferable to provide not more than one the most used example

Java:

  • 2 spaces is used to make the code more concise
  • The examples are for Java 7. Java 8 has many features but sadly it's unavailable for Android

What's next

Add more languages: Kotlin, TypeScript (and any more)!

  • Ruby - Elixir
  • Ruby - Crystal
  • Java - Kotlin
  • Java - C#
  • JavaScript - TypeScript

It would be nice to modify the existing examples to make them funnier.

Development

Install ruby:

$ ruby --version

Install dependencies:

$ bundle

Run the app in localhost (http://localhost:4567):

$ bundle exec middleman

To generate outputs below the examples:

  1. Install all interpreters/compilers needed
  2. $ rake

To add a new language:

  1. Add the language to langs variable to config.rb
  2. Add a rake task to Rakefile to run all the examples to produce output files that are included to the final html
  3. Add examples

To add an example:

  1. Modify data/code.yml
  2. Add files to code/ folder

Example for a specific version

Where can I provide a version?

  • Python 2 vs Python 3
  • Java 7 vs Java 8
  • ES5 vs ES6
  • New features that are not standard de-facto yet

Examples

Interpolation in Python is:

first = "Don't worry,"
second = 'be happy'
print('%s %s' % (first, second))

Since 3.6 you can use:

first = "Don't worry,"
second = 'be happy'
print(f'{first} {second}')

To achieve it:

  1. Change data/code.yml
python:
  .: string_interpolation.py
  '3.6': string_interpolation.py
  1. Add the first example to code/python/
  2. Add the second example to code/python/3.6

Contributing

Feel free to add or modify any examples.

  1. Fork it ( https://github.com/evmorov/lang-compare/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].