Skip to content

Instantly share code, notes, and snippets.

View mehlah's full-sized avatar
🎯

Mehdi Lahmam mehlah

🎯
View GitHub Profile
@mehlah
mehlah / cron.php
Created May 10, 2012 01:35 — forked from tmaiaroto/cron.php
Lithium Cron Wrapper
<?php
/**
* This script is meant to be executed via crontab.
* It should help you easily set li3 commands as cron jobs.
*
* You should put this in the root of your application.
* However, you don't need to, but you would then need to
* pass a --path= option with the path to your app.
* This is because the li3 console command must be called
* from a specific location.
@mehlah
mehlah / ti_tableView.js
Created May 2, 2012 14:05
Ti multiple columns Table View
var row = Ti.UI.createTableViewRow({ layout: "horizontal" });
var column1 = Ti.UI.createView({ height: "50%" });
var column2 = Ti.UI.createView({ height: "50%" });
row.add(column1);
row.add(column2);
@mehlah
mehlah / li3.vim
Created April 16, 2012 14:01
vim color scheme, the Lithium style !
" Vim color file
" Maintainer: Mehdi Lahmam B. (mehlah)
" Inspired by Li3 color scheme - http://dev.lithify.me/lithium/wiki/about/visual-identity
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@mehlah
mehlah / bootstrap_chef_server.sh
Created April 14, 2012 00:26 — forked from woods/bootstrap_chef_server.sh
Set up rackspace cloud server as chef server
#!/bin/bash
set -e # Exit on error
set -x # Print each command
apt-get install -y lsb-release
# Set up the OpsCode repository
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
@mehlah
mehlah / Consumer.php
Created April 6, 2012 11:32
Auth Oauth adapter Lithium
<?php
namespace li3_omniauth;
class Consumer extends \lithium\core\StaticObject {
/**
* Holds an instance of the oauth service class
*
* @see \li3_oauth\extensions\services\Oauth
@mehlah
mehlah / gist:1780286
Created February 9, 2012 14:18
PHP 5.4 bindable closures
<?php
class Foo
{
function barfoo()
{
return __FUNCTION__;
}
function bar()
{
@mehlah
mehlah / chart.impact.js
Created January 17, 2012 05:41
d3 impact graph
// Inspired by http://dmitry.baranovskiy.com/work/github/
d3.chart.impact = function() {
var width = 1,
height = 1,
duration = 0,
domain = null,
values = Object,
key = d3_chart_impactKey,
value = d3_chart_impactValue,
sort = null,
@mehlah
mehlah / README.md
Created January 6, 2012 01:55
Lithium lines spent

#Lithium lines spent since 0.10 (2011-06-18)

[...] if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": 
the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger.
-- 
Edsger W. Dijkstra http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1036.html

Each bar represents a commit.Green represents added lines, red removed lines. Each bar is centered at the cumulative added/removed count from my commits: the first commit is centered at 0, and if it net added code, the next commit is shifted accordingly. Hovering a bar shows part of the commit message.

@mehlah
mehlah / li3_errors.php
Created December 18, 2011 17:17
Lithium Error handler
<?php
use lithium\core\ErrorHandler;
use lithium\action\Response;
use lithium\net\http\Media;
use lithium\analysis\Debugger;
use lithium\analysis\Logger;
use lithium\core\Environment;
/**
@mehlah
mehlah / ArticleControllerTest.php
Created December 18, 2011 11:48 — forked from icambridge/ArticleControllerTest.php
Controller testing lithium
<?php
namespace app\tests\cases\controllers;
use app\tests\mocks\MockArticlesController;
use app\tests\mocks\action\MockControllerRequest as Request; //Mocking the Request
class ArticlesControllerTest extends \lithium\test\Unit {
protected $_controller;