Skip to content

Instantly share code, notes, and snippets.

deleteConfig=false
params=("$@")
if [[ -z "${params[0]}" ]]; then
params=(-c "@MOUNT C /home/pi/RetroPie/roms/pc" -c "@C:")
elif [[ "${params[0]}" == *.sh ]]; then
bash "${params[@]}"
exit
else
file="${params[@]}"
folder=${file%/*}
@jbruchanov
jbruchanov / ArbiterTask
Last active January 3, 2017 23:00
ArbiterTask
package com.smallplanet.android.planned;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
/**
* Created by JBruchanov on 03/01/2017.
*/
public class ArbiterTask<T> extends AsyncTask<Void, Void, T> {
@jbruchanov
jbruchanov / upload.html
Created November 10, 2016 14:33
AJAX file uploading + progress
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Title</title>
</head>
<script type="application/javascript">
/* //PHP SERVER SIDE
<?php
@jbruchanov
jbruchanov / gist:ade2e44f8aea52872386
Last active May 25, 2024 07:48
STF Ubuntu Installation
#install oracle java https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
#ANDROIDSTUDIO
#necessary for mksdcard
sudo apt-get install lib32stdc++6
public class MyActivity extends Activity implements PBarChange {
private ProgressBar mPbar;
private MyThread mMyThread;
public void onCreate(...){
super.onCreate(...);
setContentView(R.id.content);
mPbar = (ProgressBar)findViewById(R.id.pbar);
@jbruchanov
jbruchanov / layout.xml
Created November 18, 2015 20:59
FUJI XML
<?xml version="1.0" encoding="UTF-8"?>
<Data xmlns="http://schema.smallplanet.com/WallArt">
<Furniture image="sofa1.png" width="97" />
<Furniture image="bedroom2.png" width="116" />
<Furniture image="dining1.png" width="118" />
<Furniture image="office1.png" width="77" />
<Furniture image="bedroom1.png" width="90" />
<Furniture image="bedroom3.png" width="103" />
<Furniture image="dining3.png" width="125" />
@jbruchanov
jbruchanov / line.java
Last active November 5, 2015 10:21
Line java
package com.smallplanet.android.birdsandbees.math;
import android.graphics.PointF;
/**
* Created by JBruchanov on 04/11/2015.
*/
public class Line implements Comparable<Line> {
private PointF mPoint1;
@jbruchanov
jbruchanov / gist:6c86b788bc1d36ce4048
Created October 27, 2015 10:10
Android Activity tracker
/*
http://developer.android.com/reference/android/app/Application.html#registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks)
Helper for counting running activities to send request if we are going from background
*/
private ActivityLifecycleCallbacks mActivityLifecycleCallbacks = new ActivityLifecycleCallbacks() {
private int mActivityCounter;
@Override public void onActivityResumed(Activity activity) { }
@Override public void onActivityPaused(Activity activity) { }
@Override public void onActivitySaveInstanceState(Activity activity, Bundle outState) { }
@jbruchanov
jbruchanov / gist:23e6b01dac9ce84ce7ff
Created October 7, 2015 10:47
Upload file to PHP from IOS
- (void)uploadImage:(UIImage*) image {
/*
turning the image into a NSData object
getting the image back out of the UIImageView
setting the quality to 90
*/
NSData *imageData = UIImageJPEGRepresentation(image, 90);
// setting up the URL to post to
NSString *urlString = @"http://www.scurab.com/ios.php";
@jbruchanov
jbruchanov / RevealDrawable.java
Created September 22, 2015 09:23
RevealDrawable.java
package com.smallplanet.android.planned.drawable;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.view.View;
/**
* Created by JBruchanov on 21/09/2015.