Skip to content

Instantly share code, notes, and snippets.

View skalnik's full-sized avatar
🐈

Mike Skalnik skalnik

🐈
View GitHub Profile
class Integer
def even?
self % 2 == 0
end
end
highest, num = 0, 0
(1..1_000_000).each { |i|
original, count = i, 0
class CommentsController < ApplicationController
before_filter :find_post
before_filter :authenticate, :only => :destory
def new
@comment = @post.comments.build
end
def create
@comment = @post.comments.build(params[:comment])
def random_password
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
chars.sort_by { rand }[0,7].join
end
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'uri'
require 'hpricot'
html = Hpricot Net::HTTP.get URI.parse('http://bash.org/?random')
quote = (html/"p.qt").first.inner_html
class Example
def public
puts "Public Method"
end
private
def private
puts "Private methods go below the private tag"
end
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems/rubygems_version'
require 'rubygems/defaults'
require 'thread'
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems/rubygems_version'
require 'rubygems/defaults'
require 'thread'
total 56
drwxrwxr-x 9 root admin 306 Dec 17 15:23 .
drwxrwxr-x 3 root admin 102 Jan 14 2008 ..
drwxr-xr-x 10 root admin 340 Feb 14 2008 osx
drwxr-xr-x 3 root admin 102 Oct 21 14:54 rbconfig
drwxr-xr-x 47 root admin 1598 Dec 17 15:23 rubygems
-rw-r--r-- 1 root admin 22155 Dec 17 15:23 rubygems.rb
drwxrwxr-x 12 root admin 408 Nov 25 2007 svn
-rw-r--r-- 1 root admin 268 Oct 21 14:54 ubygems.rb
drwxrwxr-x 4 root admin 136 Aug 23 18:10 universal-darwin9.0
# This file allows for the running of rubygems with a nice
# command line look-and-feel: ruby -rubygems foo.rb
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems'
total 24
drwxr-xr-x 6 root wheel 204 Jul 20 23:59 .
drwxr-xr-x 107 root wheel 3638 Jul 17 2008 ..
lrwxr-xr-x 1 root wheel 24 Jul 20 23:59 Headers -> Versions/Current/Headers
lrwxr-xr-x 1 root wheel 26 Feb 21 2008 Resources -> Versions/Current/Resources
lrwxr-xr-x 1 root wheel 21 Feb 21 2008 Ruby -> Versions/Current/Ruby
drwxr-xr-x 4 root wheel 136 Feb 21 2008 Versions