Skip to content

Instantly share code, notes, and snippets.

@adamchainz
adamchainz / _base.html
Created January 8, 2021 14:34
Django HTMX CSRF setup
<script src="{% static 'app.js' %}" data-csrftoken="{{ csrf_token }}"></script>
@lsapan
lsapan / vue-cli-django.md
Last active December 29, 2022 10:47
Using Vue CLI to start a Vue frontend for use with a Django backend

Using Vue CLI to start a Vue frontend for use with a Django backend

Note: This guide has been updated for use with @vue/cli version 4! Please make sure you're using the latest version of @vue/cli.

When it comes to starting new Vue projects, you can't really beat Vue CLI. The Vue team has done a phenomenal job of making an easy-to-use tool for getting started with reasonable defaults. If you're using Django though, you may not have the easiest time getting its static system and webpack to play well together.

A good chunk of this is applicable to any webpack-compiled frontend and Django, but we'll focus specifically on the steps involved with Vue CLI.

As a quick heads up: this tutorial assumes you're creating your Vue project in a folder named frontend inside of your Django project folder. If you want it named something else, or want it in a different folder, just update the paths accordingly.

@marteinn
marteinn / list.md
Last active April 20, 2021 22:00
Which sites are using Turbolinks?
@RLovelett
RLovelett / gist:6791bde80575fc412983
Created October 14, 2015 00:50 — forked from chrislavender/gist:cad26500c9655627544f
HTTP Live Streaming Tutorial

Note: This is an older post that I did back when I thought I might have time to be a blogger. Oh I was oh so wrong. However, it has proven useful for some folks on stackoverflow. Thus I'm keeping it alive here on Gist.

One of my past projects dealt heavily with an open source Apple technology called HTTP Live Streaming. It’s an HTTP based streaming protocol that at its most fundamental level provides a way to stream video and audio from just about any server with nothing but a few free software tools provided by Apple**. However, it has a few additional features that I think make it a really exciting tool. Yet, I haven’t seen HTTP Live Streaming used very much. This is probably mainly due to the combination of a lack of good/clear documentation, and Apple’s Live Streaming Developer Tools being command line based also make the barrier to entry higher than many developers want to deal with.

The hope is to share my understanding of how to use this technology to:

@tkrotoff
tkrotoff / RemoveWin10DefaultApps.ps1
Last active April 6, 2024 01:52
Remove Windows 10 default apps
# See Remove default Apps from Windows 10 https://thomas.vanhoutte.be/miniblog/delete-windows-10-apps/
# See Debloat Windows 10 https://github.com/W4RH4WK/Debloat-Windows-10
# Command line to list all packages: Get-AppxPackage -AllUsers | Select Name, PackageFullName
Get-AppxPackage Microsoft.Windows.ParentalControls | Remove-AppxPackage
Get-AppxPackage Windows.ContactSupport | Remove-AppxPackage
Get-AppxPackage Microsoft.Xbox* | Remove-AppxPackage
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage # Mail and Calendar
#Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsCamera | Remove-AppxPackage
@revolunet
revolunet / control.html
Last active December 4, 2020 01:13
Control a VLC playlist with HTTP
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
var host = 'http://:test@192.168.0.99:8080';
function send(cmd) {
$('#target').attr('src', host + '/requests/status.xml?command=pl_play&id=' + cmd + '&r=' + Math.random());
}
</script>
@mobula
mobula / validators.py
Last active April 7, 2019 21:52 — forked from jrosebr1/validators.py
Performs file upload and image upload validation for django.
# -*- coding: utf-8 -*-
# https://gist.github.com/mobula/da99e4db843b9ceb3a3f
# @brief
# Performs file upload validation for django.
# with Django 1.7 migrations support (deconstructible)
# Provides:
# - FileValidator
# - ImageValidator (adds Image specific validation using PIL)
@denji
denji / nginx-tuning.md
Last active May 1, 2024 22:58
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@Daniel15
Daniel15 / 1_README.md
Last active February 12, 2024 19:14
Complete Google Drive File Picker example

Google Drive File Picker Example

This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.

Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.

See a demo at http://stuff.dan.cx/js/filepicker/google/

@simenbrekken
simenbrekken / Makefile
Created September 6, 2012 00:01
Annotated Makefile for combining and minifying LESS/CSS and JavaScript assets.
# Specify where our binaries are (I'm using package.json and npm to handle dependencies)
LESSC = node_modules/.bin/lessc
UGLIFYJS = node_modules/.bin/uglifyjs
# Our LESS input file(s)
LESS = css/base.less
# Our CSS list (replaces .less with .css in the list)
CSS = $(LESS:.less=.css)