Skip to content

Instantly share code, notes, and snippets.

@a7madev
a7madev / Android-DebugAndProBuilds.gradle
Created January 2, 2016 11:13
How to have debug, beta and prod builds installed at the same time
defaultConfig {
resValue "string", "app_name", "MyApp"
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
testCoverageEnabled = "true"
resValue "string", "app_name", "MyApp DEBUG"
}
@a7madev
a7madev / Android Retrofit.md
Last active December 25, 2015 19:10
Android Retrofit
  1. Retrofit http://square.github.io/retrofit/
  2. Simple HTTP with Retrofit 2 https://realm.io/news/droidcon-jake-wharton-simple-http-retrofit-2/
  3. Consuming APIs with Retrofit https://github.com/codepath/android_guides/wiki/Consuming-APIs-with-Retrofit
  4. Retrofit - YouTube: https://www.youtube.com/watch?v=3WONuRSUHmw
  5. Retrofit 2.0: The biggest update yet on the best HTTP Client Library for Android http://inthecheesefactory.com/blog/retrofit-2.0/en
  6. Retrofit Tutorial for Android: https://www.youtube.com/watch?v=3cN6aJmwMAg
  7. CONSUMING REST API WITH RETROFIT 2.0 IN ANDROID http://www.iayon.com/consuming-rest-api-with-retrofit-2-0-in-android/
  8. Retrofit 2 — Upgrade Guide from 1.9 https://futurestud.io/blog/retrofit-2-upgrade-guide-from-1-9
  9. Retrofit — Getting Started and Create an Android Client https://futurestud.io/blog/retrofit-getting-started-and-android-client
@a7madev
a7madev / AndroidManifest.xml
Last active August 13, 2016 11:05
Android - Request Multiple Permissions
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@a7madev
a7madev / WordPress - Rewrite Root Rules.php
Last active August 29, 2015 14:24
WordPress - Rewrite Root Rules
/**
**================================================================================================================**
* Rewrite Root Rules
**================================================================================================================**
**================================================================================================================**
**/
add_action('generate_rewrite_rules', 'roots_add_rewrites');
function roots_add_rewrites($content) {
$theme_name = next(explode('/themes/', get_stylesheet_directory()));
global $wp_rewrite;
@a7madev
a7madev / C# Retrieve Data from Database.cs
Created January 2, 2015 17:51
C# Retrieve Data from Database
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
cmd.Connection=con;
cmd.CommandType=CommandType.Text;
cmd.CommandText="select column from table where condition;";
@a7madev
a7madev / WordPress - Update Website URL.sql
Created November 24, 2014 07:04
WordPress - Update Website URL
UPDATE `database`.`wp_options` SET `option_value` = 'http://localhost/wp' WHERE `wp_options`.`option_id` = 1;
UPDATE `database`.`wp_options` SET `option_value` = 'http://localhost/wp' WHERE `wp_options`.`option_id` = 2;
@a7madev
a7madev / WordPress Functions.php
Last active August 29, 2015 14:07
Wordpress Functions
<?php
<!-- Logout and redirect to home -->
echo wp_logout_url( home_url() );
<!-- Get Page Title -->
echo get_the_title();
<!-- Redirect -->
wp_redirect('');
@a7madev
a7madev / open_whatsapp_contact.java
Created October 16, 2014 16:34
Open Whatsapp Contact Chat
void openWhatsappContact(String number) {
Uri uri = Uri.parse("smsto:" + number);
Intent i = new Intent(Intent.ACTION_SENDTO, uri);
i.setPackage("com.whatsapp");
startActivity(Intent.createChooser(i, ""));
}
@a7madev
a7madev / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console