Skip to content

Instantly share code, notes, and snippets.

View joejwright's full-sized avatar

Joe Wright joejwright

View GitHub Profile
function fix_single_image( $atts ){
$atts = shortcode_atts( array(
'class' => 'vce-single-image',
'src' => '',
'data-width' => '',
'data-height' => '',
'data-img-src' => '',
'alt' => '',
'title' => ''
@joejwright
joejwright / gist:bc6f3b09f00d65f3b642
Created July 31, 2014 14:34
Devise Token Controller
class Api::V1::TokensController < ApplicationController
skip_before_filter :verify_authenticity_token
respond_to :json
def create
email = params[:email]
password = params[:password]
if request.format != :json
render :status=>406, :json=>{:message=>"The request must be json"}
return
end
@joejwright
joejwright / gist:85aa1361c01b43d61cff
Created July 31, 2014 14:33
Devise Model w/ Token Auth
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
before_save :ensure_authentication_token
after_save :ensure_account
belongs_to :account
@joejwright
joejwright / gist:8461676
Created January 16, 2014 19:28
Asterisk logs
-- Executing [901@from-internal:1] Macro("SIP/900-0000007f", "exten-vm,901,901") in new stack
-- Executing [s@macro-exten-vm:1] Macro("SIP/900-0000007f", "user-callerid,") in new stack
-- Executing [s@macro-user-callerid:1] Set("SIP/900-0000007f", "AMPUSER=900") in new stack
-- Executing [s@macro-user-callerid:2] GotoIf("SIP/900-0000007f", "0?report") in new stack
-- Executing [s@macro-user-callerid:3] ExecIf("SIP/900-0000007f", "1?Set(REALCALLERIDNUM=900)") in new stack
-- Executing [s@macro-user-callerid:4] Set("SIP/900-0000007f", "AMPUSER=") in new stack
-- Executing [s@macro-user-callerid:5] Set("SIP/900-0000007f", "AMPUSERCIDNAME=") in new stack
-- Executing [s@macro-user-callerid:6] GotoIf("SIP/900-0000007f", "1?report") in new stack
-- Goto (macro-user-callerid,s,10)
-- Executing [s@macro-user-callerid:10] GotoIf("SIP/900-0000007f", "0?continue") in new stack
navigationBar = UINavigationBar.appearance
navigationBar.setBackgroundImage(UIImage.imageNamed('navigation-bar-background.png'), forBarMetrics: UIBarMetricsDefault)
navigationBar.setTitleTextAttributes({
UITextAttributeFont => UIFont.fontWithName('Trebuchet MS', size:24),
UITextAttributeTextShadowColor => UIColor.clearColor,
UITextAttributeTextColor => '#2a3284'.to_color
})