Skip to content

Instantly share code, notes, and snippets.

View siebertm's full-sized avatar

Michael Siebert siebertm

  • Berlin, Germany
View GitHub Profile
@siebertm
siebertm / gist:58796
Created February 5, 2009 16:21 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
# ever wanted capistrano talk to you?
# this is used with ext/multistage and only works on a mac
require 'capistrano_colors'
before :deploy, :say_begin_deploy
after :deploy, :say_end_deploy
task :say_begin_deploy do
`say deploying #{ARGV[0]}`
end
@siebertm
siebertm / post-receive
Created May 30, 2009 20:33
post-receive hook for integrity, using more than one project and https, daemonized
#!/usr/bin/env ruby
require 'rubygems'
require 'net/https'
require 'uri'
require 'json'
require 'enumerator'
require "daemons"
# EDIT POST_RECEIVE_URL
rake metrics:all > /dev/null 2>&1 && cp -r tmp/metric_fu/output /srv/deploy/integrity/public/metrics-`git rev-parse --short HEAD` && echo "To see metrics, go to https://integrity.example.com/metrics-`git rev-parse --short HEAD`/"
@siebertm
siebertm / gist:120832
Created May 31, 2009 09:46
integrity build script for metric_fu
rake metrics:all > /dev/null 2>&1 && cp -r tmp/metric_fu/output /srv/deploy/integrity/public/metrics-`git rev-parse --short HEAD` && echo "To see metrics, go to https://integrity.example.com/metrics-`git rev-parse --short HEAD`/"
public class Key {
protected SecretKey key;
public Key(String password, String salt) throws NoSuchAlgorithmException, InvalidKeySpecException {
PBEKeySpec ks = new PBEKeySpec(password.toCharArray(), salt.getBytes(), 1000);
SecretKeyFactory kf = SecretKeyFactory.getInstance("PBEWithSHA1AndDESede");
key = kf.generateSecret(ks);
}
package de.samedi.searcher;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
ld warning: option -s is obsolete and being ignored
# when i "use" the not-too good installed jruby
rvm use jruby --debug
+ case "$action" in
+ rvm-use jruby
+ implementation=jruby
+ case "$implementation" in
+ version=1.3.1
+ '[' 1.3.1 = 1.2.0 -o 1.3.1 = 1.3.1 ']'
+ MY_RUBY_HOME=/Users/micha/.rvm/jruby-1.3.1
rvm use jruby --debug
+ case "$action" in
+ rvm-use jruby
+ implementation=jruby
+ case "$implementation" in
+ version=1.3.1
+ '[' 1.3.1 = 1.2.0 -o 1.3.1 = 1.3.1 ']'
+ MY_RUBY_HOME=/Users/micha/.rvm/jruby-1.3.1
+ GEM_HOME=/Users/micha/.gem/jruby/1.8
+ alias 'ruby_ng=jruby --ng'