This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pomegranate import * | |
from pomegranate.parallel import log_probability | |
from pomegranate.io import SequenceGenerator | |
from pomegranate.kmeans import Kmeans | |
from pomegranate.distributions.IndependentComponentsDistribution import IndependentComponentsDistribution | |
from pomegranate.kmeans import Kmeans | |
from pomegranate.io import SequenceGenerator | |
import numpy | |
#get code from pomegranate lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gunzip *.gz #descompacto todos os arquivos de sitemap | |
OLD="www.dominio.com.br" | |
NEW="m.dominio.com.br" | |
TFILE="/tmp/out.tmp.$$" | |
# Fara a troca apenas nos arquivos de sitemap723.xml a sitemap956.xml | |
#Caso precise trocar em todos arquivos de um diretorio, basta trocar por um * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- solrconfig.xml --> | |
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> | |
<lst name="defaults"> | |
<str name="config">data-config.xml</str> | |
<str name="update.chain">uuid</str> <!-- ADD THIS LINE--> | |
</lst> | |
</requestHandler> | |
<updateRequestProcessorChain name="uuid"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if(!$hideCompanyLogo) | |
#if($companyHasMainPhoto) | |
<a href="#" class="lnkAvatarMini" id="lnkAvatarMini"> | |
<img src="$companyMainPhotoThumb" onerror="this.src='$imageMissing'" style="width: 45px; height: 45px;"> | |
</a> | |
#else | |
<a href="#" class="lnkAvatarMini" id="lnkAvatarMini">$companyFirstLetterName</a> | |
#end | |
#end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/model/store.rb | |
has_many :categories | |
#app/model/category.rb | |
acts_as_tree :order => :name | |
belong_to :store | |
#Desejamos que no cadastro de categoria no activeadmin seja possível associar uma loja e um sub-categoria para a nova categoria. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# chkconfig: 2345 70 40 | |
# description: elasticsearch startup script | |
# author: Matt Reid | |
# websites: http://themattreid.com | |
# license: GPL v2 | |
# date: 2012-12-06 | |
# version: 0000.1 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
belongs_to :address | |
accepts_nested_attributes_for :address #Para permitir usar address_attributes | |
def to_custom_json | |
hash = self.to_json(:include => :address, :except => [:address_id, :address_id]) | |
hash.sub("address", "address_attributes") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
belongs_to :address | |
accepts_nested_attributes_for :address #Para permitir usar address_attributes | |
def to_custom_json | |
hash = self.to_json(:include => :address, :except => [:address_id, :address_id]) | |
hash.sub("address", "address_attributes") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#apps/views/seuform.html.erb | |
f.input :image_id, :as => :img, :collection => ActiveAdmin::ApplicationHelper.all_images, :label => "Imagens" | |
=begin | |
O Collection geralmente seria um map com o id e value de cada item, mas no meu exemplo, o value é a url da imagem | |
e coloquei um terceiro valor para o endereço da imagem original que será usado no href do thumb da imagem. | |
=end | |
#/app/helpers/active_admin/application_helper.rb | |
def self.all_images |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/inputs/custom_input.rb | |
class DatePickerInput | |
include Formtastic::Inputs::Base | |
def to_html | |
<input type="text" class="custom"> | |
end | |
end | |
=begin E para usar seu componente customizado basta colocar :as = :custom onde :custom é o prefixo do seu componente | |
customizado definido no arquivo custom.input.rb |
NewerOlder