Last active
July 11, 2017 14:46
-
-
Save jmwelch/581564bd9adb9a59158e1c0e94b81855 to your computer and use it in GitHub Desktop.
Fun Things To Do
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
JS_PATH = "app/assets/javascripts/**/*.js"; | |
Dir[JS_PATH].each do |file_name| | |
begin | |
Uglifier.compile(File.read(file_name)) | |
print '.' | |
rescue | |
puts "\n#{file_name}" | |
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
https://stackoverflow.com/a/43662000/1507845 |
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 object = { top_level: 2, attrs: { foo: { baz: 'bang' } } } | |
object.attrs.nope.no #=> Uncaught TypeError: Cannot read property 'no' of undefined | |
_.chain(object).get('attrs').get('nope').get('no', 'default').value(); #=> 'default' |
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
# Nice % sign at end of input | |
config.wrappers :with_addon, tag: 'div', class: 'form-group with-addon', error_class: 'has-error' do |b| | |
b.use :html5 | |
b.use :label, class: 'control-label', wrap_with: { tag: 'span', class: 'label-block' } | |
b.wrapper tag: 'span', class: 'input-group input-right' do |ba| | |
ba.use :input, class: 'form-control' | |
ba.wrapper tag: 'span', class: 'input-group-addon' do |ao| | |
ao.use :hint | |
end | |
end | |
b.use :error, wrap_with: { tag: 'span', class: 'help-block' } | |
end | |
# Usage | |
= f.input :tax_amount, wrapper: :with_addon, hint: '%' |
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
# Definition | |
def checkbox_no_form(label: nil, **options) | |
capture do | |
concat content_tag :div, class: 'xcitee-checkbox', & -> do | |
concat content_tag :label, & -> do | |
concat label | |
concat content_tag :input, nil, { type: 'checkbox', **options } | |
concat content_tag :span, nil, class: 'x-checkbox' | |
end | |
end | |
end | |
end | |
# Usage | |
= checkbox_no_form(class: 'active-only', label: t('.active_only'), checked: checked) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment