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 @Rectangle | |
constructor: (@left, @top, @width, @height) -> | |
expand: (amount) -> | |
yamount = amount / @width * @height | |
new Rectangle( | |
@left - amount | |
@top - yamount | |
@width + amount * 2 |
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 @Rectangle | |
@fromClientRect: (clientRect) -> | |
new Rectangle( | |
clientRect.left | |
clientRect.top | |
clientRect.right - clientRect.left | |
clientRect.bottom - clientRect.top) | |
@fromNode: (node) -> | |
{left, top} = node.offset() |
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
{ | |
"estados": [ | |
{ | |
"sigla": "AC", | |
"nome": "Acre", | |
"cidades": [ | |
"Acrelândia", | |
"Assis Brasil", | |
"Brasiléia", | |
"Bujari", |
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 express = require('express'); | |
var path = require('path'); | |
var app = express(); | |
var directory = path.resolve(process.argv[2] || "."); | |
var port = process.argv[3] || 8888; | |
console.log("Serving", directory); | |
app.use('/', express.static(directory)); |
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
(page "index.html") | |
(defelem cell-input [{:keys [cell] :as attrs}] | |
(let [target-value #(do! (-> % .-currentTarget) :value)] | |
(input :type (:type attrs "text") | |
:value cell | |
:on-input #(reset! cell (target-value %))))) | |
(defn form-input | |
([& {:keys [validator] :or {validator (fn [_] true)}}] |
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
(ns travel-buddy.core | |
(:require [liberator.core :refer [resource defresource]] | |
[liberator.dev :refer [wrap-trace]] | |
[ring.middleware.params :refer [wrap-params]] | |
[ring.adapter.jetty :refer [run-jetty]] | |
[compojure.core :refer [defroutes ANY]] | |
[hiccup.core :refer [html]])) | |
(def home-template | |
[:html |
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 frozen-pizza-recipe | |
{:title "Frozen Pizza" | |
:steps [{:at 600 :message "put the pizza in!"} | |
{:at 1320 :message "pizza ready, take it out!"}]}) |
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 frozen-pizza-recipe | |
{:title "Frozen Pizza" | |
:steps #_ ?}) |
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
<script type="x-template" id="person-template"> | |
<div> | |
<div>Name: <span data-binding="name"></span></div> | |
<div>Email: <span data-binding="email"></span></div> | |
</div> | |
</script> |
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 templateString = $("#person-template").html(); |
OlderNewer