Skip to content

Instantly share code, notes, and snippets.

View victusfate's full-sized avatar
🚀

Mark Essel victusfate

🚀
View GitHub Profile
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@stan
stan / prime.rb
Created May 22, 2010 09:16 — forked from atnan/prime.rb
class Integer
def prime?
!("1" * self).match(/^1?$|^(11+?)\1+$/).nil?
end
end
~/projects/jruby ➔ gem install yajl-ruby
Building native extensions. This could take a while...
Successfully installed yajl-ruby-0.7.7
1 gem installed
Installing ri documentation for yajl-ruby-0.7.7...
Installing RDoc documentation for yajl-ruby-0.7.7...
~/projects/jruby ➔ jruby -rubygems -e "require 'yajl'; p Yajl::Parser.parse('{\"foo\": 1145}')"
{"foo"=>1145}
$('.submittable').live('change', function() {
$(this).parents('form:first').submit();
});
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function(){
jQuery.noConflict();
var jq = jQuery;
jq.ajax({
url: '/rss',
type: 'GET',
dataType: 'xml',
error: function (xhr, status, e) {
# Original blog post about Rubinius performance on the alioth mandelbrot benchmark:
# http://rfc2616.wordpress.com/2010/10/16/rubinius-vs-the-benchmark-from-hell/
#
# Problems with assumptions in the blog post:
# * The C <-> Ruby comparison is apples to oranges because the Ruby code
# is written to use blocks rather than loops. That imposes the overhead
# of additional execution contexts per pixel.
# * The output is written a byte at a time, which requires a fairly deep
# chain of methods before the byte is handed off to the OS.
# * The work is done in the script body. Unless the implementation has
@shripadk
shripadk / gist:652819
Created October 29, 2010 03:10
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
@subtleGradient
subtleGradient / appify
Created November 11, 2010 16:03
appify. Create the simplest possible mac app from a shell script
#!/usr/bin/env bash
#
# url : https://gist.github.com/672684
# version : 2.0.2
# name : appify
# description : Create the simplest possible mac app from a shell script.
# usage : cat my-script.sh | appify MyApp
# platform : Mac OS X
# author : Thomas Aylott <oblivious@subtlegradient.com>
@victusfate
victusfate / webapp.rb
Created November 16, 2010 20:45 — forked from igrigorik/webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@max-mapper
max-mapper / chicago-inspections.rb
Created December 3, 2010 22:49
chicago restaurant health inspections
require 'net/http'
require 'uri'
require 'nokogiri'
url = URI.parse('http://webapps.cityofchicago.org/healthinspection/inspectionresultrow.jsp')
request = Net::HTTP::Post.new(url.path)
request.set_form_data({"REST"=>" ", "STR_NBR"=>"", "STR_NBR2"=>"", "STR_DIRECTION"=>"", "STR_NM"=>"", "ZIP"=>""})