View CouroutinesUsefulExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun launch(f: () -> Unit) { | |
GlobalScope.launch { | |
f.invoke() | |
} | |
} | |
inline fun <reified T> asyncAndWait(crossinline f: () -> T) = runBlocking { | |
return@runBlocking GlobalScope.async(Dispatchers.IO) { | |
f.invoke() | |
}.await() |
View CallingTheSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun showBottomSheetMenu() { | |
val v = layoutInflater.inflate(R.layout.your_custom_layout_here, null) | |
val bottomSheet = GoogleBottomSheetDialog(this) | |
bottomSheet.setContentView(v) | |
bottomSheet.show() | |
} |
View gist:02c9c6a255f709b9bd8577dec5ca5025
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[03-03 13:02:12.321 2397:2397 I/vold] | |
Vold 3.0 (the awakening) firing up | |
[03-03 13:02:12.322 2397:2397 V/vold] | |
Detected support for: exfat ext4 ntfs vfat | |
[03-03 13:02:12.326 2397:2397 I/vold] | |
[libfs_mgr]fs_mgr_read_fstab_dt(): failed to read fstab from dt | |
[03-03 13:02:12.328 2397:2401 D/vold] |
View recursive_update.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WHILE 1 = 1 | |
BEGIN | |
UPDATE TOP(100000) A | |
SET CIA = CASE | |
WHEN DS_INDICADOR = 'AUTO' THEN LEFT(RIGHT(CD_ITEM,14),3) | |
WHEN DS_INDICADOR IN ('RE','RAMOS ELEMENTARES') THEN LEFT(RIGHT(CD_ITEM,10),3) | |
ELSE 0 | |
END | |
FROM DB_PGC_PRODUCAO..TB_DM_INFO_GER_ANALITICO_HIST A |
View recursive_delete.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DT_ANOMES_REF INT = 201702 | |
DECLARE @QTD_REG_BATCH INT = 0 | |
DECLARE @ID INT = 0 | |
SET @QTD_REG_BATCH = CEILING((SELECT COUNT(*) FROM DB_PGC_PRODUCAO..TB_VIDA_DBM WHERE DT_ANOMES_REF = @DT_ANOMES_REF) / 100000) | |
WHILE @ID <= @QTD_REG_BATCH -- Este número resulta no calculo [Qtde. Linhas a serem deletadas] / [100000] | |
BEGIN | |
;WITH CTE AS | |
( |
View script.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DIA_UTIL INT | |
DECLARE @PROXIMO_DIA_UTIL VARCHAR(8) | |
DECLARE @PRIMEIRO_DIA_UTIL_MES_SEGUINTE VARCHAR(8) | |
/*****************************************************************************************************************/ | |
--VERIFICA DIAS ÚTEIS | |
/*****************************************************************************************************************/ | |
--TABELA DIAS UTEIS | |
IF OBJECT_ID('TEMPDB..#DIA_UTEIS_MES_ATUAL') IS NOT NULL | |
DROP TABLE #DIA_UTEIS_MES_ATUAL |
View Android - sendFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//first you need to create a socket and connect with a socket then use the following code | |
private OutputStream out = socket.getOutputStream();; | |
//you need to use the file you want to send as a param | |
public void sendMessage(File file) throws IOException { | |
if (out != null) { | |
byte[] bytes = new byte[(int) file.length()]; | |
BufferedInputStream bis; | |
bis = new BufferedInputStream(new FileInputStream(file)); | |
bis.read(bytes, 0, bytes.length); |