Skip to content

Instantly share code, notes, and snippets.

@mayuki
mayuki / CredentialUI.cs
Created March 22, 2010 10:22
Windows Common Credential UI Helper for .NET Framework
/*
* CredentialUI.cs - Windows Credential UI Helper
*
* License: Public Domain
*
*/
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;
using System.Web.Routing;
namespace Mvc4WithAuthentication.Auth
{
@janvanderhaegen
janvanderhaegen / myscreen.lsml.js
Created October 7, 2014 00:57
SP Overlay: CSS
myapp.menuHome.buttonResources_postRender = function (element, contentItem) {
$(element).spOverlay(contentItem, 'Content/Images/TouchIcons/ResourcesLarge.png', { height:170, width:170});
};
myapp.menuHome.buttonDesigns_postRender = function (element, contentItem) {
$(element).spOverlay(contentItem, 'Content/Images/TouchIcons/DesignsLarge.png');
};
myapp.menuHome.buttonProjects_postRender = function (element, contentItem) {
$(element).spOverlay(contentItem, 'Content/Images/TouchIcons/ProjectsLarge.png');
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
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;
@About2git
About2git / archive-books.php
Last active November 17, 2020 18:12 — forked from srikat/archive-books.php
Single and Archive templates for Custom Post Type in Genesis
<?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 );
@About2git
About2git / functions.php
Last active January 21, 2019 07:14 — forked from srikat/functions.php
Full width Soliloquy slider with Header floating on the top in Genesis
//* 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() {
@imran0101
imran0101 / EndlessRecyclerOnScrollListener.java
Last active February 22, 2022 12:50
RecyclerView position helper to get first and last visible positions
/**
* 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.
/**
* 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 ) {
@DanDiplo
DanDiplo / JS-LINQ.js
Last active October 14, 2025 22:02
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// 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 },
@andhie
andhie / PermissionUtil.java
Last active October 23, 2017 17:04
Marshmallow Permission Level
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;