Skip to content

Instantly share code, notes, and snippets.

View mehlah's full-sized avatar
🎯

Mehdi Lahmam mehlah

🎯
  • Grinta
  • Saint-Etienne, France
  • X @mehlah
View GitHub Profile
@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
diff --git i/build_config.rb w/build_config.rb
index 7f52b5ee..c20be4c0 100644
--- i/build_config.rb
+++ w/build_config.rb
@@ -22,6 +22,9 @@ MRuby::Build.new do |conf|
# conf.gem :github => 'iij/mruby-io'
# conf.gem :git => 'git@github.com:iij/mruby-io.git', :branch => 'master', :options => '-v'
+ conf.gem :github => 'iij/mruby-env'
+ conf.gem :github => 'mattn/mruby-curl'
@mehlah
mehlah / li3_map_reduce.php
Created November 4, 2011 15:59
Li3 mapReduce
/**
* Execute a Map/Reduce query against a MongoDb connection
*
* @param string $map The Javascript Map function code, or if $systemJs=true the stored map procedure
* @param string $reduce The optional reduce function code, or if $systemJs=true the stored reduce procedure
* @param boolean $systemJs If true, $map/$reduce will be considered stored procs in system.js
*
* @return object A result of the map/reduce query
*/
public static function mapReduce($map, $reduce = null, $systemJs = false, $options = array()) {
@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 / carrierwave_content_type.rb
Last active August 22, 2016 03:58
CarrierWave test script for issue #1864
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails'
@mehlah
mehlah / carrierwave_fog_loading.rb
Last active February 5, 2016 13:20
CarrierWave Fog loading issue #1870
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'fog-aws'
@mehlah
mehlah / carrierwave_content_type.rb
Created February 5, 2016 10:46
CarrierWave store the content type
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails'
@mehlah
mehlah / application-ujs.js
Created July 26, 2012 14:58
Unobtrusive scripting adapter for jQuery, lithified
/**
* Unobtrusive scripting adapter for jQuery, lithified
*
* Requires jQuery 1.6.0 or later.
*/
(function($, undefined) {
// Shorthand to make it a little easier to call public lithium functions from within lithium.js
var lithium;
@mehlah
mehlah / index.html
Last active December 31, 2015 18:39
<!DOCTYPE html>
<meta charset="utf-8">
<style>
text {
font: 10px sans-serif;
}
</style>
<body>
$(document).on('pjax:popstate ', function(event) {
if(event.direction == "back") {
console.log('executes before page-change');
}
});