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
| public final class PrefManager { | |
| static PrefManager singleton = null; | |
| static SharedPreferences preferences; | |
| static SharedPreferences.Editor editor; | |
| private PrefManager() { } |
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 Foundation | |
| import UIKit | |
| extension UIImage { | |
| func scaleAndRotateImage(maxSize: CGFloat) -> UIImage { | |
| let imgRef = self.CGImage | |
| let width = CGFloat(CGImageGetWidth(imgRef)) |
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
| public class DividerItemDecoration extends RecyclerView.ItemDecoration { | |
| private Drawable mDivider; | |
| private boolean mShowFirstDivider = false; | |
| private boolean mShowLastDivider = false; | |
| public DividerItemDecoration(Context context, AttributeSet attrs) { | |
| final TypedArray a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.listDivider}); | |
| mDivider = a.getDrawable(0); |
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 Foundation | |
| import UIKit | |
| // This view will render a arbitrary number of squares | |
| @IBDesignable | |
| class SquaresView : UIView { | |
| @IBInspectable var totalSquares : Int = 10 | |
| @IBInspectable var numSquares : Int = 10 | |
| @IBInspectable var space : CGFloat = 5.0 |
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
| app.factory('calculateCenter', function($window) { | |
| var coordinates = []; | |
| return function(data) { | |
| var num_coords = data.length; | |
| var X = 0.0; | |
| var Y = 0.0; | |
| var Z = 0.0; | |
| for(var i = 0; i < num_coords; i++) { |
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
| export PS1="\[\033[36m\]\u\[\033[m\]\[\033[33;1m\]\w\[\033[m\]\$ " | |
| export CLICOLOR=1 | |
| export LSCOLORS=ExFxBxDxCxegedabagacad | |
| export HISTSIZE=5000 | |
| export HISTFILESIZE=5000 | |
| export HISTCONTROL=ignoredups | |
| export HISTTIMEFORMAT='%F %T > ' |
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 android.content.Context; | |
| import android.net.ConnectivityManager; | |
| import android.net.NetworkInfo; | |
| import android.telephony.TelephonyManager; | |
| /** | |
| * Created by <a href="mailto:marcus@gabilheri.com">Marcus Gabilheri</a> | |
| * | |
| * @author Marcus Gabilheri |
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.HashMap; | |
| // Around 5 minutes (Had to lookup hpw to convert a Integer to binaryString) | |
| // I assumed that the lookup is OK because if I asked the interviewer how to do that they would tell me | |
| public class PalindromeBits { | |
| public static void main(String[] args) { | |
| System.out.println(kthPalindromeInt(8)); | |
| System.out.println(kthPalindromeInt(100)); | |
| System.out.println(kthPalindromeInt(10000)); |
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
| public class FragmentRepos extends DefaultListFragment { | |
| @Override | |
| public void onViewCreated(View view, Bundle savedInstanceState) { | |
| super.onViewCreated(view, savedInstanceState); | |
| GithubClient client = new GithubClient(true); | |
| RepoService repoService = client.createService(RepoService.class); | |
| Observable<List<Repo>> repos = repoService.getRepos("fnk0"); | |
| AppObservable.bindFragment(this, repos); | |
| repos.subscribeOn(Schedulers.io()) | |
| .observeOn(AndroidSchedulers.mainThread()) |
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
| export PS1="\[\033[36m\]\u\[\033[m\]\[\033[33;1m\]\w\[\033[m\]\$ " | |
| export CLICOLOR=1 | |
| export LSCOLORS=ExFxBxDxCxegedabagacad | |
| export HISTSIZE=5000 | |
| export HISTFILESIZE=5000 | |
| export HISTCONTROL=ignoredups | |
| export HISTTIMEFORMAT='%F %T > ' | |
| export GREP_COLOR='1;32' |