This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This is from an actual snippet of mine, trimmed down, in order to answer a question asked in Python Bangladesh Group on | |
| adding extra buttons in Admin list. | |
| """ | |
| from django.contrib import admin | |
| from django.urls import reverse | |
| from django.utils.html import mark_safe | |
| from .models import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| class Category(models.Model): | |
| name = models.CharField(max_length=31) | |
| def __str__(self): | |
| return f"{self.name}" | |
| class Meta: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| reference link ->https://www.opengeeks.me/2015/08/filechooser-and-android-webview/ | |
| https://github.com/OpenGeeksMe/Android-File-Chooser | |
| */ | |
| import android.app.Activity; | |
| import android.app.ProgressDialog; | |
| import android.content.Intent; | |
| import android.graphics.Bitmap; | |
| import android.net.Uri; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| reference link ->https://www.opengeeks.me/2015/08/filechooser-and-android-webview/ | |
| https://github.com/OpenGeeksMe/Android-File-Chooser | |
| */ | |
| import android.app.Activity; | |
| import android.app.ProgressDialog; | |
| import android.content.Intent; | |
| import android.graphics.Bitmap; | |
| import android.net.Uri; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defmacro GET | |
| [app route handler] | |
| `(do | |
| (with-decorator | |
| (.route ~app ~route :methods ["GET"]) | |
| ~handler))) | |
| (defmacro POST | |
| [app route handler] | |
| `(do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| type Func func() | |
| func main() { | |
| var callUs []Func | |
| listOfNumbers := [...]int{1, 2, 3, 4, 5} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # HOLY FUCK I OVERDOSED MY MEDS, I'M FUCKED | |
| def sanitize(n): | |
| return n.strip().replace(" ", "").replace("\\", "/") | |
| to_decimal = lambda n: "/" not in n and float(n) or float(n.split("/")[0])/float(n.split("/")[1]) | |
| def separate_dims(n): | |
| separated = filter(None, re.findall(r'\d*\.?/?\\?\d*', n)) | |
| return separated, len(separated) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (import os sys django) | |
| (defn setup [] | |
| (sys.path.insert 1 ".") | |
| (os.environ.setdefault "DJANGO_SETTINGS_MODULE" "project.settings") | |
| (django.setup) | |
| (print "Hy <3 Django")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # This is a cheap convenience I had to bake in 2/3 minutes, will turn into a Django custom command with more meat, | |
| # optparse and templates. | |
| # This is not to be taken seriously, I was just trying to accelerate the creation of some ClojureScrip :-) | |
| ## | |
| import sys | |
| import os | |