Skip to content

Instantly share code, notes, and snippets.

View razielgn's full-sized avatar
🇺🇦
Слава Україні!

Federico Ravasio razielgn

🇺🇦
Слава Україні!
View GitHub Profile
@razielgn
razielgn / specs
Created September 4, 2011 16:01
rubypair specs
User
#interest_histogram
should generate a Hash counting the hits per reference
should generate a tag cloud containing the N most popular
should return the tag cloud sorted by tag name
HomeController
should display the most recent users
#search
should perform a search by name
CommentsController
should display a notice if the user is not logged in
should display a notice if no comments are on a page
should be possible to comment on another user's page
when a user is on its own page
should be able to delete a comment
should not be able to comment on his own page
CommentsController
should display a notice if the user is not logged in
should display a notice if no comments are on a page
should be possible to comment on another user's page
when a user is on its own page
should be able to delete a comment
should not be able to comment on his own page
@razielgn
razielgn / bla.rb
Created September 22, 2011 15:55
esempi
# Creiamo la classe Dog
class Dog
end
fido = Dog.new
# => <Dog:0x007fb92a8073a8>
fido.methods
# => [:nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :__id__, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
# Un array contentente tutti i metodi chiamabili su fido (anche quelli ereditati da Object)
# Ogni elemento dell'array è un symbol
{
"_id": ObjectId('4e8c2687e5636c00007f2837'), // ID binario che forza l'unicità tra diverse macchine, cerca maggiori info sul web
"subject": "Luogo pizzata 18/10/2011",
"description": "Dobbiamo organizzare bla bla bla...",
"end-date": ISODate('2011-10-18T00:00:00.000Z'),
"options": [{
"description": "Pizzeria da Nasti, BG",
"vote_counter": 2,
"votes": [{
"user": ObjectId('4e8c2687e5636c000067ab34'), // Reference dell'utente
- DecisionPresenter.new(@decision, self, @admin_mode).render do
- content_for :title, subject
- admin_mode do
%i= 'The url for your friends: '
= link_to decision_url(@decision), @decision
%p
%b= created_at_by
%h2= subject
flowplayer("player",
{
allowfullscreen: false,
src: "../flowplayer-3.2.7.swf",
wmode: 'opaque'
},
{
clip: {
onBeforeSeek: function (clip, target) {
console.log("BABABA");
{
"_id": ObjectId("4ee86c6fbcf83f2aad000001"),
"title": "Ma quande lingues",
"credits": 19,
"price": 28.99,
"description": "Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, li tot Europa usa li sam vocabularium. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilita; de un nov lingua franca: on refusa continuar payar custosi traductores. It solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles.Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan.",
"promote": true,
"category": 1,
"publish_date": ISODate("2011-12-14T09:26:00Z"),
"user_id": ObjectId("4ee72c30bcf83f23e1000002"),
-webkit-box-shadow: rgba(255, 255, 255, 0.199219) 0px 1px 0px 0px inset, rgba(0, 0, 0, 0.046875) 0px 1px 2px 0px;
-webkit-transition-delay: 0s;
-webkit-transition-duration: 0.10000000149011612s;
-webkit-transition-property: all;
-webkit-transition-timing-function: linear;
background-color: #006F5D;
background-image: -webkit-linear-gradient(top, rgb(3, 150, 125), rgb(3, 150, 125) 25%, rgb(0, 111, 93));
background-repeat: repeat-x;
border-bottom-color: rgba(0, 0, 0, 0.246094);
border-bottom-left-radius: 4px;
-module(bencode).
-export([ encode/1 ]).
encode(Integer) when is_integer(Integer) ->
"i" ++ integer_to_list(Integer) ++ "e";
encode(Binary) when is_binary(Binary) ->
String = binary_to_list(Binary),
Length = length(String),
integer_to_list(Length) ++ ":" ++ String;