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
(sug/defcomp report | |
[data owner] | |
{:render-state | |
(fn [_ state] | |
(dom/li nil (prn-str (rand-int 100) data) ))}) | |
(sug/defcomp window |
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
(sug/defcomp window | |
[data owner] | |
{:render-state | |
(fn [_ state] | |
(let [[x y w h] (:xywh state)] | |
(dom/div #js {:ref "tool" :style #js {:left x :top y :width w :height h :position "absolute" :border "1px solid red"}} | |
(sug/make draggable data {:opts {:className (str "title") | |
:content (str (:view state) (rand-int 100))} |
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
;sug/private is an atomic data store that links the owner path+:react-key to a data map. | |
;it works much like state, but it doesn't trigger any renders and doesn't have pending/rendered versions | |
;it's very helpful here to stash the mouse drag meta info without triggering app updates. | |
(defn unbind-drag [owner] | |
(let [[mouse-up mouse-move] (sug/private owner :event-handlers)] | |
(.unbind (js/$ js/window) "mouseup" mouse-up) | |
(.unbind (js/$ js/window) "mousemove" mouse-move))) | |
(defn drag-stop [e data owner] |
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 collapse-node [start] | |
(loop [data start result []] | |
(let [d (if (sequential? data) data [data]) | |
sorted (map (fn [v] | |
{:id (:uid v) :babies (:children v)}) d) | |
uids (flatten (filter #(not (nil? %)) (map :id sorted))) | |
babies (vec (flatten (filter #(not (nil? %)) (map :babies sorted))))] | |
(if-not (pos? (count babies)) | |
(concat result uids) |
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
if window.DEBUG | |
console.log "running outliner.js" | |
# Outliner should be a window.tools object, should easily match up with selection | |
$(window.ifrm).ready -> | |
window.tools['outliner'] = | |
toolbox: 0 | |
moving: 0 | |
move_start: [0,0] |
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
<?php | |
$con = new Connection(); | |
$res = $con->query('SELECT word, hash FROM `keywords` LIMIT 0, 30 '); | |
$rows = array(); | |
while($r = $res->fetch_assoc()) { | |
echo $r["word"]." ".$r["hash"]."<br>"; | |
} |
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
"The space captain" by Joseph Parker | |
Chapter 1 - Declarations | |
A zone is a kind of container. Zones are usually enterable. Zones are usually transparent. | |
A galaxy is a kind of room. | |
A cluster is a kind of zone. | |
A system is a kind of zone. |
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
(sug/defcomp t-c-2 | |
[data owner opts] | |
{:render-state | |
(fn [_ state] | |
(let [] | |
(.log js/console (.-_rootNodeID owner)) | |
(dom/div nil | |
(dom/p nil (prn-str (.-__om_cursor (.-props owner)))) | |
(dom/button #js {:onClick #(sug/up! :c owner {:thing true})} "eventer") | |
)))}) |
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 app-state (atom {:vect | |
[{:uid 0 :i 0} | |
{:uid 1 :i 0} | |
{:uid 2 :i 0} | |
{:uid 3 :i 0} | |
{:uid 4 :i 0} | |
{:uid 5 :i 0} | |
{:uid 3 :i 0}]})) | |
(plomb/defcomp item [data owner] |
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
;saved documents have data for :filesystem, :filepath, :unsaved-changes, :file-uid | |
(defn get-iframe [data] | |
"Returns the iframe element for the given | |
Workspace cursor" | |
(let [id (:iframe-id data)] | |
(.getElementById js/document id))) | |
(defn to-html [element] | |
"Returns the HTML string of the element and it's contents, when given an iframe returns only content HTML.") |