Skip to content

Instantly share code, notes, and snippets.

View regedarek's full-sized avatar
🏠
Working from home

Darek Finster regedarek

🏠
Working from home
View GitHub Profile
.right
= image 'nav_divider', class: 'r'
= link_to '#' do
= icon 'nav_settings', 54
-# %span= truncate current_user.name, length: 10
= image 'nav_divider', class: 'r'
= link_to cardiologist_conversations_path do
= icon 'nav_conversations', 54
- unless current_user.mailbox.inbox(unread: true).empty?
require 'delegate'
module Presenter
def presenter
presenter = "#{self.class.name}Presenter".constantize
presenter.new(self)
end
# Example of usage:
#
class Leg
include ActiveModel::Validations
include ActiveModel::Naming
include ActiveModel::Conversion
include Virtus
attribute :start_day, Integer
attribute :end_day, Integer
end

This will allow you to use devise's TokenAuthenticatable strategy while passing your :auth_token in using HTTP Authorization headers instead of params.

You can check it out using

curl -H "Authorization: Token token=XXXXXX, option=1" -vv http://railsapp.dev/api/v1/endpoint.json

It should properly authenticate using the token as well as set request.env['token.options'] to {"options" => "1"}.

@regedarek
regedarek / accounts.rb
Last active August 29, 2015 14:05
Example Versioning App in Sinatra
# app/routes/v2/accounts.rb
module Oauth2Provider
module Routes
module V2
class Accounts < Base
get '/accounts' do
content_type :json
'version 2'
end
end

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'edkolev/tmuxline.vim'
Plugin 'Zuckonit/vim-airline-tomato'
Plugin 'chriskempson/base16-vim'
@reloadWindow = ->
# window cannot be reloaded in jasmine tests
{ }
class FileUploadStub
constructor: ($el, options) ->
@done = options.done
@$el = $el
@addEventListeners
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'bling/vim-airline'
Plugin 'edkolev/tmuxline.vim'
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'edkolev/tmuxline.vim'
Plugin 'Zuckonit/vim-airline-tomato'
Plugin 'chriskempson/base16-vim'