This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MemoryCacheManager | |
| { | |
| #region Fields | |
| private readonly IMemoryCache _cache; | |
| /// <summary> | |
| /// All keys of cache | |
| /// </summary> | |
| /// <remarks>Dictionary value indicating whether a key still exists in cache</remarks> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import asyncio | |
| from vpn import get_proxy | |
| proxy = port = auth = None | |
| pool = asyncio.Queue(5) | |
| psize = 0 | |
| async def process_client(client_reader, client_writer, *, CHUNK=4096): | |
| global psize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void printPermissions(Context context) { | |
| PackageInfo android; | |
| try { | |
| android = context.getPackageManager().getPackageInfo("android", PackageManager.GET_PERMISSIONS); | |
| } catch (PackageManager.NameNotFoundException e) { | |
| e.printStackTrace(); | |
| return; | |
| } | |
| PermissionInfo[] permissions = android.permissions; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // JS array equivalents to C# LINQ methods - by Dan B. | |
| // First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version): | |
| // Here's a simple array of "person" objects | |
| var people = [ | |
| { name: "John", age: 20 }, | |
| { name: "Mary", age: 35 }, | |
| { name: "Arthur", age: 78 }, | |
| { name: "Mike", age: 27 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Template Redirect | |
| * Use page_beaver.php for all static Pages. | |
| */ | |
| add_filter( 'template_include', 'custom_page_template', 99 ); | |
| function custom_page_template( $template ) { | |
| if ( is_singular( 'page' ) ) { | |
| $new_template = locate_template( array( 'page_beaver.php' ) ); | |
| if ( '' != $new_template ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Custom Scroll listener for RecyclerView. | |
| * Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e | |
| */ | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = "EndlessScrollListener"; | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //* Register Home Slider widget area | |
| genesis_register_sidebar( array( | |
| 'id' => 'home-slider', | |
| 'name' => __( 'Home Slider', 'mpp' ), | |
| 'description' => __( 'This is the home slider widget area.', 'mpp' ), | |
| ) ); | |
| //* Add custom Slider + Header wrapper's opening div tag | |
| add_action( 'genesis_before_header', 'sk_home_opening_div' ); | |
| function sk_home_opening_div() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //* Remove breadcrumbs | |
| remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); | |
| //* Force full width content | |
| add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
| //* Remove entry meta in entry header | |
| remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
NewerOlder