Skip to content

Instantly share code, notes, and snippets.

View umar-webonise's full-sized avatar

Umar Siddiqui umar-webonise

View GitHub Profile
@umar-webonise
umar-webonise / kiba_etl_aggr.etl
Created July 2, 2015 04:32
A way to handle aggregation
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"}
@umar-webonise
umar-webonise / include_extend.rb
Created July 21, 2015 13:13
Best Way to Include and Extend a Module Method
module Swingable
def self.included(base)
base.extend(Swingable)
end
def swing
puts 'Did a swing!'
end
end
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 }
@umar-webonise
umar-webonise / ionic.setup
Last active September 8, 2015 09:25
Ionic Setup
# 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
@umar-webonise
umar-webonise / add_client.rb
Last active September 3, 2015 14:10
Added Client in treeni Data Management
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) }
@umar-webonise
umar-webonise / gist:2deec22b048e6fa02925
Created September 19, 2015 05:25
Sublime text settings
{
"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,