This gist shows how you could use apartment with searchkick, including a rake task that reindex all models/tenants.
This gist is used in this blog post: http://tiagoamaro.com.br/2014/12/11/multi-tenancy-with-searchkick/
curl -XPOST "http://localhost:9200/products/product/" -d' | |
{ | |
"name":"Ruby on Rails Jr. Spaghetti", | |
"price":16, | |
"available":true, | |
"total_on_hand":10, | |
"tax_category":"Roupas", | |
"variants":[ | |
{ | |
"id":4, |
This gist shows how you could use apartment with searchkick, including a rake task that reindex all models/tenants.
This gist is used in this blog post: http://tiagoamaro.com.br/2014/12/11/multi-tenancy-with-searchkick/
curl -i -H "X-Spree-Token: YOUR_TOKEN_ID" http://0.0.0.0:3000/api/products.json
curl -i -H "X-Spree-Token: YOUR_TOKEN_ID" http://0.0.0.0:3000/api/products/706676762.json
curl -i -X PUT -H "X-Spree-Token: YOUR_TOKEN_ID" -d "product[name]=Headphones" http://0.0.0.0:3000/api/products/706676762.json
function getQueryParams(qs) { | |
qs = qs.split("+").join(" "); | |
var params = {}, | |
tokens, | |
re = /[?&]?([^=]+)=([^&]*)/g; | |
while (tokens = re.exec(qs)) { | |
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); | |
} |
// config/environment.js | |
// This is not for production. But it will get your | |
// console to stop screaming errors if your messing | |
// around with ember cli | |
module.exports = function(environment) { | |
//lots of stuff | |
// <Add this chunk> |
$.ajax({ | |
url: "http://charles.lvh.me/api/products", | |
method: "GET", | |
contentType: "application/json; charset=utf-8", | |
crossDomain: true, | |
beforeSend: function(xhr){ | |
xhr.setRequestHeader('X-Spree-Token', 'a19d529a7ee5bc807a0b30b83adf998399f3c1804323f349'); | |
xhr.setRequestHeader('Access-Control-Allow-origin', '*'); | |
xhr.setRequestHeader('Access-Control-Allow-Methods', 'PUT, DELETE, GET'); | |
} |
// It is important to declare your variables. | |
(function() { | |
var foo = 'Hello, world!'; | |
print(foo); //=> Hello, world! | |
})(); | |
// Because if you don't, the become global variables. | |
(function() { |
conn = Faraday.new(url: 'http://veran.lvh.me:3000/', params: { token: 'ac350077d3066be3d2ca79fd0586e1b1d386b88a5870a1c0' }) do |f| | |
f.request :multipart | |
f.request :url_encoded | |
f.adapter :net_http | |
end | |
response = conn.post('api/products/abacate-embalagem-de-1kg/images',{image: {attachment: Faraday::UploadIO.new('./image.jpg', 'image/jpeg')}}) | |
## |
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-9.3 postgresql-contrib-9.3
you should succesfully installing postgresql 9.3.2 on your machine.
Prereq:
apt-get install zsh
apt-get install git-core
Getting zsh to work in ubuntu is weird, since sh
does not understand the source
command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh