Skip to content

Instantly share code, notes, and snippets.

View manoj-singh-developer's full-sized avatar
🎯
Focusing

Manoj Singh manoj-singh-developer

🎯
Focusing
View GitHub Profile
@manoj-singh-developer
manoj-singh-developer / moment-filter.js
Created July 31, 2019 09:01 — forked from cmmartin/moment-filter.js
A generic Moment.js date filter for Angular.js
// REQUIRES:
// moment.js - http://momentjs.com/
// USAGE:
// {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n]
// EXAMPLES:
// {{ someDate | moment: 'format': 'MMM DD, YYYY' }}
// {{ someDate | moment: 'fromNow' }}
SELECT
id, (
3959 * acos (
cos ( radians(78.3232) )
* cos( radians( lat ) )
* cos( radians( lng ) - radians(65.3234) )
+ sin ( radians(78.3232) )
* sin( radians( lat ) )
)
) AS distance
Mychat.find({ $or : [ { $and : [ { my_id : req.body.uid }, { user : req.body.oid } ] } , { $and : [ { my_id : req.body.oid }, { user : req.body.uid } ] } ] } ).exec(
Taxonomies are basically a way of grouping data in WordPress. The most common default taxonomies used in WordPress are when grouping posts as either ‘categories’ or ‘tags’ and these are named and recorded in the WordPress database as ‘category’ and ‘post_tag’ respectively. Specific categories or tags are called terms.
Many plugins and theme functionality will use their own custom taxonomies to group data together in a meaningful way. A photo gallery for example might have a taxonomy name ‘gallery_cat’ with terms such as ‘Sunsets’, ‘Portraits’, ‘Nature’ etc. Each term has an associated name, slug and term ID.
To query WordPress and return posts based on these custom taxonomy names and terms, we can use ‘tax_query’ within get_posts() as indicated below:
01
02
03
04
<?php /* Template Name: Hotel Custom */ ?>
<?php
$args = array(
'post_type' => 'hotel_listing', //remember this is-case sensitive
'posts_per_page' => -1,
);
$releaseQuery = new WP_Query( $args );
@manoj-singh-developer
manoj-singh-developer / gist:03f7a395facdd28c8007e1823f605db9
Created January 22, 2019 12:32
react-native background image css
<TouchableOpacity style={styles.deal} onPress={this.handlePress}>
<ImageBackground source={{uri: deal.media[0]}} style={styles.image} >
<View style={{position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center'}}>
<Text>{deal.title}</Text>
</View>
</ImageBackground>
</TouchableOpacity>
pip3 install PyMySQL
or
pip install pymysql
after then
pip3 install PyMySQL
or
pip install pymysql
after then
<!DOCTYPE html>
<html>
<head>
<title>Gmail API Quickstart</title>
<meta charset="utf-8" />
</head>
<body>
<p>Gmail API Quickstart</p>
<!--Add buttons to initiate auth sequence and sign out-->
function ipLookUp () {
$.ajax('http://ip-api.com/json')
.then(
function success(response) {
console.log('User\'s Location Data is ', response);
console.log('User\'s Country', response.country);
getAdress(response.lat, response.lon)
},
function fail(data, status) {