Skip to content

Instantly share code, notes, and snippets.

Avatar

Tadas Tamošauskas tadast

View GitHub Profile
@tadast
tadast / dynamoid_reset.rb
Created Sep 8, 2016
Dynamoid test database cleaner
View dynamoid_reset.rb
# Prevent wiping out data in non-test environments
raise "Test should be run in 'test' environment only" if Rails.env != 'test'
module DynamoidReset
def self.all
Dynamoid.adapter.list_tables.each do |table|
# Only delete tables in our namespace
if table =~ /^#{Dynamoid::Config.namespace}/
Dynamoid.adapter.delete_table(table)
end
@tadast
tadast / gist:6038585
Last active Dec 19, 2015
turbolinks sparkles
View gist:6038585
☆。★。☆。★
。☆ 。☆。☆
★。\|/。★
turbolinks
★。/|\。★
。☆。 。☆。
☆。 ★。 ☆
@tadast
tadast / sm-prototype-hierarchy-crawler.rb
Last active Nov 9, 2015
Service manual prototype hierarchy crawler
View sm-prototype-hierarchy-crawler.rb
require 'nokogiri'
require 'open-uri'
require 'pry'
require 'yaml'
class Crawl
def initialize(start_url = "http://sm-11.herokuapp.com")
@start_url = start_url
@guides = []
end
@tadast
tadast / gist:4160627
Created Nov 28, 2012
Open the last migration file from shell
View gist:4160627
# stole this from Tor Erik Linenrud @telinnerud
alias olm='subl `ls -r db/migrate/* | head -n 1`'
View gist:3723042
# helpers
module PublicHelper
def router_attributes
{
"data-router-class" => "#{controller_name.to_s.titleize}Controller",
"data-router-action" => action_name.to_s
}
end
end
View gist:1730393
https://gist.github.com/1688857
=== 1.9.3-p0
✗ time (rails runner 'puts(1)')
6.33s user 0.69s system 99% cpu 7.027 total
✗ time (rspec spec)
1736/1736: 100% |==========================================| Time: 00:00:34
42.32s user 1.52s system 92% cpu 47.279 total
@tadast
tadast / gist:1569954
Created Jan 6, 2012
useful sublime text 2 stuff
View gist:1569954

== Key Bindings

[
  //https://github.com/alexstaubo/sublime_text_alternative_autocompletion
  { "keys": ["escape"], "command": "alternative_autocomplete", "context":
    [
      { "key": "num_selections", "operator": "equal", "operand": 1 },
      { "key": "overlay_visible", "operator": "equal", "operand": false },
@tadast
tadast / heroku_colors.sh
Created Aug 10, 2011
Colorize heroku production console for iTerm2 on OSX
View heroku_colors.sh
# iTerm2, OS X
# 1. change 'your_app_production' to your application name
# 1a. Tune the colors by your taste
# 2. put these functions to your .bashrc, .zshrc
# or anywhere where it gets loaded for your iTerm session
# 3. restart iTerm or 'source ~/.zshrc' and use these functions
set_color() {
local HEX_FG=$1
local HEX_BG=$2
@tadast
tadast / terminal_color.sh
Created Aug 10, 2011
Colorize heroku production console for Terminal on OSX
View terminal_color.sh
# Terminal, OS X (iTerm version: https://gist.github.com/1137050)
# 1. change 'your_app_production' to your application name
# 1a. Tune the colors by your taste
# 2. put these functions to your .bashrc, .zshrc
# or anywhere where it gets loaded for your iTerm session
# 3. restart iTerm or 'source ~/.zshrc' and use these functions
set_color() {
local R=$1
local G=$2
View gist:1107162
class Office < ActiveRecord::Base
belongs_to :teacher
accepts_nested_attributes_for :teacher
end
class Teacher < ActiveRecord::Base
has_one :office
end
You can’t perform that action at this time.