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
| # | |
| # Copyright 2012 Mortar Data Inc. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
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
| # ... | |
| gem 'carrierwave' | |
| gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
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
| <? | |
| ///////////////////// | |
| // slack2html | |
| // by @levelsio | |
| ///////////////////// | |
| // | |
| ///////////////////// | |
| // WHAT DOES THIS DO? | |
| ///////////////////// | |
| // |
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 BookListView(ListViewPublic): | |
| def get(self, request, *args, **kwargs): | |
| t = loader.get_template('core/reader/index.html') | |
| filter_kwargs = { | |
| 'status': Book.STATUS.public, | |
| } | |
| form = SearchForm(load_all=True) | |
| books = Book.objects.filter(**filter_kwargs) | |
| c = Context({ 'form': form, 'books':books }) |
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
| upstream app { | |
| # Path to Unicorn SOCK file, as defined previously | |
| server unix:/tmp/unicorn.livepass.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| # Application root, as defined previously |
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 Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | |
| def facebook | |
| oauth_callback("Facebook", "facebook_data") | |
| end | |
| def twitter | |
| oauth_callback("Twitter", "twitter_data") | |
| 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
| myApp.controller('DashboardIndexController', ['$rootScope','$scope', 'PubNub', '$state', '$auth', | |
| function($rootScope, $scope, PubNub, $state, $auth) { | |
| // http://www.pubnub.com/blog/angularjs-101-from-zero-to-angular-in-seconds/ | |
| $scope.userEmail = $rootScope.user.email; | |
| $scope.uuid = $rootScope.user.id; | |
| $scope.channel = "Dashboard Channel"; | |
| $scope.messages = ['Welcome to ' + $scope.channel]; | |
| if (!$rootScope.chatInitialized) { | |
| // Initialize the PubNub service |
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
| #Deploy and rollback on Heroku in staging and production | |
| task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
| task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
| namespace :deploy do | |
| PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
| STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
| task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
| task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
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') | |
| .controller('SampleCtrl', ['$scope', 'sampleService', function($scope, sampleService) { | |
| $scope.loaded = true; | |
| $scope.loadedContent = null; | |
| $scope.sampleAction = function() { // Sample Action that will call the API server | |
| $scope.loaded = false; | |
| $scope.loadedContent = sampleService.get({}, function(data) { | |
| $scope.loaded = true; | |
| }, function(err) { |
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
| // In app.js or main.js or whatever: | |
| // var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']); | |
| // This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17). | |
| myApp.filter('percentage', ['$filter', function ($filter) { | |
| return function (input, decimals) { | |
| return $filter('number')(input * 100, decimals) + '%'; | |
| }; | |
| }]); |