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
| # GET /project_uploads/1/download | |
| def download | |
| authorize! :download, ProjectUpload | |
| @project_upload = ProjectUpload.find(params[:id]) | |
| redirect_to(@project_upload.attachment.expiring_url(10)) | |
| 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
| /* will return null::json on empty resultset */ | |
| SELECT array_to_json(array_agg(row_to_json(t))) FROM t; | |
| /* | |
| will return '[]' on empty resultset, | |
| null::json seems to be managed the same way than sql NULL by COALESCE() | |
| */ | |
| SELECT COALESCE(array_to_json(array_agg(row_to_json(t))), '[]') FROM t; | |
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
| import sublime, sublime_plugin | |
| class MoveTabCommand(sublime_plugin.WindowCommand): | |
| def run(self, mod): | |
| view = self.window.active_view() | |
| group_index, tab_index = self.window.get_view_index(view) | |
| self.window.set_view_index(view, group_index, | |
| (tab_index + int(mod)) % len ( | |
| self.window.views_in_group(group_index)) ) | |
| self.window.focus_view(view) |
NewerOlder