Skip to content

Instantly share code, notes, and snippets.

View t9toqwerty's full-sized avatar
🎯
Focusing

RAHUL K JHA t9toqwerty

🎯
Focusing
View GitHub Profile
@t9toqwerty
t9toqwerty / loopWithDelay.js
Last active November 2, 2016 12:58
Execute Loop with delay in Javascript
$(document).ready(function () {
$("#submit").on('click', function () {
var links = $('#links').val().split(/\n/);
var apiCount = 0;
var i=0;
processNextAjax();
function processNextAjax() {
var temp_links = links.slice(i, i + 9);
console.log(temp_links);
var data = fetchData(temp_links, apiCount);
@t9toqwerty
t9toqwerty / jqueryAjax.js
Last active November 2, 2016 15:15
Basic Jquery AJAX
$.ajax({
type: "POST",
url: 'url.php',
data: {
"key1": value1,
"key2": value2
},
success: function (data) {
return data;
},
@t9toqwerty
t9toqwerty / promise.js
Created November 2, 2016 15:19
Basic Promise in Javascript
$(document).ready(function () {
fetchData(url, postdata).then(function (data) {
//handle data
});
});
function fetchData(links, apiCount) {
return new Promise(function (resolve, reject) {
$.ajax({
type: "POST",
url: 'url.php',
"-------------- Normal Settings ------------------"
let mapleader=","
set nocompatible
syntax enable
colorscheme desert
set t_Co=256
set backspace=indent,eol,start
set number
$('.magnific-init').on('click', function (e) {
e.preventDefault();
try {
var images = e.target.dataset.images.split(",");
} catch (e) {
var images = [e.target.dataset.images];
}
this.$nextTick(function () {
if (_.isObject(this.summaryTable)) {
this.summaryTable.destroy();
}
this.summaryTable =
$("#retailer-retention-table").DataTable({
searching: false,
ordering: false,
info: false,
//Single Promise Object
new Promise((resolve, reject) => {
// Your Code which you are unsure about execution time duration.
resolve();//OR reject();
})
.then(() => {
//If resolve()
console.log('Do this');
})
@t9toqwerty
t9toqwerty / app.py
Created August 30, 2018 21:32
Example Dialogflow V2 Fullfillment Responder - Python Flask
import json
from flask import Flask, request, make_response
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if($mobileNumber==8290238014){
Auth::login(User::find(1));
dump("Logged In User:". Auth::user()->id);
} else {
print_r("Not");
}
@t9toqwerty
t9toqwerty / app.js
Created December 19, 2018 20:18 — forked from ArVan/app.js
JWT Authentication with Passport
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var index = require('./routes/index');
var user = require('./routes/user');
var auth = require('./routes/auth');