Skip to content

Instantly share code, notes, and snippets.

View SeniorZhai's full-sized avatar
🏠
Working from home

SeniorZhai SeniorZhai

🏠
Working from home
View GitHub Profile

DAO

负责SQL CRUD

  • insert
    • single insertX(x:X)
    • multiple insertXxList(xxs:List<X>)
  • update updateXXbyYY(xx:X,yy:Y)
  • delete
    • single deleteX(x:X)
    • multiple deleteByYY(yy:Y)
  • read
@yxztj
yxztj / TaskConcurrencyManifesto.md
Last active November 14, 2024 13:55 — forked from lattner/TaskConcurrencyManifesto.md
Swift Concurrency Manifesto 中文翻译
@fhefh2015
fhefh2015 / v.php
Last active February 18, 2019 05:52
抖音无水印下载地址
<?php
/**
* Created by PhpStorm.
* User: aric
* Date: 18/7/10 上午9:34
*/
//获取重定向最终网址
function get_redirect_final_target($url)
{
@fython
fython / StorageManagerCompat.java
Last active February 16, 2022 14:48
StorageManagaerCompat (openProxyFileDescriptor pre-O)
/**
* No Licenses. Use it in your favourite way.
*/
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.ParcelFileDescriptor;
import android.os.ProxyFileDescriptorCallback;
import android.os.storage.StorageManager;
@LouisCAD
LouisCAD / LifecycleCoroutines.kt
Last active July 3, 2022 11:47
CoroutineScope and Job integration with Lifecycle for Android. Meant to be used for your coroutines in lifecycle aware components. OUTDATED. See up to date implementation here: https://github.com/LouisCAD/Splitties/tree/master/modules/lifecycle-coroutines
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.Main
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job {

iOS restrictions re: bringing up the keyboard on programmatic focus

I can't find exact specifications on this, but it seems that iOS restricts bringing up the keyboard via programmatically focusing on <input>. It only brings up the keyboard in response to explicit user interaction.

  1. iOS focus on input field only brings up keyboard when called inside a click handler.
  2. It doesn’t work if the focus is async.

This presents a curious problem when you want to autofocus an input inside a modal or lightbox, since what you generally do is click on a button to bring up the lightbox, and then focus on the input after the lightbox has been opened. Without anything fancy, it actually works ok. The problem shows up when you try to add something fancy like a setTimeout or a promise.then(). I don't know why people would want to use a setTimeout here, but waiting for a promise is actually a pretty common use case. E.g. we try to batch dom manipulations like getting a lightbox to show up inside `requestAnimati

@kasim1011
kasim1011 / PDFUtil.java
Created March 12, 2018 13:35 — forked from tejpratap46/PDFUtil.java
Android Generate PDF from view
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.pdf.PdfDocument;
import android.graphics.pdf.PdfRenderer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@ibraheem4
ibraheem4 / postgres-brew.md
Last active October 14, 2024 11:59 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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
@weaming
weaming / clean-android-sdcard.sh
Last active August 14, 2022 07:33
Shell script to clean my android SDCard
# Preconditions:
# 1. Install adb drivers on your computer
# 2. Append the path of 'adb.exe' to the PATH environment variable
# 3. run "adb devices" to run adb ademon in background and list all connected devices
# 4. run "adb shell" get in the shell interface
cd /sdcard
# list all directories in current path, whose size is less than 100 KB
#du -d 1 | grep -v '\./\.' | awk '$1 < 100 {print $0}'