Skip to content

Instantly share code, notes, and snippets.

View madlymad's full-sized avatar
👻
Coding stuff

Mando Stamelaki madlymad

👻
Coding stuff
View GitHub Profile
/*
* Copyright (C) 2013 The Android Open Source Project
*
* 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
@mosabua
mosabua / AndroidInsecureKeepAliveHttpsTransportSE
Created April 7, 2011 15:51
AndroidInsecureHttpsServiceConnectionSE implements the service connection that will allow any SSL cert on Android 2.1 (api level 7) and below, this disables SSL for old platform version, be careful
import org.ksoap2.transport.HttpsTransportSE;
import org.ksoap2.transport.ServiceConnection;
import java.io.IOException;
public class AndroidInsecureKeepAliveHttpsTransportSE extends HttpsTransportSE {
private AndroidInsecureHttpsServiceConnectionSE conn = null;
private final String host;
private final int port;
@justinamberson
justinamberson / StackOverflowFanatic.py
Created August 13, 2013 01:09
StackOverflow Fanatic Golden Badge Helper Awarded for 100 days of consecutive visits. Defaults to opening the site every 12 hours (43200 seconds)
#StackOverflow Fanatic Badge Helper
#Justin Amberson 2013 : http://justin.amberson.net
#Fanatic Golden badge - 100 consecutive days on StackOverflow
import webbrowser
import time
def openURL(url):
webbrowser.open(url)
@charbgr
charbgr / record-gif.sh
Last active October 26, 2016 13:52
Android - Gif Recording Device
#!/bin/bash
adb shell screenrecord --bit-rate=20M "/sdcard/recording.mp4" &
PID=$!
echo "Recording.. ($PID)"
read -n1 -r -p "Press any key to stop" key
kill -SIGHUP $PID
sleep 1
adb pull "/sdcard/recording.mp4"
echo "Gififying..."
gifify -r 60 "recording.mp4"
package com.alexstyl.myapplication;
import android.content.res.Resources;
import android.support.annotation.StringRes;
class AndroidStringResources implements StringResources {
private final Resources resources;
AndroidStringResources(Resources resources) {
@devunwired
devunwired / ExampleFragment.java
Created May 15, 2014 17:03
Method for animating Android fragment positions during a add/replace/remove transition using custom properties. This method does not require subclassing target views with additional setter methods, but instead requires subclassing the fragment...something you are likely already doing.
/**
* An example of adding these transitions to a Fragment. This simple
* version just applies opposite transitions to any Fragment whether it is
* entering or exiting view. You can also inspect the transit mode parameter
* (i.e. TRANSIT_FRAGMENT_OPEN, TRANSIT_FRAGMENT_CLOSE) in combination to do
* different animations for, say, adding a fragment versus popping the back stack.
*
* Transactions without an explicit transit mode set, in this example, will not
* animate. Allowing the initial fragment add, for example, to simply appear.
*/
@bichotll
bichotll / load_disqus_comments_android.java
Last active April 25, 2019 15:19
Load disqus comments with a htmlview in Android
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comments);
String htmlComments = getHtmlComment("yourId", "yourShortName");
webDisqus = (WebView) findViewById(R.id.disqus);
// set up disqus
WebSettings webSettings2 = webDisqus.getSettings();
@alexsinger
alexsinger / build.gradle
Last active July 10, 2019 04:42
Separate Crashlytics reporting for debug and release buildTypes using a Gradle build
// The following code allows an app to report Crashlytics crashes separately
// for release and debug buildTypes when using Gradle. This code should be inserted
// into the specified locations within your build.gradle (Module:app) file
// The buildTypes { } block should be inserted inside the android { } block
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.crashlyticsApiSecret = "release api secret"
@kotucz
kotucz / build-robolectric.gradle
Last active November 5, 2019 12:13
Robolectric runtime dependencies downloader
/**
* Module that includes this will be configured to use offline dependencies for Robolectric
* This downloads robolectric dependencies once into the root project
*/
def robolectricDependenciesFolder = rootProject.buildDir.path + "/robolectric-dependencies"
// configuration that resolves Robolectric runtime dependencies
configurations.create('robolectricRuntime')
package com.alexzh.recyclerviewsetemptyview;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class EmptyRecyclerView extends RecyclerView {
private View mEmptyView;