Skip to content
View inheritance.cpp
#include <iostream>
// An example of function
void someFunction(char * data) {
int a;
char * b;
printf(data);
}
View gist:9f0296816e7df487eb4c672afac13965
class FranchiseUpdateView(viewsmixins.UpdateViewMixins):
model = Franchise
template_name = "franchise_update.html"
success_url = reverse_lazy('franchises:list')
form_class = FranchiseForm
form_prefix = "franchise"
# set prefix to parent form
def get_form_kwargs(self):
kwargs = super(FranchiseUpdateView, self).get_form_kwargs()
View gist:891c401a90ba39f326accef265b56f85
class Person:
def __init__(self, kargs, tup, *argv, **kwargs):
import pdb;
pdb.set_trace()
self.name = kwargs['name']
self.shirt_size = kwargs['shirt_size']
def __str__(self):
return "{} -> {}".format(self.name, self.shirt_size)
View gist:d9aeb2f72e3fae45a21f4ca1584077a0
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
def post(self):
json = request.json
View gist:024808949b496f63d6d9306e840b71ca
from datetime import datetime, timedelta
import sys
import os
from flask import Flask
from apscheduler.schedulers.background import BackgroundScheduler
app = Flask(__name__)
View fileupload.py
def upload_file(request):
if request.method == 'POST':
form = NetworkScriptForm(request.POST, request.FILES)
if form.is_valid():
content = request.FILES['file'].read()
networkscript = NetworkScript.objects.create(
title=request.POST['title'],
script=content,
)
return render(request, 'bod_detail.html', {'networkscript': networkscript})
View gist:ee6bd24ec66dcd88181606f230f98d94
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
View gist:b9c82e181aba9cca51a7fe56868d4c3b
{
"new_bandwidths": [
{
"circuit_id": "12345",
"new_bandwidith": 10
},
{
"circuit_id": "67890",
"new_bandwidth": 12
}
View gist:1c9ce578022ef6a87f1c
// Write a program that finds all prime numbers up to n for input n
import java.util.Scanner;
class Untitled {
public static void main(String[] args) {
// FizzBuzz
boolean tree = false;
boolean five = false;
for (int i = 1; i <= 100; i++) {
Something went wrong with that request. Please try again.