Skip to content

Instantly share code, notes, and snippets.

Jani Rahkola rahcola

Block or report user

Report or block rahcola

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rahcola
rahcola / gist:2314574
Created Apr 5, 2012
Tyypillinen kuulaskuri
View gist:2314574
module Kuukausi where
data Kuukausi = Tammikuu
| Helmikuu
| Maaliskuu
| Huhtikuu
| Toukokuu
| Kesäkuu
| Elokuu
| Heinäkuu
View gist:2314660
module Kuulaskuri (luo, monesko, seuraava) where
import Data.IORef
newtype Kuulaskuri = Kuulaskuri (IORef Int)
luo :: IO Kuulaskuri
luo = do
c <- newIORef 1
return $ Kuulaskuri c
View gist:2370962
hFetchLines :: Handle -> [Int] -> IO [String]
hFetchLines h nums = do; end <- hIsEOF h; hFetchLines' nums end 1 []
where
hFetchLines' [] _ _ acc = return acc
hFetchLines' _ False _ acc = return acc
hFetchLines' nums _ row acc = do
line <- hGetLine h
end <- hIsEOF h
if (head nums) == row
then hFetchLines' (tail nums) end (row+1) (line:acc)
View behaviors.clj
(ns kineticc.behaviors
(:refer-clojure :exclude [delay loop])
(:require [kineticc.epochal :as e])
(:require [kineticc.operators :as o])
(:require [clojure.data.json :as j]))
(defn remove-nil-vals
"Filter key-val pair in which val is nil."
[map]
(into {} (remove (comp nil? second) map)))
@rahcola
rahcola / gist:3806989
Created Sep 30, 2012
addition and multiplication for polynomials
View gist:3806989
typedef struct termNode {
int coef;
int deg;
struct termNode* greater;
struct termNode* lesser;
} termNode;
termNode* make_term(int coef, int deg) {
termNode* p = malloc(sizeof(termNode));
p->coef = coef;
@rahcola
rahcola / gist:3807597
Created Sep 30, 2012
a PSEUDO C translation of week 4. exercise 2.
View gist:3807597
/*THIS IS PSEUDO*/
divResult mod_div_polynomials(int mod,
termNode* p,
termNode* q) {
termNode* r = p;
termNode* s = NULL;
int b_inverse = ...;
for (int i = p->deg - q->deg; i >= 0; i--) {
if (r->deg == q->deg + i) {
@rahcola
rahcola / laskin_code.js
Created Nov 10, 2012 — forked from anonymous/laskin_code.js
Selainohjelmointi, viikko 2
View laskin_code.js
function init() {
naytaLuku("0");
/*eka näytä nolla */
var nappula = document.getElementById("nappi");
var laskin = new Laskin();
/* on nyt tosi rumasti tehty, mutta en keksinyt parempaakaan
* eli siis en päässyt tuolta hanskaaHomma-funktiosta
* käsiksi laskimeen, yritin vaikka mitä esim. antaa sen olion
* tolle hanskaaHommalle parametrina, mutta ei jostain
* syystä toiminut. Terkuin 4 tuntia myöhemmin päätin muuttaa
@rahcola
rahcola / gist:8020264
Created Dec 18, 2013
i3 statusbar conf
View gist:8020264
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
output_format = "i3bar"
View gist:1aca91bf835a7b3e7bb8
data ResourceId a = ResourceId Integer
data Image
data User
data Authorized a b = Authorized (ResourceId a)
data Create
data Read
data Update
data Delete
View keybase.md

Keybase proof

I hereby claim:

  • I am rahcola on github.
  • I am rahcola (https://keybase.io/rahcola) on keybase.
  • I have a public key whose fingerprint is 976E 796E 97C0 6370 903F FAD1 9C06 91C9 237B 9137

To claim this, I am signing this object:

You can’t perform that action at this time.