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 characters
| takeEven = lambda.select do |x| | |
| x if x % 2 == 0 | |
| end |
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 characters
| takeEven = lambda.select do |x| | |
| x if x % 2 == 0 | |
| end |
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 characters
| // Arrow function | |
| $("#ajax-action2").click(() => { | |
| const AUTH_TOKEN = $("meta[name=csrf-token]").attr("content"); | |
| // const | |
| const request = $.ajax({ | |
| type: "PATCH", | |
| url: "/home/no_js_view_action", | |
| headers: { | |
| 'X_CSRF_TOKEN': AUTH_TOKEN, |
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 characters
| $("#ajax-action2").click( function() { | |
| const AUTH_TOKEN = $("meta[name=csrf-token]").attr("content"); | |
| request = $.ajax({ | |
| type: "PATCH", | |
| url: "/home/no_js_view_action", | |
| headers: { | |
| 'X_CSRF_TOKEN': AUTH_TOKEN, | |
| }, | |
| dataType: "json", | |
| data: { |
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 characters
| const render = (Component) => { | |
| ReactDOM.render( | |
| <Provider store={store}> | |
| <Router history={history}> | |
| <Component /> | |
| </Router> | |
| </Provider>, | |
| document.getElementById('app') | |
| ); | |
| }; |
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 characters
| double = -> (e) { e * 2 } | |
| doubleF = map double | |
| doubleF.([1,2,3,4]) #=> [2,4,6,8] | |
| doubleF.([]) #=> [] | |
| doubleF.(Just(3)) #=> Just 6 | |
| doubleF.(Nothing) #=> Nothing |
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 characters
| double = -> (e) { e * 2 } | |
| doubleF = map double | |
| doubleF.([1,2,3,4]) #=> [2,4,6,8] | |
| doubleF.([]) #=> [] | |
| doubleF.(Just(3)) #=> Just 6 | |
| doubleF.(Nothing) #=> Nothing |
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 characters
| module Kernel | |
| def Just(o) | |
| Maybe.of(o) | |
| end | |
| end | |
| class Maybe | |
| def self.of(value) | |
| new(value) | |
| end |
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 characters
| module ArityRange | |
| def arity_range | |
| args = parameters.map(&:first) | |
| req = args.count :req | |
| keyreq = args.count :keyreq | |
| opt = args.include?(:rest) ? Float::INFINITY : args.count(:opt) | |
| keyopt = args.include?(:keyrest) ? Float::INFINITY : args.count(:key) |
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 characters
| const toggleClass = (id, toggle) => id === toggle ? 'toggle active' : 'toggle inactive'; | |
| const Style = ({ activeFontColor, activeBackgroundColor, fontColor }) => ( | |
| <style jsx> | |
| {` | |
| .toggle { | |
| width: 50%; | |
| height: 50px; | |
| border-radius: 100px; | |
| line-height: 50px; |