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
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class | |
# https://github.com/plataformatec/simple_form/issues/316 | |
inputs = %w[ | |
CollectionSelectInput | |
DateTimeInput | |
FileInput | |
GroupedCollectionSelectInput | |
NumericInput | |
PasswordInput |
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
# sudo apt-get install vlc vlc-plugin-pulse | |
require 'open-uri' | |
song = "Music/Creedence\\ Clearwater\\ Revival\\ -\\ Hey\\ Tonight.mp3" | |
loop do | |
begin | |
sleep 1 | |
open("http://www.emag.ro/") |
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
diff --git a/.gitignore b/.gitignore | |
index dfd12ee..bda50fe 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -5,4 +5,4 @@ test/dummy/db/*.sqlite3 | |
test/dummy/log/*.log | |
test/dummy/tmp/ | |
test/dummy/.sass-cache | |
-/nbproject/private/ | |
\ No newline at end of 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
require "active_support" | |
module M1 | |
def m; 1 end | |
end | |
module M2 | |
def m; super + 1 end | |
end |
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
class Meal < ActiveRecord::Base | |
belongs_to :chef | |
has_many :meal_translations, inverse_of: :meal, dependent: :destroy | |
scope :simple_search, ->(terms) { | |
joins{meal_translations}. | |
joins{chef.locations.outer}. | |
where{ | |
{ meal_translations => sift(:simple_search, terms) } | | |
{ chef.locations.zip_code.eq_any => terms } |
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
$ -> | |
$('[data-remove-parent]').bind 'ajax:success', -> | |
el = $(this) | |
console.log el | |
console.log el.data('remove-parent') | |
console.log el.closest(el.data('remove-parent')) | |
el.closest(el.data('remove-parent')).fadeOut() | |
$('[data-live-input]').change -> |
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
/* use with AS 3.2 */ | |
.active-scaffold-header div.actions { | |
top: 0; | |
} | |
.active-scaffold { | |
input[type="submit"], input[type="reset"], button { | |
@extend .btn; | |
@extend .btn-primary; |
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
#=================================================================== | |
0. ACL - lists, individuals | |
- query DB conforming to ACL | |
@posts = Post.where( rules as per ACL ) # +joins | |
- authorize individuals already in memory | |
@post = Post.find(params[:id]) |
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
[clyfe@sodium current]$ bundle exec rake RAILS_ENV=production db:migrate --trace | |
** Invoke db:migrate (first_time) | |
** Invoke environment (first_time) | |
** Execute environment | |
rake aborted! | |
Mysql2::Error: Table 'mydb.some_table' doesn't exist: SHOW FULL FIELDS FROM `some_table` | |
/SOME_PATH/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:233:in `query' |