Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
import qualified IPPrint
import qualified Language.Haskell.Colorize as Colorize
import qualified Language.Haskell.HsColour as HsColour
import qualified Language.Haskell.HsColour.Colourise as HsColour
import qualified Language.Haskell.HsColour.Output as HsColour
let myColourPrefs = HsColour.defaultColourPrefs { HsColour.conid = [HsColour.Foreground HsColour.Yellow, HsColour.Bold], HsColour.conop = [HsColour.Foreground HsColour.Yellow], HsColour.string = [HsColour.Foreground HsColour.Green], HsColour.char = [HsColour.Foreground HsColour.Cyan], HsColour.number = [HsColour.Foreground HsColour.Red, HsColour.Bold], HsColour.layout = [HsColour.Foreground HsColour.White], HsColour.keyglyph = [HsColour.Foreground HsColour.White] }
let myPrint = putStrLn . HsColour.hscolour (HsColour.TTYg HsColour.XTerm256Compatible) myColourPrefs False False "" False . IPPrint.pshow
@osa1
osa1 / distribution.lua
Created December 7, 2012 18:26
random distribution
randoms = 20
width = 800
height = 500
function love.load()
love.graphics.setMode(width, height, false, false, 0)
randomCounts = {}
for i=0,randoms do randomCounts[i] = 0 end
end
@osa1
osa1 / randomwalk.lua
Created December 7, 2012 18:46
random walker
width = 640
height = 360
function newWalker()
return { x=width/2, y=height/2 }
end
function love.load()
love.graphics.setMode(width, height, false, false, 0)
walker = newWalker()
xterm*faceName: Source Code Pro:pixelsize=11
xterm*saveLines: 2000
xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48,35:48
xterm*termName: xterm-color
xterm*scrollBar: false
xterm*internalBorder: 1
xterm*scrollKey: true
xterm*dynamicColors: true
xterm*utf8: 2
@osa1
osa1 / gist:4451206
Last active December 10, 2015 14:58
ghci memory overflow
import qualified Data.Vector.Unboxed as V
-- ...
ghci> V.replicate (2^32 :: Int) 0
fromList <interactive>: out of memory (requested 34360786944 bytes)
ghci> V.replicate (2^32 :: Int) (2 :: Word32)
fromList <interactive>: out of memory (requested 17180917760 bytes)
[
{ "keys": ["ctrl+shift+r"], "command": "expand_selection_to_paragraph" },
{ "keys": ["ctrl+u"], "command": "scroll_lines", "args": {"amount": 30.0}, "context": [{ "key": "setting.command_mode" }]},
{ "keys": ["ctrl+d"], "command": "scroll_lines", "args": {"amount": -30.0}, "context": [{"key": "setting.command_mode"}]},
{ "keys": ["j", "k"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
#include <string>
#include <sstream>
#include <iostream>
class AddExp;
class MulExp;
class Number;
class ExpVisitor {
public:
@osa1
osa1 / gist:5102171
Last active December 14, 2015 14:39
function makeChar(x, y)
local o = {}
o.x = x
o.y = y
o.body = love.physics.newBody(world, x, y, "dynamic")
o.body:setMass(5)
o.body:setFixedRotation(true)
o.shapeLeft = love.physics.newCircleShape(-20, 0, 5)
@osa1
osa1 / gist:5133878
Created March 11, 2013 12:20
LoveFrames textinput key repeat/delay test
local filePathDialog
local filePathInput
local filePathButton
function love.load()
love.graphics.setMode(500, 500, false, false, 0)
require("LoveFrames")
filePathDialog = loveframes.Create("frame")
# typstr "run((fun c -> <(let x = 1 in ~c, let y = 1 in ~c)>) <0>);;";;
typ <-- [0]
typ --> <fun>
typ* <--
env
typ* --> <fun>
typ** <--
RunE
(AppE