Skip to content

Instantly share code, notes, and snippets.

View sandeepwisetr's full-sized avatar

Sandeep soni sandeepwisetr

View GitHub Profile
<div style="float:right">
<?php
$i=0;
$sqllist="select count(slip) from totalsale";
$n=mysql_query($sqllist) or die("list".mysql_error());
$r=mysql_fetch_array($n);
$c=$r['count(slip)']/30;
$c=$c+1;
for($i=1;$i<=$c;$i++)
{
@sandeepwisetr
sandeepwisetr / Digital Clock using pure javascript
Created January 21, 2015 17:27
Digital Clock using pure javascript
function digital_clock()
{
var date=new Date()
var hours=date.getHours()
var minutes=date.getMinutes()
var seconds=date.getSeconds()
/*
*Calls the addZero function to add a zero infront of minutes or seconds if they are below 10, i.e.
*to make it look like 12:07:09, not 12:7:9
*/
function file_upload($f, $folder) {
extract($f);
echo("<pre>");
print_r($f);
echo("</pre>");
//echo($f["photo"]["type"]);
$name = $f["photo"]["name"];
$tmp_name = $f["photo"]["tmp_name"];
$size = $f["photo"]["size"];
@sandeepwisetr
sandeepwisetr / how to convert xml to array
Created January 24, 2015 06:47
XML to array conversion using recursive programing method
$site_url = site_url().'/xmltophp/jobsfeed.xml';
//echo $site_url;
$xml = simplexml_load_file($site_url);
$ar = xml2array($xml);
function xml2array($xml) {
$arr = array();
foreach ($xml->children() as $r) {
if (count($r->children()) == 0) {
$arr[$r->getName()] = strval($r);
@sandeepwisetr
sandeepwisetr / 0_reuse_code.js
Last active August 29, 2015 14:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
upstream my-node.com {
server 127.0.0.1:3000;
keepalive 8;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/ez-ejs-master;
server_name my-node.com;
var WPA = {
send_ajax: function (t, n, z) {
var cel;
if (typeof $ == 'undefined' || $ == "undefined") {
var $ = jQuery;
}
var e = {}, i = "/wp-admin/admin-ajax.php", o = t.find(".spinner").length;
var met=(t.attr("method")=="post" || t.attr("method")=="get")?t.attr("method"):"post";
if (typeof z != "undefined") {
e = z;
<html>
<body>
<form method="post">
<label>Username</label>
<input name="username" id="username"><br>
<label>Address</label>
<textarea name="address" id="address"></textarea><br>
<input type="hidden" value="0" id="recordnumber">
<input type="button" id="submit" name="submit" onClick="add(this)" data="add" value="add">
</form>
@sandeepwisetr
sandeepwisetr / gist:aec84651476ec20fc9a490fca939425b
Created April 1, 2019 12:33
add all bump product cart Via Javascript code
(function ($) {
let bump_all_added = false;
let first_click = false;
$(document.body).on('update_checkout', function () {
if (first_click) {
return;
}
$('.wfob_bump_product').eq(0).trigger('click');
first_click = true;
add_action( 'woocommerce_checkout_update_order_meta', function ( $order_id, $data ) {
if ( ! isset( $_POST['_wfacp_post_id'] ) ) {
return;
}
$order = wc_get_order( $order_id );
$field = [