Skip to content

Instantly share code, notes, and snippets.

@kyledecot
kyledecot / laravel-ujs.js
Created June 19, 2012 14:40
laravel UJS
(function($, undefined) {
// Shorthand to make it a little easier to call public laravel functions from within laravel.js
var laravel;
$.laravel = laravel = {
// Link elements bound by jquery-ujs
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]',
// Select elements bound by jquery-ujs
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
@emanuelez
emanuelez / git_speed.md
Last active March 17, 2024 19:03
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@loonies
loonies / hierarchy.php
Created November 20, 2011 21:39 — forked from devi/hierarchy.php
MySQL "Closure Table" for Kohana based on Bill Karwin design.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* MySQL "Closure Table" for Kohana based on Bill Karwin design.
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
* CREATE TABLE `closures` (
* `id` int(11) NOT NULL AUTO_INCREMENT,