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
| #!/usr/bin/ruby | |
| require 'ostruct' | |
| syslog = '/var/log/syslog' | |
| lines = File.read(syslog).split "\n" | |
| rows = lines.map do |line| | |
| fields = line.split(' ', 6) | |
| o = OpenStruct.new |
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
| #!/usr/bin/ruby | |
| require 'ostruct' | |
| require 'rubygems' | |
| require 'sequel' | |
| DB = Sequel.sqlite('syslogdb') | |
| DB.create_table :syslogs do | |
| primary_key :id | |
| column :time, :timestamp |
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
| #!/usr/bin/env ruby | |
| run "rm README" | |
| run "rm public/index.html" | |
| run "rm public/favicon.ico" | |
| run "rm public/robots.txt" | |
| run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" | |
| run "for i in tmp/*; do touch tmp/$i; done" | |
| file '.gitignore', <<-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
| def new | |
| x = Builder::XmlMarkup.new | |
| x.instruct! | |
| x.comment! "User Authentication Successful" | |
| x.user { | |
| x.id @user.id | |
| x.login @user.login | |
| x.name @user.name | |
| } | |
| render :xml => x |
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
| equire 'rubygems' | |
| require 'eventmachine' | |
| module Socky | |
| module Policy | |
| DEBUG = true | |
| HOST = 'localhost' | |
| PORT = 843 | |
| EOF = "\r\000" | |
| REQUEST = "<policy-file-request/>\000" |
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 Foo | |
| end | |
| class Flibby | |
| def make_method( _method_name ) | |
| puts _method_name | |
| Foo.class_eval do | |
| puts _method_name | |
| class << self | |
| define_method _method_name do |
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
| module OrderedHash | |
| def []( index ) | |
| begin | |
| super( index ) | |
| rescue TypeError | |
| x = self.detect do |i| | |
| i.first == index | |
| end # if index.class ... | |
| x && x[1] | |
| 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
| module PageHelper | |
| def hero? | |
| !!params[:event_url] | |
| end | |
| def event? | |
| !hero? && !!params[:url] | |
| 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
| def donation_uk_giftaid | |
| unless request.post? | |
| redirect_to :action=>"donate" | |
| return | |
| end | |
| @heroPage = HeroPage.search_url(params[:url], DateTime.now) | |
| hero_page_variables("preview", true) | |
| if session[:mydonation_id] | |
| @donation = Donation.find_by_id(session[:mydonation_id]) | |
| @donation.update_attributes(params[:donation]) |
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
| #!/usr/bin/env ruby | |
| run "rm README" | |
| run "rm public/index.html" | |
| run "rm public/favicon.ico" | |
| run "rm public/robots.txt" | |
| run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" | |
| file '.gitignore', <<-END | |
| .swo |