catppuccin/samples/coffeescript.coffee
Hamothy b9bbd77c7f
docs: restructure & improve contrib docs (#1876)
* docs: restructure & improve contrib docs

* chore: rework samples code

* docs: fix capitalization & brand names

* docs: PR comments & try to standardise palette vs flavor

* docs: add sample-programs

* docs: update submission guidelines (refs: #1821)

* refactor: tidy up docs

Co-authored-by: winston <hey@winston.sh>
2023-01-26 19:53:05 +01:00

52 lines
838 B
CoffeeScript

###
Some tests
###
class Animal
constructor: (@name) ->
move: (meters) -> alert @name + " moved " + meters + "m."
class Snake extends Animal
move: ->
alert 'Slithering...'
super 5
number = 42; opposite = true
/^a\/\\[a-z/\n]\u00A3b$/.test 'a//b'
square = (x) -> x * x
range = [1..2]
list = [1...5]
math =
root: Math.sqrt
cube: (x) => x * square x
race = (winner, runners...) ->
print winner, runners
alert "I knew it!" if elvis?
cubes = math.cube num for num in list
text = """
Result
is #{ @number }"""
html = ''' <body></body>'''
String::dasherize = ->
this.replace /_/g, "-"
SINGERS = {Jagger: "Rock", Elvis: "Roll"}
t = ///
[a-z]
///
$('.shopping_cart').bind 'click', (event) =>
@customer.purchase @cart
hi = `function() {
return [document.title, "Hello JavaScript"].join(": ");
}`