Skip to content

Instantly share code, notes, and snippets.

@gurix
gurix / omniauth_callbacks_controller.rb
Created August 21, 2014 14:36
Sign up via omniauth with diffferent locales
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def twitter
handle_redirect('devise.twitter_uid', 'Twitter')
end
def facebook
handle_redirect('devise.facebook_data', 'Facebook')
end
private
@gurix
gurix / used_ruby_versions.py
Created March 3, 2020 15:25
A script to determine what ruby versions for you use for different projects in a workspace.
#!/usr/bin/env python3
import glob, os, sys
from collections import Counter
# It is necessary to pass a directory in which we want to look for a ruby version.
if len(sys.argv) < 2:
sys.exit("usage: %s dir \n\n dir : Direcotry to look up for ruby version" % sys.argv[0])
# Validate the specified directory.
path_argument = sys.argv[1]
const images = require.context('../images')
const state = {
images: images.keys().map(function(name) {
return({
name: name,
path: images(name,true)
})
})
}
$("tbody tr").each(function() {$(this).find("input[type=radio]")[Math.floor(Math.random()*4)].click()}); $("input[type=submit]").click();

Keybase proof

I hereby claim:

  • I am gurix on github.
  • I am gurix (https://keybase.io/gurix) on keybase.
  • I have a public key ASBHKsemKRaojcS4rRd0o0sAt5MQmkfXVctr_YVVXCDS3wo

To claim this, I am signing this object:

@gurix
gurix / hstore_pivot.sql
Created April 9, 2014 10:01
Creating a cross tab / pivot table form hstore fields with dynamical column names using in postgresql
DROP TABLE IF EXISTS survey_sessions;
-- Imagine a table with survey sessions
-- token: some id or token to access a survey
-- answers: a key value store for answers
CREATE TABLE survey_sessions (
token text,
answers hstore);
-- We need some data to play with
INSERT INTO survey_sessions (token, answers) VALUES ('9IaxxP', 'a=>1, b=>2');
@gurix
gurix / easy_gov_review.ssml
Created July 2, 2018 18:51
EasyGov Review
<speak>
<amazon:auto-breaths volume="x-loud" frequency="x-high">The following sequence shows the keyboard only navigation through the homepage of easygov from top to bottom. To do that, i am using the tabulator key. As you can see, the element that has the focus is sometimes highlighted with a light blue border.</amazon:auto-breaths></speak>
@gurix
gurix / cannabis-infused-chai.en.md
Last active May 31, 2018 13:18
Cannabis Infused Masala Chai

Cannabis Infused Masala Chai

milk-tea-masala-chai

Ingredients

  • 0.2 dl Water
  • 0.2 dl Milk (high fat content)
  • 1 Gramm Cannabis
  • 1 Teabag Chai Tea
  • Sugar (as much as you prefere)
@gurix
gurix / INSTALL.md
Last active February 2, 2018 13:29
How to install pandoc 1.17.0.3 on ueberspace 6

The following worklow based on the official documentation from pandoc https://pandoc.org/installing.html#quick-stack-method

Install stack

Stack is not installed on ueberspace 6 by default. So we have to do install it manually.

  1. Download the release Linux 64-bit, static mannually according https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux with the command wget https://www.stackage.org/stack/linux-x86_64-static
  2. It is a tar archive, but it does not save it with the correct suffix. However we cann extract the archive using tar -xzf linux-x86_64-static
  3. Copy the stack binary into your home binary folder cp stack-1.6.3-linux-x86_64-static/stack ~/bin/

Install pandoc

  1. Download the pandoc source wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
  2. Extract the archive tar xvzf pandoc-1.17.0.3.tar.gz