This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Parse(data) | |
if data.match(/Accepted publickey for/) | |
line_to_breakdown = data | |
last_login = line_to_breakdown.match(/[A-Z][a-z][a-z]\s\s\d\s\d\d:\d\d:\d\d/).to_s | |
@last_login = Time.parse(login_time).to_i | |
last_login = @last_login_time.to_s | |
ip_address = line_to_breakdown.match(/(\d{1,3}\.){3}\d{1,3}/) | |
venue = line_to_breakdown.match(/[a-z]\d\d\d\d[\s\S]/) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appliance = Appliance.new(:venue => "m1234", :ip_address => "123.123.123.123", :last_login => "123545") | |
=> #<Appliance id: nil, venue: nil, ip_address: nil, last_login: nil, created_at: nil, updated_at: nil> | |
class Appliance < ActiveRecord::Base | |
attr_accessible :venue, :ip_address, :last_login | |
end | |
~ | |
~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appliance = Appliance.new(:venue => "m1234", :ip_address => "123.123.123.123", :last_login => "123545") | |
=> #<Appliance id: nil, venue: nil, ip_address: nil, last_login: nil, created_at: nil, updated_at: nil> | |
class Appliance < ActiveRecord::Base | |
attr_accessible :venue, :ip_address, :last_login | |
end | |
~ | |
~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :cron => :environment do | |
puts "Pulling new requests..." | |
counter = 1 | |
file = File.new("/home/test/rails_projects/RubyScripts/secure", "r") | |
while (line = file.gets) | |
if line.match(/Accepted publickey for/) | |
line_to_breakdown = line | |
login_time = line_to_breakdown.match(/[A-Z][a-z][a-z]\s\s\d\s\d\d:\d\d:\d\d/).to_s | |
@last_login_time = Time.parse(login_time).to_i | |
last_login = @last_login_time.to_s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li> | |
<%= if user_signed_in? | |
link_to "Sign Out", destroy_user_session_path, :method => :delete | |
else | |
link_to "Sign In", user_session_path | |
end %> | |
</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_status | |
@ticket.status = "open" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td><%= button_to 'Close', ticket_path(ticket), :status => 'closed', :method =>"put", :class => "btn danger" %></td> | |
def set_status(status) | |
if status == 'closed' | |
self.status = 'closed' | |
else | |
self.status = 'open' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://norvig.com/21-days.html | |
http://developers.whatwg.org/ | |
http://dev.opera.com/articles/view/1-introduction-to-the-web-standards-cur/#toc | |
Local Business connections | |
http://www.startupconnection.org/ | |
http://stlouis.startupweekend.org/ | |
Ruby/Heroku/Rails | |
http://www.nofluffjuststuff.com/blog/david_bock/2010/12/google_analytics_and_rails3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event < ActiveRecord::Base | |
has_event_calendar | |
belongs_to :user | |
end | |
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@event = Event.new(params[:event]) | |
respond_to do |format| | |
if @event.save | |
format.html { redirect_to @event, notice: 'Event was successfully created.' } | |
format.json { render json: @event, status: :created, location: @event } | |
else | |
format.html { render action: "new" } | |
format.json { render json: @event.errors, status: :unprocessable_entity } |
OlderNewer