Skip to content

Instantly share code, notes, and snippets.

View netchampfaris's full-sized avatar
🏠
Working from home/office

Faris Ansari netchampfaris

🏠
Working from home/office
View GitHub Profile
console.log('Frappe Cloud Subscription init')
@netchampfaris
netchampfaris / frappe_ui_components.vue
Created January 19, 2022 11:52
A demo vue page where Frappe UI components are rendered
<template>
<div class="max-w-xl mt-8 space-y-4">
<Alert title="Info">Your account has been created.</Alert>
<div class="flex space-x-2">
<Avatar label="John Doe" />
<Avatar label="John Doe" imageURL="https://picsum.photos/200" />
</div>
<div class="flex space-x-2">
@netchampfaris
netchampfaris / migrate_help_article_to_wiki_page.py
Created December 12, 2021 11:17
Migrate Help Article to Wiki Page.
from frappe.frappeclient import FrappeClient
from unittest.mock import patch
client = FrappeClient('https://frappe.io', username='username', password='password')
articles = client.get_list('Help Article', fields=['name', 'route'], limit_page_length=200)
category_slug = {
'Accounting': 'accounts',
'Selling': 'selling',
'Asset': 'asset',
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import io
import re
def execute(file_path):
with open(file_path, 'r') as f:
@netchampfaris
netchampfaris / make-multiple-prs
Created August 2, 2019 07:49
Bash functions to create multiple PRs from the current branch
make-3-prs() {
push-and-pr version-11-hotfix
new-branch-and-cherry-pick version-12-hotfix
push-and-pr version-12-hotfix
new-branch-and-cherry-pick develop
push-and-pr develop
}
import os
import fnmatch
import re
import pandas as pd
method_count_map = {}
def run():
scan_path = '/Users/netchampfaris/frappe-bench/apps/erpnext'
ignore_patterns = ['*/node_modules/*', '*/.git/*']
arr = [
[1, 1, 1, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0],
[0, 0, 2, 4, 4, 0],
[0, 0, 0, 2, 0, 0],
[0, 0, 1, 2, 4, 0],
]
def get_hour_glass(i, j):
frappe.ui.form.on('Sales Invoice', {
onload(frm) {
console.log('onload')
frm.add_fetch('customer', 'car_model', 'car_model')
frappe.db.get_value('Company', 'Facebook', 'abbr').then(function(value) {
console.log(value.message.abbr)
})
def nested_filters():
sql_string = parse_nested_filters('Item',
['and', [
['has_variant', '=', 1],
['show_in_website', '=', 0],
['or', [
['variant_of', '=', 'test'],
['item_group', '=', 'product'],
['and', [
['item_code', '>', 'hello'],
@netchampfaris
netchampfaris / indent_to_fenced.js
Created May 22, 2018 08:37
Converts indented code blocks to fenced code blocks in markdown files
var fs = require("fs"),
path = require("path");
walk('./', function(filepath, stats) {
if (filepath.endsWith('.md')) {
const filecontent = fs.readFileSync(filepath, { encoding: 'utf-8'});
const converted = convert(filecontent);
fs.writeFileSync(filepath, converted);
console.log(path.basename(filepath), 'done');
}