This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = "VOCDIITEIOCRUDOIANTOCSLOIOCVESTAIOCVOLIOCENTSU" | |
LONGEST = %r{TDD|DDD|ANT|IOC|LOC} | |
SHORTEST = %r{DI|DO|OO|UI|CV|SU|VO} | |
def compact!(string, times = 2) | |
[LONGEST, SHORTEST].cycle(times) do |regex| | |
string.gsub!(regex, "") | |
end | |
string | |
end | |
puts compact!(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CmsPolicies | |
java_import java.util.jar.JarFile | |
tv4_jar_file = JarFile.new(Polopoly::POLOPOLY_HOME + "/custom/client-lib/tv4.jar") | |
tv4_jar_file.entries.each do |entry| | |
if (entry.to_s =~ /.*(article|department|resource).*/ && entry.directory? ) | |
include_package entry.to_s.gsub(/\/$/, '').gsub('/', '.') | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name polopoly colorizer | |
// @match *://*/polopoly/* | |
// ==/UserScript== | |
if (document.URL.indexOf('userSession') > 0 || document.URL.indexOf('Login.jsp') > 0) { | |
if(document.URL.indexOf('stage') > 0 ) { | |
document.body.style.backgroundColor="#1E90FF"; | |
document.body.style.color="white"; | |
} else if(document.URL.indexOf('localhost')) { | |
//do nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jruby-1.6.4 :001 > require 'rubygems' | |
=> true | |
jruby-1.6.4 :002 > require 'jmx4r' | |
=> true | |
jruby-1.6.4 :003 > JMX::MBean.establish_connection :host => "localhost", :port => 10107 | |
=> #<JMX::MBeanServerConnectionProxy:0x6063f5af @connection=#<#<Class:0x166bb1ead>:0x4c9d22fc>, @connector=#<Java::JavaxManagementRemoteRmi::RMIConnector:0x5ab6b2a5>> | |
jruby-1.6.4 :004 > polopoly_mbeans = JMX::MBean.find_all_by_name "com.polopoly:*" | |
=> [#<JMX::MBean:0x2e1ed620>, #<JMX::MBean:0x6a7be687>, #<JMX::MBean:0x6c5bdfae>, #<JMX::MBean:0x3ba5016>, #<JMX::MBean:0x3cdfd643>, #<JMX::MBean:0xb6be7ee>, #<JMX::MBean:0x5947c01d>, #<JMX::MBean:0x7595ddb5>, #<JMX::MBean:0x420ed262>, #<JMX::MBean:0x5b1641cf>, #<JMX::MBean:0x123aabc1>, #<JMX::MBean:0x49e21540>, #<JMX::MBean:0x19e142a5>, #<JMX::MBean:0x13de6be9>, #<JMX::MBean:0x6f7e982f>, #<JMX::MBean:0x60396ed8>, #<JMX::MBean:0x5a9c5842>, #<JMX::MBean:0x4e668387>, #<JMX::MBean:0x75787005>, #<JMX::MBean:0x36029483>, #<JMX::MBean:0x63644028>, #<JMX::MBean:0x4ab03512>, #<JMX::MBean:0x76 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if you have an directory with a .rvmrc in like | |
#/home/user/src/my_ruby_gem | |
#and are on the master brach | |
#this will create a gemset named | |
#my_ruby_gem-master | |
rvm --create ruby-1.9.2-p180@$(basename $(pwd)$(if [ -d .git ]; then echo "-$(git branch | grep '* '| sed -e 's/ //')"; fi)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from 3.1 | |
ModelAndViewResolverMethodReturnValueHandler | |
SimpleBeanFactoryAwareAspectInstanceFactory | |
SimpleRemoteStatelessSessionProxyFactoryBean | |
SingletonMetadataAwareAspectInstanceFactory | |
TransactionAwarePersistenceManagerFactoryProxy | |
UriComponentsBuilderMethodArgumentResolver | |
AbstractDependencyInjectionSpringContextTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from a clean install av rails 3.1.3 | |
gems# egrep -ro "module (\w+)" . > ../blah | |
gems cat ../blah |awk '{print length, $0}'|sort -unr| head | |
42 NextNodeHeightIsDeterministicSharedContext | |
31 PalindromicFixtureSharedContext | |
27 AssociationBuilderExtension | |
26 BacktraceFilterForTestUnit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP/1.1 200 OK | |
Date: Mon, 30 Jan 2012 12:45:58 GMT | |
Server: Apache/2.2.20 (FreeBSD) PHP/5.3.3 with Suhosin-Patch mod_ssl/2.2.20 OpenSSL/0.9.8q | |
Vary: Cookie | |
X-Powered-By: PHP/5.3.3 | |
X-Pingback: http://trulytherese.se/xmlrpc.php | |
Connection: close | |
Transfer-Encoding: chunked | |
Content-Type: text/css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
file_map = {} | |
Dir["**/*.{rb,java,erb,js,html,css,jsp,xml}"].each do |path| | |
ext = File.extname(path) | |
if file_map.has_key? ext | |
current_count = file_map[ext] | |
count = current_count + File.open(path).readlines.size | |
file_map[ext] = count | |
else | |
file_map[ext] = File.open(path).readlines.size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout "`git rev-list master -n 1 --first-parent --before=2008-03-02`" |