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 Browser | |
import Html exposing (Html, Attribute, div, input, text, button, p, h1) | |
import Html.Attributes exposing (placeholder, style, value) | |
import Html.Events exposing (onInput, onClick) | |
-- MODEL | |
type alias Model = | |
{ field : String | |
, color : String |
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
-- Show the current time in your time zone. | |
-- | |
-- Read how it works: | |
-- https://guide.elm-lang.org/effects/time.html | |
-- | |
-- For an analog clock, check out this SVG example: | |
-- https://elm-lang.org/examples/clock | |
-- | |
import Browser |
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
heroku redis:cli -a [APP] | |
dbsize | |
keys * | |
get [KEY] |
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
#!/usr/bin/env escript | |
% This is an Erlang version of the subanagram generator. | |
% It works far faster and the code is far shorter. | |
% It takes a word at the command line as an argument. | |
% e.g.: `./subanagram_prototype.erl representative` | |
% It delivers as output the words that are eligible subanagrams, ordered in length from shortest to longest, | |
% along with the number of points from each word, assuming no double or triple letter or word squares. |
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
#!/usr/bin/env escript | |
% This is an Erlang version of the subanagram generator. | |
% It works far faster and the code is far shorter. | |
% It takes a word at the command line as an argument. | |
% e.g.: `./subanagram_prototype.erl representative` | |
% Note: You need a file of words, one word per line, in the same directory as | |
% the 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
'{:dependencies [[org.clojure/clojure "1.8.0"] | |
[cheshire "5.8.0"]]} | |
(require '[cheshire.core :as json]) | |
(def j (cheshire.core/parse-string (slurp "j.json") true)) | |
(def file-names (->> j | |
:definitions | |
(map (comp last #(clojure.string/split #"\.") :file)) |
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
; #wqc #clojure | |
; For the World Quizzing Championships | |
; http://www.worldquizzingchampionships.com/ | |
(def sample-scores | |
[["joshua Kreitzer" 1 2 3 4 5 6 7 8] | |
["Sreeradh RP" 9 10 11 12 13 14 15] | |
["david striasny" 3 8 8 7 20 4 14 11]]) | |
(defn get-wqc-scores [s] |
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 l->n [input] | |
"Given a string and the sequence a = 1, b = 2, ... z = 26, compute the total for the string. | |
Get a bonus point if the sequence 'zachary' appears in the string." | |
(let [point-values (zipmap (map char "abcdefghijklmnopqrstuvwxyz") | |
(range 1 27)) | |
bonus-point (if (re-find #"zachary" (clojure.string/lower-case input)) 1 0)] | |
(->> input | |
(map char) | |
(map point-values) | |
(cons bonus-point) |
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 get-wordboxes [word] | |
"Given a word like 'cat', make all possible wordboxes in English. Here's an example wordbox: | |
CAT | |
O*E | |
GUN | |
Note that the words 'cog', 'ten' and 'gun' come from the word 'cat'. | |
The code below is too slow for words of four-letters-long or longer. I was hoping to make a full-fledged |
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 letters->numbers [letters] | |
(let [letter-map (zipmap (map char "abcdefghijklmnopqrstuvwxyz") | |
(range 1 27))] | |
(->> letters | |
(map char) | |
(map letter-map) | |
(reduce +)))) |
NewerOlder