This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.new(2) { |i| | |
Thread.new do | |
binding.pry_remote("localhost", 6000 + i) | |
end | |
}.each(&:join) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Deck | |
RANKS = %w(2 3 4 5 6 7 8 9 10 J Q K A) | |
SUITS = %w(s h c d) | |
def initialize | |
@cards = RANKS.product(SUITS).map {|r, s| {rank: r, suit: s}} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use JSON; | |
use LWP::Simple; | |
mkdir "album"; | |
get(shift) =~ m/^\s+trackinfo : (.+),$/m; | |
$dat = from_json($1); | |
for (@$dat) | |
{ | |
$_->{title} =~ s/'/'"'"'/g; | |
$_->{track_num} =~ s/^(\d)$/0\1/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name prev/next with left/right arrows on sites | |
// @namespace http://omgmog.net | |
// @description Binds left/right arrow keys to click on urls with rel="prev" and rel="next" -- useful for navigating comic sites and image galleries | |
// @include http://* | |
// @version 1.0 | |
// ==/UserScript== | |
function addJQuery(a){var b=document.createElement("script");b.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js");b.addEventListener("load",function(){var b=document.createElement("script");b.textContent="("+a.toString()+")();";document.body.appendChild(b)},false);document.body.appendChild(b)} | |
function main(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* overflow.c, by sarahzrf | |
* Demonstrates the pitfalls of undefined behavior. | |
* Examine the code below and guess what it should output. Then continue | |
* reading for the answer(s) and an explanation, plus some bonus moralizing! | |
*/ | |
#include <limits.h> | |
#include <stdio.h> | |
void test_overflow(int n, int m) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Conway where | |
import Prelude hiding ((**)) | |
import Data.List | |
import Data.Maybe | |
import Data.Ratio | |
import qualified Data.Map as M | |
import Control.Monad | |
data Face = H | T deriving (Show, Eq, Ord, Enum, Bounded) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Arrows #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE CPP #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE OverloadedLists #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
#define OD_DEBUG 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Collated where | |
data CQueue a = CQ [a] [a] deriving (Show) | |
interleave :: [a] -> [a] -> [a] | |
interleave [] _ = [] | |
interleave (x:xs) ys = x : interleave ys xs | |
buildCQ :: [a] -> CQueue a | |
buildCQ l = CQ (interleave l1 (reverse l2)) [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Arrows #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module OpenDynamicalVis where | |
import OpenDynamical | |
import Control.Arrow | |
import Linear.Vector | |
import Linear.Affine | |
-- import Control.Concurrent | |
import Data.Time.Clock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Board | |
def self.read(stream=$<) | |
new(5.times.map do | |
stream.gets.split.map(&:to_i) | |
end) | |
end | |
def initialize(grid) | |
@num_grid = grid | |
@mark_grid = grid.map {|row| row.map {false}} |
OlderNewer