clipboardjs.com

We used zeroclipboard.js in some of our projects but now we switched to clipboard.js because it does not rely on flash. Flash support of the major browsers has ended.

...more advantages of clipboard.js: it consists only of a single javascript file, so it does not trigger additional requests with rails it automagically provides user feedback by selecting the text...

You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details attribute? is generated for all attributes and not only for boolean...

...These methods are using #query_attribute under the hood. For more details you can see ActiveRecord::AttributeMethods::Query. In most circumstances query_attribute is working like attribute.present?. If your attribute...

makandra dev

...your remote database, you might not want it to dump each time you deploy (say, you're experimenting with staging and don't want ten dumps an hour). How to...

...skip dump creation: Capistrano 2 In your Capistrano file: before 'deploy:update_code', 'db:dump' unless fetch(:skip_dump, false) The second parameter of fetch sets a default value if...

hackernoon.com

...extremely popular amongst front-end developers the last couple of years. This isn’t surprising, as it has made it a lot easier for us to create dynamic layouts and...

jqueryui.com

UI sortable helps reordering items with drag 'n drop. It works quite fine. Proven configuration for sorting table rows When invoking the plugin, you may pass several options. This set...

...causing the thead border-bottom to grow // when the first table row is dragged tr.ui-sortable-helper:first-child + tr > td border-top: none

...re looking for is not present, first try upgrading ruby-build. If it's still missing, open a request on the ruby-build issue tracker: https://github.com/sstephenson/ruby-build/issues

Our old solution for cronjobs, the "craken" plugin, is no longer maintained and does not work on Rails 3.2+. We will instead use the whenever gem. "Whenever" works just like...

...craken", by putting your rake tasks into the server's cron table. Everything seems to work just like we need it. Installation for new projects Add "whenever" to your Gemfile...

jetbrains.com

In RubyMine folders can be excluded from search, navigation etc. by marking it as excluded. You might sometimes wish to exclude single files, too. An example could be .byebug_history...

...which is located in the project root directory. Single files can be excluded by pattern in the Settings: In the Settings/Preferences dialog Ctrl+Alt+S, go to Project structure

...inherited methods but call the parent's implementation, too. In JavaScript, there is no simple "super" method like in Ruby -- so here is how to do it with Backbone.

...own initialize method, and you'd get this console output: Hello World. How to super But we want initialize of BaseClass to run as well -- and if you want to...

Expiration of Rails sessions By default Rails sessions expire when the user closes her browser window. To change this edit your config/initializers/session_store.rb like this: ActionController::Base.session = { :key => '...', :secret => '...' :expire_after...

} In older Railses the initializer is not available. Set the option in the environment.rb instead: config.action_controller.session = { :key => '...', :secret => '...' :expire_after => 10.years } Expiration of Rails cookies In addition to the...

makandra dev

Field error steps Spreewald's The...

...field should have an error and The...

...field should have the error...

...steps now have built-in support for Rails and Bootstrap (v3-v5...

...error classes. When using Bootstrap, it is no longer necessary to overwrite the steps in your project. At the same time, support for formtastic has been removed as there were...

On application servers, gems are usually bundled into the project directory, at a location shared across deployments. This is usually shared/bundle inside your project's root directory, e.g. /var/www/your-project/shared/bundle/.

When you are changing the version of RubyGems or Bundler on a system where gems are installed this way, you must wipe that bundle directory in addition to...

So I had the issue that User input (coming from many different sources and users) often contains the same long word. Maybe that's a super german thing...

...compiler that crawls the document and replaces all occurencies of certain word and puts a soft-hyphen (­, or \xAD) where i want the word to break. This is only...

When using threads, you must make your code thread-safe. This can be done by either locking (mutexes) all data shared between threads, or by only using immutable data structures...

...Ruby core classes like String or Array are not immutable. There are several gems providing thread-safe collection classes in Ruby. concurrent-ruby The concurrent-ruby gem provides thread-safe...

makandra dev
blog.getbootstrap.com

Moved from Less to Sass. Bootstrap now compiles faster than ever thanks to Libsass, and we join an increasingly large community of Sass developers. Improved grid system...

...added a new grid tier to better target mobile devices and completely overhauled our semantic mixins. Opt-in flexbox support is here. The future is now—switch a boolean variable...

...wanted bundle update some_gem What is wrong Let's say your Gemfile asks for some-gem which you can see when running gem list but bundle show some-gem...

...just gives you an error: Could not find gem 'some-gem', in any of the sources Another indicator: Doing a bundle install --local breaks and bundle install installs every gem...

...you need to do it yourself. It's not that hard: Get more disk space Add an extra virtual hard disk to the machine with the disk size you want...

...the CD, open a terminal (on the guest, not the host!) and become root: sudo su fdisk -l to see the disk information. \ There should be one drive with some...

Spreewald gives you the within meta step that will constrain page inspection to a given scope. Unfortunately, this does not work with RSS feeds, as they're XML documents and...

...re inspecting XML that is invalid in HTML, you need to inspect the page source instead of the DOM. You may use Spreewald's "... in the HTML" meta step, or...

...and extract it:\ tar xvfz rubygems-1.3.7.tgz If you previously had RubyGems installed via apt: \ sudo apt-get remove rubygems Install RubyGems:\ cd rubygems-1.3.7 && sudo ruby setup.rb

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem If gem list does not show all gems you previously had, you can create a symlink to your old gem directory:\ cd /usr/local/lib/ruby && sudo...

...Consider this HTML: Hello World Lorem ipsum... Hello Universe Lorem ipsum... Now let's say you obtain a list of all such message containers as an array: messages = page.all('.message...

messages[0].find('h2', :text => 'Hello World').text => "Hello World" Now we search inside the same container as above, which contains "Hello World" as its headline. \

Most of the JavaScript snippets have code that manipulates the DOM. For that reason dom manipulating javascript code should have been executed after the DOM has loaded completely. That means...

...above would have the advantage not to pollute the global scope and to reduce unexpected side-effects...

...t requested an action for a while. Note that this is different from deleting sessions some time after the last login, which is the default. Also note that this is...

...probably a bad idea. Most sites keep sessions alive forever because having to sign in again and again is quite inconvenient for users and makes your conversion rates go down...

There's a simple way in bolt to run commands from a file without caring about BASH escaping: # /home/user/foo.sh echo "$(hostname -f): $(uptime)" echo "${USER}" echo "${SERVERLIST}" | bolt command run...

...foo.sh --run-as root --targets - Use script run to run a ruby script: #!/usr/bin/env ruby # /home/user/bar.rb puts 'Hello, world!' echo "${SERVERLIST}" | bolt script run ./bar.rb --targets...

...a great jQuery library to make (large) fields more usable. For Bootstrap 3 there is select2-bootstrap-theme. It won't work for Bootstrap 4, but rchavik's fork does...

...if you have some. @import ~bootstrap/scss/bootstrap/variables @import ~bootstrap/scss/bootstrap/mixins @import ~font-awesome/scss/font-awesome @import ~select2/src/scss/core @import ~select2-bootstrap-theme/src/select2-bootstrap4.vars @import ~select2-bootstrap-theme/src/select2-bootstrap @import ~select2-bootstrap-theme/src/select2-bootstrap4.after