Last active
August 29, 2015 13:56
-
-
Save JosephLenton/8929980 to your computer and use it in GitHub Desktop.
Revisions
-
JosephLenton revised this gist
May 4, 2015 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ Code flush with the left side is markdown comments. --- block comments are started and ended with a triple hyphen Markdown can be used in normal comments too denoted with a triple dot. @@ -11,10 +11,10 @@ Code flush with the left side is markdown comments. even "with code" "placed inside" code instanceof comment -- is ignored in code examples --- -- double hyphen for a single comment function calls don't require parenthesis @@ -196,7 +196,7 @@ this is counting down Tokens that start with a # will be seen as a string. This is for CSS/GUI work. -- set the button background to off-white button.style.background = #eee @@ -228,7 +228,7 @@ Single-quote strings continue until the end of line, or until a closing quote. div.style.margin = '0 auto 0 auto' -- this string hasn't been closed div.style.padding = '10px 0 20px 0 -
JosephLenton revised this gist
Apr 29, 2015 . 1 changed file with 39 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -235,22 +235,51 @@ Single-quote strings continue until the end of line, or until a closing quote. ### Literal Objects Objects are created in one of three ways ... The 'obj' keyword someObj = obj text "click me" class "button class" someObj = obj text "click me" class "button class" The * someObj = * text "click me" class *button class* # alternatively someObj = * text "click me" class *button class* someObj = * text "click me" class *button class* You can also create objects using braces someObj = { text "click me" class *button class* } someObj = { x 1 } Properties can be delimited using commas someObj = { x 1, y 2 } can also have keys on their own with no value names = * john brian al @@ -267,18 +296,6 @@ this is the same as doing ... can also use commas point = { x 3, y 9 } array can be started with the 'array' keyword ns = array 1 2 3 4 5 -
JosephLenton revised this gist
Apr 14, 2015 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -191,6 +191,16 @@ this is counting down ## strings ### Hash-strings Tokens that start with a # will be seen as a string. This is for CSS/GUI work. .. set the button background to off-white button.style.background = #eee ### Number-strings Numbers that end with text become strings. -
JosephLenton revised this gist
Apr 14, 2015 . 1 changed file with 43 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,20 @@ Code flush with the left side is markdown comments. ... block comments are started and ended with a triple dot Markdown can be used in normal comments too denoted with a triple dot. * which can be used anywhere * looks cool * doesn't continue until it sees the same again even "with code" "placed inside" code instanceof comment .. is ignored in code examples ... .. double dot for a single comment function calls don't require parenthesis @@ -187,6 +187,43 @@ this is counting down puts arguments[i] # Literals ## strings ### Number-strings Numbers that end with text become strings. This is for GUI stuff. div.style.marginLeft = 10px div.style.height = 100% ### Double Quoted Strings Double-quote strings are multi-line. paragraph = "some text which continues for multiple lines" ### Single Quoted Strings Single-quote strings continue until the end of line, or until a closing quote. div.style.margin = '0 auto 0 auto' .. this string hasn't been closed div.style.padding = '10px 0 20px 0 ### Literal Objects object descriptor uses end of line to delimit different items -
JosephLenton revised this gist
Feb 9, 2015 . 1 changed file with 25 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,16 @@ indentation used to show when function ends a *= 2 return a + b or doWork = \ a b \ return a + b The second \ is optional, you can just use end of line. doWork = \ a b a *= 2 return a + b can also use guards doWork = \ a b \ | 0 b | <- 1 @@ -242,3 +252,18 @@ closing the array is optional however indentation will put things in the array ... ns = [ 1 2 3 4 5 print "hello world" Objects can have an anonymous 'constructor' for that particular object. It is defined as a function with no name or arguments. return { \ this[ 'blah' ] = 'foobar' } This translates into the JavaScript code return (function() { this['blah'] = 'foobar'; }).call( { } );
-
JosephLenton revised this gist
Feb 4, 2015 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,20 @@ Code flush with the left side is markdown comments. /// block comments are started and ended with a triple slash Markdown can be used in normal comments too denoted with a triple slash. * which can be used anywhere * looks cool * doesn't continue until it sees the same again even "with code" "placed inside" code instanceof comment // is ignored in code examples /// // double slash for a single comment function calls don't require parenthesis -
JosephLenton revised this gist
Feb 4, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ Code flush with the left side is markdown comments. /// -
JosephLenton revised this gist
Jan 20, 2015 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,12 +15,16 @@ Code flush with the left side is markdown comments. // is ignored in code examples /// // double slash for a single comment function calls don't require parenthesis alert "blah" console.log someObj ", " otherValue Statements are seperated with an end of line or a comma a = 1, b = 2, c = a + b pipes, the >> operator, for piping a value into another pane >> bb.add button >> bb.toggleClass 'show' -
JosephLenton revised this gist
Jan 20, 2015 . 1 changed file with 224 additions and 203 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,220 +1,241 @@ Code flush with the left side is markdown comments. /// block comments are started and ended with a triple slash Markdown can be used in normal comments too denoted with a triple slash. * which can be used anywhere * looks cool * doesn't continue until it sees the same again even "with code" "placed inside" code instanceof comment // is ignored in code examples /// double slash for a single comment function calls don't require parenthesis alert "blah" console.log someObj ", " otherValue pipes, the >> operator, for piping a value into another pane >> bb.add button >> bb.toggleClass 'show' functions denoted with \ args \ indentation used to show when function ends doWork = \a b\ a *= 2 return a + b can also use guards doWork = \ a b \ | 0 b | <- 1 | a b | <- a * b can add conditions, which are checked at runtime, but can be optimized out with a flag doWork = \ a b \ ensure a > b isNumber b isNumber a return a + b guards with conditions ensure can be at start or end indentation denotes if used for function or guard doWork = \ a b \ | 0 b | ensure isNumber b return 1 | a b | return a + b ensure isNumber a isNumber b : used for type notation doWork = \ a:number b:number \ <- a + b :: used for full conditions, equal to ensures doWork = \ (a::isNumber a && a > b) (b::isNumber b) \ <- a + b can be used together doWork = \ (a:number:: a > b) b:number \ <- a + b if statement starts on indentation after an expression a > 5 print a also means you can do ... 'button.classList' only run if 'button =' evaluates to true button = dom.querySelector '.button.show' button.classList.remove 'show' 0 <= i and i < users.length users[i].update 'all' is an operator that allows multiple rules to be listed, this is to avoid long 'this and, that and, something and, rule and' all 0 <= i i < users.lenght # updating one more inside 'all of', ends it users[i].update the 'or' version of 'all' any post.owner_id == user.id user.is_admin // success! edit port user A longer example, converting my .forward rules into this language any of # block those fucking mails from Dr Oz header_from.contains "Dr. Oz" header_from.contains "Dr.Oz" header_from.contains "DrOz" header_from.contains "DoctorOZ" header_from.contains "OZ Daily News" header_from.contains "USA SlimSystem" header_from.contains "LifeHealthPro" header_from.contains "Viagra" header_from.contains "viagra" header_from.contains "Viiagra" header_from.contains "viiagra" header_from.contains "Viagrra" header_from.contains "viagrra" header_from.contains "Pfizer" # bullshit mail adverts header_subject: contains "Instantly boost your website" header_subject: contains "This Stock is in the news" # both from and subject start with Chinese ... any of header_from.begins "=?utf-8?B?4" header_from.begins "=?utf-8?B?5" header_from.begins "=?utf-8?B?6" header_from.begins "=?utf-8?B?7" and any of header_subject.begins "=?utf-8?B?4" header_subject.begins "=?utf-8?B?5" header_subject.begins "=?utf-8?B?6" header_subject.begins "=?utf-8?B?7" # any mail in chinese (I can't read it even if it's legit) header_content-type.contains "charset=\"GB2312\"" # success of if here! # kill the mail! fail for loop using an iterator is denoted using the 'in' keyword key in array console.log key array[key] For loop using normal iteration uses 'to' keyword. i will be initialized to 0 by default. i to arguments.length puts arguments[i] iterates from 1 to 3 start = 1 end = 3 i = start to end puts i alternative which states where the i starts from; from 1 to arguments.length i = 1 to arguments.length puts arguments[i] this is counting down i = arguments.length - 1 to 0 step -1 puts arguments[i] object descriptor uses end of line to delimit different items someObj = { text "click me" class "button class" } closing the brace is optional denoted through indentation someObj = { text "click me" class "button class" can also have keys on their own, with no value names = { john brian al sam this is the same as doing ... names = { john undefined brian undefined al undefined sam undefined } can also use commas point = { x 3, y 9 } can also use parenthesis point = { (x 3) (y 9) } all of these also work with the 'obj' keyword point = obj x 3, y 9 point = obj (x 3) (y 9) names = obj john brian al sam array can be started with the 'array' keyword ns = array 1 2 3 4 5 also works with multiple lines ns = array 1 2 3 4 5 array description ns = [ 1 2 3 4 5 ] closing the array is optional ns = [ 1 2 3 4 5 however indentation will put things in the array ... ns = [ 1 2 3 4 5 print "hello world" -
JosephLenton revised this gist
Dec 25, 2014 . 1 changed file with 23 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Slash # denotes the start of markdown comments. # function calls don't require parenthesis alert "blah" console.log someObj ", " otherValue # pipes, the >> operator, for piping a value into another pane >> bb.add button >> bb.toggleClass 'show' @@ -157,14 +157,14 @@ for i (arguments.length-1) 0 step -1 # object descriptor # uses end of line to delimit different items someObj = { text "click me" class "button class" } # closing the brace is optional # denoted through indentation someObj = { text "click me" class "button class" @@ -189,6 +189,26 @@ point = { x 3, y 9 } # can also use parenthesis point = { (x 3) (y 9) } # all of these also work with the 'obj' keyword point = obj x 3, y 9 point = obj (x 3) (y 9) names = obj john brian al sam # array can be started with the 'array' keyword ns = array 1 2 3 4 5 # also works with multiple lines ns = array 1 2 3 4 5 # array description ns = [ 1 2 3 4 5 ] -
JosephLenton revised this gist
May 8, 2014 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -168,6 +168,21 @@ obj = { text "click me" class "button class" # can also have keys on their own, with no value names = { john brian al sam # this is the same as doing ... names = { john undefined brian undefined al undefined sam undefined } # can also use commas point = { x 3, y 9 } -
JosephLenton revised this gist
Apr 23, 2014 . 1 changed file with 61 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ # hash used for comments /# @@ -82,7 +81,67 @@ a > 5 # 'button.classList' only run if 'button =' evaluates to true button = dom.querySelector '.button.show' button.classList.remove 'show' 0 <= i and i < users.length users[i].update # 'all of' is an operator that allows multiple rules to be listed, # this is to avoid long 'this and, that and, something and, rule and' all of 0 <= i i < users.lenght # updating one more inside 'all of', ends it users[i].update # the 'or' version of 'any of' any of post.owner_id == user.id user.is_admin # success! edit port user # A longer example, converting my .forward rules into this language any of # block those fucking mails from Dr Oz header_from.contains "Dr. Oz" header_from.contains "Dr.Oz" header_from.contains "DrOz" header_from.contains "DoctorOZ" header_from.contains "OZ Daily News" header_from.contains "USA SlimSystem" header_from.contains "LifeHealthPro" header_from.contains "Viagra" header_from.contains "viagra" header_from.contains "Viiagra" header_from.contains "viiagra" header_from.contains "Viagrra" header_from.contains "viagrra" header_from.contains "Pfizer" # bullshit mail adverts header_subject: contains "Instantly boost your website" header_subject: contains "This Stock is in the news" # both from and subject start with Chinese ... any of header_from.begins "=?utf-8?B?4" header_from.begins "=?utf-8?B?5" header_from.begins "=?utf-8?B?6" header_from.begins "=?utf-8?B?7" and any of header_subject.begins "=?utf-8?B?4" header_subject.begins "=?utf-8?B?5" header_subject.begins "=?utf-8?B?6" header_subject.begins "=?utf-8?B?7" # any mail in chinese (I can't read it even if it's legit) header_content-type.contains "charset=\"GB2312\"" # success of if here! # kill the mail! fail # 'for' statement, if 'i' does not exist, it is defined on the fly and presumed to be 0 # otherwise initialized to 0 for i arguments.length -
JosephLenton created this gist
Feb 11, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,126 @@ # hash used for comments /# # Markdown Comments Slash # denotes the start of markdown comments. * which can be used anywhere * looks cool * doesn't continue until it sees the same again even "with code" "placed inside" code instanceof comment # #/ is ignored in code examples #/ /* * These comments are also supported, * namely so you can comment out sections of code */ # function calls don't require parenthesis alert "blah" console.log obj ", " otherValue # pipes, the >> operator, for piping a value into another pane >> bb.add button >> bb.toggleClass 'show' # functions denoted with \ args \ # indentation used to show when function ends doWork = \a b\ a *= 2 return a + b # can also use guards doWork = \ a b \ | 0 b | <- 1 | a b | <- a * b # can add conditions, which are checked at runtime, but can be optimized out with a flag doWork = \ a b \ ensure a > b isNumber b isNumber a return a + b # guards with conditions # ensure can be at start or end # indentation denotes if used for function or guard doWork = \ a b \ | 0 b | ensure isNumber b return 1 | a b | return a + b ensure isNumber a isNumber b # : used for type notation doWork = \ a:number b:number \ <- a + b # :: used for full conditions, equal to ensures doWork = \ (a::isNumber a && a > b) (b::isNumber b) \ <- a + b # can be used together doWork = \ (a:number:: a > b) b:number \ <- a + b # if statement starts on indentation after an expression a > 5 print a # also means you can do ... # 'button.classList' only run if 'button =' evaluates to true button = dom.querySelector '.button.show' button.classList.remove 'show' # 'for' statement, if 'i' does not exist, it is defined on the fly and presumed to be 0 # otherwise initialized to 0 for i arguments.length puts i # alternative which states where the i starts from; from 1 to arguments.length for i 1 arguments.length puts arguments[i] # this is counting down for i (arguments.length-1) 0 step -1 puts arguments[i] # object descriptor # uses end of line to delimit different items obj = { text "click me" class "button class" } # closing the brace is optional # denoted through indentation obj = { text "click me" class "button class" # can also use commas point = { x 3, y 9 } # can also use parenthesis point = { (x 3) (y 9) } # array description ns = [ 1 2 3 4 5 ] # closing the array is optional ns = [ 1 2 3 4 5 # however indentation will put things in the array ... ns = [ 1 2 3 4 5 print "hello world"