This file contains hidden or 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
#!/bin/bash | |
if [[ -z $@ ]]; then bash .redo; else echo $@ > .redo; $@; fi |
This file contains hidden or 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 List (listModules) where | |
import Control.Applicative | |
import Control.Monad | |
import Data.List | |
import GHC | |
import GHCApi | |
import GhcMonad | |
import Packages | |
import Types |
This file contains hidden or 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 TypeFamilies #-} | |
module Test where | |
type family BoundsOf x | |
type instance BoundsOf (a->a) = Int | |
type instance BoundsOf (a->a->a) = (Int,Int) |
This file contains hidden or 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
-- | Compute CRC16 checksums using a lookup table. | |
module CRC16 (crc16, crc16File) where | |
import Data.Word | |
import Data.Array | |
import Data.Bits | |
import Data.ByteString.Lazy as BS | |
tableList :: [Word16] | |
tableList = |
This file contains hidden or 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 DeriveGeneric #-} | |
module Main where | |
import Control.DeepSeq | |
import Control.Exception (evaluate) | |
import Data.Time (diffUTCTime, getCurrentTime) | |
import GHC.Generics (Generic) | |
-- import Control.DeepSeq.Generics (genericRnf) -- from deepseq-generics |
This file contains hidden or 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
Feature: The Data.List module | |
In order to be able to use lists | |
As a programmer | |
I want a module that defines list functions | |
Scenario: Defining the function foldl | |
Given I want do define foldl | |
Which has the type (in brackets) a to b to a (end of brackets), to a, to list of b, to a | |
And my arguments are called f, acc, and l |
This file contains hidden or 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
# Counts total number of duplicate lines from a CPD output. | |
# Example: | |
# pmd-bin-5.0.5/bin/run.sh cpd --minimum-tokens 100 --files ../mysource --format text --language java | python cpd-sum.py | |
import fileinput | |
import re | |
nlines = 0 | |
places = 0 | |
total_dups = 0 |
This file contains hidden or 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
function copyToClipboard(text) { | |
// ask for permission to access clipboard | |
try { | |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); | |
} catch(e) { | |
alert( | |
gettext("Copy to clipboard failed because your browser prevents it.\n") | |
+ interpolate(gettext("For Mozilla Firefox, go to about:config and set the value of %s to 'true'."), ["signed.applets.codebase_principal"]) |
This file contains hidden or 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
% Simple way to plot a function taking 2 arguments. | |
% Usage: | |
% plot3d( @(x,y) x^2+y^2, range1, range2 ) | |
function plot3d(f, range1, range2) | |
% mesh really wants it in this order :( | |
r = zeros(length(range2), length(range1)); | |
[X, Y] = meshgrid(range1, range2); | |
s1 = size(range1) | |
s2 = size(range2) |