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
module Pic (plugin) where | |
-- This plugin allows you to include a PIC diagram | |
-- in a page like this: | |
-- | |
-- ~~~ {.pic name="diagram1"} | |
-- box "box" | |
-- ~~~ | |
-- | |
-- The "pic2png" executable must be in the path. |
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 markup.test | |
(:use (clojure.java shell))) | |
(defn run-test [name input expected dut] | |
(let [actual (:out (sh dut :in input))] | |
(if (= actual expected) | |
:pass | |
:fail))) | |
(defn print-plan [tests] |
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 look-and-say [input] | |
((fn [input acc] | |
(if (empty? input) | |
(reverse acc) | |
(let [[x & xs] input [i n & as] acc] | |
(if (= x i) | |
(recur xs (list* x (inc n) as)) | |
(recur xs (list* x 1 acc)))))) | |
(rest input) [(first input) 1])) |
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 java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.io.Reader; | |
import java.io.Writer; | |
import java.util.Iterator; | |
import java.util.Map; | |
import java.util.Properties; |
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
diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor | |
index 7f99c62..8d1b996 100644 | |
--- a/basis/http/client/client.factor | |
+++ b/basis/http/client/client.factor | |
@@ -162,7 +162,8 @@ ERROR: download-failed response ; | |
: http-request ( request -- response data ) | |
[ [ % ] with-http-request ] B{ } make | |
- over content-encoding>> decode check-response-with-body ; | |
+ over content-encoding>> dup binary = [ drop ] [ decode ] if |
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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
<html> | |
<body id="container"> | |
<script type="text/javascript"> | |
function drawPaths(canvas) { | |
var ctx = canvas.getContext('2d'); | |
ctx.rect(0, 0, 256, 256); | |
ctx.fillStyle = "#FFFFFF"; | |
ctx.fill(); | |
ctx.strokeStyle = "#FF0000"; |
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
Index: src/ports/SkFontHost_mac_coretext.cpp | |
=================================================================== | |
--- src/ports/SkFontHost_mac_coretext.cpp (revision 3410) | |
+++ src/ports/SkFontHost_mac_coretext.cpp (working copy) | |
@@ -1948,7 +1948,7 @@ | |
int count = CFArrayGetCount(cfArray); | |
if (tags) { | |
for (int i = 0; i < count; ++i) { | |
- tags[i] = (SkFontTableTag)CFArrayGetValueAtIndex(cfArray, i); | |
+ tags[i] = (SkFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(cfArray, i); |
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
: standard-deposit ( a r t -- a ) swap 1 + swap ^ * ; | |
: regular-deposit ( a r n t -- a ) over [ / ] [ * ] 2bi* iota [ 2over rot 1 + standard-deposit ] map sum 2nip ; |
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
-module(p1_2). | |
-compile(export_all). | |
s([_]=L) -> | |
[[L]]; | |
s([A|L]) -> | |
S = s(L), | |
lists:append([lists:map(fun(X) -> [[A]|X] end, S)|lists:map(fun(X) -> each_append(A,X) end, S)]). | |
each_append(_, [], _, Acc) -> |
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
-module(p1_3). | |
-compile(export_all). | |
-include_lib("eunit/include/eunit.hrl"). | |
% 주어진 자연수 n의 팩토리얼을 구해서 마지막에 붙은 연속된 0의 개수와 연속된 0 바로 앞에 나오는 숫자를 구하는 문제이다. 우선 문제 설명대로 팩토리얼을 구하고 마지막 연속된 0의 갯수를 세고, 마지막 연속된 0을 제외한 마지막 자리수를 구한다. | |
% 팩토리얼을 구한다. | |
factorial(1, Acc) -> | |
Acc; |