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 Api::V1::BaseController < ActionController::Base | |
| before_filter :cors_preflight_check | |
| after_filter :cors_set_access_control_headers | |
| # For all responses in this controller, return the CORS access control headers. | |
| def cors_set_access_control_headers | |
| headers['Access-Control-Allow-Origin'] = '*' | |
| headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' |
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
| sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search && killall SystemUIServer |
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
| # /etc/ hosts | |
| # For local developement | |
| 127.0.0.1 app.local | |
| 127.0.0.1 api.app.local |
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
| <ul> | |
| <li ng-repeat="thing in things track by $id($index)"> | |
| ..... | |
| </li> | |
| </ul> | |
| or | |
| <script> | |
| JSON.stringify(value, function (key, val) { |
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'; | |
| angular.module('angular-onbeforeunload', []) | |
| .factory('onBeforeUnload', ['$window', | |
| function($window) { | |
| var leavingPageText = "You'll lose your changes if you leave"; | |
| var leavingPageText2 = "Are you sure you want to leave this page?"; | |
| function init(top, bottom) { | |
| leavingPageText = top || leavingPageText; | |
| leavingPageText2 = bottom || leavingPageText2; |
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 offCallMeFn = $scope.$on("$locationChangeStart", callMe); | |
| //this will deregister that listener | |
| offCallMeFn(); |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="fragment" content="!" /> | |
| <meta charset="utf-8"> | |
| <title>Angular Starter Kit</title> | |
| <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css"> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body ng-app="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
| !function(app) { | |
| 'use strict'; | |
| app.factory('Tracking', function($rootScope, $log) { | |
| var _tracking = {}; | |
| _tracking.success = function(event, args) { | |
| args = getArgs(arguments); | |
| return function() { | |
| $log.info(event+':success', 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
| var myApp = angular.module('myApp', []) | |
| //service style, probably the simplest one | |
| myApp.service('helloWorldFromService', function() { | |
| this.sayHello = function() { | |
| return "Hello, Service!" | |
| }; | |
| }); | |
| //factory style, more involved but more sophisticated |
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
| $modelValue -> $formatters -> $viewValue -> $render | |
| $modelValue <- $parsers <- $viewValue <- $setViewValue |