This file contains 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
{ | |
"theme": "El Capitan.sublime-theme", | |
"el_capitan_font_default": false, | |
"el_capitan_font_san_francisco": false, | |
"el_capitan_font_helvetica_neue": false, | |
"el_capitan_font_helvetica": false, | |
"el_capitan_sidebar_blue_folders": false, | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"draw_white_space": "all", | |
"font_size": 12, |
This file contains 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
client = Client.new(name: 'Treeni') | |
client.save! | |
files = Dir["app/models/*.rb"] | |
models = files.map { |file| file.split('/').last.sub(/\.rb/, '').camelize.constantize }.select { |i| i != Client } | |
models.each { |model| model.update_all(client_id: client._id) } |
This file contains 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
# Install java | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer | |
# Install ubuntu-developer-tools-center | |
sudo add-apt-repository ppa:didrocks/ubuntu-developer-tools-center |
This file contains 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
sections = Section.includes(:questions).as_json( | |
only: [:_id, :id, :name, :description, :template_id, :section_id], | |
include: { | |
questions: { | |
only: [:_id, :description, :helptext] | |
} | |
} | |
) | |
section_hash = sections.index_by { |node| node['_id'].to_s } |
This file contains 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
module Swingable | |
def self.included(base) | |
base.extend(Swingable) | |
end | |
def swing | |
puts 'Did a swing!' | |
end | |
end |
This file contains 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
source CsvSource, {"type"=>"csv", "file"=>{"path"=>"/home/webonise/Projects/Data-Integration/dump/users.csv"}, "options"=>{"col_sep"=>";"}} | |
transform RenameField, {"from"=>"euro", "to"=>"amount_euro"} | |
destination AggregateFieldsDestination,{ 'file' => { 'path' =>'dump/1435811412.csv'}, 'options' => {"group_by"=>["name"], "sum"=>"amount_euro"} } | |
source CsvSource,{ 'file' => { 'path' => 'dump/1435811412.csv' },'options' => {'col_sep' => ',' } } | |
transform RenameField, {"from"=>"amount_euro", "to"=>"euro"} |
This file contains 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
{ | |
'source' => { | |
'type' => 'csv', | |
'file' => { | |
'path' => '/home/webonise/Projects/Data-Integration/dump/test.csv' | |
}, | |
'options' => { | |
'col_sep' => ',' | |
} | |
}, |
This file contains 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
development: | |
# Configure available database sessions. (required) | |
sessions: | |
# Defines the default session. (required) | |
default: | |
# Defines the name of the default database that Mongoid can connect to. | |
# (required). | |
database: treeni_development | |
# Provides the hosts the default session can connect to. Must be an array | |
# of host:port pairs. (required) |
This file contains 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
# Patch for mongoid to return $oid instead of active record id | |
class << self | |
def serialize_from_session(key, _salt) | |
to_adapter.get(key[0]) | |
end | |
end |
This file contains 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
# place code in config/initializers/bson.rb | |
module BSON | |
class ObjectId | |
def as_json(*args) | |
to_s | |
end | |
end | |
end |
NewerOlder