Joined February 2012
·
Photo on 08.01.2013 at 04.15

Adam Stankiewicz

Ruby & JS at Monterail.com
Ruby & JS
Monterail.com
·
Poland
·
·
·

Posted to Redis can't save in background over 1 year ago

Thanks! it solved my problem too.

Posted to Speed up your zsh completions over 1 year ago

Sincerely I don't know. I found it somewhere on the Internets.

Posted to Using bitmasks to store settings over 1 year ago
  1. If you're using bitmaps in-memory you need to allocate more memory for objects to work with them than the save you space.
  2. If you're using bitmaps in database you cannot work with this data in any sensible way (no indexes, no clean queries), so you use bitfield just as crippled storage format. Moreover each database has it's own, performant and indexable structures to store such data.

Not mentioning I'd never scarify system and code readability to save few bytes of space per record. Sounds like premature optimisation, eh?

In Ruby you get neither of performance, code readability, lower storage/memory space, data normalisation, good query interface. There is literally no advantage.

Posted to Faster Git Clones over 1 year ago

It causes a lot of problems, I speak from experience.

Posted to Using bitmasks to store settings over 1 year ago

bitmaps in ruby? you gotta be kidding

Posted to setup docker client in mac over 1 year ago
  1. You can use homebrew/binary tap where you can install docker
  2. You can use DOCKER_HOST variable instead of an alias: https://github.com/dotcloud/docker/pull/3303

You don't need an alias. Docker supports now DOCKER_HOST env variable:
https://github.com/dotcloud/docker/pull/3303

It's probably better to look at my pull-request, because I made some fixes: https://github.com/sheerun/rails4-bootstrap/issues/26

Posted to Don't git commit -m "merge" over 1 year ago

@growtofill Yeah, you're right. I'm too used to it.

Promises are good to avoid callback hell.

I wrote little more enhanced version of this (layouts, fallback to generic error page, hiding of 500 error messages in production): https://github.com/sheerun/rails4-bootstrap/commit/5c2df5a108ad204bc407183b959bb355ff5ed53d

Posted to Using Angular.js and Uglify in Rails? over 1 year ago

Or more precisely:

config.assets.js_compressor = Uglifier.new(:beautify => true) if defined? Uglifier

Posted to Using Angular.js and Uglify in Rails? over 1 year ago

Uglify.new should be Uglifier.new

Posted to Few ways to quit Vim over 1 year ago

@shawncplus Thank you for noticing it. I fixed the protip.

Posted to Meet ruby-local-exec over 1 year ago

@cassianoleal Thank you. I think I'll just remove this protip.

Posted to Force SSH session exit over 1 year ago

@eugeny It won't work if you run something that traps signal that Ctrl-D sends.

@johnhunt Can't be. Ensure ls -l returns -rwsr-sr--

Btw. I've updated protip so commands are shorter.

Posted to Use only antigen in your .zshrc over 1 year ago

I used prezto for some time and it was less pleasurable than oh-my-zsh. If it matches your preferences, you can use antigen use prezto in .zshrc :)

Posted to css inline-block ie7 hack over 1 year ago

@basiclines I don't like hacks like that.
@subicura You don't need to put that * if you use if IE 7. This is hack.

nice

Posted to Quickly navigating branches in Git over 1 year ago

You can switch to last used branch by typing git checkout -

Posted to Syntax highlighting for zsh over 1 year ago

I also recommend using antigen.

Posted to Bash/Sh as a template engine over 1 year ago

nice. here is my solution (it parses only lines beginning with $)

Posted to The single most useful thing in bash over 1 year ago

@ipetepete Actually I prefer antigen, and enhancing zsh by myself :)

Hmm. OSX. I've changed the code.

Posted to Ignore changes in tracked files over 1 year ago

Because every time you checkout -f or git reset, you lose changes in that file

Posted to Enable syntax highlight in less! over 1 year ago

@0xnan Thank you for noticing this :) I've updated the protip.

I'd like to know how to put methods in class so it behaves as module as fat as we talk about "include" behavior :)

@niloct It did for me. Ensure which vim is returning the correct binary.

Posted to Ruby -ane as awk replacement over 1 year ago

@telemachus wow, that's pretty good article :) thank you for the comment!

@kablamo You are actually right. This is protip from the time I was searching fot the method to manage my dotfiles. I've used it for a moment, but it seemed overly complicated as you say.

Finally I've chosen the way cowboy does it. You can view my still-in-progress dotfiles on my Github. The main difference is, cowboy uses bash and no framework, and I use zsh + prezto.

Thank you for the comment!

Posted to Faster way to reset database entries over 1 year ago

Both MySQL and PostgreSQL are supported?

Awesome idea!

If you need just view the file, probably less +1000 bigfile is faster and more user friendly.

Posted to Reading Manpages with Vim over 1 year ago

It doesn't on Mac OS

Posted to Occasionally removed all Brew links? over 1 year ago

Isn't brew list | xargs brew link enough?

Posted to Lost connection to ssh-agent in tmux over 1 year ago

I find tmux useful only on server as on Mac OS iTerm2 is more than enough (if you're pair programming, it's probably better to connect on server anyway). I had a LOT of problems similar to this when using locally (clipboard, scrolling, encoding etc.)

Thank you.

Posted to Easy access to a web server over 1 year ago

That python server is cliche for me :) Also touch is not necessary.

Good article, horrible blog design :)

Posted to Git always rebase on git pull over 1 year ago

It's also good to set up git config --global git-up.rebase.arguments --preserve-merges. Please read my comment.

