Skip to content

Instantly share code, notes, and snippets.

View monsterbrain's full-sized avatar
🚀
Back to Android. Kotlin. Webdev. JS. Playing with new frameworks!!

Faisal rasak monsterbrain

🚀
Back to Android. Kotlin. Webdev. JS. Playing with new frameworks!!
View GitHub Profile
@monsterbrain
monsterbrain / custom-shape-layout-android.xml
Created May 23, 2019 09:24
Custom Layout - Rectangle with Oval Shape - Android
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/ovalView"
@monsterbrain
monsterbrain / android_progress_dialog_material.java
Created February 7, 2019 07:10
Simple Code snippet to quickly add a loading dialog for android
// in gradle - use compile in old one
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
// Field variable
MaterialDialog progressDialog;
progressDialog = new MaterialDialog.Builder(context)
.title("Loading something")
.content("")
.progress(true, 0) // true for indeterminate
@monsterbrain
monsterbrain / iframe_to_image_conversion_javascript_js_html5.html
Created February 7, 2019 05:05
iframe is not supported by html2canvas. to convert iframe to image / base64, using iframe2image and html2canvas to save that image data.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Canvas to Image Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="html2canvas.js"></script>
@monsterbrain
monsterbrain / space_invaders_raylibgame.c
Created December 28, 2018 17:32
Raylib Space Invader Game Tutorial Full source Code. Made for this blogpost. https://monsterbraininc.com/2018/12/raylib-game-tutorial-space-invaders-using-vscode/
/*******************************************************************************************
*
* raylib - sample game: space invaders
*
* Based on Sample game developed by Ian Eito, Albert Martos and Ramon Santamaria
* Modifed by Monster Brain (monsterbraininc.com) - 2018
*
* This game has been created using raylib v1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
@monsterbrain
monsterbrain / shuffle_unity.cs
Created May 17, 2017 11:14
Shuffle Array in Unity Code Snippet Script
void reshuffle(string[] texts)
{
// Knuth shuffle algorithm :: courtesy of Wikipedia :)
for (int t = 0; t < texts.Length; t++ )
{
string tmp = texts[t];
int r = Random.Range(t, texts.Length);
texts[t] = texts[r];
texts[r] = tmp;
}
@monsterbrain
monsterbrain / CanvasFaderScript.cs
Created May 16, 2017 10:08
A Simple Unity UI Canvas Fading In / Out C# Script. Useful for transitions.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
/*
* A Simple Canvas Fader Script (Unity 5.6)
*
*
* Uses : Fade out or Fade In a UI Canvas. Not for transitioning a whole Scene with elements.
@monsterbrain
monsterbrain / failed to resolve com.hi5dev.box2d_pexml.txt
Last active May 16, 2017 09:46
failed to resolve com.hi5dev.box2d_pexml:box2d-pexml android studio LibGDX
https://www.codeandweb.com/texturepacker/tutorials/libgdx-physics
Was getting this error. Tried searching.
But at last found that I put the repositaries link
maven { url "https://dl.bintray.com/hi5dev/maven/" }
in the buildscript {} rather than the allprojects {} section.