Skip to content

Instantly share code, notes, and snippets.

View anildigital's full-sized avatar
:octocat:

Anil Wadghule anildigital

:octocat:
View GitHub Profile
@stuartsierra
stuartsierra / gist:1212314
Created September 12, 2011 20:29
Enable Electric Ruby Mode in Emacs
;; Add this to ~/.emacs
;; Missing from ruby-mode.el, see https://groups.google.com/group/emacs-on-rails/msg/565fba8263233c28
(defun ruby-insert-end ()
"Insert \"end\" at point and reindent current line."
(interactive)
(insert "end")
(ruby-indent-line t)
(end-of-line))
(ns demo.gemstoclojure
(:use ring.adapter.jetty)
(:use clojure.contrib.io)
(:use clojure.contrib.classpath))
(import '(org.jruby.embed ScriptingContainer LocalContextScope))
(def c (ScriptingContainer. LocalContextScope/THREADSAFE))
(println (classpath))
(println (pwd))
@SaitoWu
SaitoWu / add_jruby.sh
Created September 4, 2011 11:46
jruby maven3
:~$ rvm use jruby
Using /home/saito/.rvm/gems/jruby-1.6.2
:~$ gem i mvn:org.slf4j:slf4j-simple
Successfully installed mvn:org.slf4j:slf4j-api-1.6.2-java
Successfully installed mvn:org.slf4j:slf4j-simple-1.6.2-java
@maccman
maccman / config.rb
Created August 28, 2011 12:15
Rails 3 Config
# Rails 3 Config
#
# In: config/application.yml
#
# development:
# github:
# key: test
# secret: verysecret-dev
# production:
# github:
$pid = fork
if $pid == nil
exec "./srvd/redis-server ./srvd/redis.conf"
end
sleep 5
Process.kill(:$pid)
@avdi
avdi / gist:1026546
Created June 15, 2011 05:45
A Guardfile for starting Redis
module ::Guard
class Redis < Guard
def start
puts "Starting Redis on port #{port}"
IO.popen("#{executable} -", 'w+') do |server|
server.write(config)
server.close_write
end
puts "Redis is running with PID #{pid}"
$?.success?
@achamian
achamian / ssh-copy-id
Created June 9, 2011 05:54
Copy public key to authorized_keys
#!/usr/bin/env sh
# Copy public key to authorized_keys of a remote machine
if [ -z $1 ] || [ -z $2 ];then
echo "Usage"
echo "ssh-copy-id hostname /path/to/public/key"
exit
fi
KEYCODE=`cat $2`
ssh -q $1 "mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; echo "$KEYCODE" >> ~/.ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys"
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
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
require 'logger'
class String
LOGGER = Logger.new($stderr)
def -@; LOGGER.info self; end
end
# Extracted earlier, hardcoded for speed
ENTITIES = %w(I-ORG O I-MISC I-PER I-LOC B-LOC B-MISC MO B-ORG)
@bergie
bergie / README.md
Created May 18, 2011 11:33
Falsy Values tutorials