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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
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
| function delegate (receiver, methods, toProvider) { | |
| methods.forEach(function (methodName) { | |
| receiver[methodName] = function () { | |
| return toProvider[methodName].apply(receiver, arguments); | |
| }; | |
| }); | |
| return receiver; | |
| } |
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
| "" SYNTASTIC CONFIG | |
| "" ---------------- | |
| set statusline+=%#warningmsg# | |
| set statusline+=%{SyntasticStatuslineFlag()} | |
| set statusline+=%* | |
| let g:syntastic_aggregate_errors = 1 | |
| let g:syntastic_always_populate_loc_list = 1 | |
| let g:syntastic_auto_loc_list = 1 |
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
| { | |
| "cmd": ["python", "-u", "$file"], | |
| "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", | |
| "selector": "source.python" | |
| } |
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
| function Event(sender) { | |
| this._sender = sender; | |
| this._listeners = []; | |
| } | |
| Event.prototype = { | |
| attach: function(listener) { | |
| this._listeners.push(listener); | |
| }, | |
| notify: function(args) { |
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
| class Spam: | |
| def do_it(self, message): | |
| print(message) | |
| def do_it_without_self(message) | |
| print(message) | |
| spam = Spam() | |
| bound_func = spam.do_it # Bound method object (automatically) | |
| bound_func('yummy') # Same as spam.do_it('yummy') |
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
| def dec2bin(number) | |
| number = Integer(number) | |
| if(number == 0) then 0 end | |
| ret_bin = "" | |
| while(number != 0) | |
| ret_bin = String(number % 2) + ret_bin | |
| number = number / 2 | |
| end | |
| ret_bin |
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
| # | |
| init.coffee | |
| atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-proceeded-by-j': (e) -> | |
| editor = @getModel() | |
| pos = editor.getCursorBufferPosition() | |
| range = [pos.traverse([0,-1]), pos] | |
| lastChar = editor.getTextInBufferRange(range) | |
| if lastChar != "j" | |
| e.abortKeyBinding() | |
| else |
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
| var Rx = require('rx'); | |
| function EventAggregator() { | |
| this._subject = new Rx.Subject(); // Can be ReplaySubject too | |
| } | |
| EventAggregator.prototype.publish = function (type, data) { | |
| this._subject.onNext( { type: type, data: 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
| // Copy from `You Don't Know JS: Async & Performance` book | |
| // by Kyle Simpson | |
| function asyncify(fn) { | |
| var orig_fn = fn, | |
| intv = setTimeout(function() { | |
| intv = null; | |
| if (fn) fn(); | |
| }, 0); |
NewerOlder