Skip to content

Instantly share code, notes, and snippets.

View alogic0's full-sized avatar

Oleg Tsybulskyi alogic0

  • Odessa, Ukraine
View GitHub Profile
@alogic0
alogic0 / tickets.hs
Last active August 29, 2015 14:24
tickets cost
lst = [206.51]
++ replicate 5 135.93
++ replicate 15 160.4
++ replicate 2 190.25
++ [1586.42]
debt = sum lst
-- m
m = [-3000]
@alogic0
alogic0 / Pong.elm
Last active August 29, 2015 14:19
Pong game for 1 player, run on http://elm-lang.org/try
-- See this document for more information on making Pong:
-- http://elm-lang.org/blog/Pong.elm
-- Compile this code on http://elm-lang.org/try
import Color exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Keyboard
import Mouse
import Text
// To auto-click the big cookie at a set interval, use:
var autoClicker = setInterval(Game.ClickCookie, 50);
// To end this effect, use:
clearInterval(autoClicker);
//This will spawn a golden cookie
Game.shimmerTypes.golden.time = Game.shimmerTypes.golden.maxTime;
// If you just want to set the amount of golden cookies clicked, use:
@alogic0
alogic0 / less.hs
Last active August 29, 2015 14:16
For ghci, pager of defined names in Haskell modules like *less*
-- author [Roman Cheplyaka](http://www.reddit.com/r/haskell/comments/2y2f1p/pager_in_ghci_like_less/cp5w8a9)
import System.Process
import System.Posix.IO
import System.Posix.Types
import Data.IORef
import Data.List (intersperse)
import System.IO.Unsafe
{-# NOINLINE pid_ref #-}
pid_ref :: IORef (ProcessHandle, Fd)
@alogic0
alogic0 / Astro.hs
Created January 27, 2015 08:24
Constants and formulae for IntroAstro on Coursera
import Data.Ratio
mS=19891*10^26 % 1 --in kg Sun mass
mE=597219*10^19 % 1 --in kg Earth mass
rE=6371000 % 1 --in m Earth radius
tE=3652564 % 10000 --in days Earth siderial year
mM=73477*10^18 % 1 --in kg Moon mass
rM=1737500 % 1 --in m Moon radius
aU=149597870691 % 1 --in m distance to Sun
gN=6673 % (10^14) --in m3/(kg*s2) gravitational constant G