I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen, PIPE | |
from os import path | |
git_command = ['/usr/bin/git', 'status'] | |
repository = path.dirname('/path/to/dir/') | |
git_query = Popen(git_command, cwd=repository, stdout=PIPE, stderr=PIPE) | |
(git_status, error) = git_query.communicate() | |
if git_query.poll() == 0: | |
# Do stuff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TransitionDrawable transition = (TransitionDrawable) view.getBackground(); | |
if (toggle) { | |
view.startTransition(1200); | |
} else { | |
view.reverseTransition(1200); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.mediaplayersurfaceswitch; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.media.MediaPlayer; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.SurfaceHolder; | |
import android.view.SurfaceView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//as per cyrilmottier.com/2012/05/22/the-making-of-prixing-fly-in-app-menu-part-1/ | |
public class SmoothInterpolator extends LinearInterpolator { | |
@Override | |
public float getInterpolation(float input) { | |
return (float) Math.pow(input - 1, 5) + 1; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author unknown. | |
1.) Algorithm Complexity: You need to know Big-O. If you struggle with | |
basic big-O complexity analysis, then you are almost guaranteed not to | |
get hired. | |
For more information on Algorithms you can visit: | |
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index | |
2.) Coding: You should know at least one programming language really | |
well, and it should preferably be C++ or Java. C# is OK too, since |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
/** | |
* Simple ArrayList Implementation for Java Beginners | |
* | |
* @author malalanayake | |
* | |
*/ | |
public class ArrayList { | |
private Object[] data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.wwsun.list; | |
import java.util.Iterator; | |
/** | |
* | |
* @param <E> is the type of elements in this list | |
*/ | |
public class MyArrayList<E> implements Iterable<E> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This class is an example of how to use FirebaseListAdapter. It uses the ExampleObject class to encapsulate the | |
* data for each individual chat message | |
*/ | |
public class ExampleAdapter extends FirebaseListAdapter<ExampleObject> { | |
@InjectView(R.id.example_list_item) | |
TextView exampleView; | |
public DealListAdapter(Query ref, Activity activity, int layout) { | |
super(ref, ExampleObject.class, layout, activity); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[build.gradle] | |
if ( project.hasProperty("myARG") ) { | |
// do something | |
} else { | |
// do something else | |
} | |
[CONSOLE] | |
$ gradle -PmyARG=true |
OlderNewer