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 cleanup_variants | |
self.variants.each do |variant| | |
variant.variant_values.delete(self) | |
variant.destroy if variant.variant_values.count == 0 | |
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
def update_cousin_variants_by_variant_value(variant_value) | |
first_sibling_value = variant_value.category.variant_values.first | |
existing_variants_with_this_value = self.variants.includes(:variant_values).where('variant_value_id = ?', first_sibling_value.id) | |
new_variants = [] | |
existing_variants_with_this_value.each do |variant| | |
new_variant = product.variant.create(price: self.price) | |
variant.variant_values.each do |old_variant_value| | |
if old_variant_value.variant_category != variant_value.variant_category | |
new_variant.variant_values << old_variant_value |
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
.blink { | |
-webkit-animation-duration: 1s; | |
-webkit-animation-name: blinky; | |
-webkit-animation-iteration-count: infinite; | |
} | |
@-webkit-keyframes blinky { | |
from { | |
opacity: 100%; | |
} | |
to { |
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
var tileMap = [ | |
['grass', 'dirty', 'dirty', 'dirty', 'dirty', 'dirty', 'grass'], | |
['grass', 'dirty', 'grass', 'stone', 'grass', 'dirty', 'grass'], | |
['grass', 'dirty', 'stone', 'stone', 'stone', 'dirty', 'grass'], | |
['grass', 'dirty', 'dirty', 'dirty', 'dirty', 'dirty', 'grass'], | |
['grass', 'grass', 'grass', 'grass', 'grass', 'grass', 'grass'] | |
]; | |
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
var loadBookmarkletDetail = function() { | |
var urlItem = $('#mox-url'); | |
if (urlItem.length > 0) { | |
var saveURL = decodeURIComponent(window.location.toString().split("mox-box=")[1]); | |
urlItem.val(saveURL); | |
} | |
}; | |
loadBookmarkletDetail(); |
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
subject.should.equal('div class="object-wrapper"><iframe width="100%" height="450" scrolling="no" frameborder="no" ' + | |
'src="//w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F723408&show_artwork=true">' + | |
'</iframe></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
sql = "SELECT courses.id as 'course_id', | |
courses.name as 'name', | |
courses.likes as 'likes', | |
courses.duration as 'time_total', | |
completions.finished as 'completed', | |
completions.finished_at as 'completed_on', | |
COALESCE(completions.duration,0) as 'time_remaining', | |
essentials.id as 'essential_id', | |
electives.id as 'elective_id', | |
electives.points as 'total_points', |
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 make_selection | |
selections = [] | |
1000.times { selections << ["manage", "settings"].sample } | |
selections.select { |s| s == "manage" }.size > selections.select { |s| s == "settings" }.size ? "manage" : "settings" | |
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
info - socket.io started | |
GET / 200 52ms - 1.63kb | |
GET /socket.io/socket.io.js 404 20ms - 819 | |
GET /my/feed?since_id=&before_id=&_=1349460841661 500 1403ms - 52 |
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 Presenter | |
def remaining(items = section.essentials_remaining) | |
collection = ThemePresentation.wrap_collection(items, ContentItemPresenter) | |
render partial: 'woople-theme/content_item', collection: collection | |
end | |
end |