Maybe some short explanation?

Posted to Coderwall - Markdown Cheat Sheet over 1 year ago

@coderwall - please fix that highlighting!

Posted to Better commit messages over 1 year ago

I like the second version with "add" changed to "feature" and no sys and misc tags. Just don't use any prefix (but try to avoid it).

Posted to Less command: edit file shortcut over 1 year ago

@dmedvinsky They probably don't accept such parameters as %f

Posted to Use Sublime Text 2 as Git mergetool over 1 year ago

@jchannon You must ensure you have subl command in your path that launches sublime text

Posted to Top 10 ips of your webserver logs over 1 year ago

I'd rather see some grep :)

Add this piece of code to the brew repository :)

Posted to Coderwall - Markdown Cheat Sheet over 1 year ago

there is no way to do it afair

Posted to HTML 'hidden' attribute over 1 year ago

this is sass polyfill :)

Posted to CeBo is not enough over 1 year ago

You can also use following option that enables squash by default:
git config --global --bool rebase.autosquash true

Posted to fast comparison over 1 year ago

Interestingly enough .sum method is only available in ActiveSupport

Posted to Delete local and remote Git branches over 1 year ago

git push origin :mybranch actually mean push local branch "" (empty branch) to branch "mybranch" on origin. You can also push other local branches. Example: git push heroku develop:master, that pushes local develop branch to master on heroku.

In company we agreed to use git-up tool, that rebases changes on pull, if there are any conflicts. The --preserve-merges flag is quite important when doing git rebase, or you'll flatten your --no-ff feature merges. See: https://github.com/monterail/rules

Posted to Rename a branch in git over 1 year ago

git branch --move oldbranch newbranch could be more verbose

Posted to Remove a git submodule over 1 year ago

Why subprojects have to be so difficult...

Nice, but for such things I prefer gui.

To commit changes again you have to revert the revert commit.

Also, you can revert whole feature if it was merged with --no-ff flag. Just revert the merge commit and you're done.

Posted to Dumb JavaScript string interpolation over 1 year ago

Coffeescript :)

@mcansky Thank you for clarification. I've updated the protip to include your comment.

+1 for rbenv, sorry :)

Posted to Coderwall - Markdown Cheat Sheet over 1 year ago

This protip beautifully shows how ugly is syntax coloring and fonts for code on coderwall.. It's like random...

Posted to Create hex dump of given file over 1 year ago

Actually hexdump command seems better replacement.
I'll change this protip in the future...

Posted to git clone github:user/repo over 1 year ago

No ruby needed.

Posted to Map with class' method over 1 year ago

@richoh Nope. method returns Method class, and we need to pass block. afaik ampersand operator is the only way to convert proc / lambda / method to block.

no asl for me. maybe you should include that in the title.

Posted to Copy To Clipboard Your Public SSH Key over 1 year ago

osx tag please :)

Actually ri is quite helpful. I'd stay only with --no-rdoc

Posted to Lightweight Mixins in CoffeeScript over 1 year ago

That wrapper code begs for some helper.

For would be more useful if it was sugar on map and flatMap like in Scala. Anyway, good to know. Thanks.

Posted to LESS vs SASS? My choise is SASS over 1 year ago

@delros I have no professional experience with Stylus, although I've read all the documentation and it seems extremely well designed and coherent.

Posted to LESS vs SASS? My choise is SASS over 1 year ago

I'd be interested in SCSS vs Stylus comparison.

Install oh-my-zsh and enable sublime plugin.

Posted to The single most useful thing in bash over 1 year ago

install zsh ;)

Posted to Keep a git fork up to date over 1 year ago

You may be interested in git up http://coderwall.com/p/wdpzgw

It's only time when someone someone forgets assume-unchanged and commits his passwords. It should be probably used with some sort of init script or git's smudge and clean filters.

*.example files are the safest option I know so far.

Posted to Serving static sites with rack over 1 year ago

I you want to setup local address for static site quick, then http://anvilformac.com/ is awesome.

Posted to Git immersion over 1 year ago

I just touches the surface though :) A site where you can do real-life git challenges would be awesome.

Posted to Floats over 1 year ago

You can use big decimals if you require arbitrary precision:
require 'bigdecimal'; (BigDecimal.new("5.9") - BigDecimal.new("5.8")).to_f

Posted to Some things are !important; over 1 year ago

That's because of another CSS silly behavior. The order of rules matters less than number of elements in selector. If you wrote '.container p' then everything would be OK, because it contains one tag selector and one class selector, as well as 'p.notification ', so the order now matters.

You can use SCSS to avoid such problems (although compiled CSS will be much bigger).

Posted to Some things are !important; over 1 year ago

Another reason why you should never use IDs in styling.

@i-arindam I've fixed that, thank you :)

The best thing: it's supported even by IE6..

Posted to The result of n << n over 1 year ago

Array in ruby contains "pointers" to other objects. You're just adding pointer to array itself. Interesting though.

You can also add an ampersand to system command. It prevents lag after each commit, so you don't have to wait for camera to take a picture: system "imagesnap -q -w 3 #{file} &"

You can also skip sudo and link to /usr/local/bin/subl

It's probably better to create bare "hosting" repository in Dropbox rather than directly linking. That way you get rid of constant traffic on saving files, temporary caches, etc. So:

git clone . ~/Dropbox/repo &&
git remote add origin ~/Dropbox/repo &&
git push origin master
Achievements
4,401 Karma
226,023 Total ProTip Views