Skip to content

Instantly share code, notes, and snippets.

Working from home

Arnau Mora ArnyminerZ

Working from home
View GitHub Profile
ArnyminerZ / paraulogic.js
Created Jan 21, 2022
Per a aquells mandrosos que vulguen fardar davant la família. Solució al paraulògic del 21/01/2022
View paraulogic.js
var words = Object.keys(t["p"]);
for(p in words){
document.getElementById('test-word').innerText = words[p];
ArnyminerZ /
Created Oct 3, 2021
Instrucciones para crear un proyecto de Python

Para asegurarnos que las dependencias siempre esten en la última versión podemos usar el Dependabot, que se encargará de crear pull requests actualizando a las últimas versiones.

version: 2
  - package-ecosystem: pip
    directory: "/"
      interval: daily
ArnyminerZ / Example.kt
Last active Jun 5, 2021
Kotlin extension functions for allowing Parcelable write and read from Android's shared preferences.
View Example.kt
// Being Location a Parcelable class, and location a valid initialized instance of this class:
// For writing
sharedPreferences.edit {
putParcelable("location", location)
// For reading
val loadedLocation = sharedPreferences.getParcelable<Location?>("location", null)
View JSONArrayExtension.kt
fun JSONArray.sort(keyName: String): JSONArray {
val sortedJsonArray = JSONArray()
val jsonValues = arrayListOf<JSONObject>()
for (a in 0 until length())
jsonValues.sortWith { a, b ->
val valA = a.getStringSafe(keyName) ?: a.get(keyName) as String
val valB = b.getStringSafe(keyName) ?: b.get(keyName) as String
ArnyminerZ / Example.kt
Last active Apr 14, 2020
Use MySQL in Android Kotlin Apps
View Example.kt
// MYSQL_USER, MYSQL_PASS and MYSQL_HOST are constants
private fun connect(): MySQLConnector? {
Log.v(TAG, "MySQL Connecting...")
val connector = MySQLConnector()
if (connector.connect(MYSQL_USER, MYSQL_PASS, MYSQL_HOST))
Log.v(TAG, " Connection correct!")
else {
Log.e(TAG, " Connection failed!")
return null
ArnyminerZ / After Effects Expression.js
Created Jan 26, 2020
Analize your GoPro footage and animate your content
View After Effects Expression.js
function analize(file, yMin, yMax){
eval("var gopro=" + footage(file).sourceText);
// (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
outMax = yMax; // Y max
outMin = yMin; // Y min
inMax = parseFloat(gopro.streams.GPS5.min_alt);
inMin = parseFloat(gopro.streams.GPS5.max_alt);
samplesDuration = parseInt(gopro.streams.GPS5.duration);
samplesCount = gopro.streams.GPS5.samples.length;
View gist:b4b6568627311dab7aac73118618d6d3
"activity": {
"name": "Gimcana Fotogràfica IES Pare Vitòria 2018",
"code": "GFIP018",
"questions": {
"1": {
"question": "Què és i no és?",
"location": {
"lat": "10",
"lon": "15"