Skip to content

Instantly share code, notes, and snippets.

@cesco89
cesco89 / GamePanel.java
Last active Feb 11, 2018
Java Game of life
View GamePanel.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
public class GamePanel extends JPanel implements ActionListener{
Timer timer = new Timer(1, this);
private static int width = Toolkit.getDefaultToolkit().getScreenSize().width;
private static int height = Toolkit.getDefaultToolkit().getScreenSize().height - 100;
@cesco89
cesco89 / Cell.java
Last active Feb 9, 2018
Java Maze Generator based on Maze Generation Algorithm --> https://en.wikipedia.org/wiki/Maze_generation_algorithm
View Cell.java
import java.awt.*;
import java.util.ArrayList;
public class Cell {
public int i;
public int j;
public int x;
public int y;
public boolean[] walls = {true, true, true, true}; //top, right, bottom, left
@cesco89
cesco89 / Line.java
Created Feb 8, 2018
A random java Maze generator
View Line.java
public class Line {
public int posx;
public int posy;
public int dim1;
public int dim2;
public Line (int _posx, int _posy, int _dim1, int _dim2) {
this.posx = _posx;
this.posy = _posy;
View activate-office-2016
@echo off
title Activate Microsoft Office 2016 ALL versions for FREE!&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Office Standard 2016&echo - Microsoft Office Professional Plus 2016&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_kms*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_mak*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo ============================================================================&ech
@cesco89
cesco89 / ViewPager Crossfade
Created Sep 22, 2016 — forked from kai91/ViewPager Crossfade
Crossfade effect in Android ViewPager
View ViewPager Crossfade
// Credit goes to http://fiskur.eu/?p=752
public class CrossfadePageTransformer implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
int pageWidth = page.getWidth();
View backgroundView = page.findViewById(R.id.background);
View text = page.findViewById(R.id.content);
View HeaderRecyclerViewAdapterV2.java
/*
* Copyright (C) 2014 sebnapi
*
* 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
@cesco89
cesco89 / ObservableFragment.java
Last active May 6, 2018
Listen to FragmentTransaction animation events
View ObservableFragment.java
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.app.Fragment;
/**
* Created by francesco on 14/10/14.
*/
public class ObservableFragment extends Fragment {
private TransitionListener mListener;
@cesco89
cesco89 / CircularFlipImageView.java
Last active Apr 5, 2016
A Circular Flippable ImageView (See README.md for details and credits)
View CircularFlipImageView.java
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;
@cesco89
cesco89 / MaterialDialog.java
Last active Jul 31, 2020
A custom AlertDialog that follows Material Design guidelines
View MaterialDialog.java
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ScrollView;
@cesco89
cesco89 / Fab.java
Last active Aug 29, 2015
Android Floating Action Button (FAB). Based on this: https://github.com/FaizMalkani/FloatingActionButton with a couple of additions
View Fab.java
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;