Skip to content

Instantly share code, notes, and snippets.

View stabenfeldt's full-sized avatar
🎯
Focusing

Martin Stabenfeldt stabenfeldt

🎯
Focusing
View GitHub Profile
module V1
class Users < Base
resource :users do
desc 'Lookup of single user'
get 'martin' do
'hello'
end
require 'spec_helper'
describe V1::Users do
describe 'GET /api/v1/users' do
it 'returns array of users' do
3.times { Fabricate :user }
get '/api/v1/users', {}, https_and_authorization
response.status.should eq 200
expected_ids = User.all.page(1).map { |a| a.id.to_s }
expected_ids.each { |id| response.body.should match id }
class API < Grape::API
prefix 'api'
format :json
default_format :json
mount ::V1::Base
end
module V1
class Base < API
puts "in Base"
version 'v1', using: :path, vendor: 'orwapp', cascade: false
mount Users
end
end
class ExcelController < ApplicationController
layout :resolve_layout
def dagsrapport
project = Project.find(params[:project_id])
profession = Profession.find(params[:profession_id])
overtime = params[:overtime]
file_name = Dagsrapport.new(project: project, profession: profession,
overtime: overtime).create_spreadsheet
respond_to do |format|
- content_for :breadcrumb do
= link_to 'Mine prosjekter', projects_path
| >
= @department.title
table
thead
th
th Kunde
angular.module('app', [])
.directive('starred', function() {
return {
restrict: 'E',
scope: {
objectClass: '='
},
templateUrl: '/templates/starred.html.slim',
controller: function($scope, $attrs) {
return $scope.star_clicked = function(e) {
class TemplatesController < ApplicationController
skip_before_filter :authenticate_user!
#skip_authorization_check :template
def template
render :template => 'templates/' + params[:path], :layout => false
end
end
app = angular.module("trenger")
app.controller 'SessionCtrl', ['$scope', '$http', '$window', '$localStorage', '$q',
($scope, $http, $window, $localStorage, $q) ->
$scope.current_user = JSON.parse($("meta[name='current_user']").attr('content'))
$scope.authErrors = []
defer = $q.defer()
$scope.token = $localStorage.token
app = angular.module("trenger")
app.controller 'SessionCtrl', ['$scope', '$http', '$window', '$localStorage', '$q',
($scope, $http, $window, $localStorage, $q) ->
$scope.current_user = JSON.parse($("meta[name='current_user']").attr('content'))
$scope.authErrors = []
defer = $q.defer()
$scope.authorized = () ->
$scope.current_user? and $scope.current_user._id?