Skip to content

Instantly share code, notes, and snippets.

View mehlah's full-sized avatar
🎯

Mehdi Lahmam mehlah

🎯
View GitHub Profile
@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 / gist:1780286
Created February 9, 2012 14:18
PHP 5.4 bindable closures
<?php
class Foo
{
function barfoo()
{
return __FUNCTION__;
}
function bar()
{
@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 / 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 / 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 / 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 / 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 / li3_changelog.md
Created June 11, 2012 18:53
Lithium 0.10 -> ? Changelog

Manually selected commits to highlight

  • Added Collection::reduce() f583206420e4ee0bafb68aa6d506a15fdae3bfd5
  • Added multibyte support for strpos(), strrpos() and substr().
  • Added a --verbose mode when running tests, and better tests output formatting
  • \template\View now allow subclasses to switch out adapter path
  • Added support for multiple bindings to FormHelper (#455)
  • Dispatcher rules now accepts callbaks (#408) dc3e17de251ad36d939bb7418b2fe51d130253c6
  • Added formatters for route parameters 2dc40c9b6e5bc55a790cd37cd05efb510a8a6517
  • We are on Travis! 007a6ea7d28e321989ec22a5d35e6722b9419727
@mehlah
mehlah / fixtures_factories
Created June 22, 2012 12:10
Fixtures vs. Factories
http://blog.ludovf.net/fixtures-vs-factories/http://metabates.com/2010/08/15/fixtures-v-factories-cant-we-all-just-get-along/
http://www.dan-manges.com/blog/38
http://blog.oncompare.com/2011/01/21/herding-your-test-data-in-rails/
http://robots.thoughtbot.com/post/159807023/waiting-for-a-factory-girl
https://gist.github.com/1044506
http://www.youtube.com/watch?v=OG8i9Udqm_s
@mehlah
mehlah / gitmodules.sh
Created July 2, 2012 00:27
Batch git submodule add
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path