This is an example of the power of the D3 library and how you can use the drag behavior of D3 to control the position and shape of the SVG element.
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
| // NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension | |
| { | |
| // Settings | |
| "passfail" : false, // Stop on first error. | |
| "maxerr" : 100, // Maximum error before stopping. | |
| // Predefined globals whom JSHint will ignore. | |
| "browser" : true, // Standard browser globals e.g. `window`, `document`. |
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
| // Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
| // jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
| // author: Pawel Kozlowski | |
| var myApp = angular.module('myApp', []); | |
| //service style, probably the simplest one | |
| myApp.service('helloWorldFromService', function() { | |
| this.sayHello = function() { | |
| return "Hello, World!" |
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
| # Install Node.js and friends | |
| # (From https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) | |
| sudo apt-get install python-software-properties python g++ make | |
| sudo add-apt-repository ppa:chris-lea/node.js | |
| sudo apt-get update | |
| sudo apt-get install nodejs npm nodejs-dev | |
| # Install other tools we like | |
| sudo apt-get install git emacs |
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
| /** | |
| * @see https://github.com/siongui/palidictionary/blob/master/static/js/draggable.js | |
| * @see http://docs.angularjs.org/guide/compiler | |
| */ | |
| angular.module('draggableModule', []). | |
| directive('draggable', ['$document' , function($document) { | |
| return { | |
| restrict: 'A', | |
| link: function(scope, elm, attrs) { |
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.exports = { | |
| /** | |
| * | |
| * Using raw socket.io functionality from a Sails.js controller | |
| * | |
| */ | |
| index: function (req,res) { |
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
| angular.module("MyApp", ["SocketProvider"]) | |
| .controller("MyController", ["$scope", "socket", function($scope, socket) { | |
| // Fetch initial data | |
| $scope.person = null; | |
| socket.get("/person/1").success(function(data) { | |
| $scope.person = data; | |
| }).error(function() { |
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
| #!/bin/bash | |
| # | |
| # description: DevShelf service | |
| # processname: node | |
| # pidfile: /var/run/devshelf.pid | |
| # logfile: /var/log/devshelf.log | |
| # | |
| # Based on https://gist.github.com/jinze/3748766 | |
| # | |
| # To use it as service on Ubuntu: |
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
| // Define gulp before we start | |
| var gulp = require('gulp'); | |
| // Define Sass and the autoprefixer | |
| var sass = require('gulp-sass'); | |
| var prefix = require('gulp-autoprefixer'); | |
| // This is an object which defines paths for the styles. | |
| // Can add paths for javascript or images for example | |
| // The folder, files to look for and destination are all required for sass |
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
| 'use strict'; | |
| /** | |
| * @ngdoc module | |
| * @name sails.io | |
| * @file angular-sails-io.js | |
| * | |
| * @description | |
| * | |
| * This file allows you to send and receive socket.io messages to & from Sails |
OlderNewer