Skip to content

Instantly share code, notes, and snippets.

View pablichjenkov's full-sized avatar

pablichjenkov pablichjenkov

View GitHub Profile
@aembleton
aembleton / Ignore certificate for HttpURLConnection in Android.java
Created March 27, 2011 17:25
The following code disables SSL certificate checking for any new instances of HttpsUrlConnection
/**
* Disables the SSL certificate checking for new instances of {@link HttpsURLConnection} This has been created to
* aid testing on a local box, not for use on production.
*/
private static void disableSSLCertificateChecking() {
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@orj
orj / .gitconfig
Created May 27, 2011 02:43
Using p4merge as Git mergetool on Mac OS X.
[merge]
keepBackup = false
tool = custom
[mergetool "custom"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$LOCAL" "$PWD/$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jieyu
jieyu / AndroidViewInvalidation.md
Created March 9, 2013 21:24
Describe how View.invalidate() is processed in Android to refresh a widget.

How View.invalidate() is processed in Android

This document is based on the code of android-4.1.1_r6 (Jelly Bean).

First, the invalidate() call will be propagated back to the root of the view hierarchy. During the propagation, the system determines the dirty area that needs to be redrawn. The propagation will eventually reach ViewRootImpl.

frameworks/base/core/java/android/view/View.java

10219   void invalidate(boolean invalidateCache) {

... ...

@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@mycodeschool
mycodeschool / InfixToPostfix.cpp
Created December 9, 2013 05:34
Infix to Postfix conversion in C++ using stack. We are assuming that both operators and operands in input will be single character.
/*
Infix to postfix conversion in C++
Input Postfix expression must be in a desired format.
Operands and operator, both must be single character.
Only '+' , '-' , '*', '/' and '$' (for exponentiation) operators are expected.
*/
#include<iostream>
#include<stack>
#include<string>
@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* 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
@benjchristensen
benjchristensen / EventBus.java
Last active February 24, 2022 03:02
EventBus.java
import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;
/**
* Simple pass-thru event bus with error handling and reconnect.
*/
public class EventBus {
@chrisbanes
chrisbanes / SystemUiHelper.java
Last active March 2, 2024 18:57
SystemUiHelper
/*
* Copyright (C) 2014 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
@justasm
justasm / NonPersistentCookieJar.java
Last active April 21, 2019 10:03
OkHttp 3 non-persistent CookieJar with an ACCEPT_ALL policy
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;