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
import java.io.ByteArrayOutputStream; | |
import java.util.Date; | |
| |
import javax.xml.bind.JAXBContext; | |
import javax.xml.bind.Marshaller; | |
import javax.xml.bind.annotation.XmlElement; | |
import javax.xml.bind.annotation.XmlSeeAlso; | |
import javax.xml.bind.annotation.XmlTransient; | |
| |
import com.fasterxml.jackson.annotation.JsonSubTypes; |
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
import javax.ws.rs.ApplicationPath; | |
| |
import org.glassfish.jersey.server.ResourceConfig; | |
| |
@ApplicationPath("rest") | |
public class RestApplication extends ResourceConfig { | |
public RestApplication(){ | |
packages("com.company.package.to.resources;com.fasterxml.jackson"); | |
} |
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
export CLICOLOR=1 | |
export PS1="\n\[\033[31m\]\d : \t\n\[\033[33m\]\w\n\[\033[m\]$ " |
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
static void saveTitlePref(Context context, int appWidgetId, String text) { | |
SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit(); | |
prefs.putString(PREF_PREFIX_KEY + appWidgetId, text); | |
prefs.commit(); | |
} | |
static String loadTitlePref(Context context, int appWidgetId) { | |
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0); | |
String prefix = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null); | |
if (prefix != null) { |
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
mListview.setOnScrollListener(new OnScrollListener() { | |
@Override | |
public void onScrollStateChanged(AbsListView view, int scrollState) { | |
mScrollState = scrollState; | |
} | |
@Override | |
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { | |
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
// By Chris Coyier & tweaked by Mathias Bynens | |
$(function() { | |
// Find all YouTube videos | |
var $allVideos = $("iframe[src^='http://www.youtube.com']"), | |
// The element that is fluid width | |
$fluidEl = $("div.container-narrow"); | |
// Figure out and save aspect ratio for each video |
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
try { | |
final com.google.api.services.calendar.Calendar client; | |
final HttpTransport transport = AndroidHttp.newCompatibleTransport(); | |
final JsonFactory jsonFactory = new GsonFactory(); | |
GoogleAccountCredential credential; | |
credential = GoogleAccountCredential.usingOAuth2(weakActivity.get(), CalendarScopes.CALENDAR); | |
credential.setSelectedAccountName(accountName); | |
// Calendar client | |
client = new com.google.api.services.calendar.Calendar.Builder(transport, jsonFactory, credential).setApplicationName("Timy/1.0").build(); |
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
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; | |
GoogleAccountCredential credential; | |
credential = GoogleAccountCredential.usingOAuth2(preference.getContext(), CalendarScopes.CALENDAR); | |
credential.setSelectedAccountName(accountName); | |
startActivityForResult(credential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); |
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
int first = mNotificationList.getFirstVisiblePosition(); | |
int last = mNotificationList.getLastVisiblePosition(); | |
int delta = last - first; | |
for (int i = 0; i <= delta; i++) { | |
View view = mNotificationList.getChildAt(i); | |
if (view != null) { | |
Animation animation = AnimationUtils.loadAnimation( |
NewerOlder