Skip to content

Instantly share code, notes, and snippets.

@mikdiet
mikdiet / global-id-custom.rb
Created August 28, 2020 12:02
Using GlobalID for custom classes (to pass into Rails ActiveJob)
```
class Currency
include GlobalID::Identification
attr_accessor :a, :b
def initialize(a, b)
@a = BigDecimal(a.to_f, 2)
@b = b.to_s
end
@mikdiet
mikdiet / libxml.md
Created April 16, 2019 12:35
Libxml + ruby + rvm issue

I recently faced with error when reinstalled ruby and run bundle

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

...

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
require 'memoist'
class A
extend Memoist
def foo
puts 'A'
end
memoize :foo
--------------------------------------------------------------------------------
revision: c8ac079413acca3f62d4e15bb1b5a1c5bf7d2039
date: 03/02/2016
--------------------------------------------------------------------------------
diff --git a/guides/source/security.md b/guides/source/security.md
index 095adf4..96b9f4b 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -93,9 +93,16 @@ Rails 2 introduced a new default session storage, CookieStore. CookieStore saves
--------------------------------------------------------------------------------
revision: f847f342f4958fe5c81fec37d9f661164ca771d8
date: 14/02/2016
--------------------------------------------------------------------------------
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 618b6c3..12d0280 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -15,6 +15,9 @@ After reading this guide, you will know:
generators.md: +/- 0/ 0, outdated 0 days (e6be33f1ddafdb3e85b9809d0280439fc83559ae 25/06/2015)
3_1_release_notes.md: +/- 0/ 0, outdated 0 days (f7b5f6d88a3e5a33eb622875e699432d45659f91 15/06/2015)
4_1_release_notes.md: +/- 0/ 0, outdated 0 days (d495592541b031bc165c5fb0116a33e5cb943fb7 28/02/2015)
ruby_on_rails_guides_guidelines.md: +/- 0/ 0, outdated 0 days (86b6c773378383c902c24b5b5917177bde4e8d62 28/04/2015)
active_record_querying.md: +/- 0/ 0, outdated 0 days (69d657db6faa24a237bebe564193a0a61decb01f 28/01/2016)
4_0_release_notes.md: +/- 0/ 0, outdated 0 days (f7b5f6d88a3e5a33eb622875e699432d45659f91 15/06/2015)
3_0_release_notes.md: +/- 0/ 0, outdated 0 days (f7b5f6d88a3e5a33eb622875e699432d45659f91 15/06/2015)
* profiling.md: +/- 16/ 0, outdated 0 days (5cfaf5a46eb154f98ba89
@mikdiet
mikdiet / z1.c
Created November 28, 2015 20:17
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <math.h>
// we need it as globals to use in comparing function
int symbols[256], stats[256];
@mikdiet
mikdiet / gist:031c03ff0899cde33ad3
Last active November 20, 2015 14:52
Docker Mac OS X
eval "$(docker-machine env default)" # runs docker daemon
docker-machine stop default # stop to free memory
def a
'a'
end
def b
[false, true].each do |cond|
if cond
p a
else
a = 'not a'
cluster:
name: elasticsearch
path:
logs: /usr/local/var/log
data: /usr/local/var/data
index:
number_of_shards: 1
number_of_replicas: 1