Code Monkey home page Code Monkey logo

jails's Introduction

#Welcome to Jails Jails brings the essential parts of the Ruby Standard Library (Std-lib) and core extensions from Ruby on Rails to give you the missing library for CoffeeScript.

Things To Know

  • Underscores are used in place of camelCase unless already defined by javascript (eg. (new Date).getMonth())
  • Callbacks/Blocks are always given as the last parameter unless otherwise defined in javascript (eg. [].reduce(callback, initial))
  • Object.prototype is left untouched, to define object methods on your object use Object.hash()`` or Object.hash$()`
  • Date.prototype has been partially extended to be localized
  • Ruby's self modification identifier (!) is replaced with $ in Jails but only used if another method by the same name does not self-modify the object.

Examples

Below are some examples illustrating the uses of Jails and it's similarities to Ruby (and Rails).

Date Handling

Number Helpers

1.month.from_now() # returns a new Date 1 month from now
2.weeks.ago() # returns a new Date 2 weeks ago from now

Date Manipulators

1.month.from_now().start_of_week() # returns a new Date 1 month from now on the monday at 00:00 of that week

String Formats

Date.new(2011, 1, 1, 11, 30, 15).format('%A %-d%o of %B %Y %T %p')
  # Sunday 1st of January 2012 11:30:15 AM

Note: Date.new uses months starting from 1 rather than 0, all other methods also assume this other than date.getMonth() and new Date

Contributing

Fork -> Pull Request -> Discuss

Don't forget tests.

jails's People

Stargazers

Ben avatar Oliver Morgan avatar

Watchers

Oliver Morgan avatar James Cloos 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.