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
# A class that looks like this.. | |
class A | |
def initialize(x, y) | |
@x = x | |
@y = y | |
end | |
attr_accessor :x, :y | |
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
Encryptor.encrypt("hey", :key => "mykey") | |
# this returns "Ҷ\210\220ğ\255???u;\361\273\245@" | |
# trying to put this in the DB gives: incomplete multibyte character |
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 Y | |
def name | |
'bar' | |
end | |
end | |
class X | |
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
{{ store.taxonomies | find_by_name:'Featured Pages' | assign_to:'featured_pages_taxonomy' }} | |
{{ featured_pages_taxonomy.taxons | find_by_name:'Home Page' | assign_to:'home_page_taxon' }} | |
{{ home_page_taxon.products | assign_to:'featured_products' }} | |
{{ featured_products | only:6 | assign_to:'featured_products' }} | |
<div id="featured_products"> | |
<h2>Featured Products</h2> | |
{% snippet 'Products' products:featured_products %} | |
</div> |
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
<s:taxonomies:find name="Featured Pages"> | |
<s:taxons:find name="Home Page"> | |
<div id="featured_products"> | |
<h2>Featured Products</h2> | |
<s:snippet name="Products" /> | |
</div> | |
</s:taxons:find> | |
</s:taxonomies:find> |
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
module Austin | |
Guess = Struct.new(:letter, :frequency_ratio, :word_frequency_ratio) do | |
def <=>(guess) | |
weight <=> guess.weight | |
end | |
def weight | |
2 * word_frequency_ratio + frequency_ratio | |
end |
NewerOlder