Git

echo -e “\e[32m”; while :; do printf ‘%*c’ $(($RANDOM % 30)) $(($RANDOM % 222)); sleep 0.001; done

Screen Shot 2013-08-19 at 3.08.59 PM

I’ve finally learned how git works. I’ve been using it for week and I never understood it. After getting destroyed on every merge for a month it finally dawned on me. My friend Randall explained it to me for the 10th time and it finally became crystal clear. I CAN SEE CLEARLY NOW THE RAIN IS GONE! Git is a beautiful program and extremely useful! All the commands I had been using for weeks suddenly became the best things ever. I hated Git two weeks ago now I love it.

I learned some really sexy aliases for Git.

git log –graph –pretty=’format:%h | %an | %s’
git log –graph –oneline –abbrev-commit
git log –pretty=format:’%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s’ –date=iso

thanks Vitaliy

Advertisements

“Hacking is bad, m’kay.”

I thought that it would only take me one more day for me to finish this CMS my company is building. 4 hours of code later everything is broken. 2 weeks of hard coding and hacking in every feature finally caught up to me. One thing breaks and you’re fucked. Without tests you can’t even tell whats breaking it.

Every problem I faced I just blew over with some retarded hacks. For instance, I have an array of all the products that I use to display the images and metadata. Then it becomes necessary to implement pagination. So I decide to just create a new array for every page. Then my indexing arrows don’t work. My genius inspired me to just multiply the index by the amount of products on the page, and then add the index.

Prefect code.

I’m then I added a jquery plugin to colorbox a menu and everything is fucked. What??!?! Another 4 hours of code later and my partner and I broke everything. We are straight gangsters. One last day of work becomes another week of work and way off schedule.

37845862

function showDCDetails(index)
{
	var pageOfChains = dcPagination(currentDcPage* dcPageSize, dcPageSize, allDC);
	var dc = pageOfChains[index];
	all_dc_index = ((currentDCPage * 7) + index);
	
	var all_dc = allDC[all_dc_index];
	console.log("allDC[all_dc_index]  ", allDC[all_dc_index]);
	var test = allDC[index];
	selected_dc = all_dc;
	$("#dc_chain_ul").empty();
	$("li").click(function() {
		$("a",this).addClass("selectedRow").parents().siblings().children().removeClass("selectedRow");
	});
	if (currentDcPage == 0) {
		$("#dc_title").val(dc.chainName);
	}else{
		$("#dc_title").val(all_dc.chainName);
	}
	
	
	// console.log("total items:",dc.items);
	console.log("HELLOOOOO", all_dc.items);
	
	for(var j = 0; j < all_dc.items.length; j++) 
	{
		console.log("ITEMS", all_dc.items);
		var row = $('<li></li>');
		if(j%2 == 0)
		{
			if (all_dc.items.length > 3) 
			{
				$("#deleteDCProductButton").show();
				$("#deleteDCProductButton").attr("onclick", "onRemoveProductPressed(\""+selected_dc.chainId+"\")");
			}
			else
			{	
				$("#deleteDCProductButton").hide();
			}

			// product
			var product = all_dc.items[j];
			populateRowWithProductIdAndIndex(product.productId,j);
			row.append($("<a><img id='prodRow"+j+"' onclick='showProductsForSelection("+j+")' src='img/no_product.png' width='320px' height='568px'></img></a>"));
			
		}
		else
		{
			// story
			var story = all_dc.items[j];
			row.append($("<textarea id='storyText"+j+"' onchange='onDCStoryChanged("+j+")' class='prodTextArea' rows='3'>"+story.body+"</textarea>"));
			
		}
		$('#dc_chain_ul').append(row);	
	}
}