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
package qt; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import com.trolltech.qt.core.QByteArray; | |
import com.trolltech.qt.core.QFile; | |
import com.trolltech.qt.core.QTextCodec; |
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
def huffman filename | |
h = {} | |
open(filename) do |f| | |
f.read.each do |item| | |
unless h[item].nil? | |
h[item] += 1 | |
else | |
h[item] = 1 | |
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
. |
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
Just a simple script to grab AddressBook cards from the social network StudiVZ (which is still lacking an API to do just this) |
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
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; |
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
#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) */ |
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
>> 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 |
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
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 |
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/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" |
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
(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 |
OlderNewer