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
okcoin :: Exchange | |
okcoin = Exchange | |
{ exchageName = OkCoin | |
, fetchTicker = fetchOkCoinTicker | |
} | |
fetchOkCoinTicker :: IO Ticker | |
fetchOkCoinTicker = do | |
r <- Wreq.asJSON =<< Wreq.get tickerUrl | |
let OkCoinTicker{..} = r ^. responseBody |
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
def bubble_sort(list) | |
sorted = false | |
until sorted | |
sorted = true | |
(0...list.length).each do |i| | |
if !list[i + 1].nil? && list[i] > list[i + 1] | |
list[i], list[i + 1] = list[i + 1], list[i] | |
sorted = false | |
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
module NestedHashMap where | |
import Control.Lens | |
import Data.Hashable (Hashable) | |
import Data.HashMap.Strict (HashMap, empty) | |
type NestedHashMap a b c = HashMap a (HashMap b c) | |
lookup | |
:: (Eq a, Hashable a, Eq b, Hashable b, Eq c) |
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 ReactionTest | |
( main | |
) where | |
import Control.Event.Handler | |
import Reactive.Banana | |
import Reactive.Banana.Frameworks | |
import System.IO | |
import System.Console.ANSI |
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
# NOTE: Currently not working | |
# Gets all the way to the final ./configure step and exists with error: Unknown CPU | |
FROM haskell:7.10.2 | |
RUN apt-get update | |
WORKDIR /opt/compiler | |
# Install core dependencies |
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
var R = require('ramda'); | |
// `proxy` is a function to allow for point-free recursion in JavaScrpipt | |
// it takes in a function name as a string, and returns a proxy function to the original function | |
var factorial = R.ifElse( | |
R.eq(0), R.always(1), | |
R.converge(R.multiply, R.I, R.compose(proxy('factorial'), R.dec)) | |
); | |
factorial(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
embed.spotify.com/openspotify/?spuri=spotify:track:2IuWB214OCchhPrBK8OtIR&closedelay=5000 |
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
echo '********************************************' | |
date -u | |
echo ' Beginning Incremental Import' | |
echo ' Setting PATH, GEM and RUBYLIB variables' | |
export PATH=/home/ckoziak/webapps/rails/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/ckoziak/bin; | |
export GEM_HOME=/home/ckoziak/webapps/rails/gems; | |
export RUBYLIB=/home/ckoziak/webapps/rails/lib; | |
echo ' Changing Directory to /home/ckoziak/webapps/rails/fas/' |
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
# A filter method using meta-programming to send multiple methods to the class. | |
# This allows multiple ActiveRecord scopes to be stacked easily. | |
def self.filter(params) | |
max = params[:limit] || 10 | |
methods = [:new_prices] | |
methods << :free if params[:free] | |
methods << :games if params[:games] | |
methods << [:limit, max] | |
Application.send_chain(methods) |
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
# Creating a linked list in Ruby, based on this tutorial | |
# http://www.commandercoriander.net/blog/2012/12/23/reversing-a-linked-list-in-ruby/ | |
require 'benchmark' | |
class Entry | |
attr_accessor :next, :data | |
def initialize(data) | |
@next = nil |