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
<script>
function showCount(count){
if(count)
document.getElementById('fb_fan_count').innerHTML = 'Total fans : ' + count[0].fan_count;
}
</script>
<p id="fb_fan_count"></p>
<script type="text/javascript" src="https://api.facebook.com/method/fql.query?format=json&callback=showCount&query=select+fan_count+from+page+where+page_id%3D80177638103"></script>
http://jsfiddle.net/GeJkU/
http://jsfiddle.net/fnVNc/
<script type="text/javascript">
jQuery(document).ready(function($){
$('input[name="item_meta[30]"]').change(function(){
$('select[name="item_meta[31]"], select[name="item_meta[32]"]').val('');
})
})
</script>
======================================
count href tag in a div
theDivElement.getElementsByTagName('a').length
==================================================================
Count all first list items in ul
Use the > child selector:
$('ul.menu>li').length
<form action="#">
<p><label><input type="checkbox" id="checkAll"/> Check all</label></p>
<fieldset>
<legend>Loads of checkboxes</legend>
<p><label><input type="checkbox" /> Option 1</label></p>
<p><label><input type="checkbox" /> Option 2</label></p>
<p><label><input type="checkbox" /> Option 3</label></p>
<p><label><input type="checkbox" /> Option 4</label></p>
</fieldset>
GROUP BY ,HAVING
SELECT
YEAR(orderDate) AS year,
SUM(quantityOrdered * priceEach) AS total
FROM
orders
INNER JOIN
orderdetails USING (orderNumber)
WHERE
status = 'Shipped'
<div ng-app="" ng-controller="ContactController">
Email:<input type="text" ng-model="newcontact" />
<button ng-click="add()">Add</button>
<h2>Contacts</h2>
<ul>
==================================================
function ContactController($scope) {
<h4>Angular-xeditable Editable row (Bootstrap 3)</h4>
<div ng-app="app" ng-controller="Ctrl">
<table class="table table-bordered table-hover table-condensed">
<tr style="font-weight: bold">
<td style="width:35%">Name</td>
<td style="width:20%">Status</td>
<td style="width:20%">Group</td>
<td style="width:25%">Edit</td>
</tr>
<tr ng-repeat="user in users">
INNER JOIN OR Equi join: Returns all rows when there is at least one match in BOTH tables
LEFT JOIN: Return all rows from the left table, and the matched rows from the right table
RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table
FULL JOIN: Return all rows when there is a match in ONE of the tables
Self join:You use self join when you want to combine rows with other rows in the same table. To perform the self join operation, you must use a table alias to help MySQL distinguish the left table from the right table of the same table.
SELECT a.ID, b.NAME, a.SALARY
FROM CUSTOMERS a, CUSTOMERS b
WHERE a.SALARY < b.SALARY;
<---------- find by category and limit------------------------>
<?php
global $more;
$more = 0;
$args = array(
'post_type' => 'post',
'posts_per_page' => 10,
'category_name' => 'ayurveda',
);
A closure is an inner function that has access to the variables in the outer (enclosing) function’s scope chain. The closure has access to variables in three scopes; specifically: (1) variable in its own scope, (2) variables in the enclosing function’s scope, and (3) global variables.
Here is a simple example:
var globalVar = "xyz";
(function outerFunc(outerArg) {
var outerVar = 'a';
(function innerFunc(innerArg) {