Skip to content

Instantly share code, notes, and snippets.

Mehdi Sakout medyo

Block or report user

Report or block medyo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@medyo
medyo / YouTubePlayerSupportFragmentX.java
Last active Sep 27, 2019
Solution: YouTubePlayerSupportFragment that supports androidx
View YouTubePlayerSupportFragmentX.java
package com.google.android.youtube.player;
/**
* Please create this directories schema com.google.android.youtube.player and post the file there
*/
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@medyo
medyo / gist:fad03c9c4173e7c84f1ffae0d06f9af8
Created Sep 3, 2017 — forked from balazs-endresz/gist:f9b27514046506a7db75
Drop all tables and sequences in postgres
View gist:fad03c9c4173e7c84f1ffae0d06f9af8
# tables for owned by 'tableowner'
select 'drop table if exists "' || tablename || '" cascade;' from pg_tables where tableowner='tableowner';
# all sequences
select 'drop sequence if exists "' || relname || '" cascade;' from pg_class where relkind = 'S';
View dropbox_uploader.sh
#!/usr/bin/env bash
#
# Dropbox Uploader
#
# Copyright (C) 2010-2017 Andrea Fabrizi <andrea.fabrizi@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
View auto_backup.sh
#!/bin/bash
NOW="$(date +"%Y-%m-%d")"
FILENAME=$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz
DATABASE_PATH=$OPENSHIFT_DATA_DIR/db_backups/$FILENAME
# Create db_backups folder if not existing
cd $OPENSHIFT_DATA_DIR && mkdir -p db_backups && cd db_backups
# Dump the postgresql database (for Mysql database, check the bottom of this page)
/opt/rh/postgresql92/root/usr/bin/pg_dump -h $OPENSHIFT_POSTGRESQL_DB_HOST -p $OPENSHIFT_POSTGRESQL_DB_PORT -F c $OPENSHIFT_APP_NAME > $FILENAME
View extract_realm_database_android.sh
#!/bin/sh
ADB_PATH="/Users/medyo/Library/Android/sdk/platform-tools"
PACKAGE_NAME="com.mobiacube.elbotola.debug"
DB_NAME="default.realm"
DESTINATION_PATH="/Users/Medyo/Desktop/"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Make sure a device is connected"
else
@medyo
medyo / multiple_dex.md
Last active Aug 29, 2015
Solution: Unable to execute dex: Multiple dex files
View multiple_dex.md

This error means that there is a duplicated library used on one or many libraries.

To fix it, we should exclude them from our dependencies. On the build.gradle add the following line

dependencies {...}
configurations {
    all*.exclude group: 'x', module: 'library'
}
@medyo
medyo / etudiant.php
Created Jun 23, 2015
etudiantExistant
View etudiant.php
public function etudiantExistant($ca,$cin,$cne)
{
$q = $this->db->prepare('SELECT count(*) FROM licence WHERE ca = :ca AND cin = :cin AND cne = :cne ');
$q->bindValue(':ca', $ca);
$q->bindValue(':cin', $cin);
$q->bindValue(':cne', $cne);
$q->execute();
$number_of_rows = $result->fetchColumn();
if ($number_of_rows > 0){
return true;
@medyo
medyo / SlidintTagLayout.java
Created May 11, 2015
It supports long tabs titles & arabic
View SlidintTagLayout.java
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View gist:570355d494ced1fd8ff3

Override Devise RegistrationsController

Overview

Here I'll show you

  • How to override devise registrations_controller(related to create/update user account)
  • How to change redirect path after updating user

Override RegistrationsController

You can’t perform that action at this time.