This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Auther: mkhizeryounas | |
* Usage: db.query(queryString, paramArray, (err, res) => { console.log(res) }); | |
*/ | |
var mysql = require("mysql"); | |
var keys = require('./keys'); | |
var pool = mysql.createPool({ | |
host : keys.mysql.host, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Developers</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | |
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pageFunction(context) { | |
var $ = context.jQuery; | |
var __PAGES = parseInt($('li[title="Last"]').data('val')); | |
// var __PAGES = 5; | |
console.log(__PAGES) | |
var result = []; | |
var extractData = function(page) { | |
if( page < __PAGES ) { | |
var api = 'https://beta.zameen.com/Homes/Lahore-1-'+page+'.html'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pageFunction(context) { | |
var $ = context.jQuery; | |
var result = []; | |
// var _pages = 2018; | |
var _pages = 3; | |
var fetch = function(url, cb) { | |
// console.log(url); | |
$.ajax({ | |
url: url, | |
type: 'GET', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('BearerAuthInterceptor', function ($window, $q) { | |
return { | |
request: function(config) { | |
config.headers = config.headers || {}; | |
if ($window.localStorage.getItem('token')) { | |
// may also use sessionStorage | |
config.headers.Authorization = 'Bearer ' + $window.localStorage.getItem('token'); | |
} | |
return config || $q.when(config); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func strToNum(str: String) -> UInt32 { | |
// ascii helper -> "0" = 48 && "9" = 57 | "+" = 43 | |
let arr = str.map { String($0) } | |
var num:UInt32 = 0 | |
for item in arr { | |
let asciiVal = UnicodeScalar(item)!.value | |
if(asciiVal < 48 || asciiVal > 57) { | |
continue | |
} | |
num = (num*10)+(asciiVal-48) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
-- HOW TO USE -- | |
let data = { | |
user: "Khizer", | |
company: "Shopdesk", | |
showName: "Eid", | |
money: { | |
amount: 1000, | |
currency : "PKR", | |
some: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****** bin/www ******/ | |
// After -> server.listen(port); | |
// Addd the following for Socket.IO | |
var io = require('socket.io').listen(server); | |
require('../custom_modules/socket-helper')(io); | |
/****** socket-helper.js module ******/ | |
module.exports = function (io) { | |
io.on('connection', function(socket){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Author: @mkhizeryounas | |
* @array : 1-D Array | |
* @rules : | |
* { | |
* "filter" : [ | |
* { | |
* "key" : "product_id", | |
* "value" : "10593", | |
* "op" : "<" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bcrypt = require("bcryptjs"); | |
module.exports = { | |
attributes: { | |
name: { type: "String", required: true }, | |
email: { type: "String", unique: true, required: true }, | |
password: { type: "String", required: true }, | |
phone: { type: "String", required: true } | |
}, | |
beforeCreate: (user, next) => { |
OlderNewer