Skip to content

Instantly share code, notes, and snippets.

module Main where
import Effect (Effect)
import Effect.Console (logShow)
import TryPureScript (render, withConsole)
import Prelude (class Applicative, class Apply, class Bind, class Functor, class Monad, apply, bind, map, pure, (=<<), (<>))
import Data.Eq ((==))
import Data.Show
@MitinPavel
MitinPavel / Dockerfile
Created September 18, 2017 05:56
Dockerfile for Reason.js (ReasonML)
FROM node:8-slim
ENV DEBIAN_FRONTEND noninteractive
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=/home/node/.npm-global/bin:$PATH
RUN apt-get -yq update && apt-get -yq install build-essential
USER node
@MitinPavel
MitinPavel / ruby_digest
Created March 24, 2014 06:53
Ruby дайджест #N
Привет всем.
Хочу продолжить [хорошее начинание](http://dou.ua/lenta/digests/ruby-digest-0/). Вот моя версия того, на что должен посмотреть новичок в Ruby и рельсах.
Первые книги
------------
* [Practical Object-Oriented Design in Ruby: An Agile Primer](http://www.poodr.com/) by Sandi Metz - Отличная книга об объектно-ориентированном дизайне и связанных с ним аспектах. Автор рассматривает плюсы и минусы различных подходов, говорит о тестирование.
* [Agile Web Development with Rails 4](http://pragprog.com/book/rails4/agile-web-development-with-rails-4) by Sam Ruby, Dave Thomas and David Heinemeier Hansson - Новый Завет Rails от самого автора религии.
# Server side
def deletable_by?(user)
user.owner? @project && initial?
end
@MitinPavel
MitinPavel / api_server.rb
Created December 5, 2012 07:31
A dead simple API web server contains three endpoints: fibonacci numbers, Google's home page sha1, a simple store.
require 'socket'
require 'net/https'
require 'uri'
require 'digest/sha1'
def fibonacci(n)
n < 2 ? n : fibonacci(n-1) + fibonacci(n-2)
end
def google_body
@MitinPavel
MitinPavel / dijkstras_dci.rb
Created July 6, 2012 15:11
Dijkstra's algorithm in DCI -- Example in Ruby
#!/usr/bin/env ruby
#
######################################################################################################################################
# Taken here http://fulloo.info/Examples/RubyExamples/Dijkstra/DijkstraListing.html and carefully corrected to be more ruby idiomatic.
######################################################################################################################################
#
# Example in Ruby -- Dijkstra's algorithm in DCI
# Modified and simplified for a Manhattan geometry with 8 roles
#
#
@MitinPavel
MitinPavel / meeting_dci_and_web_frameworks_1.rb
Created August 27, 2011 06:22
Meeting - DCI and Web Frameworks #1
if callcc YesNoMessageBox.new('Some question')
a_role.do_some_stuff
else
other_role.do_other_stuff
end
user_input = callcc DialogBox.new('Other question')
a_role.do user_input
@MitinPavel
MitinPavel / dci_and_aggregate.rb
Created May 29, 2011 13:16
DCI and Aggregate
class Human
attr_accessor :address
end
class Address
def to_s
"City: #{@city}"
end
private