Skip to content

Instantly share code, notes, and snippets.

(ns hello.core
(:use ring.adapter.jetty)
)
(defn app [req]
{:status 200
:headers {"Content-Type" "text/plain"}
:body "Hello from Clojure!\n"})
(defn -main []
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
http://grokbase.com/p/lucene/solr-user/11bmq4zkez/jetty-error-broken-pipe
Mar 4, 2012 4:59:25 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/update params={wt=ruby} status=0 QTime=79864
Mar 4, 2012 4:59:25 PM org.apache.solr.common.SolrException log
SEVERE: org.mortbay.jetty.EofException
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:791)
at org.mortbay.jetty.AbstractGenerator$Output.flush(AbstractGenerator.java:569)
at org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:1012)
at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
@rociiu
rociiu / face_detector.rb
Created December 14, 2011 04:07 — forked from siuying/face_detector.rb
Macruby Face Detection in Mac OS X Lion. Usage: $ macruby face_detector.rb or $ macruby face_detector.rb image_url
framework 'Cocoa'
class NSColor
def toCGColor
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace)
## approach #1
# components = Array.new(4){Pointer.new(:double)}
# color_RGB.getRed(components[0],
# green: components[1],
# blue: components[2],
@rociiu
rociiu / rails_3_1_rc4_changes.md
Created November 1, 2011 08:51 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@rociiu
rociiu / chat.html
Created October 28, 2011 10:08 — forked from JoeyButler/chat.html
Simple Chat app
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
if(typeof WebSocket === 'undefined') {
alert("Your browser does not support websockets.")
}
@rociiu
rociiu / LICENSE.txt
Created September 28, 2011 22:49 — forked from p01/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@rociiu
rociiu / gist:1089756
Created July 18, 2011 14:55 — forked from croaky/gist:1089598
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@rociiu
rociiu / gist:1015706
Created June 8, 2011 23:20 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end