Skip to content

Instantly share code, notes, and snippets.

@Znow
Znow / Error
Created December 28, 2011 08:06
Routing Error
No route matches {:action=>"edit", :controller=>"admin/advice_pages"}
Started GET "/admin/investors/2" for 192.168.233.1 at 2011-12-23 11:01:45 +0100
Processing by Admin::InvestorsController#show as HTML
Parameters: {"id"=>"2"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Investor Load (0.3ms) SELECT "investors".* FROM "investors" WHERE "investors"."id" = ? LIMIT 1 [["id", "2"]]
Completed 406 Not Acceptable in 52ms
@Znow
Znow / es.sh
Created December 19, 2011 12:52 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get install unzip
sudo apt-get install python-software-properties -y
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
@Znow
Znow / employee.rb
Created December 18, 2011 19:00
pages/show.haml
class Employee < ActiveRecord::Base
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i # full regex
validates :name, :presence => true
validates :title, :presence => true
validates :email, :presence => true, :format => { :with => email_regex }
validates :phone, :presence => true
validates :image, :presence => true
def as_json(options={})
[PS] C:\Windows\system32>Get-GlobalAddressList
Name RecipientFilter
---- ---------------
Default Global Address List (Alias -ne $null -and (ObjectClass -eq
'user' -or ObjectClass -eq 'contact' -o
r ObjectClass -eq 'msExchSystemMailbox'
-or ObjectClass -eq 'msExchDynamicDist
ributionList' -or ObjectClass -eq 'grou
p' -or ObjectClass -eq 'publicFolder'))
[PS] C:\Windows\system32>Update-GlobalAddressList -Identity "EDORAHQ"
Update-GlobalAddressList : The operation could not be performed because object
'EDORAHQ' could not be found on domain controller 'ESDKLY002.edora.hq'.
At line:1 char:25
+ Update-GlobalAddressList <<<< -Identity "EDORAHQ"
+ CategoryInfo : NotSpecified: (0:Int32) [Update-GlobalAddressLis
t], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : A404880B,Microsoft.Exchange.Management.SystemCon
figurationTasks.UpdateGlobalAddressList
- @rss.entries.each do |rss|
%li
%b= rss.pubDate.strftime('%d/%m/%y - %H:%M:%S')
%br/
= link_to(truncate(rss.title, :length => 50), rss.link)
@Znow
Znow / advice_pages_controller.rb
Created November 24, 2011 12:37
shows the specific page...
class Admin::AdvicePagesController < AdminController
def index
@pages = AdvicePage.all
end
def show
@page = AdvicePage.find(params[:id])
end
@Znow
Znow / advice_pages_controller.rb
Created November 24, 2011 12:12
show method of pages_controller
# IN ADMIN NAMESPACE
# IVE TRIED WORKING IN THE MERCURY_UPDATE METHOD IN HERE BUT NO LUCK
#
class Admin::AdvicePagesController < AdminController
def index
@pages = AdvicePage.all
end
def initialize(user)
user ||= User.new
if user.super_admin?
can :manage, :all
elsif user.admin?
can :manage, News
can :manage, Video
can :manage, Employee