Skip to content

Instantly share code, notes, and snippets.

View ahmadRagheb's full-sized avatar
🎯
Focusing

ahmadRagheb

🎯
Focusing
View GitHub Profile
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
erpnext.SMSManager = function SMSManager(doc) {
var me = this;
this.setup = function() {
console.log("SSS hello ");
var default_msg = {
'Lead' : '',
function getRequest(){
var http = new XMLHttpRequest();
var url = 'http://dummy.restapiexample.com/api/v1/employee/99990';
// var params = 'orem=ipsum&name=binny';
http.open('GET', url, true);
//Send the proper header information along with the request
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onload = function() {//Call a function when the state changes.
@ahmadRagheb
ahmadRagheb / nginx.conf
Created February 15, 2019 23:27 — forked from revant/nginx-files.conf
Frappe CORS for nginx
location @webserver {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
@frappe.whitelist()
def shipment_api(so_name):
result = {}
if frappe.db.exists("Sales Order",so_name):
so = frappe.get_doc("Sales Order",so_name)
if so.in_shipment == 0:
result['message']="Collected"
result['alert']=False
else:
@frappe.whitelist()
def shipment(so_name):
so = frappe.get_doc("Sales Order",so_name)
result = {}
if so.in_shipment == 0:
result['message']="not shipped yet"
return result
else:
shipment = frappe.get_doc("Shipment",so.shipment)
from book import Book
class LinkedList:
def __init__(self):
self.head = None
self.size = 0
def get_size(self):
class Book:
def __init__(self, title, author, ibsn, publisher, year_published, book_location, nextNode=None):
self.title = title
self.author = author
self.ibsn = ibsn
self.publisher = publisher
self.year_published = year_published
.print-format table, .print-format tr,
.print-format td, .print-format div, .print-format p {
vertical-align: middle;
}
@media screen {
.print-format {
width: 104mm;
min-height: 40mm;
height: 40mm;
padding: 0;
.print-format table, .print-format tr,
.print-format td, .print-format div, .print-format p {
vertical-align: middle;
}
@media screen {
.print-format {
width: 104mm;
min-height: 40mm;
height: 40mm;
padding: 0;
@ahmadRagheb
ahmadRagheb / textQueries
Created August 4, 2018 17:28
find how many queries coursers in list of sentences
def textQueries(sentences, queries):
res = {}
for idxx, q in enumerate(queries):
qs=str(q)
for idx, sentence in enumerate(sentences):
if all(word in sentence for word in q):
if qs in res:
res[qs] = [res[qs],str(idx)]
else: