makandra dev

It's like a GUI for the famous git add [-p]. Select files with the up/down-keys and hit u for staging/unstaging the whole file Enter for showing the diff of...

j and k to navigate in the diff u again to stage/unstage chunks 1 to stage/unstage only lines \ to split large chunks F5 to refresh the view

...To reconfigure later, call s3cmd --configure. Once you're done setting up, s3cmd gives you shell-like commands like s3cmd ls or s3cmd del somefile.png. Here is a full list...

s3cmd accesslog s3://BUCKET Sign arbitrary string using the secret key s3cmd sign STRING-TO-SIGN Sign an S3 URL to provide limited public access with expiry

github.com

FactoryBot allows a :class option to its factory definitions, to set the class to construct. However, this option is not supported for traits. Most often, you can just define a...

If you need/want to use traits instead (for example, it might make more sense semantically), you can not use a :class on a trait. In that case, use initialize...

Let's say you have two screens: Show a given project Show a report for all projects Ideally you want both screens to be handled by different controllers like this...

...action ProjectsController#report. But these are all unsatisfying. What you can do is wrap the sub-resource in a collection block like you would do with custom collection actions:

makandra dev

Using CSS sprites for background images is a technique for optimizing page load time by combining smaller images into a larger image sprite. There are ongoing arguments on how useful...

...this still is, as modern browsers become more comfortable to load images in parallel. However, many major websites still use them, for example amazon, facebook, or twitter.

We often use VCR to stub external APIs. Unfortunately VCR can have problems matching requests to recorded cassettes, and these issues are often hard to debug. VCR's error messages...

...any way it will assume an error, because it can not know how the system it mocks would answer a request it has not yet recorded. Some signs an error...

makandra Curriculum

...offers an 8 month paid trainee program 🇩🇪 for junior developers that are looking to start a professional career in web development. This curriculum contains goals, resources and code exercises for...

...When an exercise asks you to do multiple versions, these should be reviewable as separate commits or branches. After the review with mentor you can keep the best version and...

...may want to know the current commit. [1]\ Luckily, there is lots of useful stuff in the .git directory. Commit hash that you are currently applying cat .git/rebase-merge/stopped-sha

...you want to inspect the original commit for its changes, for example like: git show `cat .git/rebase-merge/stopped-sha` Current commit's message cat .git/rebase-merge/message In case you forgot what the changes...

...signal("mouse::enter", function(c) local focused = client.focus if focused and focused.class == c.class and focused.instance == "sun-awt-X11-XDialogPeer" and c.instance == "sun-awt-X11-XFramePeer" then return end if awful.layout.get...

...change that one). Known issues This will not affect "find anything" as IntelliJ uses a sun-awt-X11-XFramePeer for it. There are no properties which allow distinguishing the "find...

makandra dev

The Capybara API is somewhat hard for parse for a list of methods you can call on a Capybara node. Below you can find such a list. It's all...

...credit goes to the Capybara committers. When you talk to Capybara from a Cucumber step definition, you always have page as the document root node, or whatever you scoped to...

developer.mozilla.org

Having your site run on SSL is worthless when you include content over an unsafe connection (HTTP). Here is how to hunt down mixed content with Firefox.

...on pages (mine did not), you can enable it again: Visit about:config and search for security.warn_viewing_mixed. If it's set to false, set it back to true...

...truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. This will cause horrible, data-destroying bugs...

...this reason you should probably not use GROUP_CONCAT ever. At least you must set the value of group_concat_max_len to an insanely high value on every database...

...have a useful blank? method. It returns true for nil but also for empty strings or empty arrays. There is also a universal method present? which returns true for all...

...may also use up.util.isBlank(). By default, this function returns true for: undefined null Empty strings Empty arrays A plain object without own enumerable properties All other arguments return false.

makandra dev

gem install ruby-debug (Ruby 1.8) or gem install debugger (Ruby 1.9) Start your server with script/server --debugger Set a breakpoint by invoking debugger anywhere in your code...

...path that crosses the breakpoint Once you reach the breakpoint, the page loading will seem to "hang". Switch to the shell you started the server with. That shell will be...

Running Cucumber tests while your cucumber.yml is 100% valid may still produce the following error. cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on...

If you need to capture signatures on an IPad or similar device, you can use Thomas J Bradley's excellent Signature Pad plugin for jQuery. To implement, just follow the...

...steps on the Github page. The form If you have a model Signature with name: string, signature: text, you can use it with regular rails form like this:

...CSS but it does not fit fancy requirements. Here is a hack for the special case where you want to truncate one of two strings in one line that can...

...both vary in length, while fully keeping one of them. See this example screenshot where we never want to show an ellipsis for the distance: You can try pretty hard...

Microsoft Exchange service administrators can enable Exchange Web Services (EWS) which is a rather accessible XML API for interacting with Exchange. This allows you to read and send e-mails...

...meeting attendees, track responses, manage to-do tasks, check user availability and all other sorts of things that are usually only accessible from Outlook. You can implement an EWS by...

developer.squareup.com

We're pleased to announce Ruby 3’s new language for type signatures, RBS. One of the long-stated goals for Ruby 3 has been to add type checking tooling...

...discussion with Matz and the Ruby committer team, we decided to take the incremental step of adding a foundational type signature language called “RBS,” which will ship with Ruby...

Sometimes, you may want to open up a second database connection, to a read slave or another database. When doing that, you must make sure you don't overwrite an...

...will actually cause all kinds of trouble: def with_other_database ActiveRecord::Base.establish_connection(slave_settings) yield ensure ActiveRecord::Base.establish_connection(master_settings) end Putting aside that you are setting...

...application you often need to move data between the client (HTML, Javascript) and the server (Ruby, Rails). Step 1: Moving HTML snippets Add a find-as-you-type search to...

...should be able to use it like this: var query = // ... search(query).then(function(html) { $('.search-results').html(html) }) Please make sure that you don't duplicate view code. Both...

Sometimes you need to monitor a connection from your machine to a specific, single host or network in order to identify which network hop between your machine and the target...

...causes trouble. You can use the following shell script to easily achieve this kind of monitoring. If the target host is unable to respond to the specified number of ICMP...

...did not happen yet you should use cap deploy:migrations. The problem Let's say that you have something like that in your config/deploy.rb to create a database dump every...

...called for cap deploy:migrations. The same applies to other things that are hooked similarly, like an after 'deploy', 'craken:install'. How to avoid it When looking at the default...

...are close to given coordinates you can use the Graticule gem. Graticule Graticule offers several methods to compute the distance between two geo-dated objects but fetching records from the...

...radius of a location is a bit trickier: def close_destinations(latitude, longitude) distance_sql = Graticule::Distance::Spherical.to_sql(:latitude => latitude, :longitude => longitude, :units => :kilometers) Destination.all(:conditions => [ "#{distance_sql...