Skip to content

Instantly share code, notes, and snippets.

public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getIntent().getExtras() != null) {
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = MyFirebaseMessagingService.class.getSimpleName();
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData() != null && remoteMessage.getData().size() > 0) {
Map<String, String> data = remoteMessage.getData();
Log.d(TAG, data.toString());
05-07 14:54:59.864 21271-21271/fr.eall.e_nkesa.pointdevente E/AndroidRuntime: FATAL EXCEPTION: main
Process: fr..., PID: 21271
java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.eall.e_nkesa.pointdevente/fr...ReservationActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setVisibility(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2543)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2609)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
04-24 12:21:22.228 16961-16961/fr.eall.enkesa E/AndroidRuntime: FATAL EXCEPTION: main
Process: fr..., PID: 16961
java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.eall.enkesa/fr.eall.enkesa.ReservationActivity}: java.lang.IllegalStateException: Fragment ServicesStep{3c2f5c} not attached to Activity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2543)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2609)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1465)
@ismaeltoe
ismaeltoe / AuthController.php
Last active December 8, 2015 01:36
AuthController.php and PasswordController.php for Laravel 5.1
<?php namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use App\User;
use Validator;
class AuthController extends Controller {
/*
|--------------------------------------------------------------------------
<?php
use Illuminate\Database\Seeder;
use App\User;
class UserTableSeeder extends Seeder {
public function run()
{
@ismaeltoe
ismaeltoe / index.php
Last active August 29, 2015 14:25
[Wordpress] Display just the newest sticky post, if none return nothing
<?php
/* Get all Sticky Posts */
$sticky = get_option( 'sticky_posts' );
?>
<?php if ( !empty($sticky) ) : ?>
<?php
/* Sort Sticky Posts, newest at the top */
rsort( $sticky );

In the Java programming language, every application must contain a main method whose signature is:

public static void main(String[] args)

The main method is similar to the main function in C and C++; it's the entry point for your application and will subsequently invoke all the other methods required by your program.

If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile.

A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer.

@ismaeltoe
ismaeltoe / OffreTableSeeder.php
Last active August 29, 2015 14:24
Update slug value (Laravel)
<?php
use Illuminate\Database\Seeder;
class OffreTableSeeder extends Seeder {
public function run() {
$offres = DB::table('offres')->select('id', 'libelle')->get();
foreach ($offres as $offre) {
DB::table('offres')
->where('id', $offre->id)