Skip to content

Instantly share code, notes, and snippets.

View mcamara's full-sized avatar
🏠
Working from home

Marc Cámara mcamara

🏠
Working from home
View GitHub Profile
@mcamara
mcamara / commands
Last active January 4, 2016 00:09
Language Bar with flags Laravel, Blade, mcamara/laravel-localization
php artisan config:publish mcamara/laravel-localization
php artisan view:publish mcamara/laravel-localization
@mcamara
mcamara / post_migration
Last active August 29, 2015 13:56
Multilingual models with laravel
class CreatePostsTable extends Migration {
public function up()
{
Schema::create('posts', function(Blueprint $table) {
$table->increments('id');
foreach (array_keys(LaravelLocalization::getSupportedLocales()) as $lang) {
//add here all you translatable attributes
$table->string('title_'.$lang)->nullable()->default(null);
@mcamara
mcamara / flatten.rb
Last active January 10, 2018 16:32
Re-implementation of flatten in ruby
def flatten(element)
return [element] unless element.is_a?(Array)
new_array = []
element.each do |i|
new_array += flatten(i)
end
new_array
end
array = [1, [2, 3, [5, 6], 7], [8, 9], 10, [1, [2, 3, [5, 6], 7], [8, 9], 10]]

CoderRestaurant Website

Coder Restaurant is a Ruby on Rails restaurant website let users order foods.

Submitted by: Your Name

Time spent: XX hours spent in total

URL: heroku-app-url