Skip to content

Instantly share code, notes, and snippets.

Avatar

Eddie Ringle EddieRingle

View GitHub Profile
@pakoito
pakoito / ADomainDrivenApproachToKotlinsNewTtypes.kt
Last active Jan 11, 2021
Final code example for "A domain driven approach to Kotlin's new types"
View ADomainDrivenApproachToKotlinsNewTtypes.kt
data class UserInfo(val id: String)
data class UserInfoDto(var id: String?)
// Open Inheritance
interface IViewState { }
class Idle: IViewState
@mttkay
mttkay / Pager.java
Created Nov 4, 2015
A simple Rx based pager
View Pager.java
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
@JakeWharton
JakeWharton / BaseActivity.java
Created Jul 6, 2012
Scoped event bus which automatically registers and unregisters with the lifecycle.
View BaseActivity.java
package com.squareup.example;
public abstract BaseActivity extends SherlockActivity {
private final ScopedBus scopedBus = new ScopedBus();
protected ScopedBus getBus() {
return scopedBus;
}
@Override public void onPause() {
@yohhoy
yohhoy / threads.h
Last active Sep 29, 2021
C11 <threads.h> emulation library
View threads.h
/*
* C11 <threads.h> emulation library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef EMULATED_THREADS_H_INCLUDED_
#define EMULATED_THREADS_H_INCLUDED_
@kevinsawicki
kevinsawicki / UploadFile.java
Created Aug 2, 2011
Add downloads to a GitHub repository
View UploadFile.java
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import org.eclipse.egit.github.core.Download;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.DownloadService;
/**
View github_oauth_busy_developer_guide.md

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access: