Skip to content

Instantly share code, notes, and snippets.

View stefanpenner's full-sized avatar
🎯
Focusing

Stefan Penner stefanpenner

🎯
Focusing
View GitHub Profile
<!--- RENDERED PARTIAL >
<tr>
<td><%=h bug.user.company_name %> </td>
<td>Submitted by <%=h bug.submitter %></td>
<td><%=h bug.subject %> </td>
<td> <%=h truncate(bug.description.gsub(/<.*?>/,''), :length => 80) %> </td>
<td> <%= link_to 'Show', bug %> </td>
<% if session[:admin] %>
<td> <%= link_to 'Edit', edit_bug_path(bug)%> </td>
named_scope :bill_on, lambda { |*args|
date_to_bill = args[0]||Time.now.to_date
if date_to_bill.day < 27
{ :conditions => "DAY(billing_date) = #{date_to_bill.day}" }
else
offset = date_to_bill.end_of_month.day - date_to_bill.day
{ :conditions => "( DAY(LAST_DAY(CURRENT_DATE))-DAY(billing_date) ) = #{offset}" }
end
}
end
#p-cactions li {
border-top-left-radius: .5em;
border-top-right-radius: .5em;
-moz-border-radius-topleft: .5em;
-moz-border-radius-topright: .5em;
-webkit-border-top-left-radius: .5em;
-webkit-border-top-right-radius: .5em;
-khtml-border-top-left-radius: .5em;
-khtml-border-top-right-radius: .5em;
}
$:.push "rails/activesupport/lib"
$:.push "rails/actionpack/lib"
require "action_controller"
class Kaigi < ActionController::Http
include AbstractController::Callbacks
include ActionController::RackConvenience
include ActionController::Renderer
include ActionController::Layouts
class Greeter
def initialize(name = "World")
@name = name
end
def say_hi
puts "Hi #{@name}!"
end
def say_bye
puts "Hello there, what's your name"
name = gets
puts "What's your middle name, #{name}"
mname = gets.chomp
puts "What's your last namme, #{name} #{mname}"
lname = gets.chome
puts "Wow, so your name is #{name} #{mname} #{lname}"
puts "What's your favorite number?"
number = gets.chomp.to_i
add= 1
# Controller
def index
@results = SexOffender.all
end
# View
<% if @results.blank? %>
<span>no sex offenders were found</span>
// replaced this
$(document).ready(function() {
if ($.fn.corner) $('.corner').corner()
})
// with this
.corner {
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
require 'rubygems'
require 'ghost'
module Productivity
BLOCK_LIST = %W{ facebook.com twitter.com }
def start
puts "Blocked:"
BLOCK_LIST.each do |host|
Host.add(host,'127.0.0.1')
# previously required http://github.com/mislav/addressable
# with changes merged upstream, main repo should work too:
# http://github.com/sporkmonger/addressable/
require 'addressable/template'
# http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses%C2%A0followers
template = Addressable::Template.new 'http://{host=twitter.com}' +
'/statuses/followers{-prefix|/|id}.{format=json}' +
'?{-join|&|user_id,screen_name,cursor}'