This file contains 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 | |
/** | |
* [list_searcheable_acf list all the custom fields we want to include in our search query] | |
* @return [array] [list of custom fields] | |
*/ | |
function list_searcheable_acf(){ | |
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF"); | |
return $list_searcheable_acf; | |
} |
This file contains 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
From theme | |
<style name="SearchToolbar" parent="Theme.AppCompat.Light.NoActionBar"> | |
//toolbar back arrow color | |
<item name="android:textColorSecondary">@android:color/white</item> | |
//toolbar title color | |
<item name="android:textColorPrimary">@android:color/white</item> | |
</style> | |
Also we can do it from java code: |
This file contains 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
window.addEventListener("orientationchange", function() { | |
alert(window.orientation); | |
//do whatever you want on orientation change here | |
}, false); |
This file contains 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
<activity android:launchMode = ["standard" | "singleTop" | "singleTask" | "singleInstance"] ../> |
This file contains 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
package asaadi.hossin.app; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v4.content.ContextCompat; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.SparseIntArray; | |
public abstract class RuntimePermissionsActivity extends AppCompatActivity { |
This file contains 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
// status bar height | |
int statusBarHeight = 0; | |
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
if (resourceId > 0) { | |
statusBarHeight = getResources().getDimensionPixelSize(resourceId); | |
} | |
// action bar height | |
int actionBarHeight = 0; | |
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes( |
This file contains 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 | |
/** | |
* Created by PhpStorm. | |
* User: Hossin Asaadi | |
* Date: 9/2/2019 | |
* Time: 7:43 PM | |
*/ | |
namespace App\Traits; |
This file contains 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
/*** | |
* Regex Numeric Range Generator | |
* Author: Erwin Yusrizal <erwin.yusrizal@gmail.com> | |
* Version: 1.0.0 | |
*/ | |
this.RegNumericRange=function(){function t(r,e,n,s){return null===n&&(n={}),this instanceof t?(this.minValue=r,this.maxValue=e,this.options=this.extend({},this.defaults,n),void(this.data={})):new t(r,e,n,s)}return t.prototype.defaults={MatchWholeWord:!1,MatchWholeLine:!1,MatchLeadingZero:!1,showProcess:!1},t.prototype.generate=function(t){var r=this.minValue.toString(),e=this.maxValue.toString(),n=[],s=[],i=[];if(!this.minValue||!this.maxValue){var a="Minimum & Maximum value is required!";if("function"==typeof t)return t({success:!1,message:a});throw new Error(a)}if(!this.isNumeric(this.minValue)||!this.isNumeric(this.maxValue)){var a="Minimum & Maximum value must numbers only!";if("function"==typeof t)return t({success:!1,message:a});throw new Error(a)}if(parseInt(this.minValue)===parseInt(this.maxValue)||parseInt(this.minValue)>parseInt(this.maxValue)){var a="Max. value must greater than Min. val |
This file contains 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 | |
function regex_range($from, $to) { | |
if($from < 0 || $to < 0) { | |
throw new Exception("Negative values not supported"); | |
} | |
if($from > $to) { | |
throw new Exception("Invalid range $from..$to, from > to"); | |
} |
This file contains 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 | |
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy | |
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup | |
// REGISTER TERM META | |
add_action( 'init', '___register_term_meta_text' ); | |
function ___register_term_meta_text() { |
OlderNewer