This file contains 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
When serializing models using DRF, the related ImageFields return the file system path instead of an absolute URL. | |
To solve it, define an instance variable on your model serializer: | |
class PersonSerializer(serializers.ModelSerializer): | |
image = serializers.Field('image.url') |
This file contains 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
// Append this to your .vimrc | |
au BufNewFile,BufRead Podfile set filetype=ruby |
This file contains 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
SPACY_MODEL ?= xx_ent_wiki_sm | |
PYTHONPATH ?= ~/django_home | |
DJANGO_SETTINGS_MODULE ?= django_home.settings | |
%.min.js: %.js | |
uglifyjs < $< > $@ | |
%.xml: %.edn | |
edn2xml < $< > $@ |
This file contains 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
<html dir="rtl"><head><meta content="width=device-width, initial-scale=1" name="viewport" /><meta charset="utf-8" /><script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script><link href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" rel="stylesheet" type="text/css" /><link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet-locatecontrol/0.66.1/L.Control.Locate.min.css" rel="stylesheet" type="text/css" /><style> | |
table img { | |
height: 3em; | |
} | |
</style></head><body><table border="1" render-header="rentals$eval42259$fn__42273@558941c1" style="margin: 0 auto;" width="50%"><thead><tr><th>כתובת</th><th>קישורים</th><th>סוג נכס</th><th>תמונות</th><th>חדרים</th><th>קומה</th><th>שטח</th><th>מחיר</th><th>מחיר למ״ר</th><th>מרחק מהכיכר ▼</th></tr></thead><tbody><tr><td>האלקושי</td><td><a href="https://www.yad2.co.il/item/lioamw" target="_blank">/item/lioamw</a></td><td>דירה</td><td><a href="https:// |
This file contains 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
/*global L, document*/ | |
document.querySelectorAll("[data-leaflet]").forEach(function(el) { | |
var data = JSON.parse(el.dataset.leaflet), | |
map = L.map(el, data); | |
data.tileLayers.forEach(function(layer) { | |
L.tileLayer(layer.urlTemplate, layer).addTo(map); | |
}); | |
if (data.locate) { | |
map.locate(data.locate); | |
} |
This file contains 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
(ns ring-server-pg | |
(:require [ring.adapter.jetty :as jetty] | |
[clojure.java [jdbc :as jdbc]] | |
[clj-postgresql.core] | |
[ring.middleware.defaults :as defaults])) | |
(def db (System/getenv "DB_URL")) | |
(def last-request (atom nil)) |
This file contains 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
openapi: 3.0.0 | |
info: | |
title: Tasksheriff | |
version: 1.0.0 | |
servers: | |
- url: 'https://api.tasksheriff.com' | |
components: | |
securitySchemes: | |
oAuth2: | |
type: oauth2 |
This file contains 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
(let [per-page 25 | |
page 2 | |
page-count (sql/call :ceiling (sql/call :/ :%count.* per-page)) | |
] | |
(-> {:select [[:%count.* :total_count] | |
[page-count :page-count] | |
[(sql/call :< page page-count) :has-next?] | |
[(sql/call :> page 1) :has-previous?] | |
[page :current_page] | |
] |
This file contains 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
(defn paginate | |
([coll] (paginate 1 coll)) | |
([n coll] (paginate 25 n coll)) | |
([per-page n coll] | |
(let [partitioned (vec (partition-all per-page coll)) | |
page (or n 1)] | |
(some-> (get partitioned (dec page)) |
This file contains 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
(defn- two-column-table->map [table-dom] | |
(->> (enlive/select table-dom [:td]) | |
(map (comp string/trim enlive/text)) | |
(apply hash-map) | |
(map #(update % 0 string/replace ":" "")) | |
(into {}))) |
NewerOlder