Skip to content

Instantly share code, notes, and snippets.

View hakunin's full-sized avatar

Michal Hantl hakunin

  • Ostrava, Czech Republic
  • 23:24 (UTC -12:00)
View GitHub Profile
with(document.body.style){padding=margin=0;overflow="hidden"}c=document.getElementById("c");w=c.width=this.innerWidth;h=c.height=this.innerHeight;g=c.getContext("2d");l=[];function r(b){return Math.random()*b}for(t=i=1;i++<999;)l.push([n=r(w),m=r(h),n+r(20)-9,m+r(20)-9,n+r(99)-50,m+r(99)-50]);k=[0,255,0];j=5;document.body.onmousemove=function(b){g.fillStyle="#000";g.fillRect(0,0,w,h);if(k[t]>=j){k[t]-=j;k[(t+1)%3]+=j}else t=(t+1)%3;o="rgba("+k.join(",")+",";for(i in l){m=l[i];dx=b.clientX-m[0];dy=b.clientY-m[1];d=Math.sqrt(dx*dx+dy*dy);a=75/d;if(!(a<0.15)){g.strokeStyle=o+a+")";if(a>0.6&&r(99)<3)m.g=1;if(m.g>0)g.strokeStyle="rgba(255,255,255,"+(m.g-=0.05)+")";g.beginPath();g.moveTo(m[0],m[1]);g.quadraticCurveTo(m[2]-dx/d*20,m[3]-dy/d*20,m[4]-dx/d*80,m[5]-dy/d*80);g.stroke()}}}
<!DOCTYPE html>
<link href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz:200,300,400,700" rel="stylesheet" type="text/css" >
<style>
body {
font-family: 'Yanone Kaffeesatz', serif;
}
h1 {
font-size:4em;
}
michal@domov:~/dev/other/redcar$ jruby -S rake build
(in /home/michal/dev/other/redcar)
ant jar -f vendor/java-mateview/build.xml
Buildfile: vendor/java-mateview/build.xml
clean:
[delete] Deleting directory /home/michal/dev/other/redcar/vendor/java-mateview/bin
debug:
[echo] using platform: [linux]
michal@domov:~/dev/other/redcar$ jruby -S rake build
(in /home/michal/dev/other/redcar)
ant jar -f vendor/java-mateview/build.xml
Buildfile: vendor/java-mateview/build.xml
clean:
debug:
[echo] using platform: [linux]
[echo] |-- compile classpath
% Author: Michal Hantl, han345
% Date: 27/04/2010
% resici algoritmus ------------------------------------------------------------
solve_post(List1, List2, Sequence):-
sequence([], [], List1, List2, List1, List2, Sequence, 1, [], [], 32).
# How learning Haskell changed my programming skill
# Pascal's triangle BEFORE Haskell:
def triangle_before_haskell iterations
rows = []
iterations.times { |r|
new_row = [1]
if r >= 1
class FlightRouteDisplay {
function __construct($path) {
$this->path = $path;
}
function render()
{
$id = "route".(rand(100000, 999999));
module TuringMachine where
-- Tape ------------------------------------------------------------------------
-- constructor
tape symbols = Tapes EOT (load_tape symbols) R
load_tape [] = EOT
load_tape (symbol:symbols) =
(Symbol (Char symbol)) (load_tape symbols)
module Deque (Deque (First, Bottom), addFirst, addLast) where
import Prelude hiding (print)
data Deque a = First a (Deque a)
| Bottom
print :: (Show a)=> Deque a -> String
print Bottom = "Prazdny"
print (First f Bottom) = (show f)
-- Priklady resene v ramci cviceni c. 4
-- ====================================
--
-- 1) Vyhledani maximalni hodnoty ve stromu
-- Implementujte pro tri varianty stromu uvedene na prednasce
-- funkci, ktera vrati nejvyssi hodnotu obsazenou v uzlech stromu.
-- Uvazujte strom s nejobecnejsim moznym typem prvku (tj. ne pouze Int).
data Tree1 a = Leaf1 a
| Branch1 (Tree1 a) (Tree1 a)