Skip to content

Instantly share code, notes, and snippets.

View SelvinPL's full-sized avatar

SelvinPL SelvinPL

View GitHub Profile
import 'dart:convert';
void main() {
print(utf8.encode('[1, 2, 3]'));
}
@SelvinPL
SelvinPL / .cs
Created December 12, 2019 11:56
SO59303710
var result = paymentCollections
.GroupBy(l =>
{
switch(l.PaymentStatus)
{
case "Status1":
return "Unit1";
case "Status2":
case "Status3":
return "Unit2";
@SelvinPL
SelvinPL / BuildConstant.targets
Created November 9, 2018 16:19
BuildConstant.targets
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="SetupBuildInfoProperty" BeforeTargets="CoreCompile">
<ItemGroup>
<BuildInfoProperty Include="Configuration"/>
<BuildInfoProperty Include="ProjectDir"/>
</ItemGroup>
</Target>
<Target Name="GenereteBuildInfo" BeforeTargets="CoreCompile" >
@SelvinPL
SelvinPL / ISomeAction.java
Last active July 24, 2018 08:40
Terrible and stupid idea of passing Activity via Bundle
package pl.selvin.terribleidea;
import java.io.Serializable;
public interface ISomeAction extends Serializable {
String KEY = "interface";
void sendAddress(String address);
}
@SelvinPL
SelvinPL / main.dart
Created April 13, 2018 10:45
Popular Movies in Dart/Flutter
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyTheme {
@SelvinPL
SelvinPL / DoNotDoThisBecauseItsStupid.java
Last active June 27, 2017 14:38
Of course it will not work when Dev Options->Don't Keep Activitie is on
package pl.selvin.completelywrongsolution;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@SelvinPL
SelvinPL / TestFragment.java
Last active February 9, 2017 11:16
Show progress
public class TestFragment extends DialogFragment {
private static final String INNER_TAG = "TEST_INNER_TAG";
InnerFragment inner = null;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
/*
* Copyright (C) 2007 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
@SelvinPL
SelvinPL / build.gradle
Created August 24, 2016 15:10
themes.gradle
apply plugin: 'com.android.application'
apply from: 'themes.gradle'
def colorDisabled = 0xADADAD
android {
....
productFlavors.whenObjectAdded { flavor ->
themes_createExtension(flavor, 0x244124, 0x0B280B, 0x3D5A3D, 0x92bc00, colorDisabled)
}
....
static volatile boolean isRunning = true;
void test() {
final int SIZE = 16 * 1024;
try {
final PipedOutputStream pipedOutputStream = new PipedOutputStream();
final PipedInputStream pipedInputStream = new PipedInputStream(SIZE);
pipedOutputStream.connect(pipedInputStream);
final Object wait = new Object();
new Thread(new Runnable() {
@Override