Skip to content

Instantly share code, notes, and snippets.

@medyo
medyo / YouTubePlayerSupportFragmentX.java
Last active June 7, 2023 13:48
Solution: YouTubePlayerSupportFragment that supports androidx
package com.google.android.youtube.player;
/**
* Please create this directories schema com.google.android.youtube.player and post the file there
*/
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@mojimi
mojimi / weasyprint-async.py
Last active March 20, 2023 06:29
WeasyPrint Async Images/asyncio
import aiohttp
import asyncio
import base64
import time
from io import BytesIO
from PIL import Image
from bs4 import BeautifulSoup
from weasyprint import HTML
html_with_images = """
@yasinkuyu
yasinkuyu / paribu_api
Last active November 15, 2022 20:02
Paribu Bitcoin Rates
Paribu.com - Türkiye'nin Bitcoin Borsası
2021 (update)
Api endpoint
https://v3.paribu.com/app/markets/btc-tl?interval=1000
Ticker
anonymous
anonymous / index.html
Created February 7, 2017 08:11
Pending, success and failure status indications with just :before and :after
<div id="status" class="status -pending">Pending</div>
<div class="status -pending">Pending</div>
<div class="status -success">Success</div>
<div class="status -failure">Failure</div>
@polbins
polbins / EndlessListActivity.java
Last active January 9, 2019 10:02
Android Endless Scroll using RecyclerView
public class EndlessListActivity<D> extends Activity {
private EndlessRecyclerOnScrollListener mEndlessScrollListener;
private EndlessListAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RecyclerView listView = (RecyclerView) findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
@nrazon
nrazon / methodcount.bat
Last active August 26, 2015 12:01 — forked from mrsasha/methodcount.bat
.jar and .dex method count helpers for Windows. dx from build-tools in the Android SDK has to be in your PATH. Just call methodcount.bat "filename"
@ECHO OFF
IF "%1"=="" GOTO MissingFileNameError
IF EXIST "%1" (GOTO ContinueProcessing) ELSE (GOTO FileDoesntExist)
:ContinueProcessing
set FileNameToProcess=%1
set FileNameForDx=%~n1.dex
IF "%~x1"==".dex" GOTO ProcessWithPowerShell
REM preprocess Jar with dx
@ssg
ssg / validate.js
Last active March 28, 2016 06:11
Turkish ID Validator in a Tweet Attempt
function validate(n){n=[].map.call(n,Number);o=n[0];c=n[9];t=10;if(o){o+=n[2]+n[4]+n[6]+n[8];e=n[1]+n[3]+n[5]+n[7];};return!((7*o-e+t)%t-c|((o+e+c)%t)-n[t]);}
@mrsasha
mrsasha / methodcount.bat
Created September 14, 2014 16:08
.jar and .dex method count helpers for Windows. dx from build-tools in the Android SDK has to be in your PATH. Just call methodcount.bat "filename"
@ECHO OFF
IF "%1"=="" GOTO MissingFileNameError
IF EXIST "%1" (GOTO ContinueProcessing) ELSE (GOTO FileDoesntExist)
:ContinueProcessing
set FileNameToProcess=%1
set FileNameForDx=%~n1.dex
IF "%~x1"==".dex" GOTO ProcessWithPowerShell
REM preprocess Jar with dx
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@ozkatz
ozkatz / ec2_ssh_config.py
Created June 21, 2013 00:50
generate an ~/.ssh/config file from your EC2 instances, so that you'd never have to lookup those fugly ec2-xx-xx-xx-xxx.compute-1.amazonaws.com hostnames again. Use your instance name instead!
#!/usr/bin/env python
import os
import sys
import argparse
try:
from boto.ec2.connection import EC2Connection
except ImportError:
sys.stderr.write('Please install boto ( http://docs.pythonboto.org/en/latest/getting_started.html )\n')
sys.exit(1)