Skip to content

Instantly share code, notes, and snippets.


Tadas Tamošauskas tadast

View GitHub Profile
tadast / with_active_support.rb
Last active Dec 10, 2018 — forked from mbyczkowski/with_active_support.rb
session cookie decrypter for Rails 5.1
View with_active_support.rb
require 'cgi'
require 'json'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secrets.secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'encrypted cookie'
signed_salt = 'signed encrypted cookie'
key_generator =, iterations: 1000)
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len]
tadast /
Last active Aug 29, 2015 — forked from chrisroos/
Spike into ways of visualising Smart Answers

The print_graph method displays the Smart Answer as a tree.

The print_questions_and_possible_next_nodes method displays the questions and their possible next nodes.

The extraction of possible next nodes is horrible in the case where the Smart Answer uses the block syntax of next_node. I'm getting the source of the block and extracting things that look like symbols.

tadast /
Last active Apr 17, 2021 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
tadast /
Created Nov 28, 2012 — forked from JeanMertz/
Ruby on Rails syntax highlight switcher for Sublime Text 2
# Forked from
# Makes it work with Ruby on Rails snippets
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """