Skip to content

Instantly share code, notes, and snippets.

@alexsasharegan
alexsasharegan / .htaccess
Created September 7, 2016 00:36
Apache Config for React Router
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
@jdanyow
jdanyow / app.html
Last active December 11, 2017 10:05
Aurelia autocomplete
<template>
<require from="./autocomplete"></require>
<form>
<label class="form-component">
Country
<autocomplete service.bind="countryNameService"
value.bind="countryName"
placeholder="Country">
</autocomplete>
</label>
@melihaksoy
melihaksoy / Example BaseActivity.java
Last active November 12, 2016 09:33
An example BaseActivity, which extends AppCompatActivity, to put fragments with animations & start activities with animations easily during development
public class BaseActivity extends AppCompatActivity {
/**
* Puts given fragment to "DT410QeExd9KcRDM7n3OItQDo0jxpaT8uOE4n" id'ed view
*
* @param fragment {@link Fragment} to put in view
*/
public void putFragment(Fragment fragment) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
@gabrielemariotti
gabrielemariotti / Readme.md
Last active January 1, 2025 22:35
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@alexfu
alexfu / DividerItemDecoration.java
Last active February 9, 2023 05:09
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 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
@elqsar
elqsar / HideSoftkeyboardOnTap
Last active September 12, 2022 11:06
Hide softkeyboard in android application if user tap outside EditText control
protected void setupParent(View view) {
//Set up touch listener for non-text box views to hide keyboard.
if(!(view instanceof EditText)) {
view.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
hideSoftKeyboard();
return false;
}
});
}
@lecho
lecho / shadow.xml
Created September 7, 2013 07:01
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"