There are two (mostly) equivalent ways to define a function:
function Add(a, b) { return a + b };
var Add = function(a, b) { return a + b };
toString = Object::toString | |
hasOwnProperty = Object::hasOwnProperty | |
propertyIsEnumerable = Object::propertyIsEnumerable | |
### @return `undefined|null|boolean|string|symbol|number|NaN|array|arguments|date|object|function` ### | |
(val) -> | |
switch type = typeof val | |
when 'undefined', 'string', 'boolean', 'symbol' | |
return type | |
when 'number' | |
return (if Number.isNaN(val) || (val in [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY]) then 'NaN' else type) |
import sublime, sublime_plugin, re | |
class AlignCursors(sublime_plugin.TextCommand): | |
def adjust_column_for_tabs(self, view, tab_size, region, rowcol): | |
line_text = view.substr(view.line(region))[:rowcol[1]] | |
return rowcol[1] + (line_text.count("\t") * (tab_size - 1)) | |
def run(self, edit): | |
view = self.view | |
regions = view.sel() | |
right_most = 0 |
basic debug on object of type 'base', data: 0xdeadbeef | |
basic debug on object of type 'pointer', data: 0xdeadbeef | |
int debug (type 'int') value: '123' | |
No method 'sayHi' in 'int' | |
string debug (type 'string') value: 'hi guys' | |
Howdidledidoo 'string' |
{"a":{"b":{"c":{"ca":{"caa":true}},"d":true},"e":{"f":true},"g":true},"h":true} |
module MSC (plugin) where | |
-- This plugin allows you to include a http://www.mcternan.me.uk/mscgen/ diagram | |
-- in a page like this: | |
-- | |
-- ~~~ {.msc name="diagram1"} | |
-- msc { | |
-- # MSC for some fictional process | |
-- hscale = "1"; | |
-- a,b,c; |
# Example with basic types | |
--- | |
hash: | |
string: some text | |
number: 12345 | |
array_of_bool: [on, off, true, false, yes, no] | |
ruby symbol: :symbol | |
array: | |
- item one | |
- item two |
WIP: Illustrations of Nimrod language semantic use cases