Icon font: little CPU load (no JavaScript) fonts are relatively large 1 extra HTTP request Javascript + inline SVG: higher CPU load (needs to watch the DOM via...

no extra HTTP requests SVG sprites: largest file size, hard to subset 1 extra HTTP request In practice there are probably additional performance tradeoffs. Luckily, there is a...

...projects, :analytic_stats, :jsonb) Project.reset_column_information Project.find_each do |project| project.analytic_stats = { version: 1, analytics_url: nil, clicks_this_week: 0, clicks_this_month: 0, clicks_this_year...

...ApplicationRecord validate :validate_analytic_stats_against_json_schema has_defaults( analytic_stats: proc { { version: 1, analytics_url: nil, clicks_this_week: 0, clicks_this_month: 0, clicks_this_year...

makandra dev
innig.net

...closure-like entities? "return" returns from closure True closure? or declaring context...? Arity check? --------------- ----------------------------- ------------------- 1. block (called with yield) N declaring no 2. block (&b => f(&b) => yield) N declaring...

...Y except return declaring warn on too few 5. proc <<< alias for lambda in 1.8, Proc.new in 1.9 >>> 6. lambda Y closure yes, except arity 1 7. method Y closure...

makandra dev

...attached file into config/initializers/ to be able to say in_columns on any Array: >> [1, 2, 3, 4, 5, 6, 7].in_columns(3)

...1, 2, 3, 4, 5, 6, 7].in_columns(2) => [[1, 3, 5, 7], [2, 4, 6]] While in_groups and in_groups_of are provided by Rails this also...

...look at their titles like this: messages[0].find('h2').text => "Hello World" messages[1].find('h2').text => "Hello Universe" So far, so good. Now we want to find titles...

...using a "full" selector to avoid the broken behavior: page.find('.message:nth-of-type(1)', :text => 'Hello World').text => "Hello World" page.find('.message:nth-of-type(2)', :text => 'Hello World...

def hello 'world' end ^ $ git blame foo d47bf443 (Arne Hartherz 2012-12-19 14:44:38 +0100 1) def hello d47bf443 (Arne Hartherz 2012-12-19 14...

d47bf443 (Arne Hartherz 2012-12-19 14:44:38 +0100 3) end Now it's being changed to: def hello if world? 'world' else 'universe' end end

...gitlab-rails console. Remove GitLab Labels from already closed Issues p = Project.find_by_id(1) labels_to_remove = [3, 4, 1, 84, 86] # Scheduled, Active, This Week, One Week, Two...

...Active, This Week, One Week, Two Weeks with the respective label ids 3, 4, 1, 84, 86 which leads to the above code snipped...

:T_MODULE=>44, :T_FLOAT=>4, :T_STRING=>65685, :T_REGEXP=>137, :T_ARRAY=>984, :T_HASH=>87, :T_STRUCT=>12, :T_BIGNUM=>2,

:T_COMPLEX=>1, :T_SYMBOL=>29, :T_IMEMO=>5008, :T_ICLASS=>49} Look out for a number that keeps growing over time. Rails In a Rails application...

Observed on Rails 2.3 and machinist 1.0.6 Like the title says, when you define the method empty? like in the following example, you may not longer use collection.make.

...has_many :pages def empty? pages.empty? end end Assuming b1 = Book.find(1) b2 = Book.find(2) instead of expected b1.pages.make #=> #<Page id: 1, book_id: 1> b2.pages.make #=> #<Page id: 2, book...

...a vertical output. You know this: mysql> SELECT * FROM users; +----+---------+---------------------+-----------------+ | id | name | email | greeting | +----+---------+---------------------+-----------------+ | 1 | Alice | alice@example.com | Hello world! | | 2 | Bob | bob@example.com | Hello universe! | | 3 | Charlie | charlie@example.com | Hi mom...

This is how it looks like vertically: mysql> SELECT * FROM users \G *************************** 1. row *************************** id: 1 name: Alice email: alice@example.com greeting: Hello world! *************************** 2. row *************************** id: 2

...to read a cookie's value, you need to parse the string: document.cookie.match(/hello=([^;]+)/)[1] // => "universe" Set a cookie Setting cookies works as simple as this: document.cookie = "yes=please"

...for can be set as part of the string: document.cookie = "yes=please; expires=Sun, 1 May 2016 13:37:00 UTC; path=/" Important: If you do not set a path...

...browser based test runner. Should be easily adaptable to a pure Webpack setup. Step 1: Install Jasmine yarn add jasmine-core Step 2: Add two separate packs

...you could then test it like this: get :index persisted_session[:page_views].should == 1 # session[:page_views] is 1, so that would still work get :index persisted_session[:page...

...views].should == 2 # session[:page_views] would be 1, even though it works in the real world

...of objects, uniq does not work as expected, since it uses strict equality. So [[1], [1]].uniq() == [[1], [1]] In some cases, this might be a workaround: [[1], [1]].invoke...

...toJSON").uniq().invoke("evalJSON")

...total is either memoized itself, or using some # private memoized method subject.seat_counts = [5, 1] subject.seat_total.reload.should == 6 # => Still 5 end You might be tempted to manually unmemoize any memoized internal...

...fiddling with internal state. When writing tests, stay on your chosen abstraction level. Solution 1 record.unmemoize_all Solution 2 Perform a full reload by re-finding your record:

marvin.soup.io

...this problem when you update your FreeBSD Ports: ===>>> Launching child to update ruby19-iconv-1.9.3.547,1 to ruby20-iconv-2.0.0.576,1 ===>>> All >> ruby19-iconv-1.9.3.547,1 (17/17) ===>>> Currently installed version...

...ruby19-iconv-1.9.3.547,1 ===>>> Port directory: /usr/ports/converters/ruby-iconv ===>>> This port is marked IGNORE ===>>> Not needed with Ruby 2.0 or newer ===>>> If you are sure you can build it, remove the IGNORE...

...occurs in sliders with HTML content. The issue When a slider contains a composited[1] element, the element will overlap any other element when sliding, being rendered as frontmost element...

...or fully, e.g. by using z-index) B is rendered in its own layer[1] C is moved with a CSS transition the transition moves A and B in from...

trac.nginx.org

...increase test_types_hash_bucket_size: 64 nginx: configuration file /etc/nginx/nginx.conf test failed Option 1: Use gzip_types *; If you don't care about which MIME type gets the gzip...

...change their title from the prompt, run this function: function tab_title { if [ -z "$1" ] then title=${PWD##*/} # current directory else title=$1 # first param fi

...array for e.g. one level, it takes an optional argument. # Flattens the array recursively >> [1, [2, [3]]].flatten => [1, 2, 3] # Flattens the array the given number of times

...say you want to merge the properties of two JavaScript objects: let a = { foo: 1, bar: 2 } let b = { bar: 3, baz: 4 } let merged = merge(a, b) // => { foo: 1...

...sed -E 's/:[0-9]+: .*//'`" line_number="`echo $line | sed -E 's/.*:([0-9]+).*/\1/'`" else file="`echo $line | sed -r 's/:[0-9]+: .*//'`" line_number="`echo $line | sed -r...

...s/.*:([0-9]+).*/\1/'`" fi # since $file in working directory isn't always equal to $file in index, # we backup it; thereby we can add our whitespace fixes without accidently...

...some CSS selectors: function floatIn($element) { $element.css({ 'opacity': 0, 'margin-top': 200px }); $element.animate({ 'opacity': 1, 'margin-top': 0 }, { duration: 500 }); } The animation is implemented using setInterval and Javascript. This works...

...as smooth as a CSS transition. Fortunately the animate API can be mapped almost 1:1 to CSS transitions. There are libraries like Transit that act as a drop-in...

makandra dev
semaphoreci.com

...used anywhere inside the Rake tasks. See #Resources at the bottom for examples. Step 1: Upgrade guide For migration from 2 to 3, follow this tutorial: Capistrano 3 Upgrade Guide...

Use the new syntax instead: set :ssh_options, {...

wrong number of arguments (1 for 2) undefined method `tail' for nil:NilClass You need to wrap your task body...