Skip to content

Instantly share code, notes, and snippets.

View ElianFabian's full-sized avatar

Elián Fabián ElianFabian

View GitHub Profile
@sunnyone
sunnyone / PowerShellUICulture.ps1
Created November 15, 2013 15:48
Changing PowerShell UICulture
# example: Set-PowerShellUICulture -Name "en-US"
function Set-PowerShellUICulture {
param([Parameter(Mandatory=$true)]
[string]$Name)
process {
$culture = [System.Globalization.CultureInfo]::CreateSpecificCulture($Name)
$assembly = [System.Reflection.Assembly]::Load("System.Management.Automation")
@hosuaby
hosuaby / web_ui_elements_naming_convention.md
Last active October 3, 2022 06:58
Simple convention for naming GUI elements of Web applications

Simple convention for naming GUI elements of Web applications

Ids or names of elements (primitives or complexes) must be written in Camel Case and must to be as short as possible. All id or name must to start with one of the defined element type prefixes.

Element type prefixes

All element ids or names must use Hungarian notation to incorporate the type of element. Prefixes are used to indicate the semantic type of the element, rather than it's underlining implementation. It means that the element of GUI with button look & feel must prefixed as btn, regardless of how it is implemented, with tag <button> or with tag <a>.
Prefixes are lowercase strings of 2, 3 or 4 characters. Here a complete list of authorised prefixes:

  • btn - the button or a link with a button look & feel
@VassilisPallas
VassilisPallas / FileInformation.java
Created May 17, 2016 22:55
get file information from URI
import android.annotation.TargetApi;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
@Pulimet
Pulimet / AdbCommands
Last active July 20, 2024 12:55
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@maiconhellmann
maiconhellmann / DateExtension.kt
Last active August 17, 2023 07:36
Date extensions wrote in Kotlin
import java.text.SimpleDateFormat
import java.util.*
/**
* Pattern: yyyy-MM-dd HH:mm:ss
*/
fun Date.formatToServerDateTimeDefaults(): String{
val sdf= SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
return sdf.format(this)
}
@florina-muntenescu
florina-muntenescu / CustomTypefaceSpan.kt
Last active July 2, 2024 09:28
Style internationalized text using Annotations
/*
* Copyright (C) 2018 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
@lawrence-laz
lawrence-laz / BaseBehaviour.cs
Created November 30, 2018 18:00
Automatically get components in Unity using [GetComponent] attribute
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
public class BaseBehaviour : MonoBehaviour
{
protected virtual void OnEnable()
{
@afollestad
afollestad / BroadcastReceiver.kt
Last active January 14, 2024 10:23
A Lifecycle components aware BroadcastReceiver DSL (Kotlin)
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.Lifecycle.Event.ON_START
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import android.content.BroadcastReceiver as StockReceiver
@objcode
objcode / ConcurrencyHelpers.kt
Last active July 7, 2024 09:57
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@krishnabhargav
krishnabhargav / kotlin-sealedclass-serialization.kt
Last active May 15, 2024 12:52
Using GSON to support serialization and deserialization of Kotlin Sealed Classes.
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.TypeAdapter
import com.google.gson.TypeAdapterFactory
import com.google.gson.reflect.TypeToken
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonWriter
import kotlin.jvm.internal.Reflection
import kotlin.reflect.KClass