Skip to content

Instantly share code, notes, and snippets.

@epitron
epitron / activerecord-benchmarks.csv
Last active March 4, 2018 21:48
CockroachDB vs PostgreSQL vs MySQL vs SQLite
activerecord-cockroachdb activerecord-postgresql activerecord-mysql activerecord-sqlite Benchmark
9.216770* (60720k) 9.590111 (60984k) 12.455487 (69168k) 18.465701 (64944k) Model Object Creation: 3200 objects (No Transaction)
0.900417 (0k) 0.893337 (0k) 0.832904 (0k) 0.707108* (0k) Model Object Creation: 3200 objects (Transaction)
2.031437* (337128k) 2.070499 (336864k) 2.181665 (332112k) 2.215748 (333432k) Model Object Select: 6400 objects 64 times (No Transaction)
2.004822 (0k) 1.984105* (0k) 2.121498 (264k) 2.175031 (0k) Model Object Select: 6400 objects 64 times (Transaction)
3.460825 (0k) 3.337974 (0k) 3.875209 (0k) 2.622881* (0k) Model Object Select PK: 640 objects 64 times (No Transaction)
3.372082 (0k) 3.247312 (0k) 3.786783 (0k) 2.253132* (0k) Model Object Select PK: 640 objects 64 times (Transaction)
3.594136 (0k) 3.431209 (0k) 4.428752 (0k) 2.679963* (0k) Model Object Select Hash: 640 objects 64 times (No Transaction)
3.473371 (0k) 3.358583 (0k) 3.800874 (0k) 2.409768* (0k) Model Object Select Hash:

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@alibo
alibo / iran-sanctions_blocker-sites.csv
Last active February 21, 2024 08:11
List of sites which block IPs come from Iran [UPDATING... (July 16, 2020)] #SANCTIONS
Title URI
Flurry by Yahoo https://dev.flurry.com/secure/signup.do
Google NikCollection https://dl.google.com/edgedl/photos/nikcollection-full-1.2.11.dmg
Bitbucket http://bitbucket.org/
SoftLayer http://softlayer.com/
VirtualBox http://download.virtualbox.org/virtualbox/5.0.16/VirtualBox-5.0.16-105871-OSX.dmg
Docker Hub https://hub.docker.com/
Oracle http://oracle.com/
Java http://java.com
Sun http://sun.com
@alashow
alashow / OkHttp3Stack.java
Last active May 29, 2020 08:59 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley (okhttp3 version)
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@kustra
kustra / HeaderFooterRecyclerViewAdapter.java
Last active March 15, 2021 03:58 — forked from mheras/HeaderFooterRecyclerViewAdapter.java
Header & footer support for RecyclerView.Adapter, with custom ViewHolder types for the content, header and footer
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
public abstract class HeaderFooterRecyclerViewAdapter<
ContentViewHolder extends RecyclerView.ViewHolder,
HeaderViewHolder extends RecyclerView.ViewHolder,
FooterViewHolder extends RecyclerView.ViewHolder>
extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@bryanstern
bryanstern / OkHttpStack.java
Last active April 24, 2022 03:17
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@lapastillaroja
lapastillaroja / DividerItemDecoration.java
Last active November 17, 2023 23:06 — forked from akmalxxx/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@mheras
mheras / HeaderFooterRecyclerViewAdapter.java
Last active January 12, 2024 17:33
Header & footer support for RecyclerView.Adapter
public abstract class HeaderFooterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int VIEW_TYPE_MAX_COUNT = 1000;
private static final int HEADER_VIEW_TYPE_OFFSET = 0;
private static final int FOOTER_VIEW_TYPE_OFFSET = HEADER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private static final int CONTENT_VIEW_TYPE_OFFSET = FOOTER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private int headerItemCount;
private int contentItemCount;
private int footerItemCount;
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;