...s $http service will strip that header when the request data (body) is blank. [1] This is possibly a misconception of RFC2616. Here is how to send GET requests with...
Content-Type:application/json Host:localhost User-Agent:(...) X-Force-Content-Type:application/json Yay. :) [1] The problem is even worse when using Restangular which itself does not even allow passing...
...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...
When deploying an application with "cap deploy" by default [1] you only deploy your code but do not run migrations. To avoid an application to be running with code which...
...usage") you should consider hooking them after restart so your application starts up earlier. [1] You may want to consider overwriting the default task to run migrations (instead of update...
cookies = cookies.to_s.split("\n") unless cookies.is_a?(Array) cookies.each do |cookie| name, value = cookie.match(/^([^=]*)=([^;]*);/)[1,2] @cookies[name] = value end This won't work when you there are empty lines...
...exactly what happened for me. That is how my cookie looked when debugging: (rdb:1) puts headers['Set-Cookie'] remember_token=abcdef123456; path=/; expires=Mon, 31-Dec...
positionFields = element.find('input[id$=position]') for position, i in positionFields $(position).val i + 1 Outside of forms, within lists, you may want to manually post the new positions to...
...sortable items (i.e. table rows), which are expected in format _ . For example, tr#position_13 and tr#position_15 will be turned into position[]=13&position[]=15, which neatly resolves...
...column by applying the proper limits (65535 bytes would be a text, up to 16777215 a mediumtext, and up to 4294967295 a longtext). Or if you know that you'll...
create_table 'example' do |t| t.integer :int # int (4 bytes, max 2,147,483,647) t.integer :int1, :limit => 1 # tinyint (1 byte, -128 to 127) t.integer :int2, :limit...
...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...
...translations on arrival_places.id = arrival_place_translations.place_id AND arrival_place_translations.locale = "en"') .order('departure_place_translations.name, arrival_place_translations.name') .where(ride_id: 1) .paginate(page: 1, per_page: 20) .preload( departure_place: :translations, arrival_place: :translations )
...cluster locale settings: psql -p 5435 ^ postgres=# SHOW LC_COLLATE; lc_collate ------------- en_US.UTF-8 (1 row) postgres=# SHOW LC_CTYPE; lc_ctype ------------- en_US.UTF-8 (1 row) You may also list...
...removed and another one added. $ git diff diff --git a/app/models/content_migration/photo.rb b/app/models/content_migration/photo.rb deleted file mode 100644 index fea2bca..0000000 --- a/app/models/content_migration/photo.rb +++ /dev/null @@ -1,42 +0,0 @@ -class ContentMigration::Photo < ActiveRecord::Base # ... # ...
...git a/app/models/content_migration/record/photo.rb b/app/models/content_migration/record/photo.rb new file mode 100644 index 0000000..2c8b70a --- /dev/null +++ b/app/models/content_migration/record/photo.rb @@ -0,0 +1,42 @@ +class ContentMigration::Record::Photo < ActiveRecord::Base # ... After: The diff shows that a file has...
...bin/spring stop pkill -f spring To prevent Spring from starting again: export DISABLE_SPRING=1
...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
{ :key => '_myapp_session', :domain => :all, # :all defaults to da tld length of 1, '.web' has length of 1 :tld_length => 2 # Top Level Domain (tld) length -> '*.myapp.web' has...
...server with lvh.me:3000 or anysubdomain.lvh.me:3000. Another way is, to add mysub.domain.web to /etc/hosts like 127.0.0.1 localhost mysub.domain.web Some developers suggest to write a rack middleware, but at the moment I...
@instance, @@class, $global = [ 'instance', 'class', 'global' ] puts "#@instance, #@@class, #$global" Infinite arrays ring = [1, 2, 3].cycle p ring.take(5) # => [1, 2, 3, 1, 2] I haven't made...
...in Ruby as defined by ISO 8601, use Date#cwday, which returns values in 1..7 (mind the range difference to Date#wday). The first week of the year is...
...it. All days in this week belong to the year. This means that January 1st, 2nd and 3rd may or may not be part of the previous year's last...
...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...
...zone name by doing time_object.zone. This zone is considered when doing time calculations, e.g. 10 AM CEST minus 8 AM UTC is zero. A datetime in MySQL does not have...
...a zone. It just stores the literal string "2010-05-01 12:00:00". That means that Rails must make assumptions about timestamps loaded from and written to MySQL.
...JavaScript Event objects, the DOM element that triggered the event is attached to them. [1] However, there are 2 "opinions" on which element that would be: The element that the...
...callbacks, you usually want to do things with the element they are bound to. [1] Note that some MouseEvents also have other targets...
...works only at the beginning of the matched string, looks for a number (\d+ [1]) and also captures that. Sweet. However, mind that your input will not be magically escaped...
...the string. Simply pass them as a second argument: new RegExp('foo', 'i'); # => /foo/i [1] Note that we need to say "\\d" in our string when we want our string...
...the same every time: expect(object).to receive(:foo).with('argument').and_return('response 1', 'response 2') If the argument list differs between invocations: expect(object).to receive(:foo).with...
...argument 1').ordered.and_return('response 1') expect(object).to receive(:foo).with('argument 2').ordered.and_return('response...
...class @NestedHash @read: (objekt, keys...) -> if objekt and keys.length @read objekt[keys[0]], keys[1...]... else objekt @write: (objekt, keys..., value) -> objekt ?= {} if keys.length key = keys[0] objekt[key] = @write...
...objekt[key], keys[1...]..., value) objekt else objekt = value Jasmine-Spec describe 'NestedHash', -> describe '.write()', -> it 'writes nested values to a hash', -> hash = {} NestedHash.write hash, 'level1', 'level2', 'value' expect(hash...
...thus keeping any extra attributes: var index = element.indexOf(subElement); if (index > -1) element.splice(index, 1...
...interaction was still possible. This apparently happens to all IntelliJ IDEs, especially on Ubuntu 14.04. I've managed to fix it by having a shell script that exports XMODIFIERS="" when...
...alternate solution suggested on the Jetbrains issue tracker is setting IBUS_ENABLE_SYNC_MODE=1. #!/bin/sh IBUS_ENABLE_SYNC_MODE=1 /home/arne/rubymine/bin/rubymine.sh This seems fix issues on RubyMine 8.
...ObjectInUse: ERROR: database "foo_development" is being accessed by other users DETAIL: There is 1 other session using the database. This could be the rails server, rubymine and many more...
...session connection manually you can also find out the pid and kill the process. 1. rails db 2. SELECT * FROM pg_stat_activity; datid | 98359 datname | foo_development