Skip to content

Instantly share code, notes, and snippets.

View kirandash's full-sized avatar

Kiran Dash kirandash

View GitHub Profile
@kirandash
kirandash / js_shortcuts.js
Last active February 17, 2020 10:35
JavaScript Short Cuts
// 1. Remove Duplicate Objects from array
data = [{block:'234'......},{},{}]
data = _.uniqBy(data, function(v){
return v.block + ' ' + v.street_name + ' ' + v.floor_area_sqm + ' ' + v.resale_price + ' ' + v.month + ' ' + v.lease_commence_date + ' ' + v.flat_type;
});
// 2. Check whether an input string contains a number in javascript
function hasNumber(myString) {
return /\d/.test(myString);
}
@kirandash
kirandash / SearchScreen.js
Created January 6, 2020 06:09
Needs to tap twice to fire onPress function when keyboard is open - React Native
// Needs to tap twice to fire onPress function when keyboard is open - React Native
<ScrollView keyboardShouldPersistTaps={"always"}>
<GooglePlacesAutocomplete />
</ScrollView>
@kirandash
kirandash / git-account-config.txt
Last active November 24, 2020 09:11
git multiple user names for the different projects within the same system
https://stackoverflow.com/questions/9063176/git-multiple-user-names-for-the-different-projects-within-the-same-system
Just use --local instead of --global. In fact, local is the default so you can just do
git config user.email [email protected]
git config user.name "whatf hobbyist"
in one repo, and
git config user.email [email protected]
git config user.name "whatf at work"
@kirandash
kirandash / theme-options.php
Created December 21, 2017 14:17
Custom Theme Options
<?php
/**
* VSP functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package VSP
*/
if ( ! function_exists( 'vsp_setup' ) ) :
@kirandash
kirandash / gist:21a61eba384a5b93f5b159a18ec51300
Created September 20, 2017 16:48
XAMPP - Port 80 in use by “Unable to open process” with PID 4! 12
XAMPP - Port 80 in use by “Unable to open process” with PID 4! 12
Open a CMD prompt as administrator and execute the following command: net stop was /y
Run Dialog Box (press keys Win+R) .. then type: services.msc
Then search for World Wide Web Publishing Service (WWW-Publishing Service) and Web Deployment Agent Service and stop them. You should also deactivate them.
3.Start Apache again with XAMPP :)
Link Ref: http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/
https://stackoverflow.com/questions/20558410/xampp-port-80-in-use-by-unable-to-open-process-with-pid-4-12
@kirandash
kirandash / base-admin.class.php
Last active August 10, 2017 11:47
uncaught error operator not supported for strings revolution slider
Change line 21 in revslider/includes/framework/base-admin.class.php
from
private static $arrMetaBoxes = ''; //option boxes that will be added to post
to
private static $arrMetaBoxes = array(); //option boxes that will be added to post
@kirandash
kirandash / functions.php
Created May 18, 2017 11:21
Custom Pagination
<?php
/**
* Using $paged redirects /page/2 to page 1
*/
add_filter('redirect_canonical','pif_disable_redirect_canonical');
function pif_disable_redirect_canonical($redirect_url) {
if (is_singular()) $redirect_url = false;
return $redirect_url;
}
@kirandash
kirandash / functions.php
Created May 10, 2017 07:08
Google Maps field needs setting to add API key
add_filter('acf/settings/google_api_key', function () {
return 'your-api-key';
});
@kirandash
kirandash / functions.php
Created May 5, 2017 10:57
Modify comments form WordPress
<?php
add_filter( 'comment_form_default_fields', 'wpse_62742_comment_placeholders' );
/**
* Change default fields, add placeholder and change type attributes.
*
* @param array $fields
* @return array
*/
function wpse_62742_comment_placeholders( $fields )
@kirandash
kirandash / style.css
Created May 3, 2017 05:40
Ordered List - Nested Counter
ol {
counter-reset: item;
}
ol li {
display: block;
position: relative;
}
ol li:before {
content: counters(item, ".") " ";
counter-increment: item;