Skip to content

Instantly share code, notes, and snippets.

Avatar

Bartłomiej Danek bartlomiejdanek

View GitHub Profile
View import_date_stats_from_spark_export_backfill.rb
class ImportDateStatsFromSparkExportBackfill < ImportDateStatsFromSparkExport
FROM_DATE = Date.new(2016, 6, 1)
TO_DATE = Date.new(2017, 1, 18)
private
def process_location(location)
(FROM_DATE..TO_DATE).each do |date|
$backfill_date = date
Rails.logger.info "===> Importing for #{$backfill_date}"
@bartlomiejdanek
bartlomiejdanek / splitter.rb
Created Sep 23, 2013
split your csv files
View splitter.rb
require 'csv'
infile = ARGV[0]
slice = ARGV[1] || 100
origin = CSV.open infile
all_lines = origin.readlines
header = all_lines.first
all_lines.delete_at(0)
@bartlomiejdanek
bartlomiejdanek / hash_fail.rb
Created Apr 9, 2013
hash clone/dup/deep_dup fail
View hash_fail.rb
require 'active_support/core_ext/hash/deep_dup'
h = {a: {b: :c}, d: {e: {f: :g}}}
p "Base h: #{h.object_id}"
p "Base h[:a]: #{h[:a].object_id}"
p "Base h[:d][:e][:f] #{h[:d][:e][:f].object_id}"
puts "--------------------------------------------------------------"
_dup = h.dup
p "Dup h: #{_dup.object_id}"
p "Dup h[:a]: #{_dup[:a].object_id}"
p "Dup h[:d][:e][:f] #{_dup[:d][:e][:f].object_id}"
View gist:5161960
" Improve move speed
let g:boostmove=0
set updatetime=500
au CursorMoved * call BoostMoveON()
au CursorMovedI * call BoostMoveON()
au CursorHold * call BoostMoveOFF()
au CursorHoldI * call BoostMoveOFF()
function BoostMoveON()
if (winline() != line('$')) && (line('.') != 1)
if (winline() == winheight('.')) || (winline() == 1)
@bartlomiejdanek
bartlomiejdanek / poc_constantize
Created Feb 14, 2013
poc_constantize rails issue
View poc_constantize
➜ projects git clone git://github.com/stevo/poc_constantize.git
Cloning into 'poc_constantize'...
remote: Counting objects: 66, done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 66 (delta 2), reused 66 (delta 2)
Receiving objects: 100% (66/66), 26.54 KiB, done.
Resolving deltas: 100% (2/2), done.
➜ projects cd poc_constantize
➜ poc_constantize git:(master) rvm use 1.9.3@poc --create
Using /Users/bard/.rvm/gems/ruby-1.9.3-p385 with gemset poc
View pry-incremental-search-fix
$ rvm pkg install readline --verify-downloads 1
$ rvm install 1.9.3 --with-readline-dir=$rvm_path/usr --force
$ gem install pry
$ $ pry
(reverse-i-search)`':
[2] pry(main)>
View git_force_update_submodules
git submodule foreach 'echo $path `git checkout master --force; git pull --force`'
View algorytm_robienia_kawy.rb
# encoding: utf-8
module Selleo::Kuchnia
class PojemnikNaKapsułki
include Singleton
state_machine :initial => :pusty do
state :pusty
state :pełny