Skip to content

Instantly share code, notes, and snippets.

View osiro's full-sized avatar

Vinny Osiro osiro

View GitHub Profile
@osiro
osiro / ldap.rb
Created February 20, 2014 08:23
config/initializers/ldap.rb
# config/initializers/ldap.rb
# Adding new authentication strategy
Warden::Strategies.add(:ldap_authenticatable, Authentication::LdapAuthenticatable)
# Loading LDAP configurations
ldap_settings = YAML::load_file(Rails.root.join('config', 'ldap.yml'))
if ldap_settings[Rails.env].present?
Rails.configuration.ldap = OpenStruct.new(ldap_settings[Rails.env])
end
@osiro
osiro / ldap_authenticable.rb
Last active August 29, 2015 13:56
lib/ldap_authenticable.rb
# lib/ldap_authenticable.rb
require 'net/ldap'
require 'devise/strategies/authenticatable'
class Authentication::LdapAuthenticatable < Devise::Strategies::Authenticatable
def authenticate!
if params[:user]
result = Authentication::Ldap.instance.authenticate(email, password)
class TimesheetApprovalWorker
include Sidekiq::Worker
sidekiq_options queue: :timesheet_notifier, backtrace: true
def perform(timesheet_id)
@timesheet = Timesheet.includes(:user, :pay_perid, :authoriser)
TimesheetMailer.approved(@timesheet).deliver
end
end
@osiro
osiro / aaa.rb
Created November 19, 2013 08:27
1.8.7 :002 > u = User.last
=> #<User id: 8, email: "[email protected]", encrypted_password: "$2a$10$7OJ1p9E/WgbTjY0XW9jULOBpuxAPIM8EnQ/Wk5.rG.0R...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2013-11-19 07:22:56", updated_at: "2013-11-19 07:22:56", uuid: nil, api_token: nil, account_id: nil, role: 0>
1.8.7 :003 > u.send_reset_password_instructions
ActionView::Template::Error: ActionView::Template::Error
from /usr/local/rvm/gems/ree-1.8.7-2011.02@gimme/gems/activesupport-3.0.19/lib/active_support/core_ext/hash/reverse_merge.rb:18:in `reverse_merge'
from /usr/local/rvm/gems/ree-1.8.7-2011.02@gimme/gems/actionpack-3.0.19/lib/action_dispatch/routing/url_for.rb:131:in `url_for'
from /usr/local/rvm/gems/ree-1.8.7-2011.02@gimme/gems/actionpack-3.0.19/lib/action_view/helpers/url_helper.rb:99:in `url_for'
from /usr/local/rvm/gems/ree-1.8.7-2011.0
require 'spec_helper'
feature 'Existing users can sign in to the site' do
let(:user) { FactoryGirl.create :user }
background do
visit root_path
click_link 'Sign in'
end
class Registered::Staff::Profile::SkillsController < Registered::Staff::ProfileController
def new
@available_positions = Position.order_by_name
@form = StaffProfileSkillsForm.from_user(current_user)
end
def create
@available_positions = Position.order_by_name
stupid_voices = [
'Agnes',
'Albert',
'Alex',
'Bad News',
'Bahh',
'Bells',
'Boing',
'Bruce',
'Bubbles',
stupid_song = [
"I threw a wish in the well",
"Don't ask me, I'll never tell",
"I looked to you as it fell",
"And now you're in my way",
"I trade my soul for a wish",
"Pennies and dimes for a kiss",
"I wasn't looking for this",
"But now you're in my way",
@osiro
osiro / aaaaaaa
Created September 20, 2013 06:37
Viniciuss-MacBook-Pro:ndri-poster_maker_mobile osiro$ rake build:ios ENV=staging
WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1
/Users/osiro/Workspace/ndri-poster_maker_mobile/build/ios/www/index.html
Warning. Error encountered while saving cache ./.sass-cache/91d2099510d82e7905b3da810461ac68e3a3d819/mixins.css.sassc: can't dump anonymous class #<Class:0x007ffbc678dc68>
Warning. Error encountered while saving cache ./.sass-cache/91d2099510d82e7905b3da810461ac68e3a3d819/mixins.css.sassc: can't dump anonymous class #<Class:0x007ffbc678dc68>
/Users/osiro/Workspace/ndri-poster_maker_mobile/build/ios/www/poster_pdf.html
2013-09-20 14:36:25.534 xcodebuild[63453:4107] warning: ignoring unknown attribute assignment opcode 'b' for entry <C:'CodeSign /Users/osiro/Library/Developer/Xcode/DerivedData/PosterMaker-cjmedqapejjdvyalyjqudihktxmf/Build/Products/Debug-iphoneos/PosterMaker.app'>
2013-09-20 14:36:25.535 xcodebuild[63453:4107] warning: ignoring unknown attribute assignme
- current_url = url_for(params.slice(:search))
%h1= page_title
= semantic_form_for(@search_form, url: url_for(), method: :get, html: {class: 'inline-form'}) do |f|
= f.inputs do
= f.input :term
= f.input :released_after, as: :date_picker
= f.input :released_before, as: :date_picker
= f.actions do