Skip to content

Instantly share code, notes, and snippets.

View MaxMorais's full-sized avatar
🏢
Building TechMax Soluções

Maxwell Morais MaxMorais

🏢
Building TechMax Soluções
View GitHub Profile

OAuth 2 Authorization Code Flow For Use With Google Actions

This flow provides a "fake" OAuth 2 implementation for use with the Google Actions API.

Exposes three endpoints:

  1. /google/oauth-auth - Main auth endpoint that Google will call to initialize an OAuth 2 handshake. Checks "client" and "client secret", and returns a login form.
  2. /google/oauth-login - Processes login form, verifies "auth key" provided and generates a new OAuth auth code that the caller (Google) can then exchange for a real OAuth 2 ticket via the last endpoint.
  3. /google/oauth-token - Allows the caller to exchange an "auth key" for a valid OAuth 2 token, or request a new token via refresh token.
class Method( object ):
__slots__ = ('name', 'args', 'rt')
def __init__(self, name = None, args=(), rt=False):
super(Method, self).__init__()
self.name = None
self.args = args
self.rt = rt # Function returns value?
def __get__(self, instance, owner):
[
{
"_type": "div",
"_class": "installation-process-step",
"#text": "Installation Progress: Step 2 of 5"
},
{
"_type": "div",
"_class": "clear"
},
function depends_of(calculated_field, dependant_fields, calculation_function) {
if (calculated_field.indexOf(".") === -1) {
var doctype = cur_frm.doctype,
target_field = calculated_field
} else {
var doctype = calculated_field.split(".")[0],
target_field = calculated_field.split(".")[0],
}
if (!Array.isArray(dependant_fields)) dependand_fields = [dependant_fields];
var depencies = dependant_fields.map(function(dependency){
@MaxMorais
MaxMorais / salary_structure_report.py
Last active March 3, 2017 13:14
Report for Salary Structure for ERPNext which would EVAL the formula based Salary as well.
# Copyright (c) 2013, Rohit Industries Ltd. and contributors
# For license information, please see license.txt
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
from frappe.utils import flt, cstr
from erpnext.hr.doctype.salary_slip.salary_slip import SalarySlip
# -*- coding: utf-8 -*-
# Copyright (c) 2015, MaxMorais and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import re
import uuid
#-*- coding: utf-8 -*-
"""RoundRobin is a Python library that allow to use Redis for a message queue"""
from functools import wraps
import multiprocessing
from redis import Redis
try:
import cPickle as pickle
@MaxMorais
MaxMorais / mapr.py
Last active September 30, 2016 02:52
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import string
DEFAULT_SEPARATOR = '/'
def is_loc_valid(loc, separator=DEFAULT_SEPARATOR):
if loc == separator:
return True
.print-format {
font-face: "Arial, sans-serif",
font-size: 12px;
}
.print-format > h1 {
font-size: 14pt;
text-align: center;
font-weight: bold;
}
CREATE TABLE Entity(
label CHAR(512),
entityname CHAR(512),
entitytype CHAR(512),
required CHAR(1),
is_index CHAR(1),
is_unique CHAR(1),
options TEXT,
default TEXT,
min DOUBLE,