Skip to content

Instantly share code, notes, and snippets.

View arycloud's full-sized avatar

Abdul Rehman Yousaf arycloud

View GitHub Profile
/**
* @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/requirejs/text for details
*/
/*jslint regexp: true */
/*global require, XMLHttpRequest, ActiveXObject,
define, window, process, Packages,
java, location, Components, FileUtils */
// Underscore.js 1.6.0
// http://underscorejs.org
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
// --------------
@arycloud
arycloud / formset_payload_gen.py
Last active November 12, 2023 18:07
You can create the payload for your Inline Formset Factory forms and utilise to Unit Test your Django forms.
def build_formset_form_data(self, form_number, **data):
form = {}
for key, value in data.items():
form_key = f"form-{form_number}-{key}"
form[form_key] = value
return form
def build_formset_data(self, forms, **common_data):
formset_dict = {
@arycloud
arycloud / app.py
Created June 9, 2020 16:32
The main app.py file which contains the API logic code with routes, views and main functions.
from flask import Flask, request, jsonify
import json
import sqlite3
app = Flask(__name__)
def db_connection():
conn = None
try:
{
"@context": [
"https://w3id.org/openbadges/v2",
"https://w3id.org/blockcerts/v2"
],
"type": "Profile",
"id": "https://www.blockcerts.org/samples/2.0/issuer-testnet.json",
"name": "University of Learning",
"url": "https://www.issuer.org",
"introductionURL": "https://www.issuer.org/intro/",
@arycloud
arycloud / ML0101EN-Clus-K-Means-Customer-Seg-py-v1.ipynb
Created October 19, 2018 13:40
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory