A CLI for working with Postgres databases. Ships with auto-completion and syntax highlighting.
The API is a little confusing because animate
returns a reference to the element to enable chaining.
But you can do this:
$element.animate(...);
$element.promise().then(function() { ... });
jQuery comes with .animate()
that lets you transition 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 great, but it's not as smooth as a CSS transition.
Fortunately the animate
API can be mapped almo...
Databound provides Javascript a simple API to the Ruby on Rails CRUD.
Tries to expose a full model CRUD as an API. Not sure if this is useful for more refined requirements.
When you have an ngRepeat directive that uses track by
, be sure to move the track by
instructions to the very end of your statement, i.e. behind any filters.
Consider the following:
ng-repeat="child in category.children track by child.name | orderBy:'name'"
This will silently skip ordering; here is how AngularJS sees it (parentheses inserted to display binding strength):
ng-repeat="child in (category.children track by (child.name | orderBy:'name'))"
Moving track by
to the end will correctly...
Interesting approach to caching responses directly in the HTTP server, based on the value of an individual cookie.
No word yet how to force cache-invalidation.
Bourbon is a library of pure Sass mixins that are designed to be simple and easy to use. No configuration required. The mixins aim to be as vanilla as possible, meaning they should be as close to the original CSS syntax as possible.
The mixins contain vendor specific prefixes for all CSS3 properties for support amongst modern browsers. The prefixes also ensure graceful degradation for older browsers that support only CSS3 prefixed properties.
Cucumber will clean up files you've uploaded in your Cucumber features automatically with the attached code. Put the file in features/support/
.
RSpec::Matchers.define :be_naturally_sorted do
match do |array|
array == array.natural_sort
end
end
See RSpec: Where to put custom matchers and other support code. To use natural_sort
, see this card.
This matcher is now part of Spreewald.
This step will pass if the specified select is sorted.
Then /^the "(.*?)" select should be sorted$/ do |label, negate|
select = find_field(label)
options = select.all('option').reject { |o| o.value.nil? }
options.collect(&:text).each_cons(2) do |a,b|
(a.text.downcase <=> b.text.downcase).should <= 0
end
end
In conjunction with this custom matcher, the each_cons
block can be replaced with:
options.should be_naturally_sorted
Then the "Organizations" select should be sorted...
A set of javascript tools for working with files.
It offers different kinds of things:
File
objects.When HTML5 support is unavailable, it uses Flash polyfills.
Check out the documentation and demos at their GitHub page.
To install via bower, simply add the `...
Lightweight Angular JS directive to upload files
Includes polyfills for old IEs. Unfortunately, their auto-loading mechanism may not work properly on your Rails application due to the asset pipeline. They use FileAPI, so you could just include it manually for old browsers, or when you want to use FileAPI's toolkit anyway.
Chances are you're seeing the warning repeated a lot of times, maybe thousands of times. Here's how to reproduce the issue:
# bad code
(Time.current .. Time.current + 1.hour).include?(Time.current)
# Use Range#cover? instead of Range#include? since the former does no typecasting into integers.
(Time.current .. Time.current + 1.hour).cover?(Time.current)
# bad code
Post.where(:created_at => min_date.beginning_of_day .. max_date.end_of_day)
# Use 'BETWEEN x AND y'
Post.where(['posts.created_at BETWEEN...
Today in computer: In Coffeescript, on
and yes
are aliases for true
. off
and no
are aliases for false
.
Defining variables or functions with such a name will give you errors like this:
reserved word "true" can't be assigned
reserved word "false" can't be assigned
This will not be fixed.
It might happen that your Sidekiq queue gets stuck, hanging at 0% CPU load.
When we inspected the process using strace
we saw a blocking select
system call.
You can get backtraces for each thread by sending the TTIN
signal to the Sidekiq process like this:
kill -TTIN $process_id
If you have trouble updating something on FreeBSD you should always take a look in the UPDATING file.
For this error there is this solution which worked perfectly for me:
20141127:
AFFECTS: users of lang/perl5.*
AUTHOR: mat@FreeBSD.org
There was a nasty bug introduced in the update below, it was introduced in
svn revision 373476 and corrected in 373485. If you get errors looking like
this one:
===> Registering installation for p5-Params-Util-1.07_1 as automat...
The Angular 1.2 way:
# By default, angular returns undefined for invalid attributes which removes
# the value from the form field's ngModel (which means it's not sent to the
# server, and old values would not be overwritten).
#
# This directive makes sure that form fields with an invalid value return an
# empty string instead of undefined.
for elementType in ['input', 'textarea', 'select']
@app.directive elementType, ->
priority: 1
restrict: 'E'
require: '?ngModel'
link: (scope, element, attributes, ngModelControlle...
SELECT enum_range(NULL::portal) # Returns an array of all possible values
SELECT unnest(enum_range(NULL::portal)) # Unnests the array and returns a row for each value
Whereas portal is the enum type.
When you copy data from multi-line cells in LibreOffice Calc, quotation marks are automatically added, which you may not want.
For example with license keys:
09:46:24 [✔] pascal:~> icdiff license license_copy
license license_copy
===== LICENSE BEGIN ===== "===== LICENSE BEGIN =====
00000yIeXfhGSbt"yULWQR9n 00000yIeXfhGSbt""yULWQR9n
olysFAv105bHmKOiqbxRX"Yr ...
Angular 1.3 offers $setDirty
for your ngModelController. If you are stuck on Angular 1.2, do this:
model.$setViewValue(model.$viewValue)
This turns the model dirty, while keeping its value.
When using git diff
, you might encounter weird characters where umlauts (or any other UTF-8) characters should be. It looks like this:
R<C3><BC>ckg<C3><A4>ngig # should be "Rückgängig"
However, not Git is to blame but the less
command that Git uses to page your diff output.
You need to tell less
to use UTF-8 (otherwise it tries to convert multibyte chars like "ü" which is represented by 2 bytes C3 and BC).
$ LESSCHARSET=UT...
Note: Consider not doing this. Use form models or vanilla methods instead.
The :conditions
option for Rails associations cannot take a lambda. This makes it hard to define conditions that must be evaluated at runtime, e.g. if the condition refers to the current date or other attributes.
A hack to fix this is to use faux string interpolation in a single-quoted :conditions
string:
class User < ActiveRecord::Base
has_many :contracts
has_one :current_contract, :class_name => 'Contract', :conditions => '...
Traveling Ruby is a project which supplies self-contained, "portable" Ruby binaries: Ruby binaries that can run on any Linux distribution and any OS X machine. This allows Ruby app developers to bundle these binaries with their Ruby app, so that they can distribute a single package to end users, without needing end users to first install Ruby or gems.
A lot of the advice involves less separations of concerns in your code ("don't use $watch", "don't use isolated scopes"), but it's a nice summary of what eats time in Angular.
Note that for the purpose of this article "large" mostly mean "large number of watchers/bindings on a single screen". Angular doesn't automatically become large just because you have a lot of screens.