Skip to content

Instantly share code, notes, and snippets.

# Assume we have the following program and external_file.rb library with defined function external_function.
require "external_file.rb"
a = external_function(1,2,3)
# Where should the loaded library file be located if program executes without errors? Assume that the
# current directory is not the same as the disk root and executed program's directory.
# Note: No command line options were used to invoke Ruby
@klauern
klauern / Some RegEx's.txt
Created January 30, 2009 21:12
A RegEx for searching JCAPS 5.1.x server.log files
Here is a regular expression listing:
Find comments in server.log files (JCAPS 5.1.3)
(\[#\|(.|\s)*(?#Insert which things you're looking for here. Be it BehavScor|Thing|Thin|)\|#])
The above regex (minus the (?#...) portion)
\[#\|(.|\s)*wefwefw(.|\s)*\|#]
The wefwefw portion is merely a marker for whatever you're really looking for. Say you want to look for your project's svcJcdwhatever, you would put that there.
In the case that you're looking for MULTIPLE things contained in a message log, you would pipe an OR inside of it like so:
#
# The GoF Abstract Factory pattern
# written by Matthieu Tanguay-Carel
#
# Factories behave in effect like singletons.
# Extra functionality can be tested for with "Object#respond_to? :extra"
# if needed (See GTKFactory).
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (2.1.0)
actionpack (2.1.0)
activerecord (2.1.0)
activerecord-jdbc-adapter (0.8.2)
activerecord-jdbcsqlite3-adapter (0.8.2)
activeresource (2.1.0)
activesupport (2.1.0)
Interesting one I recently found:
Groovy Almanac - http://groovy-almanac.org/
Has a slew of good 5-liners or less for performing some common tasks.
I'm kind of disappointed there's no rating system, but it's a very clean page,
so I can't really whine too much about it.
@klauern
klauern / gist:77201
Created March 10, 2009 23:19 — forked from tony-landis/gist:31445
Simple HTTP POST/GET helper in Groovy fork
/**
* A Simple HTTP POST/GET Helper Class for Groovy
*
* @author Tony Landis
* @copyright 2007 Tony Landis
* @website http://www.tonylandis.com
* @license BSD License (http://www.opensource.org/licenses/bsd-license.php)
* @example h = new GroovyHTTP('http://www.google.com/search')
* h.setMethod('GET')
* h.setParam('q', 'groovy')
@klauern
klauern / example_gist_create.rb
Created March 20, 2009 14:48 — forked from schacon/example_gist_create.rb
Ruby Gist creator fork
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
@klauern
klauern / gist:154687
Created July 25, 2009 04:06 — forked from charlesroper/gist:65931
Method to detect whether we are running from an elevated command-prompt under Vista/Win7 or Administrator in WinXP
#
# Method to detect whether we are running from an elevated command-prompt
# under Vista/Win7 or as part of the local Administrators group in WinXP.
#
def elevated?
whoami = `whoami /groups` rescue nil
if whoami =~ /S-1-16-12288/
true
else
admin = `net localgroup administrators | find "%USERNAME%"` rescue ""
require 'sinatra-caching'
run SinatraCache
@klauern
klauern / Exception.txt
Created August 9, 2011 18:39
Error in CXF web service call.
Running com.me.RequestTest
Aug 10, 2011 4:16:24 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://service.something.net/xml}QueryService from WSDL: file://C:/mydocs/Work/project/my-service.wsdl
Aug 10, 2011 4:16:50 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://service.something.net/xml}QueryService#{http://service.something.net/xml}QueryRequest has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: "http://service.something.net/xml", the namespace on the "QueryResponse" element, is not a valid SOAP version.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:115)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
at org.a