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
require 'git'
g = Git.open('.')
commits = g.log.reject do |commit|
commit.message.start_with?('Merge')
end
words = 0
commits.each { |commit| words += commit.message.split(' ').count }
<div class="card">
<div class="container">
<div class="front">
<img src="http://placehold.it/400x600" />
</div>
<div class="back">
<h5>This is a card.</h5>
<p>This card shows some content on the front and some on the back, and can be flipped by hovering on a desktop, or by swiping across on a touch device.</p>
<p>The back of the card is intentionally long, so that we can show both an example where the card is constrained to a square and where it is as long as the content on either side requires.</p>
require 'ropencv'
include OpenCV
vect = std::Vector.new(cv::Mat)
vect << cv::imread(File.join('data','1-1.JPG'))
vect << cv::imread(File.join('data','1-2.JPG'))
vect << cv::imread(File.join('data','1-3.JPG'))
result_image = cv::Mat.new
diff --git a/.buildpacks b/.buildpacks
new file mode 100644
index 0000000..5eef61a
--- /dev/null
+++ b/.buildpacks
@@ -0,0 +1,2 @@
+https://github.com/heroku/heroku-buildpack-ruby.git
+https://github.com/heroku/heroku-buildpack-php.git
diff --git a/.travis.yml b/.travis.yml
index e74af49..deb7417 100644
# x264
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --enable-static --enable-shared --disable-asm --prefix=/app/vendor/x264
make
make install
# lame
curl -O "http://softlayer-dal.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz"
tar -xvf lame-3.99.5.tar.gz
module ReadOnly
def readonly?
true
end
def delete
raise ReadOnlyRecord
end
end
module EngineWithMigrations
class Engine < ::Rails::Engine
isolate_namespace EngineWithMigrations
initializer :append_migrations do |app|
unless app.root.to_s.match root.to_s
app.config.paths['db/migrate'] += config.paths['db/migrate'].expanded
end
end
end
class Alpha < WorkerCommand
@queue = :alpha
def self.work
sleep(5)
puts "Alpha"
end
end
@mehlah
mehlah / li3_map_reduce.php
Created May 25, 2011 09:05
Li3 Map reduce exemple
<?php
$db = Model::connection();
// construct map and reduce functions
$map = new \MongoCode("function() {}");
$reduce = new \MongoCode("function(k, vals) {}");
$metrics = $db->connection->command(array(
'mapreduce' => 'collection',
@mehlah
mehlah / li3_custom_filter.php
Created May 29, 2011 14:15
Li3 custom filter
Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
$chain = $chain->next($self, $params, $chain);
$chain->applyFilter('custom_filter', function($self, $params, $chain) {
$params['text'] = 'filtered text';
return $chain->next($self, $params, $chain);
});
return $chain;
});
//controller action