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 wagr.views.common | |
(:require | |
[net.cgrand.enlive-html :as enlive] | |
)) | |
(enlive/defsnippet show-bet "templates/index.html" [:.latest-bet-item] | |
[{better :better bettee :bettee bet :bet wager :wager}] ; ARGS | |
; TRANSFORMATIONS | |
[:.better] (enlive/content better) |
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 nurblizer.core | |
(:gen-class :name nurblizer.core) | |
(:use compojure.core nurblizer.helpers) | |
(:require | |
[clojure.string :as str] | |
[ring.adapter.jetty :as ring] | |
[compojure.core :as compojure] | |
[compojure.route :as route] | |
[compojure.handler :as handler])) |
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 nurblizer.helpers | |
(:require | |
[clostache.parser :as clostache])) | |
(defn read-template [template-file] | |
(slurp (clojure.java.io/resource (str "templates/" template-file ".mustache")))) | |
; Quick-and-dirty Mustache renderer. | |
(defn render |
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
import re | |
from flask import Flask, render_template, request | |
app = Flask(__name__) | |
# Read in the nouns file | |
with open("nouns.txt") as f: | |
NOUNS = [l.strip().lower() for l in f] | |
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 'sinatra' | |
# configure block is a Sinatra feature | |
configure do | |
@@nouns = File.open('nouns.txt').map{|line| | |
line.strip.downcase | |
} | |
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
<?php | |
$nouns = file("nouns.txt", FILE_IGNORE_NEW_LINES); | |
function nurble($text){ | |
$text = strtoupper($text); | |
$words = preg_split( | |
'/\w/', | |
preg_replace('/[^a-z ]/', '', strtolower($text))); |
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 include '_header.php'; ?> | |
<h1>Nurblizer</h1> | |
<form action="/nurble.php" method="post"> | |
<fieldset> | |
<ul> | |
<li> | |
<label>Text to nurblize</label> | |
<textarea name="text"></textarea> | |
</li> |
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
#### config.ru | |
require './app' | |
run Sinatra::Application | |
#### Procfile | |
web: bundle exec thin -R config.ru -p $PORT start |
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
#### Gemfile | |
source "https://rubygems.org" | |
gem "sinatra" | |
gem "twilio-ruby" | |
gem "pony" | |
gem "thin" |
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 'rubygems' | |
require 'twilio-ruby' | |
require 'sinatra' | |
require 'pony' | |
require 'open-uri' | |
# Config | |
MY_NUMBER = "+19995551234" | |
TO_EMAIL = "voicemail@adambard.com" | |
SMTP_HOST = "<SMTP hostname here>" |