Instantly share code, notes, and snippets.

View xmonad-problem.org
ghc -e "Graphics.X11.openDisplay [] >>= Graphics.X11.Xinerama.getScreenInfo"

results in

[Rectangle {rect_x = 4080, rect_y = 584, rect_width = 1920, rect_height = 2160}, -- D, DP-4.9
 Rectangle {rect_x = 2160, rect_y = 584, rect_width = 1920, rect_height = 2160}, -- C, DP-4.8
 Rectangle {rect_x = 0, rect_y = 1920, rect_width = 2160, rect_height = 1920}, -- B, DP-2.8
View keybase.md

Keybase proof

I hereby claim:

  • I am SKoschnicke on github.
  • I am skoschnicke (https://keybase.io/skoschnicke) on keybase.
  • I have a public key whose fingerprint is 00F0 5868 1412 6596 C9FF ACFB A408 2AE0 90DE 5CE9

To claim this, I am signing this object:

View ZipSum.hs
import Reactive.Banana
import Control.Concurrent
main = do
-- Create handles for pushing values into events
(addHandler1, push1) <- newAddHandler
(addHandler2, push2) <- newAddHandler
-- Create event network
network <- compile $ do
-- Actual events from AddHandlers
View merge.php
<?php
$a = array(1 => array(1),2 => array(2),3 => array(3), 12 => array(5));
$b = array(1 => 5,2 => 6,3 => 7, 5 => 12);
$result = $a + array_fill_keys(array_keys($b), []);
foreach ($b as $key => $value) {
array_push($result[$key], $value);
}
View test.php
<?php
class Test {
private $number = 0;
private $sub;
public function __construct($n) {
$this->number = $n;
$this->sub = new SubTest($n, $this);
echo "construct ".$this->number."\n";
View ExampleForSO.hs
{-# LANGUAGE TemplateHaskell, Rank2Types #-}
module ExampleForSO where
import Control.Lens
import Control.Applicative ((<$>), pure)
import Data.List (any)
data SomeRec = SomeRec { _name :: String, _val :: Int }
deriving (Show)
$(makeLenses ''SomeRec)
View error.hs
import Control.Error
-- A made-up type for this example.
-- This is a bit simplified because mostly there are not only these encapsuled
-- types but dependent values which can only be retrieved sequentially (e.g.
-- reading an id from stdin, then retrieving the record for this id from a
-- database).
type MyType = (Maybe (Maybe Int))
-- The goal: Return the int when it is less than 10, on other cases (greater or
View gist:3917956
$('<tr></tr>').append(
$.makeArray($(data).map(function(index, element) {
return $('<td></td>').html(element.instrument_name)
}))
).appendTo(custom_factor_table)
$('<tr></tr>').append(
$.makeArray($(data).map(function(index, element) {
return $('<td></td>').html('bla')
}))
).appendTo(custom_factor_table)
View bar.rb
class Bar < ActiveRecord::Base
attr_accessible :rec_type
end
View print file in binary
import System.IO
import Numeric(showIntAtBase)
import Char(ord, intToDigit)
main :: IO ()
main = do
output stdin
printFile :: String -> IO ()
printFile filename =