Skip to content

Instantly share code, notes, and snippets.

View timfel's full-sized avatar
👨‍🍼
Parental leave through 2024

Tim Felgentreff timfel

👨‍🍼
Parental leave through 2024
View GitHub Profile
abstract class AbstractListView<S extends IDescribable> extends ViewPart implements ISelectionListener {
public java.lang.Class<?> getGenericType() {
ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
java.lang.Class<?> rawType = (java.lang.Class<?>) parameterizedType.getRawType();
Type actualType = parameterizedType.getActualTypeArguments()[0];
TypeVariable<?> typeVariable = rawType.getTypeParameters()[0];
return (java.lang.Class<?>) actualType;
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* The maxium payload (to have enough space for new ips) */
>> class Test < Ohm::Model
?> attribute :name
?> set :tests, Test
?> end
=> [:tests]
>> t = Test.create(:name => "eins")
=> #<Test:3 name="eins" tests=#<Set: []>>
>> t2 = Test.create(:name => "zwei")
=> #<Test:4 name="zwei" tests=#<Set: []>>
>> t1.save
for i in $(ls app/controllers/companies_controller.rb app/controllers/contacts_controller.rb app/controllers/history_items_controller.rb app/helpers/accounts_helper.rb app/helpers/contacts_helper.rb app/models/account.rb app/models/bank_account.rb app/models/company.rb app/models/contact.rb app/models/customer.rb app/models/employee.rb app/models/history_item.rb app/models/history_observer.rb app/modules/accounts.rb app/modules/contacts.rb app/views/accounts/* app/views/companies/* app/views/contacts/* app/views/history_items/* features/contacts.feature features/accounts.feature features/history_items.feature spec/controllers/contacts_controller_spec.rb spec/controllers/contacts_routing_spec.rb spec/factories/account.rb spec/factories/contact.rb spec/factories/company.rb spec/factories/bank_account.rb spec/factories/history_item.rb spec/helpers/accounts_helper_spec.rb spec/helpers/contacts_helper_spec.rb spec/models/allmodels_spec.rb spec/models/account_spec.rb spec/models/bank_account_spec.rb spec/models/com
#!/usr/bin/env git
CURRENT_BRANCH=$(git branch --no-color | grep "*" | awk '{print $2}')
BRANCHES=$(git branch --no-color | grep -v "*")
TMPBRANCH="tmp-$(date +%Y%m%d%H%M)"
git checkout -b "$TMPBRANCH"
for i in $BRANCHES; do
git merge -s ours "$i"
done
git shortlog -n -s
git checkout "$CURRENT_BRANCH"
(Object allMethodsInCategory: 'testing')
select: [:m |
(m asString beginsWith: 'is') and:
[(m asString endsWith: ':') not]]
thenDo: [:each |
Object compile: (each asString
copyReplaceAll: 'is' with: 'if'), ': aBlock
^ self ', each asString, ' ifTrue: aBlock'.
Object organization
~...s/rsoc/rails_test ✔ jruby -S gem install mongrel-1.1.5.gem sqlite3-ruby
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Successfully installed fastthread-1.0.7
Successfully installed cgi_multipart_eof_fix-2.5.0
Successfully installed mongrel-1.1.5
Building native extensions. This could take a while...
Successfully installed sqlite3-ruby-1.3.1
~...s/rsoc/rails_test ✔ grep -m2 -C1 sqlite3 config/database.yml
# SQLite version 3.x
bin/jruby jruby-cext/examples/MyTest/MyTest.rb
@timfel
timfel / ruby_syntax_checker.rb
Created October 21, 2010 23:52
Simple Syntax checking for Ruby in Redcar?
require 'java'
module Java::IO
import 'java.io.File'
import 'java.io.FileInputStream'
end
module JRuby
import 'org.jruby.Ruby'
end
Error in command Redcar::WebBookmarks::ShowTree
TypeError: cannot convert instance of class org.jruby.RubySymbol to class [Ljava.lang.Object;
/Users/tim/Devel/projects/redcar/plugins/tree_view_swt/lib/tree_view_swt.rb:32:in `initialize'
/Users/tim/Devel/projects/redcar/plugins/application_swt/lib/application_swt/treebook.rb:24:in `new'
/Users/tim/Devel/projects/redcar/plugins/application_swt/lib/application_swt/treebook.rb:24:in `tree_added'
/Users/tim/Devel/projects/redcar/plugins/application_swt/lib/application_swt/treebook.rb:16:in `to_proc'
/Users/tim/Devel/projects/redcar/plugins/core/lib/core/observable.rb:103:in `call'
/Users/tim/Devel/projects/redcar/plugins/core/lib/core/observable.rb:103:in `observable_run_blocks'
/Users/tim/Devel/projects/redcar/plugins/core/lib/core/observable.rb:103:in `map'
/Users/tim/Devel/projects/redcar/plugins/core/lib/core/observable.rb:103:in `observable_run_blocks'