This file contains 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
https://drive.google.com/file/d/1PUrtICphMlDtr9kCIBodir8cN44jODeY/view?usp=drivesdk | |
https://drive.google.com/file/d/1PUrtICphMlDtr9kCIBodir8cN44jODeY/uc?usp=drivesdk |
This file contains 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
result = Hash.new(0) | |
result[:foo] += 1 | |
p result # I get { :foo => 1 } good. | |
result = Hash.new([]) | |
result[:foo] << 1 | |
p result # I get {} instead of { :foo => [1] } |
This file contains 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
function! GetSelectedLines(type, ...) range | |
let sel_save = &selection | |
let &selection = "inclusive" | |
let reg_save = @@ | |
if a:type == 'n' | |
silent exe a:firstline . "," . a:lastline . "y" | |
elseif a:type == 'c' | |
silent exe a:1 . "," . a:2 . "y" | |
else | |
silent exe "normal! `<" . a:type . "`>y" |
This file contains 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 A | |
attr_accessor :foo | |
def ==(other) | |
other.is_a?(B) && self.foo == other.foo | |
end | |
end | |
class B | |
attr_accessor :foo |
This file contains 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
def console_prices=(values) | |
values.each do |console_id, price| | |
self.classifications.build(console_id: console_id, price: price) if price.present? | |
end | |
end |
This file contains 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 :game do |f| | |
%p | |
= f.label :name | |
= f.text_field :name | |
%p | |
- @consoles.each do |console| | |
= console.name | |
= text_field_tag "game[console_prices][#{console.id}]" |
This file contains 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
var SITE = SITE || {}; | |
SITE.fileInputs = function() { | |
var $this = $(this), | |
$val = $this.val(), | |
valArray = $val.split('\\'), | |
newVal = valArray[valArray.length-1], | |
$button = $this.siblings('.button'), | |
$fakeFile = $this.siblings('.file-holder'); | |
if(newVal !== '') { |
This file contains 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 Admin.Routers.Menus extends Backbone.Router | |
routes: | |
'': 'fetchData' | |
fetchData: -> | |
Admin.Collections.MenuCategories.fetch | |
success: (col, resp) -> | |
names = col.pluck('name') | |
$("#menu_menu_category_id").autocomplete(data: names) |
This file contains 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
Menus.prototype.fetchData = function() { | |
var names; | |
Admin.Collections.MenuCategories.fetch(); | |
names = Admin.Collections.MenuCategories.pluck('name'); | |
$("#menu_menu_category_id").autocomplete({ | |
data: names | |
}); | |
return names; | |
}; |
This file contains 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 Admin.Routers.Menus extends Backbone.Router | |
routes: | |
'': 'fetchData' | |
fetchData: -> | |
Admin.Collections.MenuCategories.fetch() | |
$("#menu_menu_category_id").autocomplete | |
data: Admin.Collections.MenuCategories.pluck('name') |
NewerOlder