Skip to content

Instantly share code, notes, and snippets.

View reime005's full-sized avatar
ℹ️

Marius Reimer reime005

ℹ️
View GitHub Profile
@reime005
reime005 / AbstractStretchStage.java
Created December 5, 2016 07:26
Superclass for your stages in libGDX
package de.reimerm.hammerize;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.viewport.ScalingViewport;
/**
* Created by Marius Reimer on 15-Sep-16.
*/
package com.hmack.hammerize.utils;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import java.util.HashMap;
/**
@reime005
reime005 / discover.java
Created October 10, 2017 11:12
Discovering Anki Overdrive Vehicles via tinyB
final BluetoothManager manager = BluetoothManager.getBluetoothManager();
manager.startDiscovery () ;
for (BluetoothDevice device : manager.getDevices()) {
if (Arrays . asList ( device .getUUIDs()).contains(”be15beef−6186−407e−8381−0bd89c4d8df4”)) {
// device is of anki overdrive
}
}
manager.stopDiscovery();
@reime005
reime005 / NameStorageExample.sol
Created August 12, 2018 11:05
Solidity Smart Contract for storing names
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/// @title Contract Example for a storing names
/// @author Marius Reimer (reime005) <reime005@gmail.com>
/// @notice
/// @dev This is the core contract
contract NameStorageExample is Ownable {
string public contractName;
@reime005
reime005 / lint-staged.config.js
Created May 27, 2019 20:29
Lint Staged Configuration File
module.exports = {
'*.{js,jsx}': [
'eslint . --fix',
'prettier --write',
'git add',
'jest --bail --findRelatedTests'
]
};
@reime005
reime005 / hoisting.js
Created June 16, 2019 21:23
JavaScript hoisting example
foo(); // works because hoisted
var someVariable = 42;
// would not be hoisted: var foo = function() ...
function foo() {
console.log(someVariable); // undefined
var someVariable = 91;
console.log(someVariable); // 91
}
@reime005
reime005 / hoisting.js
Created June 16, 2019 22:01
JavaScript hoisting example 2
fooFunction(); // ReferenceError: fooFunction is not defined
foo(); // TypeError: undefined is not a function
var foo = function fooFunction() { console.log(42) };
@reime005
reime005 / zsh-cd-ls.sh
Created June 22, 2019 11:14
list dir after cd in zsh
#!/bin/sh
autoload -U add-zsh-hook
add-zsh-hook -Uz chpwd (){ ls -a; }
@reime005
reime005 / android-dev-paths.sh
Created June 23, 2019 11:57
Setup of the basic environment variables required to use Android tools (emulator, sdkmanager, adb, ...) via the command line interface (macOS)
#!/bin/sh
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/emulator
@reime005
reime005 / sdkmanager.sh
Created June 23, 2019 12:14
Example of downloading the Android SDK via sdkmanager CLI
#!/bin/sh
# note that the $ANDROID_HOME/tools/bin folder must be in your PATH
# list all installed and available packages
exec sdkmanager --list
# install or update specific packages to the latest version. automatically accept licenses
exec yes | sdkmanager --licenses && \
sdkmanager "platforms;android-28" "build-tools;28.0.3"