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
# Unique, atomic sequential number generator using MongoMapper, MongoDB and Ruby. | |
# Usage: | |
# Helper::Sequence.next_value(:my_seq) | |
# => 1 | |
# Helper::Sequence.next_value(:my_seq) | |
# => 2 | |
# Helper::Sequence.next_value(:my_other_seq) | |
# => 1 | |
# Helper::Sequence.next_value(:my_seq) | |
# => 3 |
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 Java | |
frame = javax.swing.JFrame.new | |
frame.set_default_close_operation javax.swing.JFrame::EXIT_ON_CLOSE | |
frame.get_content_pane.add javax.swing.JLabel.new("Hello, World!") | |
frame.pack | |
frame.set_visible true |
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
require 'riddle' | |
require 'riddle/0.9.9' | |
companies = %w(AmberBit Google HP) | |
client = Riddle::Client.new "localhost", 5000 | |
client.match_mode = :extended | |
client.sort_mode = :extended | |
client.sort_by = "@geodist ASC" |
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
Failures: | |
1) Mongoid::Attributes .accepts_nested_attributes_for #association_attributes= on a embeds many association when :allow_destroy is enabled removes the items that have _destroy => true set | |
Failure/Error: @person.favorites_attributes = @attributes | |
undefined method `favorites_attributes=' for #<Person:0x7f10ebc3d860> | |
# ./spec/../lib/mongoid/attributes.rb:23:in `method_missing' | |
# ./spec/unit/mongoid/attributes_spec.rb:133 | |
# /home/hubert/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `inject' | |
2) Mongoid::Collections .index_information returns index information from the collection | |
Failure/Error: Person.index_information["title_1"].should_not be_nil |
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
require 'rails' | |
module Cms | |
class Engine < Rails::Engine | |
rake_tasks do | |
load "cms/railties/tasks.rake" | |
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
package com.fuckeyah.todos; | |
import android.app.ListActivity; | |
import android.os.Bundle; | |
import android.widget.AdapterView; | |
import android.widget.AdapterView.OnItemClickListener; | |
import android.widget.ArrayAdapter; | |
import android.widget.ListView; | |
import android.widget.TextView; |
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
Failures: | |
1) Mongoid::Field#default when the field is an array when the array is object ids when using object ids performs conversion on the ids if strings | |
Failure/Error: field.set([object_id.to_s]).should == [object_id] | |
expected: [BSON::ObjectId('4d724b676e152b0eda0005d3')] | |
got: ["4d724b676e152b0eda0005d3"] (using ==) | |
Diff: | |
@@ -1,2 +1,2 @@ | |
-[BSON::ObjectId('4d724b676e152b0eda0005d3')] | |
+["4d724b676e152b0eda0005d3"] |
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
# biblioteki które raczej się przydadzą, postgres i systemowy ruby (potrzebny do zainstalowania RVM, janusa) | |
$ sudo apt-get install build-essential libxslt1-dev curl bison zlib1g-dev libssl-dev libreadline6-dev libxml2-dev git-core ruby postgresql-9.1 libpq-dev imagemagick libmagick++-dev vim git rake exuberant-ctags ack libyaml-dev nodejs npm | |
# zainstaluj janusa | |
$ curl -Lo- https://bit.ly/janus-bootstrap | bash | |
# zainstaluj RVM i Ruby 1.9.3 | |
curl -L https://get.rvm.io | bash -s stable --ruby | |
# ustaw go sobie domyślnym ruby |
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.subclass "MyClass" do | |
class_methods do | |
self.initWithName(name)andSurname(surname) do | |
@name = name | |
@surname = surname | |
end | |
end | |
sayHi do | |
(@name == "Zbigniew").ifThen(do |
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
#source 'https://rubygems.org' | |
source 'http://production.cf.rubygems.org/' |