Coder Social home page Coder Social logo

kylebanks / whatsthecodeforthat.com Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 167 KB

💻Reference snippets for common tasks in various programming languages.

Home Page: https://whatsthecodeforthat.com

License: MIT License

Makefile 2.88% HTML 50.32% CSS 43.60% JavaScript 3.19%
hugo hugo-site website snippets-collection code-samples tutorials reference

whatsthecodeforthat.com's Introduction

As developers we often switch between various languages, and sometimes it's difficult to remember how to do the little things.

How do I lower-case a string?

What's the list append function called?

How do I iterate over the key/value pairs of a map?

Speaking of which, what's the map initialization syntax again?

Don't sweat it, that's what whatsthecodeforthat.com is here for, with short snippets reminding you how to handle the small things in various languages. If you don't see a section, example or language that you need, submit a pull request to help out.

Contributing

If there's a section, language, or snippet you think is missing or needs updating, please don't hesitate to help out. When making modifications, please follow these general guidelines:

- Content Sections

If you're adding a new section or subsection to /content, please try to:

  • add the section or subsection to the map in config.toml in the order you want it to appear
  • order the content in order of sophistication; for example, arrays come after primitives, classes come after functions, etc.
  • try to avoid language-specific content and aim to focus on situations common to various languages; for example, goroutines are unique to the go language, so instead of a goroutines section it makes sense to have a concurrency section
  • ensure an _index.md with title front-matter for each folder
  • limit the depth of content to section and subsection, no more and no less

- Languages

If you're adding a new language, please try to:

  • focus on popular languages, rather than obscure or esoteric ones
  • add the language to the list in config.toml in alphabetical order
  • ensure the language is suitable to be included in most content sections

- Snippets

If you're adding a language snippet to an existing content section, please try to:

  • use the file naming convention of <lower-case-name>.md; for example go.md or python.md
  • limit the code sample to using the standard library
  • keep the code equivalent to other examples in the same content section, including variable names and values, use of print statements, etc.
  • avoid over-optimization, instead strive for simplicity and the general use case
  • the snippet file should contain one code block (marked by triple ticks), and any commentary should be done in langauge-specific comments

Running the Site Locally

This project uses hugo to generate a static website from markdown, so you'll need to have hugo installed to run locally. After that, use the make target like so to have the site generated, auto-reloaded on changes, and your browser opened:

$ make local

License

MIT License

Copyright (c) 2019 Kyle Banks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

whatsthecodeforthat.com's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.