I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
<?xml version="1.0"?> | |
<project name="Demo" default="version" basedir="."> | |
<macrodef name="git"> | |
<attribute name="command" /> | |
<attribute name="dir" default="" /> | |
<element name="args" optional="true" /> | |
<sequential> | |
<echo message="git @{command}" /> | |
<exec executable="git" dir="@{dir}"> |
log4j.debug=false | |
# Default level is INFO | |
log4j.rootLogger=INFO,StdoutErrorFatal,StdoutWarn,StdoutInfo,StdoutDebug,StdoutTrace | |
# and for com.some.package.* log everything | |
log4j.logger.com.some.package=TRACE | |
log4j.appender.StdoutErrorFatal=org.apache.log4j.ConsoleAppender | |
log4j.appender.StdoutErrorFatal.layout=org.apache.log4j.PatternLayout |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_) | |
//Permission is hereby granted, free of charge, to any person obtaining a copy | |
//of this software and associated documentation files (the "Software"), to deal | |
//in the Software without restriction, including without limitation the rights | |
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
//copies of the Software, and to permit persons to whom the Software is | |
//furnished to do so, subject to the following conditions: | |
//The above copyright notice and this permission notice shall be included in |
My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.
As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.
I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.
So, in order to profile your worker, add this to your Sidekiq configuration:
if ENV["PROFILE"]
// Run in console on the history page (http://trakt.tv/users/<username>/history) | |
// Will remove all the items, on that page, from the watched history. | |
$(".posters .grid-item").each(function(){ | |
var $this = $(this); | |
historyRemove($this, $this.data("history-id")); | |
}) |
Puts on glasses: | |
(•_•) | |
( •_•)>⌐■-■ | |
(⌐■_■) | |
Takes off glasses ("mother of god..."): | |
(⌐■_■) | |
( •_•)>⌐■-■ |