Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
@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")
@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)
#include <string>
#include <sstream>
#include <iostream>
class AddExp;
class MulExp;
class Number;
class ExpVisitor {
public:
[
{ "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 }
]
@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)
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 / 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()
@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
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 / gist:4148722
Created November 26, 2012 15:14
ffffffffffff
➜ ~ cabal install pandoc
Resolving dependencies...
In order, the following would be installed:
List-0.5.1 (new package)
base64-bytestring-1.0.0.0 (new package)
blaze-html-0.4.3.4 (new package)
digest-0.0.1.2 (new package)
hs-bibutils-4.15 (new package)
pandoc-types-1.9.1 (new package)
parsec-3.1.3 (reinstall) changes: mtl-2.0.1.0 -> 2.1.2