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 / 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
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;
@indraAsLesmana
indraAsLesmana / GPSTracker.java
Created October 15, 2018 15:22 — forked from rupakraj/GPSTracker.java
To get the current location of the android phone; GPS; Traking
package np.com.rupakraj.util;
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@indraAsLesmana
indraAsLesmana / proguard-rules.pro
Created February 25, 2018 12:00 — forked from jemshit/proguard-rules.pro
Proguard rules for common Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
/*
* Copyright 2012-2014 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of