| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
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
| ActiveAdmin.register Event do | |
| #Menu display index | |
| menu :priority => 1 | |
| #Scopes | |
| scope :all | |
| scope :pending | |
| scope :approved | |
| scope :rejected | |
| scope :cancelled |
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::AuthTokenController < ApplicationController | |
| include Concerns::AuthTokenConcern | |
| include Concerns::WechatAuthConcern | |
| def get_wechat_token | |
| # 通过 code 来获取 openid | |
| openid = App::AuthProcessor.get_wechat_openid params[:code] | |
| if openid | |
| # 通过 openid 匹配平台账户 |
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('app.resource') | |
| .factory('AuthToken', ['BaseResource', '$http', 'API_ENDPOINT', '$q', | |
| function (BaseResource, $http, API_ENDPOINT, $q) { | |
| var AuthToken = BaseResource("auth_token"); | |
| AuthToken.get_wechat_token = function(code, state){ | |
| var deferred = $q.defer(); | |
| // 构造 url | |
| var get_wechat_token_url = | |
| API_ENDPOINT+"/get_wechat_token?code="+code+"&state="+state; |
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('app.account') | |
| .controller('WechatAuthCtrl', | |
| ['$scope', '$location','AuthService', 'Account', 'AuthToken', 'jwtHelper', | |
| function($scope, $location, AuthService, Account, AuthToken, jwtHelper) { | |
| // 获取返回参数 code 和 state | |
| var code = $location.search().code; | |
| var state = $location.search().state; | |
| // 通过 code 来获得签名的 openid | |
| var respond = AuthToken.get_wechat_token(code, state); |
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('app',[]) | |
| .config([, function(){ | |
| //项目列表路由 | |
| .state('projects',{ | |
| url:'/projects', | |
| templateUrl:"app/project/ProjectList.html", | |
| controller:"ProjectListCtrl", | |
| access:{requireLogin:true} | |
| }) |
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
| namespace :tmp do | |
| desc "print env variables" | |
| task :test do | |
| SSHKit.config.default_env = { path: '/usr/local/libexec/bin:$PATH' } | |
| on roles :app do | |
| puts capture(:env) | |
| end | |
| end | |
| desc "remote run head" |
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
| routes_set = Rails.application.routes.routes | |
| routes_set.map { |r| p r.path.spec.to_s } |
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 Appointment = Backbone.Model.extend({}); | |
| var appointment = new Appointment(); | |
| appointment.set('title', 'My knee hurts'); | |
| var AppointmentView = Backbone.View.extend({ | |
| render: function(){ | |
| $(this.el).html('<li>' + this.model.get('title') + '</li>'); | |
| } | |
| }); | |
| var appointmentView = new AppointmentView({model: appointment}); |