Skip to content

Instantly share code, notes, and snippets.

[
//
// TABS (REGULAR)
//
// Tab set
{
"class": "tabset_control",
"layer0.texture": "",
@AlexVKO
AlexVKO / palestra-tdc2014-florianopolis
Created October 16, 2015 23:01 — forked from brunogh/palestra-tdc2014-florianopolis
Palestras TDC 2014 - Florianópolis
Palestras TDC 2014 - Florianópolis
Watir
Lucas Prim
http://www.slideshare.net/lucasprim/apresentacao-watir
RSpec Best Friends
Mauro George
http://pt.slideshare.net/maurogeorge/rspec-best-friends-34875731
@AlexVKO
AlexVKO / passwords_controller.rb
Created November 3, 2015 05:15
Allow devise to reset password signed in
class PasswordsController < Devise::PasswordsController
# here we need to skip the automatic authentication based on current session for the following two actions
# edit: shows the reset password form. need to skip, otherwise it will go directly to root
# update: updates the password, need to skip otherwise it won't even reset if already logged in
skip_before_filter :require_no_authentication, :only => [:edit, :update]
# we need to override the update, too.
# After a password is reset, all outstanding sessions are gone.
# When already logged in, sign_in is a no op, so the session will expire, too.
# The solution is to logout and then re-login which will make the session right.
@AlexVKO
AlexVKO / comment.rb
Created November 24, 2015 00:05
Post with commentable comments
class Comment < ActiveRecord::Base
belongs_to :commentable, polymorphic: true
has_many :comments, as: :commentable
end
@AlexVKO
AlexVKO / tmux.conf
Created November 26, 2015 22:36
Tmux conf
# set Ctrl-a as the default prefix key combination
# and unbind C-b to free it up
set -g prefix C-k
unbind C-b
#set-window-option -g mode-mouse on
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAgAElEQVR4Xky9a9DuaVbWd/2Pz+E97vPu3t09PYeeA8OMIIIjMXE0qBWrEmOSSmE8QEXj2ZRSIqnKB/PRT6aST5qyKhXLikQQGBCIiqCgQEAQgekZmO6Z7p7u3Xvvd7/7PT6H/zn1u9b97Jmu6Zru3e/7PP//fa97rWtd61rrzr5/00/FMKksC9WjNEyTsmHUeuq1l9caykz5OGnKM2VZpmwaNY6T+nFUnueassz/Td2oIs/VZ5OqItegSVKmfhqUZ5nGcVQ5ZRomvmOU8lxFlklFJn40lzT0k/+5zUZ1Xa+iLLVfFWqmTMU4aTvIz9Blk9SP/mf/Ov86DKpnlZ9tGCYNozTyH4pCfT+p4Af7Qc3Qazav1PC8WcEj+ud5lm6YlBWZ2rZTNuXKy8yfrSkXj5rlmcaB75s08b38/ChlRa4snzRN8bvlvFS3HTTlhUZJIy/FGgyD8rzUOIxe0zHn8QqN/SReve86r6n/jDVP38N7Dr3U9b2qqtZm6FUq93qOfv9MwzBqU06aZbn/OePdJOXT5M/K2aNRasdJZZ5rHPjOUZpGdYNUz0o1Ta9qKtVNo2q/cKZNNmqb516bkpcZpLEfvNcsQte2mpWVsqpQ344qM6nNJ2Vtr6KuvJ99H2s2Frn/P2dvMqnEpn50NU5DMSnvRtVFoUmZhmzQfMw1ZJP6MlMxhREOGTbF4kmN2LTCBsAC95qUt9I4K1Sy6NgYL1fmKoZRnfcg80K0bESGycWD8JAYgPe6n7wAzTSoKkvVY6ahSEa2DaNXxYaMGvMsjHsYVZQ5a4ldq+tGbxgv2IwcDGyPQ1QoL/hnnrbQNMSB82KyKLxe6TVW3/bKJwxB/h0/K0ZR5N6IsZTGdopDOY4a+CEMi3fg+dhoxfP1g7S1IYyqqtyfM7aDpqpQp1gfDJ6FGHko1jvPNLBoGP04aj4vtVlPNnSWjnccR3
@AlexVKO
AlexVKO / Gemfile ok
Created December 6, 2015 19:42
sublime text test
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
@AlexVKO
AlexVKO / config_generators.rb
Created December 6, 2015 20:16
rails config generators
config.generators do |g|
g.test_framework :rspec, fixture: true
g.fixture_replacement :factory_girl, dir: 'spec/factories'
g.view_specs false
g.helper_specs false
g.stylesheets = false
g.javascripts = false
g.helper = false
end
@AlexVKO
AlexVKO / add_hstore_extension.rb
Created December 6, 2015 20:47
rails postress migration hstore
class AddHstoreExtension < ActiveRecord::Migration
def up
execute 'CREATE EXTENSION hstore'
end
def down
execute 'DROP EXTENSION hstore'
end
end
@AlexVKO
AlexVKO / title-case-filter.js
Created December 9, 2015 19:01 — forked from jeffjohnson9046/title-case-filter.js
A title-case filter for AngularJs
// Came from the comments here: https://gist.github.com/maruf-nc/5625869
app.filter('titlecase', function() {
return function (input) {
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
input = input.toLowerCase();
return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title) {
if (index > 0 && index + match.length !== title.length &&
match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
(title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&