This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Since Rails doesn't load classes unless it needs them, you must read the models from the folder. Here is the code | |
Dir[Rails.root.to_s + '/app/models/**/*.rb'].each do |file| | |
begin | |
require file | |
rescue | |
end | |
end | |
models = ActiveRecord::Base.subclasses.collect { |type| type.name }.sort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'factory_girl' | |
require 'faker' #if needed | |
Dir[Rails.root.to_s + '/spec/factories/**/*.rb'].each {|file| require file } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
WORK_DIR=/Users/tomi/rails_apps/myapp/; | |
RETURN_DIR=/Users/tomi/my_bash_scripts/; #optional | |
if [ -r $WORK_DIR ]; then | |
cd $WORK_DIR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# why and what is solarized http://ethanschoonover.com/solarized | |
# Simple installation notes for iterm2 and Solarized | |
Set ZSH_THEME in ~/.zshrc to blinks | |
https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized | |
#if you create new profile e.g. solarized you have to set him as default | |
#Simple installation notes for janus and Solarized | |
# .vimrc.before | |
let g:solarized_termcolors=256 | |
set t_Co=16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= form_for [@user, @task], :html => { :class => 'form-inline' } do |f| | |
-if @task.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@task.errors.count, "error")} prohibited this task from being saved:" | |
%ul |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place this file in config/initializers/simple_form.rb | |
# | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# Wrappers are used by the form builder to generate a | |
# complete input. You can remove any component from the | |
# wrapper, change the order or even add your own to the | |
# stack. The options given below are used to wrap the | |
# whole input. | |
config.wrappers :default, :class => :input, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install and make run basic bootstrap date-picker functionality described here http://www.eyecon.ro/bootstrap-datepicker/ | |
# app/assets/javascript/datepicker.js.coffee | |
$(document).on 'pageChanged', -> | |
# datepicker for simple_form & Ransack | |
$(".custom_datepicker_selector").datepicker().on 'changeDate', (en) -> | |
correct_format = en.date.getFullYear() + '-' + ('0' + (en.date.getMonth() + 1)).slice(-2) + '-' + ('0' + en.date.getDate()).slice(-2) # date format yyyy-mm-dd | |
$(this).parent().find("input[type=hidden]").val(correct_format) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'bundler' | |
gem 'rb-readline' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# just speed test for http://stackoverflow.com/questions/11502629/how-to-do-number-to-string-suffix/11502715#11502715 | |
1.9.3p194 :019 > def shot | |
1.9.3p194 :020?> a=Time.now | |
1.9.3p194 :021?> 1000000.times do | |
1.9.3p194 :022 > "5".ljust(3, "0") | |
1.9.3p194 :023?> end | |
1.9.3p194 :024?> b =Time.now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-#app/views/my_gem/foo.html.haml | |
= f.input :address_country_id_eq, :as => :country_search, label: 'Country' |
OlderNewer