Skip to content

Instantly share code, notes, and snippets.

View medihack's full-sized avatar

Kai Schlamp medihack

  • Thoraxklinik Heidelberg
  • Germany
View GitHub Profile
@mw3i
mw3i / django-database-standalone.py
Last active May 13, 2024 14:45
Truly Standalone Django-ORM Wrapper
'''
Proof of Concept:
Django devs built an ORM that seems way more straightforward than many existing tools. This class lets you leverage the django-orm without any project settings or other aspects of a django setup.
There are probably weak points and functionality missing, but it seems like a relatively intuitive proof of concept
'''
import os
import django
from django.conf import settings
@frabert
frabert / COPYING
Last active December 21, 2023 13:35
Favicons for HN
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@kentcdodds
kentcdodds / session.server.ts
Created November 18, 2021 21:04
Authentication in Remix applications
import * as bcrypt from "bcrypt";
import { createCookieSessionStorage, redirect } from "remix";
import { db } from "./db.server";
export type LoginForm = {
username: string;
password: string;
};
@bartmika
bartmika / ajax_w_django_json_response_view.md
Created October 24, 2019 17:04
Example of using Javascript AJAX (XMLHttpRequest) with Django JsonResponse View

Example of using Javascript AJAX (XMLHttpRequest) with Django JsonResponse View

mkdir ajax_django_example
cd ajax_django_example/
virtualenv env
source env/bin/activate
python --version
pip install django
django-admin startproject example
@EtsuNDmA
EtsuNDmA / django_jupyter.md
Last active June 13, 2024 18:37
Two ways to integrate Django with Jupyter (JupyterLab)

⚠️ This gist was the first time written in 2018. It was tested with django==2.2.x. It's likely to be relevant for the newer versions of django and jupyter, but I did't check that.

2023-03-15: checked it for python == 3.11, django == 4.1.7, jupyterlab = 3.6.1, django-extensions == 3.2.1, jupyter-server <= 2.0.0

Django_jupyter

Using Django project in Jupyter or JupyterLab

Method 1 (using shell_plus)

/* Load Zepto as module */
module.exports = {
entry: "./app.js",
output: {
path: __dirname,
filename: "bundle.js"
},
module: {
loaders: [
{ test: /zepto(\.min)?\.js$/, loader: "exports?Zepto; delete window.$; delete window.Zepto;" },
@eguneys
eguneys / gesture.js
Created August 31, 2014 11:37
A Gesture Manager for Phaser.
'use strict';
define(['phaser'], function(Phaser) {
function Gesture(game) {
this.game = game;
this.swipeDispatched = false;
this.holdDispatched = false;
this.isTouching = false;