Skip to content

Instantly share code, notes, and snippets.

View cintrzyk's full-sized avatar

Marcin Brzeziński cintrzyk

  • stackin.com
  • Olsztyn
View GitHub Profile
require 'dry/monads'
require 'dry/matcher/result_matcher'
module BaseTransaction
include Dry::Monads[:result, :try, :do]
include Dry::Matcher.for(:call, with: Dry::Matcher::ResultMatcher)
def call
run
end
require 'benchmark'
class Measurement
LEAN_BODY_MASS_PARAM = 0.01 # dummy value
attr_reader :weight
def lean_body_mass
weight * LEAN_BODY_MASS_PARAM unless weight.nil? # returns nil when no weight
end
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@cintrzyk
cintrzyk / fibonacci7.ruby
Created October 28, 2015 17:30
fibonacci7 ruby
gcd(*neighbour(n, m))
@cintrzyk
cintrzyk / test_code_snippet.ruby
Created October 28, 2015 17:29
test_code_snippet
class Item
class Ng.RailsViews.AdminBlogImagesNewView extends Backbone.View
FILE_TYPES: ['image/png', 'image/jpeg', 'image/gif']
IMAGE_WIDTH = 100
el: 'body'
events:
'dragenter #blog-images .drop': 'dragEnter'
'dragover #blog-images .drop': 'dragOver'
@cintrzyk
cintrzyk / nazwa.txt
Created October 28, 2015 17:26
test_code_snippet
class Item
class Ng.RailsViews.AdminBlogImagesNewView extends Backbone.View
FILE_TYPES: ['image/png', 'image/jpeg', 'image/gif']
IMAGE_WIDTH = 100
el: 'body'
events:
'dragenter #blog-images .drop': 'dragEnter'
'dragover #blog-images .drop': 'dragOver'
@cintrzyk
cintrzyk / nazwa.txt
Created October 28, 2015 17:22
the description for this gist
yay file contents
@cintrzyk
cintrzyk / file11.txt
Created October 28, 2015 17:11
the description for this gist
String file contents
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
<div id='first'>
@cintrzyk
cintrzyk / gist:7703625
Created November 29, 2013 09:54
publish error
No DRb server is running. Running in local process instead ...
[Zonebie] Setting timezone to "Mountain Time (US & Canada)"
You are using WebMock 1.16.0. VCR 2.8.0 has been tested against WebMock >= 1.8.0, < 1.16, and you are using a newer version. If you experience VCR issues, consider downgrading WebMock as it may fix it.
Run options: include {:line_numbers=>[48]}
An error occurred in an after hook
ActionView::Template::Error: undefined method `[]' for nil:NilClass
occurred at /Users/cinek/netguru/dwhite/app/views/member/page_templates/builtin/template_2.haml:5:in `_app_views_member_page_templates_builtin_template___haml__651274039841050535_70220375396360'
F