Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
puffnfresh / Monads.hs
Last active December 17, 2015 17:39
Monad exercises
module Monads where
{- runhaskell Monads.hs -}
import Prelude hiding (Monad, (>>=), return)
{-
Laws:
* Associativity: `m >>= f >>= g` is equivalent to `m >>= \x -> f x >>= g`
@quchen
quchen / trolling_haskell
Last active February 24, 2024 01:30
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
@leemartin
leemartin / ontimedcomments.js
Created April 5, 2012 23:26
OnTimedComments Example
SC.initialize({
client_id: "YOUR_CLIENT_ID"
});
SC.whenStreamingReady(function() {
SC.stream(TRACK_ID, {
ontimedcomments: function(comments) {
var comment, _i, _len;
for (_i = 0, _len = comments.length; _i < _len; _i++) {
@ezkl
ezkl / faraday_typh_default.rb
Created April 1, 2012 07:26
Parallel Requests w/ Faraday + Typhoeus
require "faraday"
require 'typhoeus'
conn = Faraday.new(:url => 'http://httpstat.us') do |builder|
builder.request :url_encoded
builder.response :logger
builder.adapter :typhoeus
end
conn.in_parallel do
@ghoseb
ghoseb / scaffold.clj
Created March 16, 2012 12:54
Scaffold by Christophe Grand
(defn scaffold
"Print the ancestor method signatures of a given interface."
[iface]
(doseq [[iface methods] (->> iface
.getMethods
(map #(vector (.getName (.getDeclaringClass %))
(symbol (.getName %))
(count (.getParameterTypes %))))
(group-by first))]
(println (str " " iface))
anonymous
anonymous / gist:1406238
Created November 29, 2011 20:09
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
class Array
def mapfn(&proc)
map do |item|
lambda do |*args|
proc.call(*([item] + args))
end
end
end
end
#!/usr/bin/env python
# -*- coding: utf-8 -*-
BARS = u'▁▂▃▅▆▇'
import sys
data = sys.argv[1:] or sys.stdin.read().split()
data = (x.strip() for x in data)
data = [float(x) for x in data if x]
@fronx
fronx / ants.clj
Created November 9, 2011 17:25 — forked from michiakig/ants.clj
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world