Skip to content

Instantly share code, notes, and snippets.

Avatar

Tadas Tamošauskas tadast

View GitHub Profile
@tadast
tadast / countries_codes_and_coordinates.csv
Last active Sep 21, 2020
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude
View countries_codes_and_coordinates.csv
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Albania AL ALB 8 41 20
Algeria DZ DZA 12 28 3
American Samoa AS ASM 16 -14.3333 -170
Andorra AD AND 20 42.5 1.6
Angola AO AGO 24 -12.5 18.5
Anguilla AI AIA 660 18.25 -63.1667
Antarctica AQ ATA 10 -90 0
Antigua and Barbuda AG ATG 28 17.05 -61.8
@tadast
tadast / Paint slack black.md
Last active Sep 15, 2020
Update the Mac Desktop slack CSS
View Paint slack black.md

In the console

export SLACK_DEVELOPER_MENU=true
open /Applications/Slack.app

In slack UI

right-click on anything -> inspect element

@tadast
tadast / ssl_puma.sh
Last active Sep 5, 2020 — forked from trcarden/gist:3295935
localhost SSL with puma
View ssl_puma.sh
# 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
tadast / ruby.yml
Created Apr 26, 2020
Example github actions config for Rails with postgres using DATABASE_URL
View ruby.yml
name: Ruby
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
@tadast
tadast / capybara_chrome_download.rb
Created Jun 3, 2020
Rails Capybara chromedriver setup for testing downloads
View capybara_chrome_download.rb
# in rails_helper.rb
driver = if ENV['CHROME_DEBUG'] == 'true'
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
:chrome
else
Capybara.register_driver :headless_chrome do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
@tadast
tadast / Alphasights_technical_challenge.md
Last active May 5, 2020
A technical challenge we give to our Ruby on Rails applicants in order to evaluate their coding proficiency.Job description: http://www.alphasights.com/positions/ruby-developer-london or http://www.alphasights.com/positions/ruby-developer-new-york
View Alphasights_technical_challenge.md

Update: I no longer work for the company and this challenge is no longer used, but I'll leave the gist here in case people want to practice.

Alphasights Technical Challenge

Using Ruby on Rails we would like you to create a simple expert search tool. The application should fulfill the requirements below. The source code must be placed in a public repo on GitHub. The application should be deployable on Heroku.

  • I enter a name and a personal website address and a member is created.
  • When a member is created, all the heading (h1-h3) values are pulled in from the website to that members profile.
  • The website url is shortened (e.g. using http://goo.gl)
  • After the member has been added, I can define their friendships with other existing members. Friendships are bi-directional i.e. If Sasha is a friend of Ash, Ash is always a friend of Sasha as well.
@tadast
tadast / .irbrc
Created May 6, 2013
easy rails route scanning in Rails console
View .irbrc
# Put this in your ~/.irbrc for easy rails route scanning
#
# Usage:
# > routes
# => prints all routes
# > routes /GET.*user/i
# => prints routes matching a given regex
# > routes "user"
# => matches strings as well
@tadast
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 = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len]
@tadast
tadast / syntax_highlighting.py
Created Nov 28, 2012 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
View syntax_highlighting.py
# Forked from https://gist.github.com/925008
# Makes it work with Ruby on Rails snippets
# https://github.com/tadast/sublime-rails-snippets#sublime-text-2-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 """
@tadast
tadast / json_api_to_graphviz.js
Created Nov 19, 2016
This is a script to take in a {json:api} document (jsonapi.org) and generate a visual graph (http://www.graphviz.org) representation of it
View json_api_to_graphviz.js
/*
This is a script to take in a {json:api} document (jsonapi.org)
and generate a graphviz (http://www.graphviz.org) representation of it.
Usage:
> node <this_file>
then copy and paste the output to some graphviz parser
e.g. http://www.webgraphviz.com or http://gravizo.com
*/
You can’t perform that action at this time.