Skip to content

Instantly share code, notes, and snippets.

View medyo's full-sized avatar

Mehdi Sakout medyo

View GitHub Profile
@medyo
medyo / upload_dysms.md
Last active July 24, 2023 12:03
Upload dSYMs file to Crashlytics for react Native projects

1 - Download the dSYMs File from Appstore

  • go to https://appstoreconnect.apple.com/
  • Click on My Apps
  • From the left sidebar choose the app version you would like to get its dSYM
  • Scroll down to the Build section then click on the build version
  • then Build Metadata
  • On the new page, look for "Includes Symbols"
  • Click on Download dSYM
  • If not found please use the below method
@medyo
medyo / YouTubePlayerSupportFragmentX.java
Last active June 7, 2023 13:48
Solution: YouTubePlayerSupportFragment that supports androidx
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;
#!/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 / SlidintTagLayout.java
Created May 11, 2015 18:25
It supports long tabs titles & arabic
/*
* 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
@medyo
medyo / gist:fad03c9c4173e7c84f1ffae0d06f9af8
Created September 3, 2017 21:40 — forked from balazs-endresz/gist:f9b27514046506a7db75
Drop all tables and sequences in postgres
# 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';
#!/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.
@medyo
medyo / auto_backup.sh
Last active June 5, 2017 02:07
Auto Backup Openshift Database, Full tutorial: http://medyo.github.io/2017/backup-openshift-database/
#!/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

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

@medyo
medyo / multiple_dex.md
Last active August 29, 2015 14:27
Solution: Unable to execute dex: Multiple dex files

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 June 23, 2015 00:25
etudiantExistant
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;