Skip to content

Instantly share code, notes, and snippets.

View fazlurr's full-sized avatar

Fazlur Rahman fazlurr

View GitHub Profile
@jhned
jhned / pseudo-elements
Last active August 29, 2015 13:56
Snippets for CSS pseudo-elements.
{
"snippets": {
"css": {
"snippets": {
";bef": ":before {$1}",
";aft": ":after {$1}",
";fch": ":first-child {$1}",
";lch": ":last-child {$1}",
";och": ":only-child {$1}",
";oot": ":only-of-type {$1}",
@fazlurr
fazlurr / GMapV2Direction.java
Created March 5, 2014 03:57
Android Java Class for showing directions between origin location and destination location with Gmap V2 Direction.
import java.io.InputStream;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
@jhned
jhned / radio-swap
Created April 29, 2014 20:20
Give the label of a radio button a checked class when the input changes.
jQuery(function($) {
$(':radio').change(function () {
// First, clear out all radio buttons
$(':radio[name=' + this.name + ']').parent().removeClass('checked');
// Add the checked class to the parent. (probably a label)
$(this).parent().addClass('checked');
});
anonymous
anonymous / config.json
Created September 11, 2014 03:22
Bootstrap Customizer Config
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
@fazlurr
fazlurr / EditProfile.java
Created February 11, 2015 11:02
Take Photo, Crop, and Upload
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
var copyMergeWordsResultBtn = document.getElementById('button-copy-merge-words-result');
copyMergeWordsResultBtn.addEventListener('click', function (event) {
var mergeWordsResultTextarea = document.getElementById('merge-words-result');
mergeWordsResultTextarea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
@jhned
jhned / mobile-detection
Created September 10, 2013 13:05
Handheld device detection, courtesy of detectmobilebrowsers.com
function isMobilePhone() {
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|in
@mzgreen
mzgreen / HidingScrollListener.java
Created February 15, 2015 11:18
HideOnScrollExample - HidingScrollListener class
public abstract class HidingScrollListener extends RecyclerView.OnScrollListener {
private static final int HIDE_THRESHOLD = 20;
private int scrolledDistance = 0;
private boolean controlsVisible = true;
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (scrolledDistance > HIDE_THRESHOLD && controlsVisible) {
@jhned
jhned / awesome-wordpress-favicons
Last active March 22, 2018 15:26
Ever wanted to set up custom favicons in the WordPress admin or on the WordPress login screen? Well, now you can.
// First, create a function that includes the path to your favicon
function add_favicon() {
$favicon_url = get_stylesheet_directory_uri() . '/images/icons/admin-favicon.ico';
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
}
// Now, just make sure that function runs when you're on the login page and admin pages
add_action('login_head', 'add_favicon');
add_action('admin_head', 'add_favicon');
@lukecav
lukecav / functions.php
Created January 12, 2018 18:47
Flexible Elementor Widgets Panel
add_action( 'elementor/editor/after_enqueue_styles', function() {
echo '<style type="text/css">
.elementor-panel .panel-elements-category-items {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
}
.elementor-panel .elementor-element-wrapper {