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 answer {:answer "France" :correct "true" :age 11}) | |
(update answer :correct #(if (= % "true") true false)) |
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
(defn set-message [response] | |
(.log js/console (str ">>> RESPONSE #####" response))) | |
(defn error-handler [response] | |
(.log js/console (str ">>> RESPONSE #####" response))) | |
(defn save-json [] | |
(let [json (.-value (gdom/getElement "json-field")) | |
id (.-value (gdom/getElement "upload-id")) | |
csrf-field (.-value (gdom/getElement "__anti-forgery-token"))] |
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 [goog.dom :as gdom] | |
[goog.style :as style]) | |
(defn my-toggle [element-str] | |
(let [div-message (gdom/getElement element-str)] | |
(style/showElement div-message (not (style/isElementShown div-message))))) |
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
render: function() { | |
var trNodes = this.props.data.map(function (appointment) { | |
return ( | |
<tr><td>{appointment.id}</td><td>{appointment.scheduled_time}</td><td>{appointment.pet_id}</td><td>Delete</td></tr> | |
); | |
}); | |
var commentNodes = return ( | |
<div className="commentBox">trNodes</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
# | |
# I need to know if one product in the purchased "order_list" has an 'Event' product_type | |
# The models: order_list table belongs_to order_items and order_items belongs_to products | |
# | |
def has_event?(order_list) | |
order_list.order_items.each do |oi| | |
oi.product.each do |product| | |
return true if product.product_type == 'Event' | |
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
users = User.all | |
newall = users.map do |u| | |
u.attributes[:new_field] = Time.now | |
end |
NewerOlder