Skip to content

Instantly share code, notes, and snippets.

View dypsilon's full-sized avatar

Tim Navrotskyy dypsilon

View GitHub Profile
<?php
foreach ($navigation['nodes'] as $node) {
$node['isActive'] = false;
if(empty($node['url'])) {
continue;
}
if(!$node['isVisible']) {
@dypsilon
dypsilon / TheResult.php
Created June 5, 2011 00:10
Guard Clause
<?php
public function markActiveNode($navigation, $currentUrl)
{
if(empty($navigation['nodes']) or !is_array($navigation['nodes']) {
return $navigation;
}
foreach ($navigation['nodes'] as $node) {
$node['isActive'] = false;
#
# Table structure for table 'tx_realurl_pathcache'
#
CREATE TABLE tx_realurl_pathcache (
cache_id int(11) NOT NULL auto_increment,
page_id int(11) DEFAULT '0' NOT NULL,
language_id int(11) DEFAULT '0' NOT NULL,
rootpage_id int(11) DEFAULT '0' NOT NULL,
mpvar tinytext NOT NULL,
pagepath text NOT NULL,
@dypsilon
dypsilon / js-performance-research.md
Created December 10, 2012 17:43
JS Performance Research

Memory Management and Performance

JavaScript engines such as Google’s V8 (Chrome, Node) are specifically designed for the fast execution of large JavaScript applications. As you develop, if you care about memory usage and performance, you should be aware of some of what’s going on in your user’s browser’s JavaScript engine behind the scenes.

Continue reading Writing Fast, Memory-Efficient JavaScript, great general overview of a Google employee

Videos

REST Ideology & Rants

I am getting frustrated by the number of people calling any HTTP-based interface a REST API. Today’s example is the SocialSite REST API. That is RPC. It screams RPC. There is so much coupling on display that it should be given an X rating.

REST APIs must be hypertext-driven


Roy Fielding writes a PhD dissertation describing the architectural style of the World Wide Web. He coins the term ‘Representational State Transfer’ (REST) to describe it – after all, if you’re going to talk about something, you need to give it a name. Somehow, in a semantic shift of epic fail proportions, the term REST has also come to mean something completely different to most people, a ‘style’ of writing web services. This style has no agreed protocol.

Performance and V8 Debate

First post by Bruno Fernandez-Ruiz (Yahoo! Fellow, VP and Platform Architect) on V8 end of things with node.js. The post is dated February 6 2011.

NodeJS: To V8 or not to V8 hacker news discussion on this post.


Response by Jason Hoffman (Chief Scientist, Founder of Joyent) on the previous post. February 05, 2011 lol

Static Site Generators

A Static Site Generator is a program, that generates an HTML website as an output. ThisHTML website is then served through your web server, just like the old’n’days. This is usually achieved using template languages and code that separates out the layout of the website from its content and styles.

Advantages of a Static Site Generator?

  • Security – There’s no database layer, or rails/pylons layer of code so security excellent.
  • Performance – Under load, less memory / cpu usage to serve your website, so your website stays up longer
  • Have a copy of your content separate from your server
  • Easily move your website to another host – Copy and paste the HTML and re-route the domain name should you have one.

GIT Version Control System

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

Tools