Skip to content

Instantly share code, notes, and snippets.

View ersin-ertan's full-sized avatar
🔥
GCP/Firebase + Android Professional

Ersin Ertan ersin-ertan

🔥
GCP/Firebase + Android Professional
View GitHub Profile
@ersin-ertan
ersin-ertan / AudioTemplate
Last active December 22, 2015 21:39
Audio story collab with Aiden Venturi, here is the functional prototype for Unity3D in C#.
//copyright ersin ertan 2013
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Template // change the template name to the scene
: MonoBehaviour {
float time = 5; // change the time you have to choose an option
int numOptions = 3; // change the number of options
@ersin-ertan
ersin-ertan / .gitIgnore 2014_06_07
Last active August 29, 2015 14:02
.gitIgnore 2014_06_07
### Android ###
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@ersin-ertan
ersin-ertan / git config --global core.autocrlf input
Created June 8, 2014 04:42
git config --global core.autocrlf input
git config --global core.autocrlf input
Because of https://help.github.com/articles/dealing-with-line-endings#global-settings-for-line-endings
@ersin-ertan
ersin-ertan / cds
Last active August 29, 2015 14:03
concurrent data struct simulating memory hierarchy
// copyright ersin ertan 2014+
// Visualization
// |$|*,_|*,_,_,_|*,_,_,_,_,_,_,_|*,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_| ... etc.
// $ = entire data struct lock bit
// * = sectional lock bit
// Functions
// isArrayAccessible = array[0]; or array[2^(0 - 1)];
@ersin-ertan
ersin-ertan / google tv image scaling
Created November 21, 2014 15:17
google tv image scaling code
// Get the source image's dimensions
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true; // this does not download the actual image, just downloads headers.
BitmapFactory.decodeFile(IMAGE_FILE_URL, options);
int srcWidth = options.outWidth; // actual width of the image.
int srcHeight = options.outHeight; // actual height of the image.
// Only scale if the source is big enough. This code is just trying to fit a image into a certain width.
if(desiredWidth > srcWidth)
@ersin-ertan
ersin-ertan / JCSPConsumerProducer.java
Last active August 29, 2015 14:11
JCSP consumer producer input output classes
import jcsp.lang.*;
public class SendEvenIntsProcess implements CSProcess
{
private ChannelOutput out;
public SendEvenIntsProcess(ChannelOutput out)
{
this.out = out;
}
@ersin-ertan
ersin-ertan / ParallelProcess.java
Last active August 29, 2015 14:11
Parallel process with channels
import jcsp.lang.*;
public class IntegrateInt implements CSProcess
{
private final ChannelInputInt in;
private final ChannelOutputInt out;
public IntegrateInt (ChannelInputInt in, ChannelOutputInt out)
{
this.in = in;
@ersin-ertan
ersin-ertan / embGist.html
Created December 16, 2014 05:53
embedding a gist
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/gist-embed/2.0/gist-embed.min.js" type="text/javascript"></script>
</head>
<code data-gist-id="id of the gist"></code>
@ersin-ertan
ersin-ertan / JCSPDriver.java
Created December 16, 2014 06:04
Driver program for JCSP Example
import jcsp.lang.*;
public class DriverProgram{
public static void main(String[] args) {
One2OneChannel chan = new One2OneChannel();
new Parallel(new CSProcess[]{
new SendEvenIntsProcess (chan),
new ReadEvenIntsProcess (chan)
}
).run ();
}
@ersin-ertan
ersin-ertan / Classloaders.java
Created January 4, 2015 02:50
Classloaders
public abstract class ClassLoader {
public Class loadClass(String name);
protected Class defineClass(byte[] b);
public URL getResource(String name);
public Enumeration getResources(String name);
public ClassLoader getParent()