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
| /** | |
| * A generic confirmation for risky actions. | |
| * Usage: Add attributes: ng-really-message="Are you sure?" ng-really-click="takeAction()" function | |
| */ | |
| angular.module('app').directive('ngReallyClick', [function() { | |
| return { | |
| restrict: 'A', | |
| link: function(scope, element, attrs) { | |
| element.bind('click', function(e) { | |
| e.stopPropagation(); // In case you cancel and don't want events to be propagated. |
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 execFile = require('child_process').execFile; | |
| Hooks.addMenuItem("Actions/Python/autopep8", "cmd-alt-l", function() { | |
| var type = Document.current().rootScope(); | |
| if ('python.source'.indexOf(type) !== -1) { | |
| execFile("/usr/local/bin/autopep8", ["--aggressive", Document.current().path()], function(error, stdout, stderr) { | |
| Recipe.run(function(recipe) { | |
| recipe.text = stdout; | |
| }); |
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
| Post | |
| has_many :upvotes <= Model: Vote | |
| has_many :downvotes <= Model: Vote | |
| Vote | |
| Fields: user_id, comment | |
| belongs_to :post <= as an upvote or downvote.. | |
| What I want to achieve: |
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
| i need to save distances between two sites => a Directions-Model should have something like | |
| id | |
| origin_id | |
| destination_id | |
| distance | |
| How do I set this up via active record because origin and destination are both from the type site? |
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
| @entries | |
| for feed in Feed.all | |
| @entries << feed.entries | |
| end |
NewerOlder