Skip to content

Instantly share code, notes, and snippets.

@easyaspi314
easyaspi314 / FooActivity.java
Created December 8, 2014 19:28
How to get the Menu key working in AppCompat
package foo.bar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
public class FooActivity extends ActionBarActivity {
private Toolbar toolbar;
@easyaspi314
easyaspi314 / MainActivity.java
Created February 8, 2015 18:26
Android WebView code that works with Facebook's image scaling.
package com.example.facebookwebview;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.example.facebookwebview.R;
import android.view.Window;
@easyaspi314
easyaspi314 / OS Preferences.md
Created September 17, 2016 07:28
My OS preferences

My personal OS preferences

I am an Android only guy, and prefer Macs, but is is very close and I can literally use any computer you throw at me.

Why I prefer Android:

Features iPhones don't have:

  • A goddamn file manager without the need of jailbreaking/root
  • You can download, upload, and often view any file
  • GBA emulators (screw you PoGo players, I'm playing FireRed!)
  • Real Firefox, not that lame Safari disguise.
@easyaspi314
easyaspi314 / xbatalarm
Created May 8, 2017 01:45
Hopefully functional Xbatalarm for nonfunctional ACPI. Copy to /usr/bin/xbatalarm and reboot. Original file by QuaLaPinna.
#!/bin/bash
# Copyright (C) QuaLaPinna team (Gius & Whitesnow, repository: http://qualapinna.dyndns.org/repo, blog: http://qualapinna.dyndns.org)
# April 2014, license: GPL3 and any later versions
# Credits: Puppy Linux forum user josejp2424 for input and collaboration in NLS development (see es_AR localized file).
# Xbatalarm version 2.0
export TEXTDOMAIN=xbatalarm
export OUTPUT_CHARSET=UTF-8
f_get_values() {
@easyaspi314
easyaspi314 / troll.bbcode
Last active December 21, 2017 20:45
How to break Pokécommunity (and other BBCode forums which allow CSS)
Click and be trolled by the power of unsanitized CSS!
<!--
This shows a troll face that completely covers the screen when you unhide the spoiler.
**** This is mainly a proof of concept; if you actually post this, don't be surprised if mods get angry! ****
Basically, some BBCode-based forums have a [div][/div] or [style][/style] tag which allows custom CSS.
This takes full advantage of that and CSS's position: fixed, which positions the element in relation to the
browser window, not the parent element.
@easyaspi314
easyaspi314 / orthodoxc++.md
Created July 18, 2018 19:56 — forked from bkaradzic/orthodoxc++.md
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@easyaspi314
easyaspi314 / README.md
Last active May 30, 2021 17:23
C style void pointer/malloc wrapper for C++

C Style Malloc in C aka Void Pointers

One of the most annoying things about C++ is the incompatibility with C's void * conversion. In C, void * can be cast implicitly to any pointer type, but C++ needs an explicit cast.

Most C code is valid C++ code, but the most common issue is malloc, which returns void *.

For example, this is valid C code, but not valid C++ code:

struct Foo *x = malloc(sizeof(struct Foo));
@easyaspi314
easyaspi314 / setup.sh
Last active October 26, 2018 02:33
easyaspi314's agbcc and pokeruby build script for Termux
#!/data/data/com.termux/files/usr/bin/sh
note() {
printf "\033[1m%s\n\033[0m" "$1" >&2
}
die() {
printf "%b\n" <<EOF >&2
\033[31;1mDamn it! \033[0;1m$1
You should be able to find a log in ~/agbcc-build-log.txt.
@easyaspi314
easyaspi314 / OvercomplicatedWayToPrintA5x5Square.java
Last active February 9, 2019 04:41
Java assignment to print a 5x5 square
/* filename: OvercomplicatedWayToPrintA5x5Square.java */
public class OvercomplicatedWayToPrintA5x5Square {
/*
* An abstract class representing a shape that can be printed to the console.
*/
private static abstract class Shape {
/*
* Prints the contents of the shape to the console.
*/
public abstract void printToConsole();
@easyaspi314
easyaspi314 / README.md
Last active October 4, 2018 21:03
Overcomplicated ShowNum assignment

ShowNum

A completely overcomplicated way to do my homework assignment.

The assignment

Write a Java class (called ShowNum) that displays the same number of asterisks (row and columns) as is input in 2 numbers. 
Your class should have a default constructor (number1 is 0, number2 is 0) and 
another constructor that inputs 2 numbers (integers). 
You'll need accessor methods for the numbers and a display method that displays as follows: