Skip to content

Instantly share code, notes, and snippets.

@burgalon
burgalon / AccountAuthenticator.java
Last active July 15, 2023 08:29
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
@MostafaGazar
MostafaGazar / SvgMaskedImageView.java
Last active August 21, 2024 12:37
Based on https://github.com/MostafaGazar/CustomShapeImageView, Custom shape ImageView using PorterDuffXfermode and SVGs as masks
/*
* Copyright 2014 Mostafa Gazar
*
* 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
@hachinobu
hachinobu / mainScreen
Created March 26, 2014 08:55
ステータスバー領域を含む画面の領域とステータスバー領域を含まない画面の領域の取得方法
//ステータスバー領域を含む画面の領域
CGRect bounds = [UIScreen mainScreen].bounds;
ステータスバー領域を含まない画面の領域
CGRect applicationFrame = [UIScreen mainScreen].applicationFrame;
{
"status": "success",
"search_nag": {},
"code": 0,
"bookmark": "b28xMDB8MDQ0NWZiOTBjNzNiODlkOTQ1ZTk3ZjY0ZTBhYjU0YjM0ZDYyNDg3NjU3ZWQ3OGJmZjI4ZTliZGRmODBlMzJlNQ==",
"debug_data": {
"query_data": {}
},
"message": "ok",
"data": [
@rishabhmhjn
rishabhmhjn / tweetLinky.js
Last active June 5, 2020 19:25
This is an AngularJS filter to linkify #hashtags and @mention texts into respective Twitter URLsDemo - http://plnkr.co/edit/vrdgxU?p=preview
var app = angular.module('tLinky', ['ngSanitize']);
app.filter('tweetLinky',['$filter', '$sce',
function($filter, $sce) {
return function(text, target) {
if (!text) return text;
var replacedText = $filter('linky')(text, target);
var targetAttr = "";
if (angular.isDefined(target)) {
@komiya-atsushi
komiya-atsushi / ChiSquaredTestMatcher.java
Created September 27, 2013 22:44
#渋谷java 第3回で発表予定のコードです。 http://atnd.org/events/42501
import org.apache.commons.math3.distribution.ChiSquaredDistribution;
import org.apache.commons.math3.stat.inference.ChiSquareTest;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import java.util.Arrays;
import java.util.List;
/**
* カイ二乗検定を用いた検証を行う BaseMatcher 継承クラスです。
@jacopen
jacopen / backup.md
Last active June 9, 2016 22:51
gem backupを使ってみる

gem backup

これって何

その名の通り、backupを取るための便利なgem https://github.com/meskyanichi/backup

  • データのdump
    • ローカルファイルやディレクトリだけでなく、MySQL、Postgres、MongoDB、Redis、RiakからDumpできる
  • データの圧縮