Skip to content

Instantly share code, notes, and snippets.

@uvtc
uvtc / gist:5440450
Created April 23, 2013 02:49
find and count number palindromes (convert the int to a string, then see if it's the same backwards)
;; try1.clj
(require '[clojure.string :as str])
(defn count-palindromes
[max]
(let [n (atom 0)]
(doseq [i (range 10 max)]
(let [i-str (str i)
i-rstr (str/reverse i-str)]
@uvtc
uvtc / gist:5225592
Last active December 15, 2015 07:48
text with quil
(ns text-example.core
(require [quil.core :as q])
(:gen-class))
(def screen-width 640)
(def screen-height 480)
(def blue [53 108 237])
(def yellow [235 229 20])
@uvtc
uvtc / gist:5213415
Created March 21, 2013 14:26
quil skeleton starter standalone app
(ns my-quil-app.core
(:require [quil.core :as q])
(:gen-class))
;; `setup` is called once when we start up.
(defn setup []
(q/smooth) ;; Turn on anti-aliasing.
(q/frame-rate 1) ;; Set framerate to 1 FPS.
(q/background 200)) ;; Set the background colour to
;; a nice shade of grey.
@uvtc
uvtc / gist:5110760
Created March 7, 2013 19:02
test gist for Rust code
struct Point {
x: float,
y: float,
}
enum Shape {
Circle(Point, float),
Rectangle(Point, Point),
}
@uvtc
uvtc / gist:5067946
Created March 1, 2013 21:29
pandoc markdown, multiple list items, nested lists with code blocks
hi
* first item in bulleted list
second paragraph of first item
code block
in first item
second paragraph in first item
@uvtc
uvtc / gist:5030261
Last active December 14, 2015 04:48
Rakudo Star release announcement template
# Announce: Rakudo Star
## A useful, usable, "early adopter" distribution of Perl 6
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the MONTH 2013 release of "Rakudo Star", a useful and usable
distribution of Perl 6. The tarball for the MONTH 2013 release is
available from <http://rakudo.org/downloads/star/>. A Windows .MSI
version of Rakudo star will usually appear in the downloads area
shortly after the tarball release.
@uvtc
uvtc / gist:5030169
Last active December 14, 2015 04:39
Template for rakudo/rakudo release announcement
# Announce: Rakudo Perl 6 compiler, Development Release #NN ("NAME")
On behalf of the Rakudo development team, I'm proud to announce the
MONTH 2013 release of Rakudo Perl #NN "NAME". Rakudo is an
implementation of Perl 6 on the Parrot Virtual Machine (see
<http://www.parrot.org>). The tarball for this release is available
from <http://rakudo.org/downloads/rakudo/>.
Please note: This announcement is not for the Rakudo Star
distribution[^1] --- it's announcing a new release of the compiler
@uvtc
uvtc / gist:5016872
Last active December 14, 2015 02:49
prospective ToC for perl6-tut
basics.md
pod.md
variables.md
numbers-and-math.md
strings-and-unicode.md
lists-and-arrays.md
hashes.md
types.md
context.md
nested-data-structures.md
@uvtc
uvtc / gist:4664608
Last active December 11, 2015 21:48
crunch-it: little benchmark in Perl
#!/usr/bin/env perl
use Modern::Perl;
#use diagnostics;
use List::Util qw/max min sum/;
# TODO: more of the following code needs to be put into functions
if (@ARGV != 1) {
say "Please pass exactly one arg: the number of";
(map + [1 2 3 4 5]
[6 7 8 9 10])
;; => ((+ 1 6)
; (+ 2 7)
; (+ 3 8)
; (+ 4 9)
; (+ 5 10))
;;----------------------------------