Skip to content

Instantly share code, notes, and snippets.

View JoseRivas1998's full-sized avatar
💭
Why does github have this?

Jose Rodriguez Rivas JoseRivas1998

💭
Why does github have this?
View GitHub Profile
@JoseRivas1998
JoseRivas1998 / index.html
Created February 6, 2020 17:02
Image with caption overlay
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #ffd2d2;
}
section {
import java.util.Objects;
public class ComplexNumber implements Comparable<ComplexNumber> {
private final float real;
private final float complex;
private ComplexNumber(float real, float complex) {
this.real = real;
this.complex = complex;
@JoseRivas1998
JoseRivas1998 / BitFilteringTester.java
Last active June 1, 2018 00:01
An Introduction to Bit Operations, Masking and Filtering
public class BitFilteringTester {
InteractingObject a = new InteractingObject('a');
InteractingObject b = new InteractingObject('b');
InteractingObject c = new InteractingObject('c');
InteractingObject d = new InteractingObject('d');
InteractingObject e = new InteractingObject('e');
InteractingObject f = new InteractingObject('f');
public BitFilteringTester() {
@JoseRivas1998
JoseRivas1998 / Function.java
Created October 14, 2017 17:15
Definite Integral in Java
public interface Function {
public double f(double x);
}
@JoseRivas1998
JoseRivas1998 / FontAwesome.java
Created October 4, 2017 00:14
Font Awesome Unicode Characters in Java Strings
public class FontAwesome {
/*
=================================
http://fontawesome.io/cheatsheet/
=================================
*/
public static final String FA_500PX = "\uF26E";
public static final String FA_ADDRESS_BOOK = "\uF2B9";
@JoseRivas1998
JoseRivas1998 / Color.java
Last active July 27, 2017 15:59
Makes gl color with a hex int.
public class Color {
float r, g, b;
public Color(int color) {
this.r = ((color >> 16) & 0xFF) / 255f;
this.g = ((color >> 8) & 0xFF) / 255f;
this.b = ((color >> 0) & 0xFF) / 255f;
}
@JoseRivas1998
JoseRivas1998 / patterns.js
Last active February 8, 2017 22:18
I am the cube patterns iamthecu.be
function checkerBoard() {
cube.twist('MMEESS');
}
function wire() {
cube.twist('RLFB'.multiply(3));
cube.twist('RRBBLLRRBBLL');
}
function wireInverse() {
@JoseRivas1998
JoseRivas1998 / twitterframe.html
Created September 12, 2016 01:29
Twitter iframe
<iframe src="http://site.santasusana.org/embedtwitter.html" width="300" height="350" frameborder="0"></iframe>
@JoseRivas1998
JoseRivas1998 / 404.php
Created July 8, 2016 19:04
Changing header based on request uri
<?php
$uri = $_SERVER["REQUEST_URI"];
$sapi_type = php_sapi_name();
$resp = 404;
if(strcasecmp($uri, '/test/hello.php') == 0) {
$resp = 200;
}
if (substr($sapi_type, 0, 3) == 'cgi') {
if($resp == 200) {
header("Status: 200 OK");
@JoseRivas1998
JoseRivas1998 / StringAlgorithms.java
Last active January 15, 2016 06:03
Here is a bunch of String Algorithms, feel free to use them
/**
* Allows you to remove punctuation from a string
* @param s The String you will be removing the punctuation from
* @return A new String without punctuation
*/
public static String removePunctuation(String s) {
String removed = s;
for(int i = 33; i <= 47; i++) {
removed = removed.replace(String.valueOf((char) i), "");
}