Skip to content

Instantly share code, notes, and snippets.

@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できる
  • データの圧縮
@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 継承クラスです。
@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)) {
{
"status": "success",
"search_nag": {},
"code": 0,
"bookmark": "b28xMDB8MDQ0NWZiOTBjNzNiODlkOTQ1ZTk3ZjY0ZTBhYjU0YjM0ZDYyNDg3NjU3ZWQ3OGJmZjI4ZTliZGRmODBlMzJlNQ==",
"debug_data": {
"query_data": {}
},
"message": "ok",
"data": [
@hachinobu
hachinobu / mainScreen
Created March 26, 2014 08:55
ステータスバー領域を含む画面の領域とステータスバー領域を含まない画面の領域の取得方法
//ステータスバー領域を含む画面の領域
CGRect bounds = [UIScreen mainScreen].bounds;
ステータスバー領域を含まない画面の領域
CGRect applicationFrame = [UIScreen mainScreen].applicationFrame;
@MostafaGazar
MostafaGazar / SvgMaskedImageView.java
Last active April 30, 2022 07:48
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
@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);
@okamuuu
okamuuu / mongo.aggregate.coffee
Last active September 8, 2016 16:06
mongo aggregate order by ymd
require 'coffee-script'
require 'coffee-errors'
assert = require 'assert'
moment = require 'moment'
async = require 'async'
MongoClient = require('mongodb').MongoClient
describe 'MongoClient', ->
package com.example.fragmentpageradapterdemo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.ListFragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
@kaiinui
kaiinui / eventbus.md
Last active March 3, 2017 03:54
Android開発いろいろ

EventBus

EventBus は必ず onStart()onStop() で呼ぶ。バックグラウンドで色々動かれて困る。 また、onStop() では super.onStop() よりも 先に 呼ぶ。

@Override
protected void onStart() {
 super.onStart();