Skip to content

Instantly share code, notes, and snippets.

@indraAsLesmana
indraAsLesmana / TapGestureRecognizerWithoutSelector.swift
Created February 13, 2024 02:24 — forked from saoudrizwan/TapGestureRecognizerWithoutSelector.swift
Easily create tap gesture recognizers for any view using closures as actions instead of selectors.
import UIKit
extension UIView {
// In order to create computed properties for extensions, we need a key to
// store and access the stored property
fileprivate struct AssociatedObjectKeys {
static var tapGestureRecognizer = "MediaViewerAssociatedObjectKey_mediaViewer"
}
@indraAsLesmana
indraAsLesmana / gist:da9be0ec7ce65aada765c34b97ba87f5
Created January 20, 2024 11:12
Error install xdebug on Mac
Install using ```pecl install xdebug```
and got error something like this:
Warning: mkdir(): File exists in System.php on line 294
PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/php/8.2.12_1/share/php/pear/System.php on line 294
Warning: mkdir(): File exists in /opt/homebrew/Cellar/php/8.2.12_1/share/php/pear/System.php on line 294
ERROR: failed to mkdir /opt/homebrew/Cellar/php/8.2.12_1/pecl/20220829
simply fix with this:
@indraAsLesmana
indraAsLesmana / setup_gpg
Last active December 26, 2024 14:26 — forked from cdalvaro/gpg-with-key
Setting up GPG signature on macOS Sonoma for IDE IntelliJ and XCode
# Install gpg tools
https://gpgtools.org
# Install gpg
brew install gpg
# Generating and exporting
gpg --gen-key
gpg --armor --export <email> > ~/.backups/gpg_git_public.key
gpg --armor --export-secret-key <email> > ~/.backups/gpg_git_private.key
@indraAsLesmana
indraAsLesmana / task_screen.dart
Created April 26, 2022 01:15
ModalBottomSheet above Keyboard
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => SingleChildScrollView(
child: Container(
color: Color(0xff757575),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container(
padding: EdgeInsets.all(20.0),
@indraAsLesmana
indraAsLesmana / DinamicAdsMarginFullscreenMode.kt
Last active January 13, 2021 23:14
Add dinamic buttom margin, when scrren in immersive mode/fullscreen
private fun setDinamicAdsMarginFullscreenMode() {
val bottomMargin = getNavigationBarHeight(this, resources.configuration.orientation)
if (adView?.layoutParams is MarginLayoutParams) {
(adView?.layoutParams as MarginLayoutParams).setMargins(
0,
top,
0,
bottomMargin
)
adView?.requestLayout()
@indraAsLesmana
indraAsLesmana / RecyclerMargin.kt
Last active November 20, 2020 02:49
Create recyclerview margin, end, middle, start margin of item
import android.graphics.Rect
import androidx.recyclerview.widget.RecyclerView
import android.view.View
/**
* this widget add margin to start
* @param outReact.left to change margin start
*
* */
class RecyclerMargin(
DateTime.ToString() Patterns
All the patterns:
0 MM/dd/yyyy 08/22/2006
1 dddd, dd MMMM yyyy Tuesday, 22 August 2006
2 dddd, dd MMMM yyyy HH:mm Tuesday, 22 August 2006 06:30
3 dddd, dd MMMM yyyy hh:mm tt Tuesday, 22 August 2006 06:30 AM
4 dddd, dd MMMM yyyy H:mm Tuesday, 22 August 2006 6:30
5 dddd, dd MMMM yyyy h:mm tt Tuesday, 22 August 2006 6:30 AM
@indraAsLesmana
indraAsLesmana / shadow.xml
Created March 11, 2020 23:31 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
image: node:latest
cache:
paths:
- node_modules/
- app/bower_components
deploy_production:
stage: deploy
environment: Production
@indraAsLesmana
indraAsLesmana / EqualSpacingItemDecoration.java
Created April 23, 2019 22:22 — forked from alexfu/EqualSpacingItemDecoration.java
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;