This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="config_app_name">AVélib</string> | |
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string> | |
<string name="config_com.google.android.maps.v2.api_key">XXX</string> | |
</resources> |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
/*1) Searching Array by converting Array to ArrayList in Java | |
ArrayList in Java has a convenient method called contains() which returns true if object passed to it are inside ArrayList. by converting an array into ArrayList in Java we can easily use this option for searching any element in Java array. | |
2) Search Java array by converting Array to HashSet | |
Just like we can leverage ArrayList's contains method we can also use HashSet contains() method which has O(1) response time for search. So if you need constant search time to find an element in array, consider converting your Array into HashSet in Java. see the code section for complete example of searching elements in Java array using HashSet's contains() method. | |
3) Searching Java Array using Arrays.binarySearch() | |
Binary Search is another faster way of searching elements in Java array but it requires array to be sorted while earlier examples of finding elements on Array can be used with both sorted and unsorted array. java.util.Arrays class provides both so |
This file contains 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
private final Handler mHandler = new Handler(); | |
// should be inside onItemClick of DrawerItemClickListener | |
mHandler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
mFragManager.beginTransaction().replace(R.id.content_frame,mFragment).addToBackStack(null).commit(); | |
} | |
}, 300); |
This file contains 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
// Apache 2.0 licensed. | |
import android.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */ | |
public abstract class BindableAdapter<T> extends BaseAdapter { |
This file contains 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
/* The date/time conversion code is going to be moved outside the asynctask later, | |
* so for convenience we're breaking it out into its own method now. | |
*/ | |
private String getReadableDateString(long time){ | |
// Because the API returns a unix timestamp (measured in seconds), | |
// it must be converted to milliseconds in order to be converted to valid date. | |
Date date = new Date(time * 1000); | |
SimpleDateFormat format = new SimpleDateFormat("E, MMM d"); | |
return format.format(date).toString(); | |
} |
This file contains 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
#! /usr/bin/env python2 | |
import cv2 | |
import numpy as np | |
from collections import deque | |
orig_image = None | |
gray_image = None | |
threshold_image = None | |
edge_image = None |
This file contains 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
dependencies { | |
compile 'com.android.support:appcompat-v7:21.+' | |
compile 'com.wrapp.floatlabelededittext:library:0.0.5' | |
} |
This file contains 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
def multiply(x: Double, n: Double): Double = { | |
if (n == 0) 0 else x + multiply(x, n - 1) | |
} | |
def power(b: Int, e: Int): Double = { | |
if (e > 0) multiply(b.toDouble, power(b, e - 1)) | |
else if (e < 0) 1/power(b, -e) // let me use / for negative e :P | |
else 1.0 | |
} |
This file contains 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
/* | |
* Copyright 2014 Chris Banes | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
OlderNewer