Skip to content

Instantly share code, notes, and snippets.

View subsidel's full-sized avatar
🎧

Joel Howard-White subsidel

🎧
  • Manchester, UK
View GitHub Profile
function Hello_world_enterprise_edition_version_1_0_1 () {
class Enum {
constructor(enumeration) {
Object.keys(enumeration).forEach(function (enum_key) {
this[enum_key] = enumeration[enum_key];
}.bind(this));
}
}
const types = new Enum({
@subsidel
subsidel / Combined
Created March 29, 2015 19:04
An example of how to use the randomNumber class in your work.
if (min <= max) {
int randNum;
if (checkEven.isChecked()){
randNum = RandomNumber.generateEven(max, min);
} else if (checkOdd.isChecked()){
randNum = RandomNumber.generateOdd(max, min);
} else {
randNum = RandomNumber.generate(max, min);
}
generatedText.setText(randNum + "");
@subsidel
subsidel / RandomNumbers.java
Last active August 29, 2015 14:17
Random number generator for odd numbers
import java.util.Random;
public class RandomNumbers{
public static int generateOdd(int max, int min) {
Random random = new Random();
int num = min / 2 + random.nextInt((max + 1) / 2 - min / 2);
return num + 1;
}
}
o="rps";p o[c=rand(3)],%w{Draw Win Lose}[c.-o.index$_]
@subsidel
subsidel / human_python
Last active December 22, 2015 15:18
100
import math
def f(a):
s="KMGT "
b=math.floor((len(str(a))-1)/3)
return "{0}".format(a/1024**b)+s[b-1]+"B"
function f($a) {
$s="KMGT";
$b=floor((strlen($a)-1)/3);
return sprintf("%2f",$a/pow(1024, $b)).@$s[$b-1]."B";
}
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
def main():
print 0.7
if __name__ == '__main__':
main()