Skip to content

Instantly share code, notes, and snippets.

View tadast's full-sized avatar

Tadas Tamošauskas tadast

View GitHub Profile
@tadast
tadast / syntax_highlighting.py
Created November 28, 2012 15:17 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
# 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 / .irbrc
Created May 6, 2013 19:46
easy rails route scanning in Rails console
# 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 / Alphasights_technical_challenge.md
Last active April 3, 2024 12:25
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

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 / gist:6038585
Last active December 19, 2015 23:59
turbolinks sparkles
☆。★。☆。★
。☆ 。☆。☆
★。\|/。★
turbolinks
★。/|\。★
。☆。 。☆。
☆。 ★。 ☆
@tadast
tadast / countries_codes_and_coordinates.csv
Last active April 26, 2024 09:43
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude coordinates
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Åland Islands AX ALA 248 60.116667 19.9
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
@tadast
tadast / arsample.rb
Created March 20, 2014 09:00
ActiveRecord#sample for postgres
class ActiveRecord::Base
def self.sample
order('random()').first
end
end
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — 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
tadast / hash_wat.rb
Last active August 29, 2015 14:01
ruby **options inconsistency
def foo(a, *b, **c)
[a, b, c]
end
=> :foo
[16] » foo 10, {d: 40, e: 50}
=> [
[0] 10,
[1] [],
[2] {
@tadast
tadast / quotes_scrum_xp.md
Created May 27, 2014 22:20
Quotes from Scrum and XP from the Trenches by Henrik Kniberg

Scrum and XP from the Trenches by Henrik Kniberg

Disclaimer: exported by readmill in no particular order :(

If the product owner has a technical background he might add stories such as “Add indexes to the Events table”. Why does he wa nt this? The real underlying goal is probably something like “speed u p the search event form in the back office

The distinction is quite simple. Stories are deliver able stuff that the product owner cares about. Tasks are non-deliverable stuff, or stuff that the product owner doesn’t care about.

Normally the product owner starts the meeting by summarizing his goal for the sprint and the most important stories. Next , the team goes through and time-estimates each story, starting with the most important one. As they do this, they will come up with important scope questions – “does this ‘delete user’ story include going through each pending transaction for that user and canceling it?’” In some cases the answers will be surprising to the team, prompting them to change

@tadast
tadast / activesupport_offsets.rb
Created June 17, 2014 10:55
ActiveSupport::Timezone offsets
{
"American Samoa" => -11,
"International Date Line West" => -11,
"Midway Island" => -11,
"Hawaii" => -10,
"Alaska" => -9,
"Pacific Time (US & Canada)" => -8,
"Tijuana" => -8,
"Arizona" => -7,
"Chihuahua" => -7,